On Fri, 28 Jan 2011, Henning Hraban Ramm wrote:
Am 2011-01-27 um 20:08 schrieb Aditya Mahajan:
On a unrelated note, I have been thinking if I can extend the filter module to take care of features provided by lilypond and gnuplot modules. IIUC, in both these modules, the input is transformed before being written to an output file, then an external filter is run and the output is read back again. If we restrict ourselves to MkIV, then the transforming the input can be done in a lua function; the filter module already takes care of the rest of the book-keeping.
Do you think that it makes sense to have such a feature? Then you could just define the gnuplot module as:
\usemodule[filter]
\defineexternalfilter[GNUPLOT] [filter={gnuplot --appropriate options}, conitnue=yes, transformation=thirddata.GNUPLOT.transformation, ]
where thirddata.GNUPLOT.transformation is a lua function that does all the fancy processing.
What do you think?
I already replaced the LilyPond module by a filter setup, see http://wiki.contextgarden.net/LilyPond
It doesn't work completely the same, but good enough. And since every user has different needs, the filter approach is more flexible and thus better than a bunch of hardcoded setup options.
Making the interface configurable is not too difficult. Here[1] is an example that replicates the main functionality of the gnuplot module (a separate inclusions environment and named figures, using the pdf terminal). I will also look at the functionality of the lilypond module in detail and see if I can replicate all features. [1]: https://github.com/adityam/filter/blob/dev/tests/gnuplot.tex Aditya