diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-02-25 21:15:28 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-02-25 21:15:28 -0800 |
commit | 4b43531a708ef03fa92a7cf0a8048a6094986e8a (patch) | |
tree | b1ce9f99990e01e7d913d34bd11040019de909e6 /src/Text/Pandoc/Writers | |
parent | 7af3e23bdf18fe41cea1dc6bac8bf623161ac473 (diff) | |
download | pandoc-4b43531a708ef03fa92a7cf0a8048a6094986e8a.tar.gz |
Markdown writer: don't emit span tags if plain or raw HTML disabled.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r-- | src/Text/Pandoc/Writers/Markdown.hs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index 8b126a562..662373209 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -724,8 +724,10 @@ escapeSpaces x = x -- | Convert Pandoc inline element to markdown. inlineToMarkdown :: WriterOptions -> Inline -> State WriterState Doc inlineToMarkdown opts (Span attrs ils) = do + plain <- gets stPlain contents <- inlineListToMarkdown opts ils - return $ if isEnabled Ext_raw_html opts + return $ if not plain && + (isEnabled Ext_raw_html opts || isEnabled Ext_native_spans opts) then tagWithAttrs "span" attrs <> contents <> text "</span>" else contents inlineToMarkdown opts (Emph lst) = do @@ -758,13 +760,14 @@ inlineToMarkdown opts (Subscript lst) = do else "<sub>" <> contents <> "</sub>" inlineToMarkdown opts (SmallCaps lst) = do plain <- gets stPlain - if plain - then inlineListToMarkdown opts $ capitalize lst - else do + if not plain && + (isEnabled Ext_raw_html opts || isEnabled Ext_native_spans opts) + then do contents <- inlineListToMarkdown opts lst return $ tagWithAttrs "span" - ("",[],[("style","font-variant:small-caps;")]) + ("",[],[("style","font-variant:small-caps;")]) <> contents <> text "</span>" + else inlineListToMarkdown opts $ capitalize lst inlineToMarkdown opts (Quoted SingleQuote lst) = do contents <- inlineListToMarkdown opts lst return $ "‘" <> contents <> "’" |