emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] example filter for code blocks?


From: John Kitchin
Subject: Re: [O] example filter for code blocks?
Date: Fri, 27 Sep 2013 14:44:40 -0400

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" <address@hidden>
To: address@hidden
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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]