[NTG-context] Problem with Filter Module in latent context beta

Hans Hagen j.hagen at xs4all.nl
Mon Apr 16 23:59:16 CEST 2018


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/c34023fd1ede0909a056a10c6352202f2295fba4 
>>>
>>> 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/5056d7a854142aa63032b0a3ca4d41c496e41faf/tex/context/base/catc-ini.mkiv 
>>>
>>> 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
-----------------------------------------------------------------


More information about the ntg-context mailing list