aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-10-28 21:14:01 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2019-10-28 21:14:01 -0700
commit47566817c559557f5bc6c9c503afa1a37bf7df90 (patch)
tree430027938b0e21c53a115ce449aae755f6a319a6
parent57e2148ca2b9604b35cfceacbd89487d6f5f8aab (diff)
downloadpandoc-47566817c559557f5bc6c9c503afa1a37bf7df90.tar.gz
Shared: improve isTight.
If a list has an empty item, this should not count against its being a tight list. Closes #5857.
-rw-r--r--src/Text/Pandoc/Shared.hs2
-rw-r--r--test/command/5857.md11
2 files changed, 12 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs
index c5183aacb..59e30feeb 100644
--- a/src/Text/Pandoc/Shared.hs
+++ b/src/Text/Pandoc/Shared.hs
@@ -623,7 +623,7 @@ onlySimpleTableCells = all isSimpleCell . concat
-- | Detect if a list is tight.
isTightList :: [[Block]] -> Bool
-isTightList = all firstIsPlain
+isTightList = all (\item -> firstIsPlain item || null item)
where firstIsPlain (Plain _ : _) = True
firstIsPlain _ = False
diff --git a/test/command/5857.md b/test/command/5857.md
new file mode 100644
index 000000000..31320cd12
--- /dev/null
+++ b/test/command/5857.md
@@ -0,0 +1,11 @@
+```
+% pandoc -f native -t markdown
+[BulletList
+ [[Plain [Str "a"]]
+ ,[]
+ ,[Plain [Str "b"]]]]
+^D
+- a
+-
+- b
+```