git.iko.soy/typeable/pandoc
on master help sign in
Muse writer: do not join Span's doing normalization

Separate spans may have different semantics, for example if spans indicate syllables in a word.

commitd58b961a6d83a9f3a815d7aa281c692281954a00 authorAlexander Krotov <ilabdsf@gmail.com> dateSat 24 Mar 2018, 23:51 (9 years ago) parent8b533f9
2 files changed+4−2
src/Text/Pandoc/Writers/Muse.hs+1−2 test/Tests/Writers/Muse.hs+3
src/Text/Pandoc/Writers/Muse.hs+1−2
@@ -339,8 +339,7 @@ normalizeInlineList (Code _ x1 : Code _ x2 : ils)
339339 = normalizeInlineList $ Code nullAttr (x1 ++ x2) : ils
340340normalizeInlineList (RawInline f1 x1 : RawInline f2 x2 : ils) | f1 == f2
341341 = normalizeInlineList $ RawInline f1 (x1 ++ x2) : ils
342−normalizeInlineList (Span a1 x1 : Span a2 x2 : ils) | a1 == a2
343− = normalizeInlineList $ Span a1 (x1 ++ x2) : ils
342+-- Do not join Span's during normalization
344343normalizeInlineList (x:xs) = x : normalizeInlineList xs
345344normalizeInlineList [] = []
346345
test/Tests/Writers/Muse.hs+3
@@ -405,6 +405,9 @@ tests = [ testGroup "block elements"
405405 =?> "#anchor Foo bar"
406406 , "span with class and anchor" =: spanWith ("anchor", ["foo"], []) (text "bar")
407407 =?> "#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>"
408411 , testGroup "combined"
409412 [ "emph word before" =:
410413 para (text "foo" <> emph (text "bar")) =?>