From fce3ebb8e023d0f9fd5756503e9264b05571b75a Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 27 Jun 2015 20:18:42 -0700 Subject: Plain writer: don't use symbols for super/subscript. Simplified code by using plainExtensions from Options. Closes #2237. --- src/Text/Pandoc/Writers/Markdown.hs | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index 9838cefff..8e821ec3f 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -79,17 +79,7 @@ writeMarkdown opts document = -- pictures, or inline formatting). writePlain :: WriterOptions -> Pandoc -> String writePlain opts document = - evalState (pandocToMarkdown opts{ - writerExtensions = Set.delete Ext_escaped_line_breaks $ - Set.delete Ext_pipe_tables $ - Set.delete Ext_raw_html $ - Set.delete Ext_markdown_in_html_blocks $ - Set.delete Ext_raw_tex $ - Set.delete Ext_footnotes $ - Set.delete Ext_tex_math_dollars $ - Set.delete Ext_citations $ - writerExtensions opts } - document) def{ stPlain = True } + evalState (pandocToMarkdown opts document) def{ stPlain = True } pandocTitleBlock :: Doc -> [Doc] -> Doc -> Doc pandocTitleBlock tit auths dat = @@ -774,17 +764,23 @@ inlineToMarkdown opts (Strikeout lst) = do contents <- inlineListToMarkdown opts lst return $ if isEnabled Ext_strikeout opts then "~~" <> contents <> "~~" - else "" <> contents <> "" + else if isEnabled Ext_raw_html opts + then "" <> contents <> "" + else contents inlineToMarkdown opts (Superscript lst) = do contents <- inlineListToMarkdown opts $ walk escapeSpaces lst return $ if isEnabled Ext_superscript opts then "^" <> contents <> "^" - else "" <> contents <> "" + else if isEnabled Ext_raw_html opts + then "" <> contents <> "" + else contents inlineToMarkdown opts (Subscript lst) = do contents <- inlineListToMarkdown opts $ walk escapeSpaces lst return $ if isEnabled Ext_subscript opts then "~" <> contents <> "~" - else "" <> contents <> "" + else if isEnabled Ext_raw_html opts + then "" <> contents <> "" + else contents inlineToMarkdown opts (SmallCaps lst) = do plain <- gets stPlain if not plain && -- cgit v1.2.3