Aloha Kaushal,
Kaushal Modi writes:
> Hi all,
>
> I'd like to have an EXAMPLE block in my org file whose value is set using
> something like an org macro at the time of export.
>
> So, something like:
>
> #+MACRO TAR_FILE some_file.tar.gz
>
> #+BEGIN_EXAMPLE
>> tar xvzf {{{TAR_FILE}}}
> #+END_EXAMPLE
>
> As the above is not possible, what would be a good way to generate the
> EXAMPLE block on the fly during export with the value of {{{TAR_FILE}}}
> replaced based on the macro definition?
You might use babel instead of a macro:
,---------------------------------------------------------------------------
| #+name: tar-eg
| #+header: :var tar-file=""
| #+begin_src emacs-lisp
| (format "> tar xzvf %s" tar-file)
| #+end_src
|
| #+CALL: tar-eg(tar-file="some_file.tar.gz") :wrap example :exports results
|
| #+results:
| #+BEGIN_example
| > tar xzvf some_file.tar.gz
| #+END_example
`---------------------------------------------------------------------------
hth,
Tom
--
Thomas S. Dye
http://www.tsdye.com