21 lines
1.0 KiB
HTML
21 lines
1.0 KiB
HTML
{{- /*
|
|
边注 / 注释。
|
|
宽屏:显示在正文左侧的空白处,并用一条折线与原文所在行相连(由 static/js/notes.js 定位)。
|
|
窄屏:以虚线框内嵌在文章中。
|
|
用法:{{< note >}}注释内容{{< /note >}}
|
|
书目:{{< note cite >}}每行一项,各占一行{{< /note >}}
|
|
*/ -}}
|
|
{{- $class := .Get 0 | default "" -}}
|
|
{{- $page := .Page -}}
|
|
{{- $n := add ($page.Store.Get "noteCount" | default 0) 1 -}}
|
|
{{- $page.Store.Set "noteCount" $n -}}
|
|
<span class="post-note-anchor" aria-hidden="true"></span><sup class="post-note-mark">{{ $n }}</sup><span class="post-note{{ with $class }} {{ . }}{{ end }}"><span class="post-note-num">{{ $n }}</span>{{- with .Inner -}}
|
|
{{- if eq $class "cite" -}}
|
|
{{- range split (trim . "\r\n") "\n" -}}
|
|
{{- $line := trim . "\r" -}}
|
|
{{- if ne (trim $line " ") "" -}}<span class="note-line">{{ $line | $page.RenderString (dict "display" "inline") }}</span>{{- end -}}
|
|
{{- end -}}
|
|
{{- else -}}
|
|
{{- . | $page.RenderString (dict "display" "inline") -}}
|
|
{{- end -}}
|
|
{{- end -}}</span> |