refactor: split single header and meta components into partials

This commit is contained in:
Ben Goldsworthy 2025-01-27 23:34:33 +01:00
parent d0577aec91
commit e6889cabba
No known key found for this signature in database
22 changed files with 742 additions and 406 deletions

View file

@ -0,0 +1,34 @@
{{- /*
Renders appendices and corrigenda for an item.
@params toc The page ToC.
@params appendices The item's appendices. Optional.
@params fileDir The file folder name.
*/
-}}
{{ $empty_toc_html := "<nav id=\"TableOfContents\"></nav>" }}
{{ if and ( .toc ) ( ne .toc $empty_toc_html ) }}
<nav class="article-header__table-of-contents">
<h3 class="article-header__subtitle">Table of Contents</h3>
{{ .toc }}
{{- if fileExists ( path.Join .fileDir "appendices.md" ) -}}
<ul class="toc-list--appendices">
<li>
<a href="#appendices">Appendices</a>
<ol>
{{ range .appendices }}
<li><a href="#{{ . | anchorize }}">{{ . | safeHTML }}</a></li>
{{ end }}
</ol>
</li>
</ul>
{{- end -}}
{{- if fileExists ( path.Join .fileDir "corrigenda.md" ) -}}
<ul class="toc-list--corrigenda">
<li><a href="#corrigenda">Corrigenda</a></li>
</ul>
{{- end -}}
</nav>
{{ end }}