diff options
| author | John MacFarlane <[email protected]> | 2023-10-28 10:06:28 -0700 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2023-10-28 10:07:13 -0700 |
| commit | 0f3211c3391cd9e1c638772ddce553f810c0bccc (patch) | |
| tree | a513f42bdb416f6185191a82aba7998dbaf57462 /src | |
| parent | 196bf9693215eb45efd365295e27c3d840d31f54 (diff) | |
Shared: improve isTightList...
so that it recognizes an item containing only a list which is
itself tight as potentially an item in a tight list.
Closes #9161.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Text/Pandoc/Shared.hs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index 92269ddec..1e68bdd10 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -633,9 +633,13 @@ onlySimpleTableCells = all isSimpleCell . concat -- | Detect if a list is tight. isTightList :: [[Block]] -> Bool -isTightList = all (\item -> firstIsPlain item || null item) - where firstIsPlain (Plain _ : _) = True - firstIsPlain _ = False +isTightList = all isPlainItem + where + isPlainItem [] = True + isPlainItem (Plain _ : _) = True + isPlainItem [BulletList xs] = isTightList xs + isPlainItem [OrderedList _ xs] = isTightList xs + isPlainItem _ = False -- | Convert a list item containing tasklist syntax (e.g. @[x]@) -- to using @U+2610 BALLOT BOX@ or @U+2612 BALLOT BOX WITH X@. |
