git.iko.soy/typeable/pandoc
on master help sign in
RST writer: If label for a link reference contains a colon,

surround by ` signs so the colon won't be interpreted as the end of the link label. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1029 788f1e2b-df1e-0410-8736-df70ead52e1b

commitd9dedf08139e60fddfb0cd7e03c2f4ec9e48aae7 authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateWed 19 Sep 2007, 01:15 (19 years ago) parent2b429e9
1 file changed+4−1
src/Text/Pandoc/Writers/RST.hs+4−1
src/Text/Pandoc/Writers/RST.hs+4−1
@@ -76,7 +76,10 @@ keyToRST :: WriterOptions
7676 -> State WriterState Doc
7777keyToRST opts (label, (src, tit)) = do
7878 label' <- inlineListToRST opts label
79− return $ text ".. _" <> label' <> text ": " <> text src
79+ let label'' = if ':' `elem` (render label')
80+ then char '`' <> label' <> char '`'
81+ else label'
82+ return $ text ".. _" <> label'' <> text ": " <> text src
8083
8184-- | Return RST representation of notes.
8285notesToRST :: WriterOptions -> [[Block]] -> State WriterState Doc