* lua EOL in xmlsetups
@ 2012-04-14 18:15 Jano Kula
2012-04-15 19:47 ` Wolfgang Schuster
0 siblings, 1 reply; 2+ messages in thread
From: Jano Kula @ 2012-04-14 18:15 UTC (permalink / raw)
To: ntg-context
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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / 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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: lua EOL in xmlsetups
2012-04-14 18:15 lua EOL in xmlsetups Jano Kula
@ 2012-04-15 19:47 ` Wolfgang Schuster
0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Schuster @ 2012-04-15 19:47 UTC (permalink / raw)
To: mailing list for ConTeXt users
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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / 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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-04-15 19:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-14 18:15 lua EOL in xmlsetups Jano Kula
2012-04-15 19:47 ` Wolfgang Schuster
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).