Dear all,
For a small project, I have two questions (without MWE…) on processing xml via
Lua and context. I’ll write two messages so eager volunteers can reply more
easily!
So question one: given an xml structure like this
<section>
<sectiontitle>
Introduction: the <em>Iliad</em>
</sectiontitle>
<sectionlist>
Introduction: the <em>Iliad</em>
</sectionlist>
</section>
I want to typeset the section title with some added information. Since I’m
processing in a loop, I thought this would be easier in Lua, so I have
something like this:
local i = 0
local sessions = { “April 2”, “April 9”, “April 16” } -- etc.
function xml.functions.section(t)
i = i + 1
local raw_section = xml.text (t, "/sectiontitle")
local section_head = i .. ". session, " .. sessions [i] .. ": " ..
raw_section
context.startsection { title=section_head }
lxml.flush (t)
context.stopsection ()
end
However, this means that the section_head is serialized as a string and not
processed according to the xml setups, so I have “the <em>Iliad</em>” in my
typeset document. How can this be avoided? How can I have the <em>...</em>
processed instead of serialized in the section title?
Thanks for looking at my code!
Thomas
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : [email protected] / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________