aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-09-19 01:15:20 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-09-19 01:15:20 +0000
commitd9dedf08139e60fddfb0cd7e03c2f4ec9e48aae7 (patch)
treefcb73cbba3cd3ed9b709e4b52c4ecef381d0091a /src/Text/Pandoc
parent2b429e980e81c31bacbf2f2242a2c8a119a91743 (diff)
downloadpandoc-d9dedf08139e60fddfb0cd7e03c2f4ec9e48aae7.tar.gz
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
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Writers/RST.hs5
1 files changed, 4 insertions, 1 deletions
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