2023-09-30 13:19:21

This commit is contained in:
z17CX 2023-09-30 13:19:21 +00:00
parent 1fde56fdf5
commit 25325e11d9
Signed by: z17cx
GPG key ID: 3F5F87C84EE943E4
7 changed files with 35 additions and 5 deletions

View file

@ -37,6 +37,7 @@ sources: { other: 'Sources' }
stats: { other: 'Statistics' } stats: { other: 'Statistics' }
sys_path: { other: 'System path' } sys_path: { other: 'System path' }
tags: { other: 'Tags' } tags: { other: 'Tags' }
toc: { other: 'Contents' }
type: { other: 'Type' } type: { other: 'Type' }
uuid: { other: 'UUID' } uuid: { other: 'UUID' }
word_count: { other: 'Word count' } word_count: { other: 'Word count' }

View file

@ -37,6 +37,7 @@ sources: { other: 'Источники' }
stats: { other: 'Статистика' } stats: { other: 'Статистика' }
sys_path: { other: 'Системный путь' } sys_path: { other: 'Системный путь' }
tags: { other: 'Теги' } tags: { other: 'Теги' }
toc: { other: 'Содержание' }
type: { other: 'Тип' } type: { other: 'Тип' }
uuid: { other: 'UUID' } uuid: { other: 'UUID' }
word_count: { other: 'Количество слов' } word_count: { other: 'Количество слов' }

View file

@ -0,0 +1,6 @@
{{ $anchor := ((.Anchor) | safeURL) }}
<h{{ .Level }} id="{{ ($anchor) }}">
{{ ((.Text) | safeHTML) }}
<sup><a class="text-muted small" href="#{{ ($anchor) }}"><i class="fas fa-link fa-fw"></i></a></sup>
</h{{ (.Level) }}>
{{- /* This comment removes trailing newlines. */ -}}

View file

@ -1,5 +1,6 @@
{{ $title := ((.Title) | default "") }} {{- $title := ((.Title) | default "") -}}
{{ $alt := ((.Text) | default "") }} {{- $alt := ((.Text) | default "") -}}
{{ $src := ((.Destination) | safeURL) }} {{- $src := ((.Destination) | safeURL) -}}
<img title="{{ ($title) }}" class="img-fluid img-thumbnail" src="{{ ($src) }}" alt="{{ ($alt) }}" loading="lazy"/> <img title="{{- ($title) -}}" class="img-fluid img-thumbnail" src="{{- ($src) -}}" alt="{{- ($alt) -}}" loading="lazy"/>
{{- /* This comment removes trailing newlines. */ -}}

View file

@ -15,3 +15,4 @@
{{ end }} {{ end }}
<a title="{{ ($title) }}" href="{{ ($viewer) }}{{ ($href) }}" target="{{ ($target) }}" rel="{{ ($rel) }}">{{ ($text) }}</a> <a title="{{ ($title) }}" href="{{ ($viewer) }}{{ ($href) }}" target="{{ ($target) }}" rel="{{ ($rel) }}">{{ ($text) }}</a>
{{- /* This comment removes trailing newlines. */ -}}

View file

@ -104,6 +104,10 @@
)) }} )) }}
{{ end }} {{ end }}
<div class="node-toc mb-3">
{{ (partial "module/node/toc" .) }}
</div>
{{ (.Content) }} {{ (.Content) }}
</div> </div>
{{ with (.Param "sources") }} {{ with (.Param "sources") }}

View file

@ -0,0 +1,16 @@
{{ $tocID := (printf "toc-%s" ((.File.UniqueID) | default "")) }}
<div class="accordion" id="accordion-{{ ($tocID) }}">
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapse-{{ ($tocID) }}" aria-expanded="false" aria-controls="collapse-{{ ($tocID) }}">
{{ (i18n "toc") }}
</button>
</h2>
<div id="collapse-{{ ($tocID) }}" class="accordion-collapse collapse" data-bs-parent="#accordion-{{ ($tocID) }}">
<div class="accordion-body">
{{ (.TableOfContents) }}
</div>
</div>
</div>
</div>