diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2023-03-14 21:39:32 -0700 |
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2023-03-14 21:49:05 -0700 |
| commit | 1bfab1d11ecf65362c0e8fde98a66c0e6f08f258 (patch) | |
| tree | 503f014f5307c57a597d63c37c2bd70d06f1152c /src/Text | |
| parent | 03d80ccd38118d6e75e7d81e62545e95ed5fea3c (diff) | |
HTML writer footnotes changes:
When `--reference-location=section` or `=block`, use an
`aside` element for the notes rather than a `section`.
When `--reference-location=section`, include the `aside`
element inside the section element, rather than outside.
(In slide shows, this option causes footnotes on a slide
to be displayed at the bottom of the slide.)
Closes #8695.
Diffstat (limited to 'src/Text')
| -rw-r--r-- | src/Text/Pandoc/Writers/HTML.hs | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index 1695c1897..9f61d483c 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -543,7 +543,14 @@ footnoteSection refLocation startCounter notes = do = H5.section ! A.id "footnotes" ! A.class_ className ! customAttribute "epub:type" "footnotes" $ x - | html5 = H5.section ! A5.id "footnotes" + | html5 + , refLocation == EndOfDocument + , slideVariant == RevealJsSlides -- need a section for a new slide: + = H5.section ! A5.id "footnotes" + ! A5.class_ className + ! A5.role "doc-endnotes" + $ x + | html5 = H5.aside ! A5.id "footnotes" ! A5.class_ className ! A5.role "doc-endnotes" $ x @@ -795,7 +802,18 @@ blockToHtmlInner opts (Div (ident, "section":dclasses, dkvs) modify $ \st -> st{ stInSection = True } res <- blockListToHtml opts innerSecs modify $ \st -> st{ stInSection = inSection } - return res + notes <- gets stNotes + let emitNotes = writerReferenceLocation opts == EndOfSection && + not (null notes) + if emitNotes + then do + st <- get + renderedNotes <- footnoteSection (writerReferenceLocation opts) + (stEmittedNotes st + 1) (reverse notes) + modify (\st' -> st'{ stNotes = mempty, + stEmittedNotes = stEmittedNotes st' + length notes }) + return (res <> renderedNotes) + else return res let classes' = nubOrd $ ["title-slide" | titleSlide] ++ ["slide" | slide] ++ ["section" | (slide || writerSectionDivs opts) && @@ -1065,8 +1083,7 @@ blockToHtml opts block = do doc <- blockToHtmlInner opts block st <- get let emitNotes = - (writerReferenceLocation opts == EndOfBlock && stBlockLevel st == 1) || - (writerReferenceLocation opts == EndOfSection && isSection) + writerReferenceLocation opts == EndOfBlock && stBlockLevel st == 1 res <- if emitNotes then do notes <- if null (stNotes st) |
