[NTG-context] dealing with footnotes and ol in XML

Hans Hagen pragma at wxs.nl
Sat Jan 10 14:01:39 CET 2015


On 1/9/2015 1:24 PM, Pablo Rodriguez wrote:
> On 01/09/2015 12:29 PM, Hans Hagen wrote:
>> [...]
>> I'll add this:
>>
>> \startluacode
>>       local gsub = string.gsub
>>       function xml.expressions.idstring(str)
>>           return type(str) == "string" and gsub(str,"^#","") or ""
>>       end
>> \stopluacode
>>
>> \startxmlsetups xml:footnote:ref
>>
>> \xmlfilter{main}{div[@class='footnotes']/ol/li[@id=idstring('\xmlatt{#1}{href}')]/command(xml:footnote:set)}
>> \stopxmlsetups
>>
>> As this id stuff happens more often.
>
> Many thanks for your reply and the code, Hans.
>
> I have an issue with multiparagraph footnotes. Here is the sample in
> ConTeXt code:
>
> \setuppapersize[A7]
> \setupbodyfont[15pt]
> \starttext
> \dorecurse{2}{A footnote\footnote
> {\dorecurse{2}{Footnote paragraph.\par}}}
> \dorecurse{3}{B footnote\footnote
> {Footnote paragraph.\par Footnote paragraph.}}
> \stoptext
>
> Footnotes that end with \par have wrong space with next footnote.
>
> I don’t know whether this is intended. How could I avoid that in XML?

well, more unexpected .. messing with the depth is always tricky

\unexpanded\def\handlenoteitself#tag#id%
   {\edef\currentnotenumber{#id}%
    \edef\currentnote{#tag}%
    \strc_constructions_initialize{#tag}%
    \strc_notes_synchronize
 
\edef\currentconstructionlistentry{\ctxcommand{notelistindex("\currentnote",#id)}}% 

    \reinstateconstructionnumberentry\currentconstructionlistentry
    \dontcomplain
    \strc_notes_interaction_check_display
    \strc_notes_set_reference_attribute_text
    \strc_constructions_stored_start
    \begstrut
    \strc_references_flush_destination_nodes
    \strc_notes_set_destination_attribute_text
    \strc_notes_inject_text
    \ifvmode\obeydepth\else\endstrut\fi % \obeydepth is new per 2015-01-10
    \strc_constructions_stored_stop}



-----------------------------------------------------------------
                                           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
-----------------------------------------------------------------


More information about the ntg-context mailing list