diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2022-10-17 15:14:09 -0700 |
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2022-10-17 15:14:09 -0700 |
| commit | 1e7b57e1e888575ec772fa30381a9edc9577a406 (patch) | |
| tree | 6195d6446f1895bd756dfa2d20e42c1f0b4028aa /src/Text | |
| parent | 0cc48b560e1a86b5a4ef123c98a5e0ec7131d69f (diff) | |
MediaWiki writer: avoid extra section divs with repeated ids.
Closes #8383.
Previously when converting HTML with headings nested under
section elements, pandoc would produce HTML div tags and
a span with an identifier duplicating the one on the div.
It seems better just to omit the superstructure of section
divs, so that's what this commit does, yielding more
normal MediaWiki output.
Diffstat (limited to 'src/Text')
| -rw-r--r-- | src/Text/Pandoc/Writers/MediaWiki.hs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Writers/MediaWiki.hs b/src/Text/Pandoc/Writers/MediaWiki.hs index f4bdf239c..b0a7b5b24 100644 --- a/src/Text/Pandoc/Writers/MediaWiki.hs +++ b/src/Text/Pandoc/Writers/MediaWiki.hs @@ -82,6 +82,10 @@ blockToMediaWiki :: PandocMonad m blockToMediaWiki Null = return "" +blockToMediaWiki (Div (ident,("section":_),_) + (Header lev (_, cls, kvs) ils : bs)) = + blockListToMediaWiki (Header lev (ident,cls,kvs) ils : bs) + blockToMediaWiki (Div attrs bs) = do contents <- blockListToMediaWiki bs return $ render Nothing (tagWithAttrs "div" attrs) <> "\n\n" <> |
