Menu

#131 formatting within <link> is ignored

v1.0 (example)
open
nobody
None
5
2022-07-06
2022-07-06
Flupp
No

In contrast to <ulink>, formatting withing <link> is ignored.

Proposed fix:

diff -r 3ddf5d6cedcb xsl/xref.xsl
--- a/xsl/xref.xsl  Tue Sep 10 00:40:26 2019 +0200
+++ b/xsl/xref.xsl  Wed Jul 06 10:50:51 2022 +0200
@@ -55,7 +55,8 @@
   </xsl:choose>
   <!-- The hot text -->
   <xsl:text>}{</xsl:text>

-  <xsl:value-of select="$text"/>
+  <!-- text() within link is handled somewhere else -->
+  <xsl:apply-templates/>
   <xsl:text>}</xsl:text>
 </xsl:template>

Example showing the problem (test.db):

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE article>
<article
  xmlns="http://docbook.org/ns/docbook" version="5.0"
  xmlns:xlink="http://www.w3.org/1999/xlink" >
  <info>
    <title>Test</title>
  </info>
  <section xml:id="sec">
    <title>sec</title>
    <itemizedlist spacing="compact">
      <listitem>
        <para>
          <link linkend="sec"><literal>foo</literal> and
          <literal>bar</literal></link> (link)
        </para>
      </listitem>
      <listitem>
        <para>
          <link xlink:href="https://www.google.de"><literal>foo</literal>
          and <literal>bar</literal></link> (ulink)
        </para>
      </listitem>
    </itemizedlist>
  </section>
</article>

Translating with dblatex --debug --tmpdir=tmp test.db results in the following LaTeX:

% […]
\begin{itemize}[itemsep=0pt]

\item{}  \hyperlink{sec}{foo and bar} (link)



\item{}  \href{https://www.google.de}{\texttt{foo}           and \texttt{bar}} (ulink)


\end{itemize}
% […]

PS: The Docbook was actually generated using Pandoc (pandoc --standalone test.md --output=test.db) from test.md:

---
title: Test
...

# sec


- [`foo` and `bar`](#sec) (link)
- [`foo` and `bar`](https://www.google.de) (ulink)

Discussion


Log in to post a comment.

MongoDB Logo MongoDB