emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Brett Viren <bv@bnl.gov>
To: emacs-orgmode@gnu.org
Subject: Interpreter/shell prompts when exporting code blocks?
Date: Fri, 26 Jul 2013 10:14:42 -0400	[thread overview]
Message-ID: <ir4zjt94dd9.fsf@lycastus.phy.bnl.gov> (raw)

[-- Attachment #1: Type: text/plain, Size: 947 bytes --]

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.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

             reply	other threads:[~2013-07-26 14:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-26 14:14 Brett Viren [this message]
2013-07-26 15:24 ` Interpreter/shell prompts when exporting code blocks? Eric Schulte
2013-07-26 15:33 ` Rick Frankel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ir4zjt94dd9.fsf@lycastus.phy.bnl.gov \
    --to=bv@bnl.gov \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).