git.iko.soy/typeable/pandoc
on master help sign in
DocBook reader: Support link tag with no content.
commit02fa1050b06f55c54da0e894e46b6a2c603925c9 authorJohn MacFarlane <fiddlosopher@gmail.com> dateFri 11 May 2012, 20:27 (14 years ago) parente1e6505
1 file changed+7−4
src/Text/Pandoc/Readers/DocBook.hs+7−4
src/Text/Pandoc/Readers/DocBook.hs+7−4
@@ -861,10 +861,13 @@ parseInline (Elem e) =
861861 $ code $ strContent e
862862 "uri" -> return $ link (strContent e) "" $ code $ strContent e
863863 "ulink" -> link (attrValue "url" e) "" <$> innerInlines
864− "link" -> case findAttr (QName "href" (Just "http://www.w3.org/1999/xlink") Nothing) e of
865− Just href -> link href "" <$> innerInlines
866− _ -> link ('#' : attrValue "linkend" e) ""
867− <$> innerInlines
864+ "link" -> do
865+ ils <- innerInlines
866+ let href = case findAttr (QName "href" (Just "http://www.w3.org/1999/xlink") Nothing) e of
867+ Just h -> h
868+ _ -> ('#' : attrValue "linkend" e)
869+ let ils' = if ils == mempty then code href else ils
870+ return $ link href "" ils'
868871 "foreignphrase" -> emph <$> innerInlines
869872 "emphasis" -> case attrValue "role" e of
870873 "strong" -> strong <$> innerInlines