8 Jul
2015
8 Jul
'15
10:07 a.m.
On 08 Jul 2015, at 11:05, Jaroslav Hajtmar
wrote: Hello ConTeXist.
Within the one very complex problem I need to solve the following case. I want using lua code to define a macro with one optional parameter in brackets.
Simplest solution I know is this: \startluacode interfaces.definecommand ('dolastname', { arguments = { { "option", "string" } }, macro = function (opt_1) if #opt_1>0 then context(opt_1) else context('nothing') end end }) interfaces.definecommand ('lastname', { macro = function () context.dosingleempty() context.dolastname() end }) \stopluacode Best wishes, Taco