git.iko.soy/typeable/pandoc
on master help sign in
Muse writer: do not join Span's doing normalization
d58b961Alexander Krotov
src/Text/Pandoc/Writers/Muse.hs+1−2
@@ -339,8 +339,7 @@ normalizeInlineList (Code _ x1 : Code _ x2 : ils)
339 = normalizeInlineList $ Code nullAttr (x1 ++ x2) : ils
339 = normalizeInlineList $ Code nullAttr (x1 ++ x2) : ils
340normalizeInlineList (RawInline f1 x1 : RawInline f2 x2 : ils) | f1 == f2
340normalizeInlineList (RawInline f1 x1 : RawInline f2 x2 : ils) | f1 == f2
341 = normalizeInlineList $ RawInline f1 (x1 ++ x2) : ils
341 = normalizeInlineList $ RawInline f1 (x1 ++ x2) : ils
342−normalizeInlineList (Span a1 x1 : Span a2 x2 : ils) | a1 == a2
342+-- Do not join Span's during normalization
343− = normalizeInlineList $ Span a1 (x1 ++ x2) : ils
344normalizeInlineList (x:xs) = x : normalizeInlineList xs
343normalizeInlineList (x:xs) = x : normalizeInlineList xs
345normalizeInlineList [] = []
344normalizeInlineList [] = []
346
345
test/Tests/Writers/Muse.hs+3
@@ -405,6 +405,9 @@ tests = [ testGroup "block elements"
405 =?> "#anchor Foo bar"
405 =?> "#anchor Foo bar"
406 , "span with class and anchor" =: spanWith ("anchor", ["foo"], []) (text "bar")
406 , "span with class and anchor" =: spanWith ("anchor", ["foo"], []) (text "bar")
407 =?> "#anchor <class name=\"foo\">bar</class>"
407 =?> "#anchor <class name=\"foo\">bar</class>"
408+ , "adjacent spans" =: spanWith ("", ["syllable"], []) (str "wa") <>
409+ spanWith ("", ["syllable"], []) (str "ter")
410+ =?> "<class name=\"syllable\">wa</class><class name=\"syllable\">ter</class>"
408 , testGroup "combined"
411 , testGroup "combined"
409 [ "emph word before" =:
412 [ "emph word before" =:
410 para (text "foo" <> emph (text "bar")) =?>
413 para (text "foo" <> emph (text "bar")) =?>