File size: 6,723 Bytes
fca4ff8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
{{- define "head" }}
    {{- /*

        MathML render engine    */}}
    {{- if or .Params.Math site.Params.Math }}
        {{ partialCached "head/js/katex.html" . }}
    {{- else if or .Params.MathJax site.Params.MathJax }}
        {{ partialCached "head/js/mathjax.html" . }}
    {{- end }}
    {{- /*

        Verbatim Style
    {{- with findRE `class="chroma"` .Content 1 }}
        {{ partialCached "head/css/verbatim.html" $ }}
    {{- end }}
     */}}
    {{- /*

        use Highlight.js */}}
    {{- if .Params.Hljs -}}
        {{ partialCached "head/js/hljs.html" . }}
    {{- end }}
{{- end }}

{{- define "main" }}
    {{- $isPost := eq .Params.type (or "post" "articles") }}
    {{- $sf := or site.Params.Posts.sfdefault .Params.sfdefault }}
    <article id="main-article" class="pagewidth {{ if or (not $isPost) $sf }}sf{{ else }}rm{{ end }}"
        role="document" aria-labelledby="title"
        {{- if ne (lower .Params.type) (or "post" "articles") }}
            data-pagefind-ignore="all"
        {{- else }}
            data-pagefind-body
        {{- end }}>
        <header aria-labelledby="title">
            {{- $series := .GetTerms "series" }}
            {{- $stage := .GetTerms "stage" }}
            {{ if or $series $stage }}
            <span id="has-stage" class="section-title">
                {{- with $series }}
                    {{- range . | first 1 }}
                        <a href="{{ .Permalink }}" id="series" aria-label="{{ i18n "series" 1 }}: {{ .Title }}">
                            <span>{{ .Title }}</span>
                        </a>
                    {{- end }}
                {{- end }}
                {{- with $stage }}
                    {{- range . | first 1 }}
                        {{- $ic := or .Params.indicator .Params.icon .Params.badge }}
                        {{- if .Params.emoji }}
                            <span class="emoji emoji--stage">{{ .Params.emoji }}</span>
                        {{- else if $ic }}
                            <img src="{{ absURL $ic }}" class="stage-indicator">
                        {{- else }}
                            <span class="st {{ lower .Title }}"></span>
                        {{- end }}
                        <a href="{{ .Permalink }}" id="stage" aria-label="{{ i18n "stage" 1 }}: {{ .Title }}">
                            <span>{{ .Title }}</span>
                        </a>
                    {{- end }}
                {{- end }}
            </span>
            {{ end }}
            {{ partial "page/title.html" . }}
            {{- if $isPost }}
            <div id="doc-author" class="textsw author">
                {{- $author := cond .Params.author .Params.author site.Params.Author.name }}
                {{- $authors := or (.GetTerms "authors") (.GetTerms "author") }}
                {{- $notMultiAuthor := eq (len $authors) 1 }}
                {{- if $authors }}
                    {{- if $notMultiAuthor }}
                        {{- range $authors }}
                            {{ $flair := .Params.flair }}
                            {{- if $flair }}
                                {{- $displayPicture := partial "page/cover.html" (dict "page" .) }}
                                <a id="avatar" class="sri" href="{{ .Permalink }}" aria-label="{{ .LinkTitle }}">
                                    <img src="{{ $displayPicture }}" alt="{{ .LinkTitle }}"/>
                                </a>
                            {{- end }}
                            <a href="{{ .Permalink }}"
                                {{- if $flair }}
                                    class="has-desc"
                                    aria-label="{{ .LinkTitle }}"
                                    aria-description="{{ $flair }}"
                                {{- end }}>
                                {{- .LinkTitle -}}
                            </a>
                        {{- end }}
                    {{- else }}
                        {{ partial "terms.html" (dict "taxonomy" "author" "class" "delimiter" "page" .) }}
                    {{- end }}
                {{- else if $author -}}
                    <span>{{ $author }}</span>
                {{- end }}
            </div>
            {{ partial "page/timestamp.html" . }}
            {{- end }}
        </header>
        {{- with .Params.toc }}
            {{ partial "nav.html" (dict "navID" "TableOfContents" "page" $) }}
        {{- end }}
        {{ partial "page/audio.html" . }}
        <section aria-labelledby="title" id="content" data-bionRead-safe {{- if or site.Params.posts.secnum .Params.secnum }} class="secnum"{{- end }}>
            {{- if or .Params.task site.Params.Post.enableCheckbox }}
                {{ replace .Content "disabled=" "" | safeHTML }}
            {{- else }}
                {{ .Content }}
            {{- end }}
        </section>
        {{- if $isPost }}
            <footer>
                {{ partial "post/tagged.html" . }}
            </footer>
        {{- end }}
    </article>
    <hr class="hide" style="margin: 1in 0;">
    {{- if not (or site.Params.BearMode site.Params.ZenMode) }}
    <div id="contentinfo" class="pagewidth" role="contentinfo" data-pagefind-ignore="all">
        {{- if $isPost }}
            {{- if or .Params.related site.Params.posts.related }}
                {{ partial "post/related.html" . }}
            {{- end }}
            {{- if or .Params.colophon site.Params.posts.colophon }}
                {{ partial "post/colophon.html" . }}
            {{- end }}
            {{- if not site.Params.posts.disableHistory }}
                {{ partial "post/history.html" . }}
            {{- end }}
            {{ partial "post/contribute.html" . }}
        {{- end }}
        {{- if site.Params.posts.share }}
            {{ partial "nav.html" (dict "navID" "share" "page" .) }}
        {{- end }}
    </div>
    {{- end }}
    {{ if not site.Params.comments.disabled -}}
        {{- $toot := or .Params.toot  .Params.mstd .Params.mastodon }}
        {{- $bsky := or .Params.skeet .Params.bsky .Params.bluesky }}
        {{- $giscus := isset .Site.Params "giscus" }}
        {{ if or $toot $bsky $giscus -}}
            {{ if not (or $toot $bsky) -}}
                {{ if ne .Params.comments false }}
                    {{ partial "giscus.html" . }}
                {{ end }}
            {{- else }}
                {{ partial "fediverse.html" (dict "toot" $toot "bsky" $bsky ) }}
            {{- end }}
        {{- end }}
    {{- end }}
{{- end }}

{{- define "post" }}
    {{ "<!-- [post] single.html -->" | safeHTML }}
    {{- /*

        bionRead Snapshot */}}
    <div id="bionReadSnapshot" hidden></div>
{{- end }}