aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2020-01-12 15:17:53 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2020-01-12 15:18:37 -0800
commit157936c927a6b4ea40e5f5100ed5cc7714e2b046 (patch)
treed79d33886a14ff7ada8b1a52b507e3837cc73a22 /src/Text
parent11e99409cec24749df5dabeb4dca96c084ddbc75 (diff)
downloadpandoc-157936c927a6b4ea40e5f5100ed5cc7714e2b046.tar.gz
HTML writer: fix duplicate attributes on headings.
Another regression from 2.7.x. Closes #6062.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index b739e2b2d..1bd96c2ca 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -29,7 +29,7 @@ module Text.Pandoc.Writers.HTML (
) where
import Control.Monad.State.Strict
import Data.Char (ord)
-import Data.List (intercalate, intersperse, partition, delete)
+import Data.List (intercalate, intersperse, partition, delete, (\\))
import Data.Maybe (fromMaybe, isJust, isNothing, mapMaybe)
import qualified Data.Set as Set
import Data.Text (Text)
@@ -664,16 +664,9 @@ blockToHtml opts (Div (ident, "section":dclasses, dkvs)
else case splitBy isPause xs of
[] -> ([],[])
(z:zs) -> ([],z ++ concatMap inDiv zs)
- let classes' = ordNub $
- ["title-slide" | titleSlide] ++ ["slide" | slide] ++
- ["section" | (slide || writerSectionDivs opts) &&
- not html5 ] ++
- ["level" <> tshow level | slide || writerSectionDivs opts ]
- <> dclasses
let secttag = if html5
then H5.section
else H.div
- let attr = (ident, classes', dkvs)
titleContents <- blockListToHtml opts titleBlocks
inSection <- gets stInSection
innerContents <- do
@@ -681,6 +674,13 @@ blockToHtml opts (Div (ident, "section":dclasses, dkvs)
res <- blockListToHtml opts innerSecs
modify $ \st -> st{ stInSection = inSection }
return res
+ let classes' = ordNub $
+ ["title-slide" | titleSlide] ++ ["slide" | slide] ++
+ ["section" | (slide || writerSectionDivs opts) &&
+ not html5 ] ++
+ ["level" <> tshow level | slide || writerSectionDivs opts ]
+ <> dclasses
+ let attr = (ident, classes', dkvs)
if titleSlide
then do
t <- addAttrs opts attr $
@@ -704,7 +704,8 @@ blockToHtml opts (Div (ident, "section":dclasses, dkvs)
then mempty
else innerContents <> nl opts
else do
- t <- addAttrs opts attr header'
+ let attr' = (ident, classes' \\ hclasses, dkvs \\ hkvs)
+ t <- addAttrs opts attr' header'
return $ t <>
if null innerSecs
then mempty