From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: example filter for code blocks? Date: Fri, 27 Sep 2013 14:44:40 -0400 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=bcaec520e97b08b74e04e761e159 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37889) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPd1w-0003F8-Bl for emacs-orgmode@gnu.org; Fri, 27 Sep 2013 14:44:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VPd1t-0005KW-Ff for emacs-orgmode@gnu.org; Fri, 27 Sep 2013 14:44:44 -0400 Received: from mail-pd0-x22a.google.com ([2607:f8b0:400e:c02::22a]:41651) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPd1t-0005KJ-40 for emacs-orgmode@gnu.org; Fri, 27 Sep 2013 14:44:41 -0400 Received: by mail-pd0-f170.google.com with SMTP id x10so2973454pdj.15 for ; Fri, 27 Sep 2013 11:44:40 -0700 (PDT) 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: "emacs-orgmode@gnu.org" --bcaec520e97b08b74e04e761e159 Content-Type: text/plain; charset=ISO-8859-1 That is a pretty interesting pdf. I cannot think of a way to do this simply. I think that filters get an info argument, which contains the parse tree. Maybe you could use that to build up a table of which blocks refer to each other somehow. I guess you would need some syntax in the src-block to indicate which blocks were referred to. then, use filters to modify the output of the rendered src-block by inserting the links in. From: "Sebastien Vauban" To: emacs-orgmode@gnu.org Cc: Date: Fri, 27 Sep 2013 09:42:39 +0200 Subject: Re: [O] example filter for code blocks? Hello, John Kitchin wrote: > Thanks for the tips in using export filters for code blocks. I thought I > would share my current solution. The goal was to export all the code blocks > in an org-file to files systematically named part1/script-%d.py where %d is > a number. I didnot want to tangle exactly, because I wanted to avoid naming > the code block tangle files. > > Then, I wanted to insert a pdf link that would open the file, after the > syntax highlighted code. Thanks for sharing your wonderful solution! Related to such things, something I'd like to have for long (but never found time investigating it more) is that the PDF produced by Org would resemble more the PDF produced by Noweb. In the attached example file (sent on this ML in... 2009), you see that the Noweb extension to LaTeX - generated a code block number: page number + order (if there are multiple code blocks on the same page); - for each code block, attached a reference to all code blocks using it. In the example, you see that code block "sql-init.sql" (defined on page 2) gets the number 2a (in that export [1]), and is used in code blocks 2c and 3. And all those references are hyperlinks. I found that very handy for reading your LP (or RR) document. Best regards, Seb [1] It could change if text or code is added in the documentation. -- Sebastien Vauban 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 --bcaec520e97b08b74e04e761e159 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
That is a pretty interesting pdf. I cannot think of a way = to do this simply. I think that filters get an info argument, which contain= s the parse tree. Maybe you could use that to build up a table of which blo= cks refer to each other somehow. I guess you would need some syntax in the = src-block to indicate which blocks were referred to. then, use filters to m= odify the output of the rendered src-block by inserting the links in.

From:=A0"Sebastien Vauban" <sva-news@mygooglest.com>
To:=A0emacs-orgmode@gnu.org
Cc:=A0
Date:=A0Fri= , 27 Sep 2013 09:42:39 +0200
Subject:=A0Re: [O] example filter for code blocks?
Hello,

John Kitchin wrote:
> Thanks for =A0the tips in using export filters for code blocks. I thou= ght I
> would share my current solution. The goal was to export all the code b= locks
> in an org-file to files systematically named part1/script-%d.py where = %d is
> a number. I didnot want to tangle exactly, because I wanted to avoid n= aming
> the code block tangle files.
>
> Then, I wanted to insert a pdf link that would open the file, after th= e
> syntax highlighted code.

Thanks for sharing your wonderful solution!

Related to such things, something I'd like to have for long (but never = found
time investigating it more) is that the PDF produced by Org would resemble = more
the PDF produced by Noweb.

In the attached example file (sent on this ML in... 2009), you see that the=
Noweb extension to LaTeX

- generated a code block number: page number + order (if there are multiple=
=A0 code blocks on the same page);

- for each code block, attached a reference to all code blocks using it.
In the example, you see that code block "sql-init.sql" (defined o= n page 2) gets
the number 2a (in that export [1]), and is used in code blocks 2c and 3. An= d
all those references are hyperlinks.

I found that very handy for reading your LP (or RR) document.

Best regards,
=A0 Seb

[1] It could change if text or code is added in the documentation.

--
Sebastien Vauban
John

-----------------------------------
Joh= n Kitchin
Associate Professor
Doherty Hall A207F
Department of Che= mical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu

--bcaec520e97b08b74e04e761e159--