Skip to content

Commit

Permalink
DokuWiki writer: fix lists with Div elements.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jgm committed Jun 28, 2023
1 parent 6c4980d commit c908867
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Text/Pandoc/Writers/DokuWiki.hs
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit c908867

Please sign in to comment.