emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* copy title text string from #+TITLE field?
@ 2014-02-10  4:59 Peter Salazar
  2014-02-10  6:19 ` Nick Dokos
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Salazar @ 2014-02-10  4:59 UTC (permalink / raw)
  To: org-mode

[-- Attachment #1: Type: text/plain, Size: 505 bytes --]

Next question: is there a way to take the text from the #+TITLE: field of
an org file and insert it, as text, somewhere else within the file (i.e.
inside an HTML block)?

I can't do this manually because my various org files all use an #+INCLUDE:
reference to the same org file, which contains some HTML blocks. For each
different org file, I'd like to copy the title text string from #+TITLE
field and insert it inside an <H1></H1> field in an HTML block in the
included file.

Is this possible? Thanks!

[-- Attachment #2: Type: text/html, Size: 654 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: copy title text string from #+TITLE field?
  2014-02-10  4:59 Peter Salazar
@ 2014-02-10  6:19 ` Nick Dokos
  2014-02-10  6:24   ` Nick Dokos
  0 siblings, 1 reply; 6+ messages in thread
From: Nick Dokos @ 2014-02-10  6:19 UTC (permalink / raw)
  To: emacs-orgmode

Peter Salazar <cycleofsong@gmail.com> writes:

> Next question: is there a way to take the text from the #+TITLE: field
> of an org file and insert it, as text, somewhere else within the file
> (i.e. inside an HTML block)? 
>
> I can't do this manually because my various org files all use an
> #+INCLUDE: reference to the same org file, which contains some HTML
> blocks. For each different org file, I'd like to copy the title text
> string from #+TITLE field and insert it inside an <H1></H1> field in
> an HTML block in the included file.
>
> Is this possible? Thanks!
>

{{{title}}}  should do it. See

    (info "(org) Macro replacement")

-- 
Nick

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: copy title text string from #+TITLE field?
  2014-02-10  6:19 ` Nick Dokos
@ 2014-02-10  6:24   ` Nick Dokos
  0 siblings, 0 replies; 6+ messages in thread
From: Nick Dokos @ 2014-02-10  6:24 UTC (permalink / raw)
  To: emacs-orgmode

Nick Dokos <ndokos@gmail.com> writes:

> Peter Salazar <cycleofsong@gmail.com> writes:
>
>> Next question: is there a way to take the text from the #+TITLE: field
>> of an org file and insert it, as text, somewhere else within the file
>> (i.e. inside an HTML block)? 
>>
>> I can't do this manually because my various org files all use an
>> #+INCLUDE: reference to the same org file, which contains some HTML
>> blocks. For each different org file, I'd like to copy the title text
>> string from #+TITLE field and insert it inside an <H1></H1> field in
>> an HTML block in the included file.
>>
>> Is this possible? Thanks!
>>
>
> {{{title}}}  should do it. See
>
>     (info "(org) Macro replacement")

Actually, I'm not sure it will do: macro replacement takes place during
export, so it may or may not be enough, depending on what you really
want to do.

-- 
Nick

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: copy title text string from #+TITLE field?
@ 2014-02-13  5:57 Peter Salazar
  2014-02-13 12:18 ` Nick Dokos
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Salazar @ 2014-02-13  5:57 UTC (permalink / raw)
  To: org-mode, Nick Dokos

[-- Attachment #1: Type: text/plain, Size: 534 bytes --]

Thanks. I do need it only on export, but even so, it doesn't seem to be
working:

http://i.imgur.com/1tMGaHz.png

Again, it's inside an HTML code block. Not sure if there's a way to make it
work inside that block?

#+BEGIN_HTML
...
<div class="page-header">
  <h1>{{{title}}}</h1>
</div>
...
#+END_HTML



> {{{title}}}  should do it. See
>
>     (info "(org) Macro replacement")

Actually, I'm not sure it will do: macro replacement takes place during
export, so it may or may not be enough, depending on what you really
want to do.

[-- Attachment #2: Type: text/html, Size: 935 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: copy title text string from #+TITLE field?
  2014-02-13  5:57 copy title text string from #+TITLE field? Peter Salazar
@ 2014-02-13 12:18 ` Nick Dokos
  2014-02-13 17:38   ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Nick Dokos @ 2014-02-13 12:18 UTC (permalink / raw)
  To: emacs-orgmode

Peter Salazar <cycleofsong@gmail.com> writes:

> Thanks. I do need it only on export, but even so, it doesn't seem to be working:
>
> http://i.imgur.com/1tMGaHz.png
>
> Again, it's inside an HTML code block. Not sure if there's a way to make it work inside that block?
>

I don't think so. The doc says "...which can be referenced in
paragraphs, verse blocks, table cells and some keywords". I'm not sure
why macro expansion is restricted like that. Maybe Nicolas will chime
in.

> #+BEGIN_HTML 
> ...
> <div class="page-header">
>   <h1>{{{title}}}</h1>
> </div>
> ...
> #+END_HTML 
>
>> {{{title}}}  should do it. See
>>
>>     (info "(org) Macro replacement")
>
> Actually, I'm not sure it will do: macro replacement takes place during
> export, so it may or may not be enough, depending on what you really
> want to do.
>

-- 
Nick

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: copy title text string from #+TITLE field?
  2014-02-13 12:18 ` Nick Dokos
@ 2014-02-13 17:38   ` Nicolas Goaziou
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Goaziou @ 2014-02-13 17:38 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

Hello,

Nick Dokos <ndokos@gmail.com> writes:

> Peter Salazar <cycleofsong@gmail.com> writes:
>
>> Thanks. I do need it only on export, but even so, it doesn't seem to be working:
>>
>> http://i.imgur.com/1tMGaHz.png
>>
>> Again, it's inside an HTML code block. Not sure if there's a way to make it work inside that block?
>>
>
> I don't think so. The doc says "...which can be referenced in
> paragraphs, verse blocks, table cells and some keywords". I'm not sure
> why macro expansion is restricted like that. Maybe Nicolas will chime
> in.

Because macros are parsed objects. Org only parse objects in these
environments.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-02-13 17:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-13  5:57 copy title text string from #+TITLE field? Peter Salazar
2014-02-13 12:18 ` Nick Dokos
2014-02-13 17:38   ` Nicolas Goaziou
  -- strict thread matches above, loose matches on Subject: below --
2014-02-10  4:59 Peter Salazar
2014-02-10  6:19 ` Nick Dokos
2014-02-10  6:24   ` Nick Dokos

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).