diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index a945c9355..db00d5aa4 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -424,13 +424,12 @@ compactify [] = [] compactify items = let (others, final) = (init items, last items) in case reverse (B.toList final) of - (Para a:xs) -> case [Para x | Para x <- concatMap B.toList items] of - -- if this is only Para, change to Plain - [_] -> others ++ [B.fromList (reverse $ Plain a : xs)] - -- if other Paras, it's a loose list, change - -- all Plain to Para - _ -> map (fmap plainToPara) items - _ -> items + (Para a:xs) + | null [Para x | Para x <- (xs ++ concatMap B.toList others)] + -> others ++ [B.fromList (reverse (Plain a : xs))] + _ | null [Para x | Para x <- concatMap B.toList items] + -> items + _ -> map (fmap plainToPara) items plainToPara :: Block -> Block plainToPara (Plain ils) = Para ils diff --git a/test/command/5285.md b/test/command/5285.md index 780812761..6085ec1a9 100644 --- a/test/command/5285.md +++ b/test/command/5285.md @@ -13,3 +13,20 @@ ,[Para [Str "a"]] ,[Para [Str "b"]]]] ``` + +``` +% pandoc -t native +- foo + + foo +- foo + + > foo +^D +[BulletList + [[Para [Str "foo"] + ,Para [Str "foo"]] + ,[Para [Str "foo"] + ,BlockQuote + [Para [Str "foo"]]]]] +``` diff --git a/test/rst-reader.native b/test/rst-reader.native index cd1437ac8..70ed3cf60 100644 --- a/test/rst-reader.native +++ b/test/rst-reader.native @@ -96,8 +96,8 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa ,OrderedList (1,Decimal,Period) [[Para [Str "Item",Space,Str "1,",Space,Str "graf",Space,Str "one."] ,Para [Str "Item",Space,Str "1.",Space,Str "graf",Space,Str "two.",Space,Str "The",Space,Str "quick",Space,Str "brown",Space,Str "fox",Space,Str "jumped",Space,Str "over",Space,Str "the",Space,Str "lazy",Space,Str "dog\8217s",SoftBreak,Str "back."]] - ,[Plain [Str "Item",Space,Str "2."]] - ,[Plain [Str "Item",Space,Str "3."]]] + ,[Para [Str "Item",Space,Str "2."]] + ,[Para [Str "Item",Space,Str "3."]]] ,Para [Str "Nested:"] ,BulletList [[Plain [Str "Tab"] @@ -107,17 +107,17 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa [[Plain [Str "Tab"]]]]]]] ,Para [Str "Here\8217s",Space,Str "another:"] ,OrderedList (1,Decimal,Period) - [[Plain [Str "First"]] + [[Para [Str "First"]] ,[Para [Str "Second:"] ,BlockQuote [BulletList [[Plain [Str "Fee"]] ,[Plain [Str "Fie"]] ,[Plain [Str "Foe"]]]]] - ,[Plain [Str "Third"]]] + ,[Para [Str "Third"]]] ,Header 2 ("fancy-list-markers",[],[]) [Str "Fancy",Space,Str "list",Space,Str "markers"] ,OrderedList (2,Decimal,TwoParens) - [[Plain [Str "begins",Space,Str "with",Space,Str "2"]] + [[Para [Str "begins",Space,Str "with",Space,Str "2"]] ,[Para [Str "and",Space,Str "now",Space,Str "3"] ,Para [Str "with",Space,Str "a",Space,Str "continuation"] ,OrderedList (4,LowerRoman,Period) diff --git a/test/rst-reader.rst b/test/rst-reader.rst index cfe959f2d..a918c0e2c 100644 --- a/test/rst-reader.rst +++ b/test/rst-reader.rst @@ -192,7 +192,7 @@ Multiple paragraphs: Item 1. graf two. The quick brown fox jumped over the lazy dog's back. - + 2. Item 2. 3. Item 3. diff --git a/test/testsuite.native b/test/testsuite.native index 73fcc0633..f9132c797 100644 --- a/test/testsuite.native +++ b/test/testsuite.native @@ -137,7 +137,7 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa ,[Para [Str "this",Space,Str "is",Space,Str "an",Space,Str "example",Space,Str "list",Space,Str "item",SoftBreak,Str "indented",Space,Str "with",Space,Str "spaces"]]]]] ,Header 2 ("fancy-list-markers",[],[]) [Str "Fancy",Space,Str "list",Space,Str "markers"] ,OrderedList (2,Decimal,TwoParens) - [[Plain [Str "begins",Space,Str "with",Space,Str "2"]] + [[Para [Str "begins",Space,Str "with",Space,Str "2"]] ,[Para [Str "and",Space,Str "now",Space,Str "3"] ,Para [Str "with",Space,Str "a",Space,Str "continuation"] ,OrderedList (4,LowerRoman,Period) diff --git a/test/writer.custom b/test/writer.custom index f3341360e..595d8f70e 100644 --- a/test/writer.custom +++ b/test/writer.custom @@ -263,7 +263,7 @@ indented with spaces
begins with 2
and now 3
with a continuation
diff --git a/test/writer.dokuwiki b/test/writer.dokuwiki index 34f4246db..5e6773799 100644 --- a/test/writer.dokuwiki +++ b/test/writer.dokuwiki @@ -205,7 +205,7 @@ Same thing but with paragraphs: ===== Fancy list markers =====begins with 2
and now 3
with a continuation
Fancy list markers
(2) begins with 2
+(3) and now 3
with a continuation
diff --git a/test/writer.haddock b/test/writer.haddock index 13f22021d..fbe6c257b 100644 --- a/test/writer.haddock +++ b/test/writer.haddock @@ -236,6 +236,7 @@ Same thing but with paragraphs: #fancy-list-markers# (2) begins with 2 + (3) and now 3 with a continuation diff --git a/test/writer.html4 b/test/writer.html4 index bed6617a0..4d5d11897 100644 --- a/test/writer.html4 +++ b/test/writer.html4 @@ -196,7 +196,7 @@ These should not be escaped: \$ \\ \> \[ \{begins with 2
and now 3
with a continuation
begins with 2
and now 3
with a continuation
begins with 2
and now 3
with a continuation
begins with 2
and now 3
with a continuation