git.iko.soy/typeable/pandoc
on master help sign in
Ms writer: fix code highlighting with blank lines.
9ae792bJohn MacFarlane
src/Text/Pandoc/Writers/Ms.hs+5−5
@@ -517,11 +517,11 @@ toMacro sty toktype =
517
517
518msFormatter :: WriterOptions -> FormatOptions -> [SourceLine] -> Doc Text
518msFormatter :: WriterOptions -> FormatOptions -> [SourceLine] -> Doc Text
519msFormatter opts _fmtopts =
519msFormatter opts _fmtopts =
520− vcat . map fmtLine
520+ literal . T.intercalate "\n" . map fmtLine
521+ where
521− where fmtLine = hcat . map fmtToken
522+ fmtLine = mconcat . map fmtToken
522− fmtToken (toktype, tok) = literal "\\*" <>
523+ fmtToken (toktype, tok) =
523− brackets (literal (tshow toktype) <> literal " \""
524− <> literal (escapeStr opts tok) <> literal "\"")
524+ "\\*[" <> (tshow toktype) <> " \"" <> (escapeStr opts tok) <> "\"]"
525
525
526highlightCode :: PandocMonad m => WriterOptions -> Attr -> Text -> MS m (Doc Text)
526highlightCode :: PandocMonad m => WriterOptions -> Attr -> Text -> MS m (Doc Text)
527highlightCode opts attr str =
527highlightCode opts attr str =