aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Readers/DocBook.hs10
-rw-r--r--tests/docbook-xref.native6
2 files changed, 9 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Readers/DocBook.hs b/src/Text/Pandoc/Readers/DocBook.hs
index 4d8d5ab94..68552ccb3 100644
--- a/src/Text/Pandoc/Readers/DocBook.hs
+++ b/src/Text/Pandoc/Readers/DocBook.hs
@@ -964,9 +964,11 @@ parseInline (Elem e) =
content <- dbContent <$> get
let linkend = attrValue "linkend" e
let title = case attrValue "endterm" e of
- "" -> maybe "???" xrefTitleByElem (findElementById linkend content)
- endterm -> maybe "???" strContent (findElementById endterm content)
- return $ link ('#' : linkend) "" (singleton (Str title))
+ "" -> maybe "???" xrefTitleByElem
+ (findElementById linkend content)
+ endterm -> maybe "???" strContent
+ (findElementById endterm content)
+ return $ link ('#' : linkend) "" (text title)
"email" -> return $ link ("mailto:" ++ strContent e) ""
$ str $ strContent e
"uri" -> return $ link (strContent e) "" $ str $ strContent e
@@ -1050,4 +1052,4 @@ parseInline (Elem e) =
where
xrefLabel = attrValue "xreflabel" el
descendantContent name = maybe "???" strContent
- . findElement (QName name Nothing Nothing)
+ . filterElementName (\n -> qName n == name)
diff --git a/tests/docbook-xref.native b/tests/docbook-xref.native
index d45412695..23bc497b2 100644
--- a/tests/docbook-xref.native
+++ b/tests/docbook-xref.native
@@ -2,9 +2,9 @@ Pandoc (Meta {unMeta = fromList []})
[Header 1 ("ch01",[],[]) [Str "XRef",Space,Str "Samples"]
,Para [Str "This",Space,Str "paragraph",Space,Str "demonstrates",Space,Str "several",Space,Str "features",Space,Str "of",SoftBreak,Str "XRef."]
,BulletList
- [[Para [Str "A",Space,Str "straight",Space,Str "link",Space,Str "generates",Space,Str "the",SoftBreak,Str "cross-reference",Space,Str "text:",Space,Link ("",[],[]) [Str "The Second Chapter"] ("#ch02",""),Str "."]]
- ,[Para [Str "A",Space,Str "link",Space,Str "to",Space,Str "an",Space,Str "element",Space,Str "with",Space,Str "an",SoftBreak,Str "XRefLabel:",SoftBreak,Link ("",[],[]) [Str "Chapter the Third"] ("#ch03",""),Str "."]]
- ,[Para [Str "A",Space,Str "link",Space,Str "with",Space,Str "an",SoftBreak,Str "EndTerm:",SoftBreak,Link ("",[],[]) [Str "Chapter 4"] ("#ch04",""),Str "."]]
+ [[Para [Str "A",Space,Str "straight",Space,Str "link",Space,Str "generates",Space,Str "the",SoftBreak,Str "cross-reference",Space,Str "text:",Space,Link ("",[],[]) [Str "The",Space,Str "Second",Space,Str "Chapter"] ("#ch02",""),Str "."]]
+ ,[Para [Str "A",Space,Str "link",Space,Str "to",Space,Str "an",Space,Str "element",Space,Str "with",Space,Str "an",SoftBreak,Str "XRefLabel:",SoftBreak,Link ("",[],[]) [Str "Chapter",Space,Str "the",Space,Str "Third"] ("#ch03",""),Str "."]]
+ ,[Para [Str "A",Space,Str "link",Space,Str "with",Space,Str "an",SoftBreak,Str "EndTerm:",SoftBreak,Link ("",[],[]) [Str "Chapter",Space,Str "4"] ("#ch04",""),Str "."]]
,[Para [Str "A",Space,Str "link",Space,Str "to",Space,Str "an",SoftBreak,Str "cmdsynopsis",Space,Str "element:",Space,Link ("",[],[]) [Str "chgrp"] ("#cmd01",""),Str "."]]
,[Para [Str "A",Space,Str "link",Space,Str "to",Space,Str "an",SoftBreak,Str "funcsynopsis",Space,Str "element:",Space,Link ("",[],[]) [Str "max"] ("#func01",""),Str "."]]]
,Header 1 ("ch02",[],[]) [Str "The",Space,Str "Second",Space,Str "Chapter"]