From eca39d6cf1e97c81564c2f69881733271cfe01a6 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 21 Dec 2019 12:26:29 -0800 Subject: [PATCH] HTML writer: more tweaks to avoid round-trip failures... having to do with makeSections. --- src/Text/Pandoc/Writers/HTML.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index 32a3b853b..acd68300a 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -630,7 +630,8 @@ blockToHtml opts (LineBlock lns) = htmlLines <- inlineListToHtml opts $ intercalate [LineBreak] lns return $ H.div ! A.class_ "line-block" $ htmlLines 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 slideLevel <- gets stSlideLevel let slide = slideVariant /= NoSlides && @@ -684,7 +685,9 @@ blockToHtml opts (Div (ident, "section":dclasses, dkvs) else id) $ t <> if null innerSecs then mempty 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 $ secttag $ nl opts <> header' <> nl opts <>