git.iko.soy/typeable/pandoc
on master help sign in
RST writer: Don't insert `\ ` when complex expression in matched pairs.

E.g. `` [:sup:`3`] `` is okay; you don't need `` [:sup:`3`\ ] ``.

commitc82f3ad61e1e0ce41133134b44d2bb5045dc5217 authorJohn MacFarlane <jgm@berkeley.edu> dateWed 12 Aug 2015, 21:08 (11 years ago) parentef18b83
1 file changed+4−3
src/Text/Pandoc/Writers/RST.hs+4−3
src/Text/Pandoc/Writers/RST.hs+4−3
@@ -333,7 +333,8 @@ blockListToRST = blockListToRST' False
333333-- | Convert list of Pandoc inline elements to RST.
334334inlineListToRST :: [Inline] -> State WriterState Doc
335335inlineListToRST lst =
336− mapM inlineToRST (removeSpaceAfterDisplayMath $ insertBS lst) >>= return . hcat
336+ mapM inlineToRST (removeSpaceAfterDisplayMath $ insertBS lst) >>=
337+ return . hcat
337338 where -- remove spaces after displaymath, as they screw up indentation:
338339 removeSpaceAfterDisplayMath (Math DisplayMath x : zs) =
339340 Math DisplayMath x : dropWhile (==Space) zs
@@ -341,8 +342,8 @@ inlineListToRST lst =
341342 removeSpaceAfterDisplayMath [] = []
342343 insertBS :: [Inline] -> [Inline] -- insert '\ ' where needed
343344 insertBS (x:y:z:zs)
344− | isComplex y && surroundComplex x z =
345− x : y : RawInline "rst" "\\ " : insertBS (z:zs)
345+ | isComplex y && (surroundComplex x z) =
346+ x : y : insertBS (z : zs)
346347 insertBS (x:y:zs)
347348 | isComplex x && not (okAfterComplex y) =
348349 x : RawInline "rst" "\\ " : insertBS (y : zs)