From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: Interpreter/shell prompts when exporting code blocks? Date: Fri, 26 Jul 2013 09:24:50 -0600 Message-ID: <8761vxibst.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56388) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2jvU-0003gb-Qm for emacs-orgmode@gnu.org; Fri, 26 Jul 2013 11:27:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V2jvT-0001vR-EY for emacs-orgmode@gnu.org; Fri, 26 Jul 2013 11:27:28 -0400 Received: from mail-pb0-x229.google.com ([2607:f8b0:400e:c01::229]:58590) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2jvS-0001vJ-Pf for emacs-orgmode@gnu.org; Fri, 26 Jul 2013 11:27:27 -0400 Received: by mail-pb0-f41.google.com with SMTP id rp16so2165227pbb.14 for ; Fri, 26 Jul 2013 08:27:25 -0700 (PDT) In-Reply-To: (Brett Viren's message of "Fri, 26 Jul 2013 10:14:42 -0400") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Brett Viren Cc: emacs-orgmode@gnu.org Brett Viren 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