good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Hacking a source filter into the #! lineby dcmertens (Scribe) |
on Jul 25, 2014 at 02:28 UTC ( [id://1094980]=note: print w/replies, xml ) | Need Help?? |
I have done some digging around LyX's source code and found some very interesting things. First, the LyX parser ignores commas, which means that the following is a valid (beginning of a) LyX source file:
Notice the commas after every element? Those make it possible for perl to parse this document down to the "use yX", at which point the source filter can take over. Unfortunately, I cannot find a way to override how LyX writes the contents of its files. Everything seems to boil down to calling the Buffer class's save method, which does not provide any runtime-modifiable hooks. Perhaps I should take a different approach: defining a "Run Perl Source" output format. :-)
In Section
Seekers of Perl Wisdom
|
|