From da9c196e09ecd87b2d727294810357f485733be8 Mon Sep 17 00:00:00 2001 From: Pavol Otto Date: Wed, 15 Feb 2023 11:01:00 +0100 Subject: [PATCH] fixed references to tables in DocBook files Closes #8626. --- src/Text/Pandoc/Readers/DocBook.hs | 1 + test/docbook-xref.docbook | 23 ++++++++ test/docbook-xref.native | 84 ++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+) diff --git a/src/Text/Pandoc/Readers/DocBook.hs b/src/Text/Pandoc/Readers/DocBook.hs index e11da4253d15..ea977f9eb994 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 a83657b6bbea..624b4c0819e7 100644 --- a/test/docbook-xref.docbook +++ b/test/docbook-xref.docbook @@ -27,6 +27,9 @@ cross-reference text: . A link to a figure element: . +A link to a +table element: . + @@ -77,5 +80,25 @@ cross-reference text: . + + Supported features by version + + + + + + Version + Feat + + + + + Free + no + + + +
+ diff --git a/test/docbook-xref.native b/test/docbook-xref.native index bcfe434a4354..9487224baa45 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 ( "" , [] , [] ) []) ]