Markdown writer: Use bracketed form for native spans...

...when `bracketed_spans` enabled.

Closes #3229.
This commit is contained in:
John MacFarlane 2016-11-18 11:58:56 +01:00
parent 20b2269fb7
commit 31076adf09

View file

@ -858,10 +858,17 @@ inlineToMarkdown :: WriterOptions -> Inline -> MD Doc
inlineToMarkdown opts (Span attrs ils) = do inlineToMarkdown opts (Span attrs ils) = do
plain <- asks envPlain plain <- asks envPlain
contents <- inlineListToMarkdown opts ils contents <- inlineListToMarkdown opts ils
return $ if not plain && return $ case plain of
(isEnabled Ext_raw_html opts || isEnabled Ext_native_spans opts) True -> contents
then tagWithAttrs "span" attrs <> contents <> text "</span>" False | isEnabled Ext_bracketed_spans opts ->
else contents "[" <> contents <> "]" <>
if attrs == nullAttr
then "{}"
else linkAttributes opts attrs
| isEnabled Ext_raw_html opts ||
isEnabled Ext_native_spans opts ->
tagWithAttrs "span" attrs <> contents <> text "</span>"
| otherwise -> contents
inlineToMarkdown opts (Emph lst) = do inlineToMarkdown opts (Emph lst) = do
plain <- asks envPlain plain <- asks envPlain
contents <- inlineListToMarkdown opts lst contents <- inlineListToMarkdown opts lst