[NTG-context] How to process simple HTML files with LuaTeX

Hans Hagen pragma at wxs.nl
Sun Sep 16 23:58:29 CEST 2007


Aditya Mahajan wrote:

> (Caveat: I do not really know lua regex, and have not tried out the 
> code)

they are not regexp but expressions -)

> Assuming lua follows standard regex syntax, this means
> 
> & # The letter &
> ( # start a group
> .. # any character
> - # As few as needed
> ) # end group
> ; # the letter ;
> 
> so this will match all entities.

just &(.-); with () being the capture


> If it helps, the equivalent vim regex will be
> \&\(.\{-}\);
> 
> I guess that $1 (the first group, that is everything that matches .-) 

%1

> will be compared with mojcaentities table and replaced accordingly. 

indeed

> This looks like a really nice feature of lua. In Ruby and Vim, I often 
> find myself writing a bunch of similar regex, and always wished there 
> was something like what lua does.

the nice thing about many lua feature is that less code (lua c code) 
behaves more powerful




-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list