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
plain <- asks envPlain
contents <- inlineListToMarkdown opts ils
return $ if not plain &&
(isEnabled Ext_raw_html opts || isEnabled Ext_native_spans opts)
then tagWithAttrs "span" attrs <> contents <> text "</span>"
else contents
return $ case plain of
True -> contents
False | isEnabled Ext_bracketed_spans opts ->
"[" <> 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
plain <- asks envPlain
contents <- inlineListToMarkdown opts lst