@@ -55,10 +55,7 @@ writeCommonMark opts (Pandoc meta blocks) = do
55 notes' = if null notes
55 notes' = if null notes
57 else [OrderedList (1, Decimal, Period) $ reverse notes]
57 else [OrderedList (1, Decimal, Period) $ reverse notes]
58− let blocks'' = if writerWrapText opts == WrapNone
59− then walk softBreakToSpace blocks'
61− main <- blocksToCommonMark opts (blocks'' ++ notes')
58+ main <- blocksToCommonMark opts (blocks' ++ notes')
62 metadata <- metaToJSON opts
59 metadata <- metaToJSON opts
63 (blocksToCommonMark opts)
60 (blocksToCommonMark opts)
64 (inlinesToCommonMark opts)
61 (inlinesToCommonMark opts)
@@ -232,10 +229,16 @@ inlinesToNodes :: WriterOptions -> [Inline] -> [Node]
232inlinesToNodes opts = foldr (inlineToNodes opts) []
229inlinesToNodes opts = foldr (inlineToNodes opts) []
234inlineToNodes :: WriterOptions -> Inline -> [Node] -> [Node]
231inlineToNodes :: WriterOptions -> Inline -> [Node] -> [Node]
235−inlineToNodes _ (Str s) = (node (TEXT (T.pack s)) [] :)
232+inlineToNodes opts (Str s) = (node (TEXT (T.pack s')) [] :)
233+ where s' = if isEnabled Ext_smart opts
234+ then unsmartify opts s
236inlineToNodes _ Space = (node (TEXT (T.pack " ")) [] :)
236inlineToNodes _ Space = (node (TEXT (T.pack " ")) [] :)
237inlineToNodes _ LineBreak = (node LINEBREAK [] :)
237inlineToNodes _ LineBreak = (node LINEBREAK [] :)
238−inlineToNodes _ SoftBreak = (node SOFTBREAK [] :)
238+inlineToNodes opts SoftBreak
239+ | isEnabled Ext_hard_line_breaks opts = (node LINEBREAK [] :)
240+ | writerWrapText opts == WrapNone = (node (TEXT " ") [] :)
241+ | otherwise = (node SOFTBREAK [] :)
239inlineToNodes opts (Emph xs) = (node EMPH (inlinesToNodes opts xs) :)
242inlineToNodes opts (Emph xs) = (node EMPH (inlinesToNodes opts xs) :)
240inlineToNodes opts (Strong xs) = (node STRONG (inlinesToNodes opts xs) :)
243inlineToNodes opts (Strong xs) = (node STRONG (inlinesToNodes opts xs) :)
241inlineToNodes opts (Strikeout xs) =
244inlineToNodes opts (Strikeout xs) =
@@ -264,8 +267,12 @@ inlineToNodes opts (Quoted qt ils) =
264 ((node (TEXT start) [] :
267 ((node (TEXT start) [] :
265 inlinesToNodes opts ils ++ [node (TEXT end) []]) ++)
268 inlinesToNodes opts ils ++ [node (TEXT end) []]) ++)
266 where (start, end) = case qt of
269 where (start, end) = case qt of
267− SingleQuote -> (T.pack "‘", T.pack "’")
270+ SingleQuote
271+ | isEnabled Ext_smart opts -> ("'","'")
272+ | otherwise -> ("‘", "’")
268− DoubleQuote -> (T.pack "“", T.pack "”")
273+ DoubleQuote
274+ | isEnabled Ext_smart opts -> ("\"", "\"")
275+ | otherwise -> ("“", "”")
269inlineToNodes _ (Code _ str) = (node (CODE (T.pack str)) [] :)
276inlineToNodes _ (Code _ str) = (node (CODE (T.pack str)) [] :)
270inlineToNodes _ (Math mt str) =
277inlineToNodes _ (Math mt str) =
271 case mt of
278 case mt of