HTML writer: more tweaks to avoid round-trip failures...

having to do with makeSections.
This commit is contained in:
John MacFarlane 2019-12-21 12:26:29 -08:00
parent 80a0e56a5d
commit eca39d6cf1

View file

@ -630,7 +630,8 @@ blockToHtml opts (LineBlock lns) =
htmlLines <- inlineListToHtml opts $ intercalate [LineBreak] lns htmlLines <- inlineListToHtml opts $ intercalate [LineBreak] lns
return $ H.div ! A.class_ "line-block" $ htmlLines return $ H.div ! A.class_ "line-block" $ htmlLines
blockToHtml opts (Div (ident, "section":dclasses, dkvs) blockToHtml opts (Div (ident, "section":dclasses, dkvs)
(Header level hattr ils : xs)) = do (Header level
hattr@(hident,hclasses,hkvs) ils : xs)) = do
slideVariant <- gets stSlideVariant slideVariant <- gets stSlideVariant
slideLevel <- gets stSlideLevel slideLevel <- gets stSlideLevel
let slide = slideVariant /= NoSlides && let slide = slideVariant /= NoSlides &&
@ -684,7 +685,9 @@ blockToHtml opts (Div (ident, "section":dclasses, dkvs)
else id) $ t <> if null innerSecs else id) $ t <> if null innerSecs
then mempty then mempty
else nl opts <> innerContents else nl opts <> innerContents
else if writerSectionDivs opts || slide || not (null dclasses) else if writerSectionDivs opts || slide ||
(hident /= ident && not (T.null hident || T.null ident)) ||
(hclasses /= dclasses) || (hkvs /= dkvs)
then addAttrs opts attr then addAttrs opts attr
$ secttag $ secttag
$ nl opts <> header' <> nl opts <> $ nl opts <> header' <> nl opts <>