From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: Re: Generate BEGIN_EXAMPLE block dynamically during export Date: Tue, 16 Feb 2016 17:40:03 -0500 Message-ID: References: <87mvr0nvc8.fsf@alphaville.usersys.redhat.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e011762d1d32f43052bead237 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVoIX-0006Zf-Dc for emacs-orgmode@gnu.org; Tue, 16 Feb 2016 17:40:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aVoIW-0000da-5n for emacs-orgmode@gnu.org; Tue, 16 Feb 2016 17:40:45 -0500 Received: from mail-io0-x22b.google.com ([2607:f8b0:4001:c06::22b]:36050) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVoIV-0000dG-TC for emacs-orgmode@gnu.org; Tue, 16 Feb 2016 17:40:44 -0500 Received: by mail-io0-x22b.google.com with SMTP id l127so4176529iof.3 for ; Tue, 16 Feb 2016 14:40:43 -0800 (PST) In-Reply-To: <87mvr0nvc8.fsf@alphaville.usersys.redhat.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nick Dokos Cc: emacs-org list --089e011762d1d32f43052bead237 Content-Type: text/plain; charset=UTF-8 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? --089e011762d1d32f43052bead237 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
This is turning out to be more = complicated than I anticipated ..

I need to=C2=A0
(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:

<= /div>
(1) First I need to export the result to th= e file only. I cannot include it as that file hasn't yet been created.<= /div>

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

=
#+NAME: tar-eg
#+BEGIN_SRC emacs-lisp
(format "&= gt; tar xzvf %s" tar-file)
#+END_SRC

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

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

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

(2) But I do not need that file link in the ex= port.. I need the whole exported result embedded verbatim in the exported d= ocument too.

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

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

#+NAME: tar-eg
<= div class=3D"gmail_extra">#+BEGIN_SRC emacs-lisp
(format "> tar xzvf %s" tar-file)
#+END_SRC

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

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

=3D=3D=3D=3D=3D org asc= ii export =3D=3D=3D=3D=3D
,----
| > tar xzvf bar.tar.gz
`----
Listing 1: `results.txt'
=3D=3D=3D=3D=3D

Is there a way t= o export results of a code block evaluation to a file and also embed them i= n the exported document?


--089e011762d1d32f43052bead237--