From 02fa1050b06f55c54da0e894e46b6a2c603925c9 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 11 May 2012 20:27:28 -0700 Subject: DocBook reader: Support link tag with no content. --- src/Text/Pandoc/Readers/DocBook.hs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/Text') 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 -- cgit v1.2.3