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()
╰────





Reply via email to