[dev-context] Comma lists and Lua
Wolfgang Schuster
schuster.wolfgang at googlemail.com
Thu Jun 7 18:14:04 CEST 2012
Hi,
in the following example the space before the “one” in the line
\ctxlua{userdata.commalist(" one, two, three")}
is visible in the output. I guess this counts as bug because in the assignment
list the space before “a=x” is removed.
Example:
\starttext
\startluacode
userdata = userdata or {}
function userdata.commalist(list)
local list = utilities.parsers.settings_to_array(list)
context.starttabulate()
for index, value in next, list do
context.NC()
context.quotation(index)
context.NC()
context.quotation(value)
context.NC()
context.NR()
end
context.stoptabulate()
end
function userdata.parameters(list)
local list = utilities.parsers.settings_to_hash(list)
context.starttabulate()
for key, value in next, list do
context.NC()
context.quotation(key)
context.NC()
context.quotation(value)
context.NC()
context.NR()
end
context.stoptabulate()
end
\stopluacode
\ctxlua{userdata.commalist("one,two,three")}
\ctxlua{userdata.commalist(" one, two, three")}
\ctxlua{userdata.parameters("a=x,b=y,c=z")}
\ctxlua{userdata.parameters(" a=x, b=y, c=z")}
\stoptext
Wolfgang
More information about the dev-context
mailing list