[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Interpreter/shell prompts when exporting code block s?
From: |
Rick Frankel |
Subject: |
Re: [O] Interpreter/shell prompts when exporting code block s? |
Date: |
Fri, 26 Jul 2013 11:33:40 -0400 |
User-agent: |
Roundcube Webmail/0.9.0 |
On 2013-07-26 10:14, Brett Viren wrote:
I'd like to have my executable code blocks get exported to HTML/LaTeX
with some prompt prefixed to each line of code but still let the blocks
themselves remain executable in their given language. Is there already
a nice way to do this?
[snip]
Not exactly what you asked for, but how about using noweb references:
#+begin_src org
,* Prefix export
,#+name: sh-src
,#+BEGIN_SRC sh :results none :exports none
echo "foo"
echo "bar"
,#+END_SRC
,#+BEGIN_SRC sh :noweb yes :exports code :eval never
$ <<sh-src>>
,#+END_SRC
,#+name: python-src
,#+BEGIN_SRC python :exports none
import mymod
defun myfun():
mymod.foo()
,#+END_SRC
,#+BEGIN_SRC python :noweb yes :exports code :eval never
>>>> <<python-src>>
#+END_SRC
#+end_src
which exports as (text export):
━━━━━━━━━━━━━━━
PREFIX EXPORT
Rick Frankel
━━━━━━━━━━━━━━━
╭────
│ $ echo "foo"
│ $ echo "bar"
╰────
╭────
│ >>>> import mymod
│ >>>> defun myfun():
│ >>>> mymod.foo()
╰────