On 1/9/2015 11:41 AM, Pablo Rodriguez wrote:
Dear list,
I have the following sample:
\startbuffer[demo] <doc>
<p>This is the first paragraph.</p>
<ol> <li><p>first item</p></li> <li><p>second item</p></li> </ol>
<p>text with footnote<a href="#fn1" class="footnoteRef" id="fnref1"><sup>1</sup></a></p>
<p>text with another footnote<a href="#fn2" class="footnoteRef" id="fnref2"><sup>2</sup></a></p>
<div class="footnotes"> <hr /> <ol> <li id="fn1"><p>footnote text</p> <p>In two paragraphs<a href="#fnref1">↩</a></p></li>
<li id="fn2"><p>footnote text</p> <p>In two paragraphs<a href="#fnref2">↩</a></p></li> </ol> </div>
</doc> \stopbuffer
\starttext
\usemodule[html]
\startxmlsetups xml:initialize \xmlsetsetup{#1}{*}{xml:*} \xmlsetsetup{\xmldocument}{a[@class='footnoteRef']}{xml:footnote}
\stopxmlsetups
\xmlregistersetup{xml:initialize}
\startxmlsetups xml:doc \xmlflush{#1} \stopxmlsetups
\startxmlsetups xml:footnote \startfootnote
\xmlfirst{main}{div[@class='footnotes']/ol/li[@id=string.sub('\xmlatt{#1}{href}',2)]} \stopfootnote \stopxmlsetups
\setupitemize[margin=yes]
\xmlprocessbuffer{main}{demo}{}
\stoptext
The first issue I’m experiencing is that I don’t know how to avoid that footnotes (implemented in XML as items in an ordered list) are also typeset as list items. Footnotes may be inside lists or contain lists, but footnotes themselves are only implemented as lists. The only way I know is to disable lists, but this is not an option.
\startbuffer[demo] <doc> <p>This is the first paragraph.</p> <ol> <li><p>first item</p></li> <li><p>second item</p></li> </ol> <p>text with footnote<a href="#fn1" class="footnoteRef" id="fnref1"><sup>1</sup></a></p> <p>text with another footnote<a href="#fn2" class="footnoteRef" id="fnref2"><sup>2</sup></a></p> <div class="footnotes"> <hr/> <ol> <li id="fn1"><p>footnote text</p><p>In two paragraphs<a href="#fnref1">↩</a></p></li> <li id="fn2"><p>footnote text</p><p>In two paragraphs<a href="#fnref2">↩</a></p></li> </ol> </div> </doc> \stopbuffer \starttext \usemodule[html] \xmlregistersetup{xml:html:basics} \xmlregistersetup{xml:html:tables} \startxmlsetups xml:initialize \xmlsetsetup{#1}{a[@class='footnoteRef']}{xml:footnote:ref} \xmlsetsetup{#1}{div[@class='footnotes']}{} \stopxmlsetups \xmlregistersetup{xml:initialize} \startxmlsetups xml:doc \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:footnote:set \startfootnote \xmlflush{#1} \stopfootnote \stopxmlsetups \startxmlsetups xml:footnote:ref \xmlfilter{main}{div[@class='footnotes']/ol/li[@id=string.sub('\xmlatt{#1}{href}',2)]/command(xml:footnote:set)} \stopxmlsetups \xmlprocessbuffer{main}{demo}{} \stoptext -- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------