Problem with Filter Module in latent context beta
Hi all, with latest context my filter test file fails with an error. My file: \usemodule[filter] \defineexternalfilter [luatexdevelopmentlevel] [filtercommand={luatex --credits | grep Development > \externalfilteroutputfile}] \starttext \inlineluatexdevelopmentlevel{} \stoptext Error message: loading > Module Catcodes (ver: 2011.12.17) tex error > tex error on line 96 in file /usr/local/context/tex/texmf-modules/tex/context/third/filter/t-module-catcodes.tex: ! Undefined control sequence l.96 ...tivecatcode \gdef\activeendoflinetoken{^^M} 86 \stopcatcodetable 87 88 89 90 \ifdefined \activeendoflinetoken \else 91 % from catc-ini.mkiv 92 \bgroup 93 \catcode \tabasciicode \activecatcode \gdef\activetabtoken {^^I} 94 \gdef\outputnewlinechar {^^J} 95 \catcode \formfeedasciicode \activecatcode \gdef\activeformfeedtoken {^^L} 96 >> \catcode \endoflineasciicode \activecatcode \gdef\activeendoflinetoken{^^M} 97 \egroup 98 \fi 99 100 \protectmodulecatcodes 101 \stopmodule 102 I append the logfile. Greetings Lutz -- GPG Key ID 3C4F83BC
On Sat, 14 Apr 2018, Lutz Haseloff wrote:
Hi all,
with latest context my filter test file fails with an error. My file:
\usemodule[filter] \defineexternalfilter [luatexdevelopmentlevel] [filtercommand={luatex --credits | grep Development > \externalfilteroutputfile}] \starttext \inlineluatexdevelopmentlevel{} \stoptext
There should be a more direct way of getting this information!
Error message:
loading > Module Catcodes (ver: 2011.12.17)
tex error > tex error on line 96 in file /usr/local/context/tex/texmf-modules/tex/context/third/filter/t-module-catcodes.tex: ! Undefined control sequence
l.96 ...tivecatcode \gdef\activeendoflinetoken{^^M}
86 \stopcatcodetable 87 88 89 90 \ifdefined \activeendoflinetoken \else 91 % from catc-ini.mkiv 92 \bgroup 93 \catcode \tabasciicode \activecatcode \gdef\activetabtoken {^^I} 94 \gdef\outputnewlinechar {^^J} 95 \catcode \formfeedasciicode \activecatcode \gdef\activeformfeedtoken {^^L} 96 >> \catcode \endoflineasciicode \activecatcode \gdef\activeendoflinetoken{^^M} 97 \egroup 98 \fi 99 100 \protectmodulecatcodes 101 \stopmodule 102
I am not on a machine with latest context (and cannot update right now). The code above was taken from catc-ini.mkiv, but that file changed in the latest update. Could you please run the following test and see if it works: 1. Copy t-module-catcodes.tex to your local directory. 2. Change \gdef\activetabtoken{^^M} with \xdef\activetabtoken {\Uchar\tabasciicode } and similar for other \gdef's according to lines 121-124 of https://github.com/contextgarden/context-mirror/blob/25fcad7435f56cdce265833... and run your test again. Thank you for the report. Aditya
On 4/14/2018 3:02 PM, Aditya Mahajan wrote:
On Sat, 14 Apr 2018, Lutz Haseloff wrote:
Hi all,
with latest context my filter test file fails with an error. My file:
\usemodule[filter] \defineexternalfilter [luatexdevelopmentlevel] [filtercommand={luatex --credits | grep Development > \externalfilteroutputfile}] \starttext \inlineluatexdevelopmentlevel{} \stoptext
There should be a more direct way of getting this information! I am not on a machine with latest context (and cannot update right now). The code above was taken from catc-ini.mkiv, but that file changed in the latest update. Could you please run the following test and see if it works:
1. Copy t-module-catcodes.tex to your local directory. 2. Change \gdef\activetabtoken{^^M} with
\xdef\activetabtoken {\Uchar\tabasciicode }
and similar for other \gdef's according to lines 121-124 of https://github.com/contextgarden/context-mirror/blob/25fcad7435f56cdce265833... what exactly do you want to achieve ... i tried to get rid of ^^ syntax in all files ...
Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
I get another error message:
open source > level 4, order 5, name 't-module-catcodes.tex'
loading > Module Catcodes (ver: 2011.12.17)
tex error > tex error on line 96 in file t-module-catcodes.tex: ! Undefined control sequence
l.96 ...iveendoflinetoken{\Uchar\endoflineasciicode}
86 \stopcatcodetable
87
88
89
90 \ifdefined \activeendoflinetoken \else
91 % from catc-ini.mkiv
92 \bgroup
93 \catcode \tabasciicode \activecatcode \xdef\activetabtoken {\Uchar\tabasciicode}
94 \xdef\outputnewlinechar {\Uchar\newlineasciicode}
95 \catcode \formfeedasciicode \activecatcode \xdef\activeformfeedtoken {\Uchar\formfeedasciicode}
96 >> \catcode \endoflineasciicode \activecatcode \xdef\activeendoflinetoken{\Uchar\endoflineasciicode}
97 \egroup
98 \fi
99
100 \protectmodulecatcodes
101 \stopmodule
102
Am 14. April 2018 15:02:09 MESZ schrieb Aditya Mahajan
On Sat, 14 Apr 2018, Lutz Haseloff wrote:
Hi all,
with latest context my filter test file fails with an error. My file:
\usemodule[filter] \defineexternalfilter [luatexdevelopmentlevel] [filtercommand={luatex --credits | grep Development > \externalfilteroutputfile}] \starttext \inlineluatexdevelopmentlevel{} \stoptext
There should be a more direct way of getting this information!
Error message:
loading > Module Catcodes (ver: 2011.12.17)
tex error > tex error on line 96 in file /usr/local/context/tex/texmf-modules/tex/context/third/filter/t-module-catcodes.tex: ! Undefined control sequence
l.96 ...tivecatcode \gdef\activeendoflinetoken{^^M}
86 \stopcatcodetable 87 88 89 90 \ifdefined \activeendoflinetoken \else 91 % from catc-ini.mkiv 92 \bgroup 93 \catcode \tabasciicode \activecatcode \gdef\activetabtoken {^^I} 94 \gdef\outputnewlinechar {^^J} 95 \catcode \formfeedasciicode \activecatcode \gdef\activeformfeedtoken {^^L} 96 >> \catcode \endoflineasciicode \activecatcode \gdef\activeendoflinetoken{^^M} 97 \egroup 98 \fi 99 100 \protectmodulecatcodes 101 \stopmodule 102
I am not on a machine with latest context (and cannot update right now). The code above was taken from catc-ini.mkiv, but that file changed in the latest update. Could you please run the following test and see if it works:
1. Copy t-module-catcodes.tex to your local directory. 2. Change \gdef\activetabtoken{^^M} with
\xdef\activetabtoken {\Uchar\tabasciicode }
and similar for other \gdef's according to lines 121-124 of https://github.com/contextgarden/context-mirror/blob/25fcad7435f56cdce265833...
and run your test again.
Thank you for the report.
Aditya ___________________________________________________________________________________ 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 ___________________________________________________________________________________
-- GPG Key ID 3C4F83BC
I get another error message:
open source > level 4, order 5, name 't-module-catcodes.tex' loading > Module Catcodes (ver: 2011.12.17)
tex error > tex error on line 96 in file t-module-catcodes.tex: ! Undefined control sequence why are special catcodes needed? an dif so, there are often easier ways
On 4/14/2018 9:52 PM, Lutz Haseloff wrote: than low level hacking Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
On Sun, 15 Apr 2018, Hans Hagen wrote:
I get another error message:
open source > level 4, order 5, name 't-module-catcodes.tex' loading > Module Catcodes (ver: 2011.12.17)
tex error > tex error on line 96 in file t-module-catcodes.tex: ! Undefined control sequence why are special catcodes needed? an dif so, there are often easier ways
On 4/14/2018 9:52 PM, Lutz Haseloff wrote: than low level hacking
This is the commit (from 2011!) where I added this code: https://github.com/adityam/filter/commit/c34023fd1ede0909a056a10c6352202f229... My guess is that I did not want multiple newlines to collapse in t-vim, so I had redefined \activeendoflinetoken to {\strut\par}. The offending lines are copied from catc-ini.mkiv from the same time: https://github.com/contextgarden/context-mirror/blob/5056d7a854142aa63032b0a... to make sure that I use the same syntax for MkII and MkIV. A couple of years after that I split the MkII and MkIV code into separate files, but I never touched the catcode part (because it was working). I cannot test the latest beta right now; I'll test it on Monday. In the meanwhile, what is the current recommended method to alter the way literal newlines and tabs are shown. Aditya
On 4/15/2018 7:08 AM, Aditya Mahajan wrote:
On Sun, 15 Apr 2018, Hans Hagen wrote:
On 4/14/2018 9:52 PM, Lutz Haseloff wrote:
I get another error message:
open source > level 4, order 5, name 't-module-catcodes.tex' loading > Module Catcodes (ver: 2011.12.17)
tex error > tex error on line 96 in file t-module-catcodes.tex: ! Undefined control sequence why are special catcodes needed? an dif so, there are often easier ways than low level hacking
This is the commit (from 2011!) where I added this code:
https://github.com/adityam/filter/commit/c34023fd1ede0909a056a10c6352202f229...
My guess is that I did not want multiple newlines to collapse in t-vim, so I had redefined \activeendoflinetoken to {\strut\par}. The offending lines are copied from catc-ini.mkiv from the same time:
https://github.com/contextgarden/context-mirror/blob/5056d7a854142aa63032b0a...
to make sure that I use the same syntax for MkII and MkIV.
A couple of years after that I split the MkII and MkIV code into separate files, but I never touched the catcode part (because it was working).
I cannot test the latest beta right now; I'll test it on Monday. In the meanwhile, what is the current recommended method to alter the way literal newlines and tabs are shown. \starttext
\start \def\obeyedline{\blank[line]} \obeylines line 1 line 2 line 3 \stop \stoptext blank will cleanup for you ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
On Sun, 15 Apr 2018, Hans Hagen wrote:
\start \def\obeyedline{\blank[line]} \obeylines
Thanks! Not sure why I wasn't using that since the beginning. I am testing with the latest beta and I get another bug with reading http files. This is a simplified version of what I use in the filter module: \unprotect \def\AnyFilename#1% {\ctxcommand{getreadfilename("any",".","#1")}} \def\ProcessFile#1% {\edef\InputFile{\AnyFilename{#1}}% \InputFile \typefile[\InputFile]} \protect \starttext \ProcessFile{http://cim.mcgill.ca/~adityam/index.html} \stoptext With the latest beta, I get the following error: ...inimals/texmf-context/tex/context/base/mkiv/file-res.lua:147: bad argument #1 to 'find' (string expected, got nil) stack traceback: [C]: in function 'string.find' ...inimals/texmf-context/tex/context/base/mkiv/file-res.lua:147: in upvalue 'action1' [string "local action = tokens._action..."]:4: in field 'getreadfilename' [ctxlua]:1: in main chunk Not sure why #1 is being passed to the lua function instead of the expanded value of "#1". Aditya
On 4/16/2018 6:52 PM, Aditya Mahajan wrote:
On Sun, 15 Apr 2018, Hans Hagen wrote:
\start \def\obeyedline{\blank[line]} \obeylines
Thanks! Not sure why I wasn't using that since the beginning.
I am testing with the latest beta and I get another bug with reading http files. This is a simplified version of what I use in the filter module:
\unprotect \def\AnyFilename#1% {\ctxcommand{getreadfilename("any",".","#1")}}
\def\ProcessFile#1% {\edef\InputFile{\AnyFilename{#1}}% \InputFile \typefile[\InputFile]} \protect \starttext \ProcessFile{http://cim.mcgill.ca/~adityam/index.html} \stoptext
With the latest beta, I get the following error:
...inimals/texmf-context/tex/context/base/mkiv/file-res.lua:147: bad argument #1 to 'find' (string expected, got nil) stack traceback: [C]: in function 'string.find'
...inimals/texmf-context/tex/context/base/mkiv/file-res.lua:147: in upvalue 'action1' [string "local action = tokens._action..."]:4: in field 'getreadfilename' [ctxlua]:1: in main chunk
Not sure why #1 is being passed to the lua function instead of the expanded value of "#1". hm, i'll check it
#1 just means first argument in lua -) use this: \unprotect \def\AnyFilename#1{\clf_getreadfilename{any}{.}{#1}} \protect ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
On Sun, 15 Apr 2018, Hans Hagen wrote:
On 4/15/2018 7:08 AM, Aditya Mahajan wrote:
On Sun, 15 Apr 2018, Hans Hagen wrote:
I get another error message:
open source > level 4, order 5, name 't-module-catcodes.tex' loading > Module Catcodes (ver: 2011.12.17)
tex error > tex error on line 96 in file t-module-catcodes.tex: ! Undefined control sequence why are special catcodes needed? an dif so, there are often easier ways
On 4/14/2018 9:52 PM, Lutz Haseloff wrote: than low level hacking
This is the commit (from 2011!) where I added this code:
https://github.com/adityam/filter/commit/c34023fd1ede0909a056a10c6352202f229...
My guess is that I did not want multiple newlines to collapse in t-vim, so I had redefined \activeendoflinetoken to {\strut\par}. The offending lines are copied from catc-ini.mkiv from the same time:
https://github.com/contextgarden/context-mirror/blob/5056d7a854142aa63032b0a...
to make sure that I use the same syntax for MkII and MkIV.
A couple of years after that I split the MkII and MkIV code into separate files, but I never touched the catcode part (because it was working).
I cannot test the latest beta right now; I'll test it on Monday. In the meanwhile, what is the current recommended method to alter the way literal newlines and tabs are shown. \starttext
\start \def\obeyedline{\blank[line]} \obeylines
line 1
line 2
line 3
\stop
\stoptext
blank will cleanup for you
I don't want multiple empty lines to collapse (this is for code listing). Here is a minimal example showing what t-vim is doing: \newcatcodetable \MinimalCatcodes \startcatcodetable \MinimalCatcodes % for reading t-vim output \catcode\backslashasciicode = \escapecatcode \catcode\leftbraceasciicode = \begingroupcatcode \catcode\rightbraceasciicode = \endgroupcatcode \catcode\endoflineasciicode = \activecatcode \catcode\formfeedasciicode = \othercatcode \catcode\spaceasciicode = \othercatcode \stopcatcodetable \starttext \bgroup \def\obeyedline{\strut\par} %\def\obeyedline{\blank[line]} \setcatcodetable\MinimalCatcodes\letcharcode\endoflineasciicode\obeyedline This is a \color[red]{test} To check multiple lines as well as color \egroup \stoptext If I replace the {\strut\par} with {\blank[line]}, multiple empty lines are collapsed to a single line. Aditya
On 4/16/2018 11:27 PM, Aditya Mahajan wrote:
On Sun, 15 Apr 2018, Hans Hagen wrote:
On 4/15/2018 7:08 AM, Aditya Mahajan wrote:
On Sun, 15 Apr 2018, Hans Hagen wrote:
On 4/14/2018 9:52 PM, Lutz Haseloff wrote:
I get another error message:
open source > level 4, order 5, name 't-module-catcodes.tex' loading > Module Catcodes (ver: 2011.12.17)
tex error > tex error on line 96 in file t-module-catcodes.tex: ! Undefined control sequence why are special catcodes needed? an dif so, there are often easier ways than low level hacking
This is the commit (from 2011!) where I added this code:
https://github.com/adityam/filter/commit/c34023fd1ede0909a056a10c6352202f229...
My guess is that I did not want multiple newlines to collapse in t-vim, so I had redefined \activeendoflinetoken to {\strut\par}. The offending lines are copied from catc-ini.mkiv from the same time:
https://github.com/contextgarden/context-mirror/blob/5056d7a854142aa63032b0a...
to make sure that I use the same syntax for MkII and MkIV.
A couple of years after that I split the MkII and MkIV code into separate files, but I never touched the catcode part (because it was working).
I cannot test the latest beta right now; I'll test it on Monday. In the meanwhile, what is the current recommended method to alter the way literal newlines and tabs are shown. \starttext
\start \def\obeyedline{\blank[line]} \obeylines
line 1
line 2
line 3
\stop
\stoptext
blank will cleanup for you
I don't want multiple empty lines to collapse (this is for code listing). Here is a minimal example showing what t-vim is doing:
(I always remove multiple empty lines in code as i consider it an error.)
\newcatcodetable \MinimalCatcodes
\startcatcodetable \MinimalCatcodes % for reading t-vim output \catcode\backslashasciicode = \escapecatcode \catcode\leftbraceasciicode = \begingroupcatcode \catcode\rightbraceasciicode = \endgroupcatcode \catcode\endoflineasciicode = \activecatcode \catcode\formfeedasciicode = \othercatcode \catcode\spaceasciicode = \othercatcode \stopcatcodetable
\starttext \bgroup \def\obeyedline{\strut\par} %\def\obeyedline{\blank[line]} \setcatcodetable\MinimalCatcodes\letcharcode\endoflineasciicode\obeyedline This is a \color[red]{test}
To check multiple lines as well as color \egroup \stoptext
If I replace the {\strut\par} with {\blank[line]}, multiple empty lines are collapsed to a single line. Ok, I though that you wanted to collapse. How about this:
\def\obeyedline{\forcestrutdepth\vskip\lineheight} \obeylines ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
All features of the filter and vim modules work with the latest beta, except for one final bug: leading spaces are stripped from the buffer. \starttext \startbuffer[test] Leading spaces \stopbuffer \savebuffer[file=test-temp.tmp, prefix=no, list=test] \stoptext The leading spaces are stripped before the buffer is saved to the file temp.tmp. Is it possible for the leading space NOT to be stripped? (If not, I'll just document this as a feature :-). Aditya
On 4/17/2018 12:01 AM, Aditya Mahajan wrote:
All features of the filter and vim modules work with the latest beta, except for one final bug: leading spaces are stripped from the buffer.
\starttext
\startbuffer[test] Leading spaces \stopbuffer
\savebuffer[file=test-temp.tmp, prefix=no, list=test]
\stoptext
The leading spaces are stripped before the buffer is saved to the file temp.tmp. Is it possible for the leading space NOT to be stripped? (If not, I'll just document this as a feature :-).
\samplefile{ward} \startnarrower \samplefile{ward} \startbuffer[test] Leading spaces And some more \stopbuffer \typebuffer[test] \stopnarrower \samplefile{ward} \startbuffer[test] Leading spaces And some more \stopbuffer \typebuffer[test] it is actually a feature to align the left edge relative to the least indented so that we can use them inside other constructs Now, as you're not afraid of low level code: \unprotect \unexpanded\def\StartAditya {\buff_pickup {Aditya}% {StartAditya}% {StopAditya}% {}% {\savebuffer[file=test-temp.tmp,prefix=no,list=Aditya]}% \zerocount} \unexpanded\def\StopAditya {} \protect \StartAditya Leading spaces And some more \StopAditya (1) \typebuffer[Aditya] (2) \typefile{test-temp.tmp} Does what you want but of course it's sort of ugly for a module to do that. What we can do is this which is still ugly but picking up verbatim is always ugly: \unprotect \def\buff_start_indeed#1#2#3#4% {\edef\p_strip{\namedbufferparameter{#1}\c!strip}% \normalexpanded{\buff_pickup{#2}{#3}{#4}{}{\buff_stop{#4}}\ifx\p_strip\v!no\zerocount\else\plusone\fi}} \protect \definebuffer[Aditya][strip=no] \startAditya Leading spaces And some more And even more \stopAditya \typeAditya But then we need Wolfgang to double check if this extension has side effects elsewhere. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
On Tue, 17 Apr 2018, Hans Hagen wrote:
On 4/17/2018 12:01 AM, Aditya Mahajan wrote:
All features of the filter and vim modules work with the latest beta, except for one final bug: leading spaces are stripped from the buffer.
\starttext
\startbuffer[test] Leading spaces \stopbuffer
\savebuffer[file=test-temp.tmp, prefix=no, list=test]
\stoptext
The leading spaces are stripped before the buffer is saved to the file temp.tmp. Is it possible for the leading space NOT to be stripped? (If not, I'll just document this as a feature :-).
\samplefile{ward} \startnarrower \samplefile{ward} \startbuffer[test] Leading spaces And some more \stopbuffer \typebuffer[test] \stopnarrower \samplefile{ward}
\startbuffer[test] Leading spaces And some more \stopbuffer \typebuffer[test]
it is actually a feature to align the left edge relative to the least indented so that we can use them inside other constructs
Now, as you're not afraid of low level code:
\unprotect
\unexpanded\def\StartAditya {\buff_pickup {Aditya}% {StartAditya}% {StopAditya}% {}% {\savebuffer[file=test-temp.tmp,prefix=no,list=Aditya]}% \zerocount}
This is perfect as I am already using `\grabbufferdata` in my code. I can easily adapt it to use `\buff_pickup` instead. Thanks!.
Does what you want but of course it's sort of ugly for a module to do that. What we can do is this which is still ugly but picking up verbatim is always ugly:
\def\buff_start_indeed#1#2#3#4% {\edef\p_strip{\namedbufferparameter{#1}\c!strip}%
\normalexpanded{\buff_pickup{#2}{#3}{#4}{}{\buff_stop{#4}}\ifx\p_strip\v!no\zerocount\else\plusone\fi}}
\protect
I want this to be configurable at runtime and the vim module already has code that enables `strip=yes` and `strip=no` options (I do this via a function in vim so that it works with both mkii and mkiv; although I don't think that anyone uses the mkii module any longer). Aditya
On Tue, 17 Apr 2018, Aditya Mahajan wrote:
On Tue, 17 Apr 2018, Hans Hagen wrote:
On 4/17/2018 12:01 AM, Aditya Mahajan wrote:
All features of the filter and vim modules work with the latest beta, except for one final bug: leading spaces are stripped from the buffer.
\starttext
\startbuffer[test] Leading spaces \stopbuffer
\savebuffer[file=test-temp.tmp, prefix=no, list=test]
\stoptext
The leading spaces are stripped before the buffer is saved to the file temp.tmp. Is it possible for the leading space NOT to be stripped? (If not, I'll just document this as a feature :-).
\samplefile{ward} \startnarrower \samplefile{ward} \startbuffer[test] Leading spaces And some more \stopbuffer \typebuffer[test] \stopnarrower \samplefile{ward}
\startbuffer[test] Leading spaces And some more \stopbuffer \typebuffer[test]
it is actually a feature to align the left edge relative to the least indented so that we can use them inside other constructs
Now, as you're not afraid of low level code:
\unprotect
\unexpanded\def\StartAditya {\buff_pickup {Aditya}% {StartAditya}% {StopAditya}% {}% {\savebuffer[file=test-temp.tmp,prefix=no,list=Aditya]}% \zerocount}
This is perfect as I am already using `\grabbufferdata` in my code. I can easily adapt it to use `\buff_pickup` instead. Thanks!.
Does what you want but of course it's sort of ugly for a module to do that. What we can do is this which is still ugly but picking up verbatim is always ugly:
\def\buff_start_indeed#1#2#3#4% {\edef\p_strip{\namedbufferparameter{#1}\c!strip}%
\normalexpanded{\buff_pickup{#2}{#3}{#4}{}{\buff_stop{#4}}\ifx\p_strip\v!no\zerocount\else\plusone\fi}}
\protect
I want this to be configurable at runtime and the vim module already has code that enables `strip=yes` and `strip=no` options (I do this via a function in vim so that it works with both mkii and mkiv; although I don't think that anyone uses the mkii module any longer).
I added `strip=yes` option to the filter module, which is now the default option. See "Stripping leading whitespace" in the module documentation (https://github.com/adityam/filter). This is a MkIV only feature and I will not implement it in MkII. I also made `strip=yes` to be the default in t-vim (to be consistent with t-filter). In t-vim, the `strip` option works with both mkii and mkiv. Aditya
On Sat, 14 Apr 2018, Lutz Haseloff wrote:
Hi all,
with latest context my filter test file fails with an error. My file:
\usemodule[filter] \defineexternalfilter [luatexdevelopmentlevel] [filtercommand={luatex --credits | grep Development > \externalfilteroutputfile}] \starttext \inlineluatexdevelopmentlevel{} \stoptext
Error message:
loading > Module Catcodes (ver: 2011.12.17)
tex error > tex error on line 96 in file /usr/local/context/tex/texmf-modules/tex/context/third/filter/t-module-catcodes.tex: ! Undefined control sequence
l.96 ...tivecatcode \gdef\activeendoflinetoken{^^M}
86 \stopcatcodetable 87 88 89 90 \ifdefined \activeendoflinetoken \else 91 % from catc-ini.mkiv 92 \bgroup 93 \catcode \tabasciicode \activecatcode \gdef\activetabtoken {^^I} 94 \gdef\outputnewlinechar {^^J} 95 \catcode \formfeedasciicode \activecatcode \gdef\activeformfeedtoken {^^L} 96 >> \catcode \endoflineasciicode \activecatcode \gdef\activeendoflinetoken{^^M} 97 \egroup 98 \fi 99 100 \protectmodulecatcodes 101 \stopmodule 102
I uploaded a new version of filter module where this is fixed. The new method is slightly cleaner and hopefully works better. Aditya
Hi Aditya,
your filter module works for me again.
Thank you very much.
Greetings Lutz
Am 17. April 2018 04:52:21 MESZ schrieb Aditya Mahajan
On Sat, 14 Apr 2018, Lutz Haseloff wrote:
Hi all,
with latest context my filter test file fails with an error. My file:
\usemodule[filter] \defineexternalfilter [luatexdevelopmentlevel] [filtercommand={luatex --credits | grep Development > \externalfilteroutputfile}] \starttext \inlineluatexdevelopmentlevel{} \stoptext
Error message:
loading > Module Catcodes (ver: 2011.12.17)
tex error > tex error on line 96 in file /usr/local/context/tex/texmf-modules/tex/context/third/filter/t-module-catcodes.tex: ! Undefined control sequence
l.96 ...tivecatcode \gdef\activeendoflinetoken{^^M}
86 \stopcatcodetable 87 88 89 90 \ifdefined \activeendoflinetoken \else 91 % from catc-ini.mkiv 92 \bgroup 93 \catcode \tabasciicode \activecatcode \gdef\activetabtoken {^^I} 94 \gdef\outputnewlinechar {^^J} 95 \catcode \formfeedasciicode \activecatcode \gdef\activeformfeedtoken {^^L} 96 >> \catcode \endoflineasciicode \activecatcode \gdef\activeendoflinetoken{^^M} 97 \egroup 98 \fi 99 100 \protectmodulecatcodes 101 \stopmodule 102
I uploaded a new version of filter module where this is fixed. The new method is slightly cleaner and hopefully works better.
Aditya ___________________________________________________________________________________ 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 ___________________________________________________________________________________
-- GPG Key ID 3C4F83BC
participants (3)
-
Aditya Mahajan
-
Hans Hagen
-
Lutz Haseloff