summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenjamin Esham <benjamin@esham.io>2023-08-31 23:30:25 -0400
committerJohn MacFarlane <jgm@berkeley.edu>2023-09-01 11:42:48 -0700
commit9190b19fc7cfb1037fc35fa564142122eae985e6 (patch)
tree0c81bd0706a5da68aa57d087306cb989544982eb /src
parent5fe3396a221b34145c56ccfae39ab947fb407817 (diff)
HTML writer: use the ID prefix in the ID for the footnotes section.
In general, the ID prefix makes it possible to combine multiple pieces of Pandoc-generated HTML with no possibility that IDs will conflict. One exception to this was that the footnotes were always put into an element like <aside id="foonotes" ...> This commit applies the ID prefix to this ID as well.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index 473fd4c14..adabd302e 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -299,7 +299,7 @@ pandocToHtml opts (Pandoc meta blocks) = do
if null (stNotes st)
then return mempty
else do
- notes <- footnoteSection EndOfDocument (stEmittedNotes st + 1) (reverse (stNotes st))
+ notes <- footnoteSection opts EndOfDocument (stEmittedNotes st + 1) (reverse (stNotes st))
modify (\st' -> st'{ stNotes = mempty, stEmittedNotes = stEmittedNotes st' + length (stNotes st') })
return notes
st <- get
@@ -524,8 +524,8 @@ tableOfContents opts sects = do
-- | Convert list of Note blocks to a footnote <div>.
-- Assumes notes are sorted.
footnoteSection ::
- PandocMonad m => ReferenceLocation -> Int -> [Html] -> StateT WriterState m Html
-footnoteSection refLocation startCounter notes = do
+ PandocMonad m => WriterOptions -> ReferenceLocation -> Int -> [Html] -> StateT WriterState m Html
+footnoteSection opts refLocation startCounter notes = do
html5 <- gets stHtml5
slideVariant <- gets stSlideVariant
let hrtag = if refLocation /= EndOfBlock
@@ -550,7 +550,7 @@ footnoteSection refLocation startCounter notes = do
! A5.class_ className
! A5.role "doc-endnotes"
$ x
- | html5 = H5.aside ! A5.id "footnotes"
+ | html5 = H5.aside ! prefixedId opts "footnotes"
! A5.class_ className
! A5.role "doc-endnotes"
$ x
@@ -805,7 +805,7 @@ blockToHtmlInner opts (Div (ident, "section":dclasses, dkvs)
if emitNotes
then do
st <- get
- renderedNotes <- footnoteSection (writerReferenceLocation opts)
+ renderedNotes <- footnoteSection opts (writerReferenceLocation opts)
(stEmittedNotes st + 1) (reverse notes)
modify (\st' -> st'{ stNotes = mempty,
stEmittedNotes = stEmittedNotes st' + length notes })
@@ -1084,7 +1084,8 @@ blockToHtml opts block = do
then do
notes <- if null (stNotes st)
then return mempty
- else footnoteSection (writerReferenceLocation opts) (stEmittedNotes st + 1) (reverse (stNotes st))
+ else footnoteSection opts (writerReferenceLocation opts)
+ (stEmittedNotes st + 1) (reverse (stNotes st))
modify (\st' -> st'{ stNotes = mempty, stEmittedNotes = stEmittedNotes st' + length (stNotes st') })
return (doc <> notes)
else return doc