From 8aed3652c2cb1811aa5685bbeb7c97b097b2eed4 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Tue, 6 Feb 2018 03:17:31 +0300 Subject: Muse reader: refactor to avoid reparsing Lists are parsed in linear instead of exponential time now. Contents of block tags, such as , is parsed directly, without storing it in a string and parsing with parseFromString. Fixed a bug: headers did not terminate lists. --- test/Tests/Readers/Muse.hs | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'test/Tests') diff --git a/test/Tests/Readers/Muse.hs b/test/Tests/Readers/Muse.hs index 60059df77..967a63ac9 100644 --- a/test/Tests/Readers/Muse.hs +++ b/test/Tests/Readers/Muse.hs @@ -313,6 +313,16 @@ tests = , "" ] =?> blockQuote (para $ text "Hello, world") + , "Nested quote tag" =: + T.unlines [ "" + , "foo" + , "" + , "bar" + , "" + , "baz" + , "" + ] =?> + blockQuote (para "foo" <> blockQuote (para "bar") <> para "baz") , "Verse tag" =: T.unlines [ "" , "" @@ -514,6 +524,12 @@ tests = ] =?> header 2 "Foo" <> para (spanWith ("bar", [], []) mempty) + , "Headers terminate lists" =: + T.unlines [ " - foo" + , "* bar" + ] =?> + bulletList [ para "foo" ] <> + header 1 "bar" ] , testGroup "Directives" [ "Title" =: @@ -846,6 +862,15 @@ tests = , para "c" ] ] + , "List continuation afeter nested list" =: + T.unlines + [ " - - foo" + , "" + , " bar" + ] =?> + bulletList [ bulletList [ para "foo" ] <> + para "bar" + ] -- Emacs Muse allows to separate lists with two or more blank lines. -- Text::Amuse (Amusewiki engine) always creates a single list as of version 0.82. -- pandoc follows Emacs Muse behavior @@ -1087,7 +1112,21 @@ tests = , para "* Bar" ] ] - , "List inside a tag" =: + , "Bullet list inside a tag" =: + T.unlines + [ "" + , " - First" + , "" + , " - Second" + , "" + , " - Third" + , "" + ] =?> + blockQuote (bulletList [ para "First" + , para "Second" + , para "Third" + ]) + , "Ordered list inside a tag" =: T.unlines [ "" , " 1. First" -- cgit v1.2.3