diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2023-06-28 09:04:17 -0700 |
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2023-06-28 09:05:51 -0700 |
| commit | c9088677faec3758dfeda820fd76933544a1e037 (patch) | |
| tree | 231ceea08492b6a4bc1a0d57b501505e3bdceda2 | |
| parent | 6c4980d819cb3b62a0443617df09a2765589bd34 (diff) | |
DokuWiki writer: fix lists with Div elements.
The DokuWiki writer doesn't render Divs specially, so their presence in
a list (e.g. because of custom-styles) need not prevent a regular
DokuWiki list from being used. (Falling back to raw HTML in this case is
pointless because no new information is given.)
Closes #8920.
| -rw-r--r-- | src/Text/Pandoc/Writers/DokuWiki.hs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/DokuWiki.hs b/src/Text/Pandoc/Writers/DokuWiki.hs index e2d948125..1450babef 100644 --- a/src/Text/Pandoc/Writers/DokuWiki.hs +++ b/src/Text/Pandoc/Writers/DokuWiki.hs @@ -102,7 +102,8 @@ blockToDokuWiki :: PandocMonad m blockToDokuWiki opts (Div _attrs bs) = do contents <- blockListToDokuWiki opts bs - return $ contents <> "\n" + indent <- asks stIndent + return $ contents <> if T.null indent then "\n" else "" blockToDokuWiki opts (Plain inlines) = inlineListToDokuWiki opts inlines @@ -310,6 +311,8 @@ isSimpleList x = isSimpleListItem :: [Block] -> Bool isSimpleListItem [] = True isSimpleListItem [x, CodeBlock{}] | isPlainOrPara x = True +isSimpleListItem (Div _ bs : ys) = -- see #8920 + isSimpleListItem bs && all isSimpleList ys isSimpleListItem (x:ys) | isPlainOrPara x = all isSimpleList ys isSimpleListItem _ = False |
