1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-11-27 14:12:09 +00:00
seirdy.one/layouts/partials/processed-content.html

26 lines
1.1 KiB
HTML
Raw Normal View History

{{ if .Params.footnote_heading -}}
2022-04-14 01:21:39 +00:00
<!--Add heading to footnotes, remove unused class-->
{{ $references := `(<section class="footnotes" role="doc-endnotes">
<hr>)` -}}
{{ $heading := .Params.footnote_heading -}}
2022-04-07 00:49:25 +00:00
{{ $referencesWithHeading := printf `<section role="doc-endnotes" aria-labelledby="note-hd">
<h2 id="note-hd">%s</h2>` ($heading) -}}
<!--Remove deprecated DPUB-ARIA role and unused classes-->
{{ $endnote := `(role="doc-endnote"|class="footnote-(back)?ref")` }}
{{ $noEndnote := printf "" }}
2022-04-07 00:49:25 +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>` }}
{{ $preWithTabIndex := `<pre tabindex="0">` }}
2022-04-07 00:49:25 +00:00
<!--Move the Table of Contents heading *inside* the <nav> element-->
{{ $tocHeadingOutside := `<h2>Table of Contents</h2><nav id="TableOfContents">` }}
2022-04-14 01:21:39 +00:00
{{ $tocHeadingInside := `<nav id=TableOfContents role="doc-toc"><h2>Table of Contents</h2>` }}
{{ .Content | replaceRE $references $referencesWithHeading | replaceRE $endnote $noEndnote | replaceRE $preWithoutTabIndex $preWithTabIndex | replaceRE $tocHeadingOutside $tocHeadingInside | safeHTML -}}
{{ else -}}
{{ .Content -}}
{{ end -}}