emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rick Frankel <rick@rickster.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 11:33:40 -0400	[thread overview]
Message-ID: <81b96e9e97c3a9bf5dcf4c06e6b768b0@mail.rickster.com> (raw)
In-Reply-To: <ir4zjt94dd9.fsf@lycastus.phy.bnl.gov>

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

      parent reply	other threads:[~2013-07-26 15:33 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
2013-07-26 15:33 ` Rick Frankel [this message]

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=81b96e9e97c3a9bf5dcf4c06e6b768b0@mail.rickster.com \
    --to=rick@rickster.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).