mirror of
https://github.com/jgm/pandoc.git
synced 2026-07-12 04:17:16 +00:00
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.
This commit is contained in:
committed by
John MacFarlane
parent
5fe3396a22
commit
9190b19fc7
@@ -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
|
||||
|
||||
@@ -4,7 +4,7 @@ This.^[Has a footnote.]
|
||||
^D
|
||||
<p>This.<a href="#foofn1" class="footnote-ref" id="foofnref1"
|
||||
role="doc-noteref"><sup>1</sup></a></p>
|
||||
<aside id="footnotes" class="footnotes footnotes-end-of-document"
|
||||
<aside id="foofootnotes" class="footnotes footnotes-end-of-document"
|
||||
role="doc-endnotes">
|
||||
<hr />
|
||||
<ol>
|
||||
|
||||
Reference in New Issue
Block a user