Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross-reference to section is labelled „section_title“ #4526

Closed
carstenfuchs opened this issue Apr 4, 2018 · 4 comments
Closed

Cross-reference to section is labelled „section_title“ #4526

carstenfuchs opened this issue Apr 4, 2018 · 4 comments

Comments

@carstenfuchs
Copy link

Using Ubuntu 17.10:

$ pandoc --version
pandoc 2.1.3
Compiled with pandoc-types 1.17.4.2, texmath 0.10.1.1, skylighting 0.7.0.2

$ pandoc --from docbook testbook.xml --output testbook.tex

with testbook.xml:

<?xml version="1.0" encoding="UTF-8"?>
<?asciidoc-toc maxdepth="3"?>
<?asciidoc-numbered?>
<book xmlns="http://docbook.org/ns/docbook" xmlns:xl="http://www.w3.org/1999/xlink" version="5.0" xml:lang="de">
<info>
<title>Lori Handbuch</title>
<date>2018-04-04</date>
<author>
<personname>
<firstname>Test</firstname>
<surname>Author</surname>
</personname>
</author>
<authorinitials>TA</authorinitials>
</info>
<part xml:id="_einführung">
<title>Einführung</title>
<partintro>
<simpara>This is a simple test document.</simpara>
</partintro>
<chapter xml:id="_bedienoberfläche">
<title>Bedienoberfläche</title>
<simpara>Dieses Kapitel stellt die Bedienoberfläche vor.</simpara>
<section xml:id="_anmelden">
<title>Anmelden</title>
<simpara>Nach dem Anmelden wird man auf die <xref linkend="_startseite"/> weitergeleitet.</simpara>
<tip>
<simpara>This is a test for a „tip“.</simpara>
</tip>
</section>
<section xml:id="_startseite">
<title>Startseite</title>
<simpara>Nach dem <xref linkend="_anmelden"/>  gelangt man zur Startseite.</simpara>
</section>
</chapter>
</part>
</book>

yields this output in testbook.tex:

This is a simple test document.

\hypertarget{_bedienoberfluxe4che}{%
\section{Bedienoberfläche}\label{_bedienoberfluxe4che}}

Dieses Kapitel stellt die Bedienoberfläche vor.

\hypertarget{_anmelden}{%
\subsection{Anmelden}\label{_anmelden}}

Nach dem Anmelden wird man auf die
\protect\hyperlink{_startseite}{section\_title} weitergeleitet.

\begin{quote}
\textbf{Tip}

This is a test for a „tip``.
\end{quote}

\hypertarget{_startseite}{%
\subsection{Startseite}\label{_startseite}}

Nach dem \protect\hyperlink{_anmelden}{section\_title} gelangt man zur
Startseite.

The problem is the section\_title in the output, which should have been substituted. For example:

Nach dem Anmelden wird man auf die
\protect\hyperlink{_startseite}{Startseite} weitergeleitet.

Note that this is not specific to LaTeX output. I also see this in EPUB3 output as well.

@jgm
Copy link
Owner

jgm commented Apr 4, 2018

Shorter repro:

<chapter xml:id="_bedienoberfläche">
<title>Bedienoberfläche</title>
<simpara>Dieses Kapitel stellt die Bedienoberfläche vor.</simpara>
<section xml:id="_anmelden">
<title>Anmelden</title>
<simpara>Nach dem Anmelden wird man auf die <xref linkend="_startseite"/> weitergeleitet.</simpara>
<tip>
<simpara>This is a test for a „tip“.</simpara>
</tip>
</section>
<section xml:id="_startseite">
<title>Startseite</title>
<simpara>Nach dem <xref linkend="_anmelden"/>  gelangt man zur Startseite.</simpara>
</section>
</chapter>

@jgm
Copy link
Owner

jgm commented Apr 4, 2018

Relevant bit of docbook reader:

         -- Use the 'xreflabel' attribute for getting the title of a xref link;
         -- if there's no such attribute, employ some heuristics based on what
         -- docbook-xsl does.
         xrefTitleByElem el
             | not (null xrefLabel) = xrefLabel
             | otherwise            = case qName (elName el) of
                  "chapter"      -> descendantContent "title" el
                  "sect1"        -> descendantContent "title" el
                  "sect2"        -> descendantContent "title" el
                  "sect3"        -> descendantContent "title" el
                  "sect4"        -> descendantContent "title" el
                  "sect5"        -> descendantContent "title" el
                  "cmdsynopsis"  -> descendantContent "command" el
                  "funcsynopsis" -> descendantContent "function" el
                  _              -> qName (elName el) ++ "_title"

@carstenfuchs
Copy link
Author

I don't know Haskell at all, but do I get it right that only a single line is missing?

"section"      -> descendantContent "title" el

@jgm
Copy link
Owner

jgm commented Apr 8, 2018

That seems correct!

@jgm jgm closed this as completed in c82ee31 Apr 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants