diff options
| author | Pavol Otto <[email protected]> | 2023-02-15 11:01:00 +0100 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2023-02-15 15:51:51 -0800 |
| commit | da9c196e09ecd87b2d727294810357f485733be8 (patch) | |
| tree | 62a7d27727a098ea2e8663fc92521947ea474dfb | |
| parent | 5889d70a97c142805c34faf42fd0f933df9e3bdc (diff) | |
fixed <xref> references to tables in DocBook files
Closes #8626.
| -rw-r--r-- | src/Text/Pandoc/Readers/DocBook.hs | 1 | ||||
| -rw-r--r-- | test/docbook-xref.docbook | 23 | ||||
| -rw-r--r-- | test/docbook-xref.native | 84 |
3 files changed, 108 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Readers/DocBook.hs b/src/Text/Pandoc/Readers/DocBook.hs index e11da4253..ea977f9eb 100644 --- a/src/Text/Pandoc/Readers/DocBook.hs +++ b/src/Text/Pandoc/Readers/DocBook.hs @@ -1359,6 +1359,7 @@ parseInline (Elem e) = "cmdsynopsis" -> descendantContent "command" el "funcsynopsis" -> descendantContent "function" el "figure" -> descendantContent "title" el + "table" -> descendantContent "title" el _ -> qName (elName el) <> "_title" where xrefLabel = attrValue "xreflabel" el diff --git a/test/docbook-xref.docbook b/test/docbook-xref.docbook index a83657b6b..624b4c081 100644 --- a/test/docbook-xref.docbook +++ b/test/docbook-xref.docbook @@ -27,6 +27,9 @@ cross-reference text: <xref linkend="ch02"/>. <listitem><para>A link to a <sgmltag>figure</sgmltag> element: <xref linkend="fig01"/>. </para></listitem> +<listitem><para>A link to a +<sgmltag>table</sgmltag> element: <xref linkend="table01"/>. +</para></listitem> </itemizedlist> </chapter> @@ -77,5 +80,25 @@ cross-reference text: <xref linkend="ch02"/>. </mediaobject> </figure> +<table id="table01" frame="all" rowsep="1" colsep="1"> + <title>Supported features by version</title> + <tgroup cols="2"> + <colspec colname="col_1" colwidth="50*"/> + <colspec colname="col_2" colwidth="50*"/> + <thead> + <row> + <entry>Version</entry> + <entry>Feat</entry> + </row> + </thead> + <tbody> + <row> + <entry>Free</entry> + <entry>no</entry> + </row> + </tbody> + </tgroup> +</table> + </chapter> </book> diff --git a/test/docbook-xref.native b/test/docbook-xref.native index bcfe434a4..9487224ba 100644 --- a/test/docbook-xref.native +++ b/test/docbook-xref.native @@ -168,6 +168,33 @@ Pandoc , Str "." ] ] + , [ Para + [ Str "A" + , Space + , Str "link" + , Space + , Str "to" + , Space + , Str "a" + , SoftBreak + , Str "table" + , Space + , Str "element:" + , Space + , Link + ( "" , [] , [] ) + [ Str "Supported" + , Space + , Str "features" + , Space + , Str "by" + , Space + , Str "version" + ] + ( "#table01" , "" ) + , Str "." + ] + ] ] , Header 1 @@ -214,4 +241,61 @@ Pandoc ] ( "figures/pythag.png" , "fig:" ) ] + , Table + ( "" , [] , [] ) + (Caption + Nothing + [ Plain + [ Str "Supported" + , Space + , Str "features" + , Space + , Str "by" + , Space + , Str "version" + ] + ]) + [ ( AlignDefault , ColWidth 0.5 ) + , ( AlignDefault , ColWidth 0.5 ) + ] + (TableHead + ( "" , [] , [] ) + [ Row + ( "" , [] , [] ) + [ Cell + ( "" , [] , [] ) + AlignDefault + (RowSpan 1) + (ColSpan 1) + [ Plain [ Str "Version" ] ] + , Cell + ( "" , [] , [] ) + AlignDefault + (RowSpan 1) + (ColSpan 1) + [ Plain [ Str "Feat" ] ] + ] + ]) + [ TableBody + ( "" , [] , [] ) + (RowHeadColumns 0) + [] + [ Row + ( "" , [] , [] ) + [ Cell + ( "" , [] , [] ) + AlignDefault + (RowSpan 1) + (ColSpan 1) + [ Plain [ Str "Free" ] ] + , Cell + ( "" , [] , [] ) + AlignDefault + (RowSpan 1) + (ColSpan 1) + [ Plain [ Str "no" ] ] + ] + ] + ] + (TableFoot ( "" , [] , [] ) []) ] |
