diff options
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Writers/Man.hs | 10 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/Markdown.hs | 11 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/RST.hs | 8 |
3 files changed, 6 insertions, 23 deletions
diff --git a/src/Text/Pandoc/Writers/Man.hs b/src/Text/Pandoc/Writers/Man.hs index b9596dc2d..fd04732c6 100644 --- a/src/Text/Pandoc/Writers/Man.hs +++ b/src/Text/Pandoc/Writers/Man.hs @@ -98,12 +98,6 @@ noteToMan opts num note = do let marker = text "\n.SS [" <> text (show num) <> char ']' return $ marker $$ contents -wrappedMan :: WriterOptions -> [Inline] -> State WriterState Doc -wrappedMan opts sect = do - let chunks = splitBy Space sect - chunks' <- mapM (inlineListToMan opts) chunks - return $ fsep chunks' - -- | Association list of characters to escape. manEscapes :: [(Char, String)] manEscapes = [('\160', "\\ "), ('\'', "\\[aq]")] ++ backslashEscapes "\".@\\" @@ -121,9 +115,9 @@ blockToMan :: WriterOptions -- ^ Options -> Block -- ^ Block element -> State WriterState Doc blockToMan opts Null = return empty -blockToMan opts (Plain inlines) = wrappedMan opts inlines +blockToMan opts (Plain inlines) = wrapped (inlineListToMan opts) inlines blockToMan opts (Para inlines) = do - contents <- wrappedMan opts inlines + contents <- wrapped (inlineListToMan opts) inlines return $ text ".PP" $$ contents blockToMan opts (RawHtml str) = return $ text str blockToMan opts HorizontalRule = return $ text $ ".PP\n * * * * *" diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index a96e11abf..643e5b21a 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -96,12 +96,6 @@ noteToMarkdown opts num blocks = do let marker = text "[^" <> text (show num) <> text "]:" return $ hang marker (writerTabStop opts) contents -wrappedMarkdown :: WriterOptions -> [Inline] -> State WriterState Doc -wrappedMarkdown opts sect = do - let chunks = splitBy Space sect - chunks' <- mapM (inlineListToMarkdown opts) chunks - return $ fsep chunks' - -- | Escape special characters for Markdown. escapeString :: String -> String escapeString = escapeStringUsing markdownEscapes @@ -150,9 +144,10 @@ blockToMarkdown :: WriterOptions -- ^ Options -> Block -- ^ Block element -> State WriterState Doc blockToMarkdown opts Null = return empty -blockToMarkdown opts (Plain inlines) = wrappedMarkdown opts inlines +blockToMarkdown opts (Plain inlines) = + wrapped (inlineListToMarkdown opts) inlines blockToMarkdown opts (Para inlines) = do - contents <- wrappedMarkdown opts inlines + contents <- wrapped (inlineListToMarkdown opts) inlines return $ contents <> text "\n" blockToMarkdown opts (RawHtml str) = return $ text str blockToMarkdown opts HorizontalRule = return $ text "\n* * * * *\n" diff --git a/src/Text/Pandoc/Writers/RST.hs b/src/Text/Pandoc/Writers/RST.hs index 70df479b5..434cd1cf7 100644 --- a/src/Text/Pandoc/Writers/RST.hs +++ b/src/Text/Pandoc/Writers/RST.hs @@ -107,15 +107,9 @@ pictToRST opts (label, (src, _)) = do -- | Take list of inline elements and return wrapped doc. wrappedRST :: WriterOptions -> [Inline] -> State WriterState Doc wrappedRST opts inlines = - mapM (wrappedRSTSection opts) (splitBy LineBreak inlines) >>= + mapM (wrapped (inlineListToRST opts)) (splitBy LineBreak inlines) >>= return . vcat -wrappedRSTSection :: WriterOptions -> [Inline] -> State WriterState Doc -wrappedRSTSection opts sect = do - let chunks = splitBy Space sect - chunks' <- mapM (inlineListToRST opts) chunks - return $ fsep chunks' - -- | Escape special characters for RST. escapeString :: String -> String escapeString = escapeStringUsing (backslashEscapes "`\\|*_") |