Improved reading <xref> elements in DocBook files (#8065)
<xref> elements can also be used to link to <figure> elements. Alas, the DocBook reader was not aware of this and thus generated a link text which just said 'figure_title'. https://tdg.docbook.org/tdg/4.5/figure.html explains that <figure> elements can contain <title> elements, so let's try to use that if it is available.
This commit is contained in:
parent
b0195b7ef4
commit
b888a8c77e
3 changed files with 53 additions and 1 deletions
|
@ -1342,6 +1342,7 @@ parseInline (Elem e) =
|
||||||
"sect5" -> descendantContent "title" el
|
"sect5" -> descendantContent "title" el
|
||||||
"cmdsynopsis" -> descendantContent "command" el
|
"cmdsynopsis" -> descendantContent "command" el
|
||||||
"funcsynopsis" -> descendantContent "function" el
|
"funcsynopsis" -> descendantContent "function" el
|
||||||
|
"figure" -> descendantContent "title" el
|
||||||
_ -> qName (elName el) <> "_title"
|
_ -> qName (elName el) <> "_title"
|
||||||
where
|
where
|
||||||
xrefLabel = attrValue "xreflabel" el
|
xrefLabel = attrValue "xreflabel" el
|
||||||
|
|
|
@ -24,6 +24,9 @@ cross-reference text: <xref linkend="ch02"/>.
|
||||||
<listitem><para>A link to an
|
<listitem><para>A link to an
|
||||||
<sgmltag>funcsynopsis</sgmltag> element: <xref linkend="func01"/>.
|
<sgmltag>funcsynopsis</sgmltag> element: <xref linkend="func01"/>.
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
|
<listitem><para>A link to a
|
||||||
|
<sgmltag>figure</sgmltag> element: <xref linkend="fig01"/>.
|
||||||
|
</para></listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
</chapter>
|
</chapter>
|
||||||
|
|
||||||
|
@ -65,6 +68,14 @@ cross-reference text: <xref linkend="ch02"/>.
|
||||||
</funcprototype>
|
</funcprototype>
|
||||||
</funcsynopsis>
|
</funcsynopsis>
|
||||||
|
|
||||||
|
<figure id="fig01"><title>The Pythagorean Theorem Illustrated</title>
|
||||||
|
<mediaobject>
|
||||||
|
<imageobject>
|
||||||
|
<imagedata fileref="figures/pythag.png"/>
|
||||||
|
</imageobject>
|
||||||
|
<textobject><phrase>An illustration of the Pythagorean Theorem</phrase></textobject>
|
||||||
|
</mediaobject>
|
||||||
|
</figure>
|
||||||
|
|
||||||
</chapter>
|
</chapter>
|
||||||
</book>
|
</book>
|
||||||
|
|
||||||
|
|
|
@ -141,6 +141,33 @@ Pandoc
|
||||||
, Str "."
|
, Str "."
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
, [ Para
|
||||||
|
[ Str "A"
|
||||||
|
, Space
|
||||||
|
, Str "link"
|
||||||
|
, Space
|
||||||
|
, Str "to"
|
||||||
|
, Space
|
||||||
|
, Str "a"
|
||||||
|
, SoftBreak
|
||||||
|
, Str "figure"
|
||||||
|
, Space
|
||||||
|
, Str "element:"
|
||||||
|
, Space
|
||||||
|
, Link
|
||||||
|
( "" , [] , [] )
|
||||||
|
[ Str "The"
|
||||||
|
, Space
|
||||||
|
, Str "Pythagorean"
|
||||||
|
, Space
|
||||||
|
, Str "Theorem"
|
||||||
|
, Space
|
||||||
|
, Str "Illustrated"
|
||||||
|
]
|
||||||
|
( "#fig01" , "" )
|
||||||
|
, Str "."
|
||||||
|
]
|
||||||
|
]
|
||||||
]
|
]
|
||||||
, Header
|
, Header
|
||||||
1
|
1
|
||||||
|
@ -174,4 +201,17 @@ Pandoc
|
||||||
, Plain [ Str "int1" ]
|
, Plain [ Str "int1" ]
|
||||||
, Plain [ Str "int" ]
|
, Plain [ Str "int" ]
|
||||||
, Plain [ Str "int2" ]
|
, Plain [ Str "int2" ]
|
||||||
|
, Para
|
||||||
|
[ Image
|
||||||
|
( "fig01" , [] , [] )
|
||||||
|
[ Str "The"
|
||||||
|
, Space
|
||||||
|
, Str "Pythagorean"
|
||||||
|
, Space
|
||||||
|
, Str "Theorem"
|
||||||
|
, Space
|
||||||
|
, Str "Illustrated"
|
||||||
|
]
|
||||||
|
( "figures/pythag.png" , "fig:" )
|
||||||
|
]
|
||||||
]
|
]
|
||||||
|
|
Loading…
Add table
Reference in a new issue