diff options
author | Alexander Krotov <ilabdsf@gmail.com> | 2018-03-24 23:51:38 +0300 |
---|---|---|
committer | Alexander Krotov <ilabdsf@gmail.com> | 2018-03-25 00:30:05 +0300 |
commit | d58b961a6d83a9f3a815d7aa281c692281954a00 (patch) | |
tree | b5826ddd7b8bdfe4a88a5d3fd1ea0091c1a91092 | |
parent | 8b533f9c386029f1a95dd2ea887ec7bb151fe513 (diff) | |
download | pandoc-d58b961a6d83a9f3a815d7aa281c692281954a00.tar.gz |
Muse writer: do not join Span's doing normalization
Separate spans may have different semantics, for example if spans indicate syllables in a word.
-rw-r--r-- | src/Text/Pandoc/Writers/Muse.hs | 3 | ||||
-rw-r--r-- | test/Tests/Writers/Muse.hs | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/Muse.hs b/src/Text/Pandoc/Writers/Muse.hs index ad3afd751..6ecd826fa 100644 --- a/src/Text/Pandoc/Writers/Muse.hs +++ b/src/Text/Pandoc/Writers/Muse.hs @@ -339,8 +339,7 @@ normalizeInlineList (Code _ x1 : Code _ x2 : ils) = normalizeInlineList $ Code nullAttr (x1 ++ x2) : ils normalizeInlineList (RawInline f1 x1 : RawInline f2 x2 : ils) | f1 == f2 = normalizeInlineList $ RawInline f1 (x1 ++ x2) : ils -normalizeInlineList (Span a1 x1 : Span a2 x2 : ils) | a1 == a2 - = normalizeInlineList $ Span a1 (x1 ++ x2) : ils +-- Do not join Span's during normalization normalizeInlineList (x:xs) = x : normalizeInlineList xs normalizeInlineList [] = [] diff --git a/test/Tests/Writers/Muse.hs b/test/Tests/Writers/Muse.hs index 56fa22955..1218bc7c9 100644 --- a/test/Tests/Writers/Muse.hs +++ b/test/Tests/Writers/Muse.hs @@ -405,6 +405,9 @@ tests = [ testGroup "block elements" =?> "#anchor Foo bar" , "span with class and anchor" =: spanWith ("anchor", ["foo"], []) (text "bar") =?> "#anchor <class name=\"foo\">bar</class>" + , "adjacent spans" =: spanWith ("", ["syllable"], []) (str "wa") <> + spanWith ("", ["syllable"], []) (str "ter") + =?> "<class name=\"syllable\">wa</class><class name=\"syllable\">ter</class>" , testGroup "combined" [ "emph word before" =: para (text "foo" <> emph (text "bar")) =?> |