From d9dedf08139e60fddfb0cd7e03c2f4ec9e48aae7 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Wed, 19 Sep 2007 01:15:20 +0000 Subject: 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 --- src/Text/Pandoc/Writers/RST.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Text/Pandoc/Writers/RST.hs b/src/Text/Pandoc/Writers/RST.hs index e2b55daa0..2e02ee662 100644 --- a/src/Text/Pandoc/Writers/RST.hs +++ b/src/Text/Pandoc/Writers/RST.hs @@ -76,7 +76,10 @@ keyToRST :: WriterOptions -> State WriterState Doc keyToRST opts (label, (src, tit)) = do label' <- inlineListToRST opts label - return $ text ".. _" <> label' <> text ": " <> text src + let label'' = if ':' `elem` (render label') + then char '`' <> label' <> char '`' + else label' + return $ text ".. _" <> label'' <> text ": " <> text src -- | Return RST representation of notes. notesToRST :: WriterOptions -> [[Block]] -> State WriterState Doc -- cgit v1.2.3