diff options
-rw-r--r-- | Master/texmf-dist/doc/context/third/filter/filter.txt | 33 | ||||
-rw-r--r-- | Master/texmf-dist/tex/context/third/filter/t-filter.tex | 43 |
2 files changed, 62 insertions, 14 deletions
diff --git a/Master/texmf-dist/doc/context/third/filter/filter.txt b/Master/texmf-dist/doc/context/third/filter/filter.txt index 1b03acaaac1..0a199a1d188 100644 --- a/Master/texmf-dist/doc/context/third/filter/filter.txt +++ b/Master/texmf-dist/doc/context/third/filter/filter.txt @@ -640,18 +640,25 @@ for this. For example, in the above barcode example, use Limitations ------------ -- The option `continue=yes` does not work correctly with filters that have a +- In MkII, the option `continue=yes` does not work correctly with filters that have a pipe `|` in their definition. This is because internally `continue=yes` calls - mtxrun --ifchanged=filename --direct filtercommand + mtxrun --ifchanged=filename --direct filtercommand - and this produces + and this produces - MTXrun | - MTXrun | executing: filtercommand - MTXrun | - MTXrun | + MTXrun | + MTXrun | executing: filtercommand + MTXrun | + MTXrun | + In MkIV, `continue=yes` calls + + \ctxlua{job.files.run("filename", "filtercommand")} + + so filters with a `|` work correctly. + + Messages and Tracing ------------------- @@ -686,6 +693,14 @@ information add \traceexternalfilters in your tex file. This shows the name of the filters when they are defined. +In MkIV, `\traceexternalfilters` also enables the trackers for `graphic.run`, so +when `continue=yes` is used, message like + + graphics > run > processing file, no changes in '<filename>-temp-<filtername>-<n>.tmp', not processed + +are shown. + + Version History @@ -736,3 +751,7 @@ Version History - **2011.09.14** - `\inline<filter>` now accepts optional arguments. - `before=` and `after=` keys are disabled in `\inline<filter>` +- **2011.10.22** + - Added `\process<filter>buffer` +- **2011.12.04** + - Use `job.files.run` instead of `mtxrun --ifchanged` in MkIV. diff --git a/Master/texmf-dist/tex/context/third/filter/t-filter.tex b/Master/texmf-dist/tex/context/third/filter/t-filter.tex index e44550de3ea..66639bd4d64 100644 --- a/Master/texmf-dist/tex/context/third/filter/t-filter.tex +++ b/Master/texmf-dist/tex/context/third/filter/t-filter.tex @@ -1,6 +1,6 @@ %D \module %D [ file=t-filter, -%D version=2011.10.22, +%D version=2011.12.04, %D title=\CONTEXT\ User Module, %D subtitle=Filter, %D author=Aditya Mahajan, @@ -9,7 +9,7 @@ %D email=adityam <at> ieee <dot> org, %D license=Simplified BSD License] -\writestatus{loading}{Filter (ver: 2011.10.22)} +\writestatus{loading}{Filter (ver: 2011.12.04)} \ifx\undefined\normalexpanded \let\normalexpanded\expanded \fi @@ -63,6 +63,7 @@ \setinterfacemessage\m!externalfilter{forbidden} {Fatal Error: Cannot use absolute path -- as directory} \setinterfacemessage\m!externalfilter{slash} {Appending / to directory -- } \setinterfacemessage\m!externalfilter{reuse} {\c!state=\v!stop : Not running filter on file --} +\setinterfacemessage\m!externalfilter{force} {mode 'force' enabled: Forcing running of filters} % For backward compatibility \let\setupexternalfilters \setupexternalfilter @@ -71,7 +72,9 @@ \newif\iftraceexternalfilters -\let\traceexternalfilters\traceexternalfilterstrue +\def\traceexternalfilters + {\traceexternalfilterstrue + \doifmode\s!mkiv{\enabletrackers[graphic.runfile]}} \starttexdefinition externalfilter::show_filenames \writestatus\m!externalfilter{current filter : \externalfilter::name} @@ -424,7 +427,7 @@ %D \subsubject {Execute Filter} -\starttexdefinition externalfilter::execute_filter +\starttexdefinition externalfilter::execute_filter_mkii \processcommacommand[\externalfilterparameter{\c!filter\c!setups}]\directsetup \externalfilter::show_filtercommand @@ -434,16 +437,42 @@ {\showmessage\m!externalfilter{reuse}\externalfilter::input_file} {\doifmode{*first} {\doifmodeelse{force} - {\message{\externalfilterparameter\c!filtercommand} + {\showmessage\m!externalfilter{force} \executesystemcommand {mtxrun --direct \externalfilterparameter\c!filtercommand}} {\executesystemcommand - {mtxrun --ifchanged=\externalfilter::input_file\space - --direct \externalfilterparameter\c!filtercommand}}}}} + {mtxrun --ifchanged=\externalfilter::input_file\space + --direct \externalfilterparameter\c!filtercommand}}}}} {\executesystemcommand {\externalfilterparameter\c!filtercommand}} \stoptexdefinition +% In MkIV, we use job.files.run to check if a file has changed. This function +% writes the md5 sum to the tuc file rather than to an external file. So, we +% must not check for the \type{*first} mode (otherwise the md5 sum is overridden +% in the next run. +\starttexdefinition externalfilter::execute_filter_mkiv + + \processcommacommand[\externalfilterparameter{\c!filter\c!setups}]\directsetup + \externalfilter::show_filtercommand + + \doifelse{\externalfilterparameter\c!continue}\v!yes + {\doifelse{\externalfilterparameter\c!state}\v!stop + {\showmessage\m!externalfilter{reuse}\externalfilter::input_file} + {\doifmodeelse{force} + {\showmessage\m!externalfilter{force} + \executesystemcommand + {\externalfilterparameter\c!filtercommand}} + {\ctxlua{job.files.run(\!!bs\externalfilter::input_file\!!es, + \!!bs\externalfilterparameter\c!filtercommand\!!es)}}}} + {\executesystemcommand + {\externalfilterparameter\c!filtercommand}} +\stoptexdefinition + +\doifmodeelse\s!mkiv + {\let\externalfilter::execute_filter\externalfilter::execute_filter_mkiv} + {\let\externalfilter::execute_filter\externalfilter::execute_filter_mkii} + %D \subsubject {Read output} \starttexdefinition externalfilter::read_processed_file |