From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: example filter for code blocks? Date: Thu, 26 Sep 2013 15:34:57 -0400 Message-ID: References: <874n97srm5.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11332d9804fc6504e74e7725 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38414) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPHL5-0002aU-NT for emacs-orgmode@gnu.org; Thu, 26 Sep 2013 15:35:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VPHL0-0007Yu-Jf for emacs-orgmode@gnu.org; Thu, 26 Sep 2013 15:35:03 -0400 Received: from mail-pd0-x229.google.com ([2607:f8b0:400e:c02::229]:49170) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPHL0-0007Yl-7R for emacs-orgmode@gnu.org; Thu, 26 Sep 2013 15:34:58 -0400 Received: by mail-pd0-f169.google.com with SMTP id r10so1599863pdi.28 for ; Thu, 26 Sep 2013 12:34:57 -0700 (PDT) In-Reply-To: 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: "Cook, Malcolm" Cc: "emacs-orgmode@gnu.org" , Eric Schulte --001a11332d9804fc6504e74e7725 Content-Type: text/plain; charset=ISO-8859-1 I think the approach I sent earlier would potentially work. essentially you would get the html code and wrap it with whatever text is required for the folding mode. you would return something like (format "%s" text) where text is the html code from the src block. In latex I had to parse that text a little bit because the first line was \begin{minted}... and the last line was \end{minted}, which I did not want. John ----------------------------------- John Kitchin Associate Professor Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 http://kitchingroup.cheme.cmu.edu On Thu, Sep 26, 2013 at 2:31 PM, Cook, Malcolm wrote: > >Check out `org-export-filter-src-block-functions'. It shouldn't be too > >hard to add a custom filter to that list which may be used to process > >all code block bodies during latex export. > > Somewhat off-topic, but, thanks for pointing out this variable Eric.... > I've been wanting an approach that would wrap all exported code in some > kind of folded mode (maybe a jquery accordion). Initially the html > document by default would display only exported 'results'. The user could > choose to display the code behind any result with a single click (keyboard > interactivity would be even better). Do you think that this is the right > 'hook' to apply such? Have you seen this already done better somewhere? > > ~ Malcolm Cook > > > > >Best, > > > >-- > >Eric Schulte > >https://cs.unm.edu/~eschulte > >PGP: 0x614CA05D > > --001a11332d9804fc6504e74e7725 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I think the approach I sent earlier would potentially work= . essentially you would get the html code=A0 and wrap it with=A0 whatever t= ext is required for the folding mode. you would return something like (form= at "<code to fold>%s</end code to fold>" text) where = text is the html code from the src block. In latex I had to parse that text= a little bit because the first line was \begin{minted}... and the last lin= e was \end{minted}, which I did not want.

John

-------= ----------------------------
John Kitchin
Associate Professor
Dohe= rty Hall A207F
Department of Chemical Engineering
Carnegie Mellon Uni= versity
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu

<= /div>

On Thu, Sep 26, 2013 at 2:31 PM, Cook, M= alcolm <MEC@stowers.org> wrote:
>Check out `org-export-filter-src-block-functions'= . =A0It shouldn't be too
=A0>hard to add a custom filter to that list which may be used to proces= s
=A0>all code block bodies during latex export.

Somewhat off-topic, but, thanks for pointing out this variable Eric..= .. =A0I've been wanting an approach that would wrap all exported code i= n some kind of folded mode (maybe a jquery accordion). =A0Initially the htm= l document by default would display only exported 'results'. =A0The= user could choose to display the code behind any result with a single clic= k (keyboard interactivity would be even better). =A0Do you think that this = is the right 'hook' to apply such? =A0Have you seen this already do= ne better somewhere?

~ Malcolm Cook

>
=A0>Best,
=A0>
=A0>--
=A0>Eric Schulte
=A0>https:/= /cs.unm.edu/~eschulte
=A0>PGP: 0x614CA05D


--001a11332d9804fc6504e74e7725--