On Fri, 11 Nov 2011, Steffen Wolfrum wrote:
quite often I wish we could have a kind of in line comment:
Something like ¿this is my comment¡ this.
I assume it is not trivial due to catcode issues, to say the least.
But nevertheless, as it is getting close to christmas, I just wanted to mention
this idea here.
As long as there is no line break in the comment, the following lua based
solution works (inspired by m-translate)
\startluacode
local comments = {}
thirddata = thirddata or {}
thirddata.comments = comments
function comments.translate(s)
return string.gsub(s, "¿.-¡","")
end
local textlineactions = resolvers.openers.helpers.textlineactions
utilities.sequencers.appendaction(textlineactions,"after","thirddata.comments.translate")
function comments.enable()
utilities.sequencers.enableaction(textlineactions,"thirddata.comments.translate")
end
function comments.disable()
utilities.sequencers.disableaction(textlineactions,"thirddata.comments.translate")
end
comments.disable()
\stopluacode
\def\enablecomments {\ctxlua{thirddata.comments.enable()}}
\def\disablecomments{\ctxlua{thirddata.comments.disable()}}
\appendtoks
\enablecomments
\to \everystarttext
\starttext
\section{An ¿in \iffalse comment¡ works}
Multiple ¿in \iffalse comment¡ with something ¿in \iffalse comment¡ in betweeen
\stoptext
Aditya___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : [email protected] / 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
___________________________________________________________________________________