emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: Brett Viren <bv@bnl.gov>
Cc: emacs-orgmode@gnu.org
Subject: Re: Interpreter/shell prompts when exporting code blocks?
Date: Fri, 26 Jul 2013 09:24:50 -0600	[thread overview]
Message-ID: <8761vxibst.fsf@gmail.com> (raw)
In-Reply-To: <ir4zjt94dd9.fsf@lycastus.phy.bnl.gov> (Brett Viren's message of "Fri, 26 Jul 2013 10:14:42 -0400")

Brett Viren <bv@bnl.gov> 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

  reply	other threads:[~2013-07-26 15:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-26 14:14 Interpreter/shell prompts when exporting code blocks? Brett Viren
2013-07-26 15:24 ` Eric Schulte [this message]
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=8761vxibst.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=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).