> Am 25.01.2021 um 18:58 schrieb Aditya Mahajan <adit...@umich.edu>:
> 
> or some variant of that should also work. But the filter module does make it 
> easier to store the results in another directory so that they are out of 
> sight.

No, you need additional file system commands.

> Here is a simple example:

Thank you!
Meanwhile, looking at my LilyPond module, I got as far as:

"""
\startmodule[tikzfilter]

\usemodule[filter]
% docs see https://github.com/adityam/filter

\def\TIKZTEMP{tikztemp} % name of folder for TikZ/buffer files

\startbuffer[tikz::before]
\environment env_world % contains font setup etc.
\environment env_TikZ % contains TikZ settings

\startpagefigure
\starttikzpicture[thick,domain=-90:90]% TODO: make this configurable
\stopbuffer

\startbuffer[tikz::after]
\stoptikzpicture
\stoppagefigure
\stopbuffer

\define[1]\ParseTikZFile% #1 is the name of the output file
  {\ctxlua{thirddata.parsetikzfile("#1")}}

\startluacode
 thirddata = thirddata or {}

 -- create temp folder if missing
 if not lfs.isdir("\TIKZTEMP") then
   lfs.mkdir("\TIKZTEMP")
 end

 function thirddata.parsetikzfile(name)
   -- name is like \TIKZTEMP/mainfile-temp-tikz-21.pdf
   logs.report("TIKZFILTER","name='" .. name .. "'")
   context("\\externalfigure[" .. name .. "]")
 end
\stopluacode

\defineexternalfilter[tikz][
  cache=yes,
  purge=no,
  directory=\TIKZTEMP,
  bufferbefore={tikz::before},
  bufferafter={tikz::after},
  readcommand=\ParseTikZFile,
  output={\externalfilterbasefile.pdf},
% ConTeXt never writes results to other directories
  filtercommand={context --batchmode --once --autopdf=auto 
--result=\externalfilterbasefile\space \externalfilterinputfile\space && mv 
\externalfilterbasefile.pdf\space \TIKZTEMP/},
]

\stopmodule


Hraban
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to