filter
filter copied to clipboard
Multichunk processing
Is there an option to process multiple chunks as a single external document? I think codebraid and pythontex support that, and that can be handy at times.
This is related to the discussion on using pandoc for citation processing. I was thinking you could use this to build a complete fake markdown document containing only the citations. Something like this:
\defineexternalfilter
[pandoccitation]
[filter={pandoc -t context --citeproc --csl mystyle.csl --bibliography refs.bib},
mode=continuous]
\starttext
Bla bla this is normal context text.
As has been said before this is really important \pandoccitation{[@foo, 45]}.
Back in context mode.
This is again super important \pandoccitation{[@bar, 12]}.
\startpandoccitation
::: refs
:::
\stoppandoccitation
Does that make sense?
Of course, one problem might be how the results will be written back.
Currently, the filter module does not support multi-chunck processing, but what you want is relatively simple (because the \pandoccitation{...} command does not need to necessarily be in verbatim mode). What should be written to a file and what external command should be run to generate the output?
Good question. I think that depends on how that stuff can be written back. (Like, how will you decide where each of the results will be placed? Seem like, in order to deal with ibids and that kind of stuff, you'll always want to have the complete context available...) WDYT?
If you want to do bib by external filters, then we essentially need to follow the approach taken by latex+bibtex: write some context command (e.g. key
) to an external file; have the program parse the external file for keys and use it to create something equivalent to a bbl
file; and then in the second run context reads the bbl
file and uses that to determine how the \cite
should be rendered.
So, all the bib rendering stuff has to be done at the context end.