On 15-11-2011 06:43, Aditya Mahajan wrote:

Here is a slightly cleanup version that handles multiline comments better

https://github.com/adityam/context-comments/blob/master/t-comments.mkvi

 if find(s,stop) then
   insideComment = false
   return cleaned_line .. currentfilter(strip_to_stop(s))
 else

as find returns a position, you can do things like this:

local stop = find(s,stop)
if stop then
 ...
 return cleaned_line .. sub(s,stop+#stop,#s)

(ok, you need to know the real unescaped length of stop)

But this will only work if % has its usual catcode. I don't know how to
get around that limitation.

for multiline we can plug into the texthandler instead, but it's not worth the trouble and the line based one permits selective enable/disable

Hans

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
    tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to