emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Generate BEGIN_EXAMPLE block dynamically during export


From: Kaushal Modi
Subject: Re: [O] Generate BEGIN_EXAMPLE block dynamically during export
Date: Tue, 16 Feb 2016 17:40:03 -0500

This is turning out to be more complicated than I anticipated ..

I need to 
(1) Export the evaluated emacs-lisp block to a separate file, and
(2) also include the result in the same document

I can do that but it is a multi-step process:

(1) First I need to export the result to the file only. I cannot include it as that file hasn't yet been created.

===== org buffer =====
#+AUTHOR:
#+OPTIONS: toc:nil
#+PROPERTY: header-args:emacs-lisp :var tar-file="bar.tar.gz" :exports results :file "results.txt"

#+NAME: tar-eg
#+BEGIN_SRC emacs-lisp
(format "> tar xzvf %s" tar-file)
#+END_SRC

# #+CAPTION: =results.txt=
# #+NAME: code__results
# #+INCLUDE: "results.txt" :src text
=====

So "C-c C-e t A" gives me:

===== org ascii export =====
[file:results.txt]
=====

(2) But I do not need that file link in the export.. I need the whole exported result embedded verbatim in the exported document too.

So I need to export the document the second time with the :exports in #+PROPERTY set to none and the CAPTION/NAME/INCLUDE lines uncommented.

===== org buffer =====
#+AUTHOR:
#+OPTIONS: toc:nil
#+PROPERTY: header-args:emacs-lisp :var tar-file="bar.tar.gz" :exports none :file "results.txt"

#+NAME: tar-eg
#+BEGIN_SRC emacs-lisp
(format "> tar xzvf %s" tar-file)
#+END_SRC

#+CAPTION: =results.txt=
#+NAME: code__results
#+INCLUDE: "results.txt" :src text
=====

Then I get the desired output on doing "C-c C-e t A".

===== org ascii export =====
,----
| > tar xzvf bar.tar.gz
`----
Listing 1: `results.txt'
=====

Is there a way to export results of a code block evaluation to a file and also embed them in the exported document?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]