2021-01-18 01:18:02 +00:00
|
|
|
{{ if .Params.footnote_heading -}}
|
2022-04-06 04:41:08 +00:00
|
|
|
|
2022-04-09 15:51:10 +00:00
|
|
|
<!--Add heading to footnotes-->
|
2021-01-18 03:42:07 +00:00
|
|
|
{{ $references := `(<section class="footnotes" role="doc-endnotes">
|
|
|
|
<hr>)` -}}
|
2022-04-06 04:41:08 +00:00
|
|
|
{{ $heading := .Params.footnote_heading -}}
|
2022-04-07 00:49:25 +00:00
|
|
|
{{ $referencesWithHeading := printf `<section role="doc-endnotes" aria-labelledby="note-hd">
|
2021-01-18 03:42:07 +00:00
|
|
|
<h2 id="note-hd">%s</h2>` ($heading) -}}
|
2022-04-06 04:41:08 +00:00
|
|
|
|
2022-04-09 15:54:58 +00:00
|
|
|
<!--Remove deprecated DPUB-ARIA role and unused classes-->
|
|
|
|
{{ $endnote := `(role="doc-endnote"|class="footnote-ref")` }}
|
2022-04-06 04:41:08 +00:00
|
|
|
{{ $noEndnote := printf "" }}
|
2022-04-07 00:49:25 +00:00
|
|
|
|
2022-04-09 15:51:10 +00:00
|
|
|
<!--Add tabindex to all <pre> elements, inc. those that aren't generated by Goldmark-->
|
2022-04-07 00:49:25 +00:00
|
|
|
{{ $preWithoutTabIndex := `<pre>` }}
|
2022-04-07 22:39:06 +00:00
|
|
|
{{ $preWithTabIndex := `<pre tabindex="0">` }}
|
2022-04-07 00:49:25 +00:00
|
|
|
|
2022-04-09 15:51:10 +00:00
|
|
|
<!--Move the Table of Contents heading *inside* the <nav> element-->
|
|
|
|
{{ $tocHeadingOutside := `<h2>Table of Contents</h2><nav id="TableOfContents">` }}
|
|
|
|
{{ $tocHeadingInside := `<nav id=TableOfContents><h2>Table of Contents</h2>` }}
|
|
|
|
|
|
|
|
{{ .Content | replaceRE $references $referencesWithHeading | replaceRE $endnote $noEndnote | replaceRE $preWithoutTabIndex $preWithTabIndex | replaceRE $tocHeadingOutside $tocHeadingInside | safeHTML -}}
|
2021-01-18 03:42:07 +00:00
|
|
|
{{ else -}}
|
|
|
|
{{ .Content -}}
|
2021-01-18 01:18:02 +00:00
|
|
|
{{ end -}}
|