Hi again,

Jonathan Nieder wrote:

> The docbook-xsl manpage backend does not seem to like simple
> paragraphs in footnotes.

I wrote this report about a month and a half ago and sent
it to [email protected] and [email protected],
but I am not sure it ended up in the right place.  Could you
take a glance and let me know?

> Using asciidoc, I tried to use a footnote, like this:
> 
>                                ...some directory separators
>       included for performance reasons footnote:[Permitted
>       pathnames have the form...       ... rest of the
>       object ID.].
> 
> This produces what seems to be valid Docbook 4.5 markup:
> 
>                                             ... performance
>       reasons <footnote><simpara>Permitted pathnames...
>              ... object ID.</simpara></footnote>.</simpara>
> 
> xsltproc warns about it:
> 
>  $ xsltproc --nonet \
>    /usr/share/xml/docbook/stylesheet/docbook-xsl/manpages/docbook.xsl \
>    Documentation/git-notes.xml
>  Warn: endnote  #1 : Bad: footnote[1] in source            git-notes
>  [...]
> 
> and the output includes extra line breaks.
> 
>       NOTES
>               1.
> 
>                  Permitted pathnames have the form ab/cd/ef/.../abcdef...:
>                  a sequence of directory names of two hexadecimal digits
>                  each followed by a filename with the rest of the object ID.
> 
> So I wrote this very rough patch, which seems to work okay for
> my case.  I tried sending it to [email protected], but
> apparently that list is subscriber-only.
> 
> Thoughts?  Suggestions?
> 
> diff --git a/manpages/block.xsl b/manpages/block.xsl
> index 2341b5d..27355f2 100644
> --- a/manpages/block.xsl
> +++ b/manpages/block.xsl
> @@ -101,16 +101,38 @@
>  </xsl:template>
>  
>  <xsl:template match="simpara">
> -  <xsl:if test="not(ancestor::authorblurb)
> -    and not(ancestor::personblurb)
> -    and not(ancestor::callout)"
> -    >
> -    <xsl:text>.sp&#10;</xsl:text>
> -  </xsl:if>
> +  <xsl:choose>
> +    <xsl:when test="ancestor::footnote or
> +                    ancestor::annotation or
> +                    ancestor::authorblurb or
> +                    ancestor::personblurb or
> +                    ancestor::callout">
> +      <xsl:if test="preceding-sibling::*[not(name() ='')]">
> +        <xsl:text>.sp</xsl:text>
> +        <xsl:text>&#10;</xsl:text>
> +        <xsl:text>.RS 4n</xsl:text>
> +        <xsl:text>&#10;</xsl:text>
> +      </xsl:if>
> +    </xsl:when>
> +    <xsl:otherwise>
> +      <xsl:text>.sp</xsl:text>
> +      <xsl:text>&#10;</xsl:text>
> +    </xsl:otherwise>
> +  </xsl:choose>
>    <xsl:variable name="content">
>      <xsl:apply-templates/>
>    </xsl:variable>
>    <xsl:value-of select="normalize-space($content)"/>
> +    <xsl:if test="ancestor::footnote or
> +                  ancestor::annotation or
> +                  ancestor::authorblurb or
> +                  ancestor::personblurb">
> +      <xsl:if test="preceding-sibling::*[not(name() ='')]">
> +        <xsl:text>&#10;</xsl:text>
> +        <xsl:text>.RE</xsl:text>
> +        <xsl:text>&#10;</xsl:text>
> +      </xsl:if>
> +    </xsl:if>
>    <xsl:text>&#10;</xsl:text>
>  </xsl:template>
>  
> diff --git a/manpages/endnotes.xsl b/manpages/endnotes.xsl
> index 360692e..1925fe3 100644
> --- a/manpages/endnotes.xsl
> +++ b/manpages/endnotes.xsl
> @@ -259,7 +259,9 @@
>            <!-- * do some further checking on it, so we can emit warnings -->
>            <!-- * about potential problems -->
>          <xsl:for-each select="node()">
> -          <xsl:if test="local-name() != 'para' and local-name() !=''">
> +          <xsl:if test="local-name() != 'para' and
> +                        local-name() != 'simpara' and
> +                        local-name() !=''">
>              <!-- * for each node we find as a child of a footnote or -->
>              <!-- * annotation, if it's not a para or a text node, emit a -->
>              <!-- * warning... because in manpages output, we can't render -->
> -- 
> 

Thanks,
Jonathan



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to