[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Generate BEGIN_EXAMPLE block dynamically during export
From: |
Thomas S . Dye |
Subject: |
Re: [O] Generate BEGIN_EXAMPLE block dynamically during export |
Date: |
Tue, 16 Feb 2016 10:02:13 -1000 |
User-agent: |
mu4e 0.9.17; emacs 24.5.1 |
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
- [O] Generate BEGIN_EXAMPLE block dynamically during export, Kaushal Modi, 2016/02/16
- Re: [O] Generate BEGIN_EXAMPLE block dynamically during export,
Thomas S . Dye <=
- Re: [O] Generate BEGIN_EXAMPLE block dynamically during export, Kaushal Modi, 2016/02/16
- Re: [O] Generate BEGIN_EXAMPLE block dynamically during export, Thomas S . Dye, 2016/02/16
- Re: [O] Generate BEGIN_EXAMPLE block dynamically during export, Kaushal Modi, 2016/02/16
- Re: [O] Generate BEGIN_EXAMPLE block dynamically during export, Kaushal Modi, 2016/02/16
- Re: [O] Generate BEGIN_EXAMPLE block dynamically during export, Thomas S . Dye, 2016/02/16
- Re: [O] Generate BEGIN_EXAMPLE block dynamically during export, Kaushal Modi, 2016/02/16
- Re: [O] Generate BEGIN_EXAMPLE block dynamically during export, Nick Dokos, 2016/02/16
- Re: [O] Generate BEGIN_EXAMPLE block dynamically during export, Kaushal Modi, 2016/02/16
- Re: [O] Generate BEGIN_EXAMPLE block dynamically during export, Kaushal Modi, 2016/02/16