ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Pablo Rodriguez <oinos@gmx.es>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: extra space in footnotes (XML)
Date: Sat, 28 Mar 2015 21:50:42 +0100	[thread overview]
Message-ID: <55171422.2010701@gmx.es> (raw)

Hi Hans,

the issue I described in a previous message with extra space with
footnote is related to XML handling:

\startbuffer[demo]
<doc>
     <p>Text
         <a href="#fn1" class="footnoteRef" id="fnref1"><sup>1</sup></a> and
         <a href="#fn2" class="footnoteRef" id="fnref2"><sup>2</sup></a>
     </p>
     <div class="footnotes">
         <hr />
         <ol>
             <li id="fn1"><p>this is a footnote</p>
                <p>this is a footnote</p>
                <p>this is a footnote</p>
                <a class="footnoteBack" href="#fnref1">↩</a></li>
             <li id="fn2"><p>A second footnote.<a class="footnoteBack"
href="#fnref2">↩</a></p></li>
         </ol>
     </div>
</doc>
\stopbuffer

\starttext

\startxmlsetups xml:initialize
     \xmlsetsetup{#1}{doc|p}{xml:*}
    \xmlsetsetup{\xmldocument}{a[@class='footnoteRef']}{xml:footnote:ref}
    \xmlsetsetup{\xmldocument}{div[@class='footnotes']}{}
    \xmlsetsetup{\xmldocument}{a[@class='uri']}{xml:autolink}
    \xmlsetsetup{\xmldocument}{a[@class='footnoteBack']}{}
    \xmlsetsetup{\xmldocument}{a[text()='↩']}{}
\stopxmlsetups

\xmlregistersetup{xml:initialize}

\startxmlsetups xml:doc
     \setuppapersize[A8]
     \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:p
    \xmldoifnotselfempty {#1} {
        \dontleavehmode
        \ignorespaces
        \xmlflush{#1}
        \removeunwantedspaces
    }
    \par
\stopxmlsetups
\startxmlsetups xml:footnote:set
     \startfootnote
         \xmlflush{#1}
     \stopfootnote
\stopxmlsetups

\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

\xmlprocessbuffer{main}{demo}{}

\stoptext

Beta from 2015.03.28 16:30 adds an unwanted empty paragraph after each
footnote. Previous beta from 2015.03.25 22:13 added no extra space.

Is this a bug or how should I change my definition of xml:p?

Many thanks for your help,


Pablo
-- 
http://www.ousia.tk
___________________________________________________________________________________
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
___________________________________________________________________________________

             reply	other threads:[~2015-03-28 20:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-28 20:50 Pablo Rodriguez [this message]
2015-03-28 21:41 ` Hans Hagen
2015-03-29  6:26   ` Pablo Rodriguez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55171422.2010701@gmx.es \
    --to=oinos@gmx.es \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).