2021-01-18 01:18:02 +00:00
|
|
|
{{ if .Params.footnote_heading -}}
|
2022-04-06 04:41:08 +00:00
|
|
|
|
2022-04-14 01:21:39 +00:00
|
|
|
<!--Add heading to footnotes, remove unused class-->
|
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-->
|
2022-04-09 15:59:12 +00:00
|
|
|
{{ $endnote := `(role="doc-endnote"|class="footnote-(back)?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-->
|
2022-04-18 15:56:22 +00:00
|
|
|
{{ $tocHeadingOutside := `<h2>Table of Contents</h2><nav id="TableOfContents">` }}
|
2022-04-18 08:29:05 +00:00
|
|
|
{{ $tocHeadingInside := `<nav id=TableOfContents role="doc-toc"><h2 id="toc-hd">Table of Contents</h2>` }}
|
2022-04-09 15:51:10 +00:00
|
|
|
|
|
|
|
{{ .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 -}}
|