lua EOL in xmlsetups
Hello to everybody, why end of line is not accepted by \startluacode ... \stopluacode construct in xmlsetups? Is there a better way? This works: \startluacode for i=10,1,-1 do tex.print(i) end \stopluacode This doesn't work: \startluacode for i=10,1,-1 do tex.print(i) end \stopluacode Thanks, Jano book.xml source file: --------------------- <?xml version="1.0" encoding="utf-8"?> <book> </book> book.tex file to test: ---------------------- \startxmlsetups xml:base \xmlsetsetup{\xmldocument}{*}{-} \xmlsetsetup{\xmldocument}{book}% {xml:*}% default \stopxmlsetups \xmlregistersetup{xml:base} \startxmlsetups xml:book \startluacode for i=10,1,-1 do tex.print(i) end \stopluacode \stopxmlsetups \starttext \xmlprocessfile{main}{book.xml}{} \stoptext
Am 14.04.2012 um 20:15 schrieb Jano Kula:
Hello to everybody,
why end of line is not accepted by \startluacode ... \stopluacode construct in xmlsetups? Is there a better way?
That’s a feature of \startsetups etc. because you don’t have to worry about unwanted spaces when you write code, e.g. in this example there is no unwanted space even though I haven’t added a % after { (or a few other places) \startsetups test \doifelse { \somevariable } { \somevalue } { do this } { else do this } \stopsetups In your case this feature shows a unwanted side effect because the line end after “do” is ignored and Lua gets “dotex.print”. To fix this you can either use \dostepwiserecurse where you can set a start/stop value for the loop of you add a space after “do”. Wolfgang
participants (2)
-
Jano Kula
-
Wolfgang Schuster