[NTG-context] context() does not ignore space in empty line

Hans Hagen j.hagen at xs4all.nl
Mon Apr 19 10:19:21 CEST 2021


On 4/19/2021 9:22 AM, Sylvain Hubert wrote:
> Dear list,
> 
> does anyone have an idea why, in the example below, context() starts a 
> new paragraph at "\n\n" but not at "\n \n" with a space in between? Is 
> there any way to fix it?
> 
> \starttext
> Without using context(), inside the next parentheses is a new line: (
> ) note that a space sits between the two line breaks.
> 
> \startluacode
>    context('Using context(), inside the next parentheses is also a new 
> line: (\n\n) because there is *no* space between the two line breaks.\n\n')
>    context('Using context(), inside the next parentheses is however *no* 
> new line: (\n \n) because of the space between the two line breaks.\n\n')
> \stopluacode
> \stoptext
> 
> Any help is appreciated.
kind of tricky and dangerous to chanmge after many years

in cldf-ini.lua, change line 579 into

local emptyline     = space^0 * newline^2 + newline * space^1

and run context --make

then test

\starttext
     \startbuffer
     \startluacode
         context('line 1.1 (\n)       line 1.2\n\n') context.blank()
         context('line 2.1 (\n )      line 2.2\n\n') context.blank()
         context('line 3.1 ( \n)      line 3.2\n\n') context.blank()
         context('line 4.1 ( \n )     line 4.2\n\n') context.blank()
         context('line 5.1 (\n\n)     line 5.2\n\n') context.blank()
         context('line 6.1 (\n\n )    line 6.2\n\n') context.blank()
         context('line 7.1 ( \n\n)    line 7.2\n\n') context.blank()
         context('line 8.1 ( \n\n )   line 8.2\n\n') context.blank()
         context('line 9.1 (\n \n)    line 9.2\n\n') context.blank()
         context('line 0.1 (\n \n \n) line 0.2\n\n') context.blank()
     \stopluacode
     \stopbuffer
     \typebuffer
     \getbuffer
\stoptext

now, the question is, does this cover all cases and is this what we 
expect ...

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
-----------------------------------------------------------------


More information about the ntg-context mailing list