summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/DocBook.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-05-11 20:27:28 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-05-11 20:27:28 -0700
commit02fa1050b06f55c54da0e894e46b6a2c603925c9 (patch)
treee6038aae9939106dac37cf58a61c082387a8c7d3 /src/Text/Pandoc/Readers/DocBook.hs
parente1e6505abeabd6f743f9f35f3804435431239f33 (diff)
DocBook reader: Support link tag with no content.
Diffstat (limited to 'src/Text/Pandoc/Readers/DocBook.hs')
-rw-r--r--src/Text/Pandoc/Readers/DocBook.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/DocBook.hs b/src/Text/Pandoc/Readers/DocBook.hs
index ca59cc1af..0dfb3c856 100644
--- a/src/Text/Pandoc/Readers/DocBook.hs
+++ b/src/Text/Pandoc/Readers/DocBook.hs
@@ -861,10 +861,13 @@ parseInline (Elem e) =
$ code $ strContent e
"uri" -> return $ link (strContent e) "" $ code $ strContent e
"ulink" -> link (attrValue "url" e) "" <$> innerInlines
- "link" -> case findAttr (QName "href" (Just "http://www.w3.org/1999/xlink") Nothing) e of
- Just href -> link href "" <$> innerInlines
- _ -> link ('#' : attrValue "linkend" e) ""
- <$> innerInlines
+ "link" -> do
+ ils <- innerInlines
+ let href = case findAttr (QName "href" (Just "http://www.w3.org/1999/xlink") Nothing) e of
+ Just h -> h
+ _ -> ('#' : attrValue "linkend" e)
+ let ils' = if ils == mempty then code href else ils
+ return $ link href "" ils'
"foreignphrase" -> emph <$> innerInlines
"emphasis" -> case attrValue "role" e of
"strong" -> strong <$> innerInlines