git.iko.soy/typeable/pandoc
on master help sign in
RST writer: If label for a link reference contains a colon,
d9dedf0fiddlosopher
src/Text/Pandoc/Writers/RST.hs+4−1
@@ -76,7 +76,10 @@ keyToRST :: WriterOptions
76 -> State WriterState Doc
76 -> State WriterState Doc
77keyToRST opts (label, (src, tit)) = do
77keyToRST opts (label, (src, tit)) = do
78 label' <- inlineListToRST opts label
78 label' <- inlineListToRST opts label
79+ let label'' = if ':' `elem` (render label')
80+ then char '`' <> label' <> char '`'
81+ else label'
79− return $ text ".. _" <> label' <> text ": " <> text src
82+ return $ text ".. _" <> label'' <> text ": " <> text src
80
83
81-- | Return RST representation of notes.
84-- | Return RST representation of notes.
82notesToRST :: WriterOptions -> [[Block]] -> State WriterState Doc
85notesToRST :: WriterOptions -> [[Block]] -> State WriterState Doc