2023-09-30 13:19:21
This commit is contained in:
parent
1fde56fdf5
commit
25325e11d9
7 changed files with 35 additions and 5 deletions
|
@ -37,6 +37,7 @@ sources: { other: 'Sources' }
|
|||
stats: { other: 'Statistics' }
|
||||
sys_path: { other: 'System path' }
|
||||
tags: { other: 'Tags' }
|
||||
toc: { other: 'Contents' }
|
||||
type: { other: 'Type' }
|
||||
uuid: { other: 'UUID' }
|
||||
word_count: { other: 'Word count' }
|
||||
|
|
|
@ -37,6 +37,7 @@ sources: { other: 'Источники' }
|
|||
stats: { other: 'Статистика' }
|
||||
sys_path: { other: 'Системный путь' }
|
||||
tags: { other: 'Теги' }
|
||||
toc: { other: 'Содержание' }
|
||||
type: { other: 'Тип' }
|
||||
uuid: { other: 'UUID' }
|
||||
word_count: { other: 'Количество слов' }
|
||||
|
|
6
layouts/_default/_markup/render-heading.html
Normal file
6
layouts/_default/_markup/render-heading.html
Normal 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. */ -}}
|
|
@ -1,5 +1,6 @@
|
|||
{{ $title := ((.Title) | default "") }}
|
||||
{{ $alt := ((.Text) | default "") }}
|
||||
{{ $src := ((.Destination) | safeURL) }}
|
||||
{{- $title := ((.Title) | default "") -}}
|
||||
{{- $alt := ((.Text) | default "") -}}
|
||||
{{- $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. */ -}}
|
||||
|
|
|
@ -14,4 +14,5 @@
|
|||
{{ 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. */ -}}
|
|
@ -104,6 +104,10 @@
|
|||
)) }}
|
||||
{{ end }}
|
||||
|
||||
<div class="node-toc mb-3">
|
||||
{{ (partial "module/node/toc" .) }}
|
||||
</div>
|
||||
|
||||
{{ (.Content) }}
|
||||
</div>
|
||||
{{ with (.Param "sources") }}
|
||||
|
|
16
layouts/partials/module/node/toc.html
Normal file
16
layouts/partials/module/node/toc.html
Normal 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>
|
Loading…
Reference in a new issue