[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Interpreter/shell prompts when exporting code blocks?
From: |
Eric Schulte |
Subject: |
Re: [O] Interpreter/shell prompts when exporting code blocks? |
Date: |
Fri, 26 Jul 2013 09:24:50 -0600 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Brett Viren <address@hidden> writes:
> Hi organistas.
>
> 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?
>
> For example, if there was something like a "prompt" header to specify
> what should get prefixed on export then something like...
>
> #+prompt: $
> #+BEGIN_SRC sh :results none :exports code
> mkdir mymod
> touch mymod/__init__.py
> #+END_SRC
>
> #+prompt: >>> :indent ...
> #+BEGIN_SRC python :results none :exports code
> import mymod
> def myfun():
> mymod.something()
> #+END_SRC
>
> ...would export something resembling:
>
> $ mkdir mymod
> $ touch mymod/__init__.py
>
>>>> import mymod
>>>> def myfun():
> ... mymod.something()
>
>
> For HTML export, some stylesheet magic which allows any cut-and-paste to
> ignore the prefixed prompt would be icing on an already tasty cake.
>
> -Brett.
I think the best solution here would be to apply your own custom CSS to
the page, or possibly to post-process the code blocks with a custom
export filter, see (info "(org)Advanced configuration").
Best,
--
Eric Schulte
http://cs.unm.edu/~eschulte