Thomas, et alia.
Thanks so very much! I now have this:
\startluacode
function filter(s)
if math.mod(s,5) == 0 then
context.color( { "darkred" }, s )
end
end
\stopluacode
\define[1]\MyNumber%
{\ctxlua{filter(#1)}\endgraf}
\startxmlsetups xml:lb
\lineNumbers{\MyNumber{\xmlatt{#1}{n}}}
\xmlflush{#1}
\stopxmlsetups
\defineinmargin [lineNumbers] [outer] [normal]
This gets me what I wanted. Still fumbling greatly with the macro
syntax. I'm not sure what the recursion is for, for example. On the
other hand the lua seems rather straightforward to me by comparison. I
tried returning an empty string like this: context.color( {"blue"}, ''
) to remove the other numbers, but that seemed silly, so I just
removed the 'else' clause instead, and that seemed to work as well.
In python-speak I'd interpret context.color() as a method call on a
module 'context'. Could you, or anyone, direct me to any documentation
for this module and a list of the properties and methods that it
supports?
On Wed, Dec 15, 2010 at 11:34 PM, Thomas A. Schmitz
This is easy with a lua function. Since you know python, I guess the following example will be easy for you:
\startluacode function filter(s) if math.mod(s,5) == 0 then context.color( { "darkred" }, s ) else context.color( { "darkblue" }, s ) end end \stopluacode
\define[1]\MyNumber% {\ctxlua{filter(#1)}\endgraf}
\starttext
\dorecurse{25}{\MyNumber{\recurselevel}}
\stoptext
This should get you going, I hope
Good luck
Thomas