Replace scratch with param
This commit is contained in:
@@ -1,4 +1,14 @@
|
||||
{{ $params := . }}
|
||||
|
||||
{{ $page := . }}
|
||||
{{ $listshowcontent := false }}
|
||||
|
||||
{{ if reflect.IsMap $params }}
|
||||
{{ $page = $params.page }}
|
||||
{{ $listshowcontent = $params.listshowcontent }}
|
||||
{{ else }}
|
||||
{{ $params = dict "listshowcontent" $listshowcontent "page" $page }}
|
||||
{{ end }}
|
||||
|
||||
{{ $class := slice "paige-article" }}
|
||||
{{ $draft := $page.Draft }}
|
||||
@@ -30,8 +40,8 @@
|
||||
|
||||
<article class="{{ $class }}">
|
||||
<div class="align-items-center d-flex flex-column mb-0">
|
||||
{{ partial "paige/metadata.html" $page }}
|
||||
{{ partial "paige/toc.html" $page }}
|
||||
{{ partial "paige/content.html" $page }}
|
||||
{{ partial "paige/metadata.html" $params }}
|
||||
{{ partial "paige/toc.html" $params }}
|
||||
{{ partial "paige/content.html" $params }}
|
||||
</div>
|
||||
</article>
|
||||
|
@@ -1,10 +1,18 @@
|
||||
{{ $params := . }}
|
||||
|
||||
{{ $page := . }}
|
||||
{{ $listshowcontent := false }}
|
||||
|
||||
{{ if reflect.IsMap $params }}
|
||||
{{ $page = $params.page }}
|
||||
{{ $listshowcontent = $params.listshowcontent }}
|
||||
{{ end }}
|
||||
|
||||
{{ $class := $page.Param "paige.main.content.class" | default "mw-100 paige-content" }}
|
||||
{{ $content := "" }}
|
||||
|
||||
{{ if $page.Param "paige.main.content.hide" | not }}
|
||||
{{ $content = cond ($page.Scratch.Get "paige_list_show_content" | not) ($page.Content | replaceRE `(<h[1-6] id="([^"]+)".+)(</h[1-6]+>)` (printf `${1}<a aria-label="%v" class="paige-header-link" href="#${2}">#</a>${3}` (i18n "paige_aria_section_link")) | safeHTML) $page.Content }}
|
||||
{{ $content = cond ($listshowcontent | not) ($page.Content | replaceRE `(<h[1-6] id="([^"]+)".+)(</h[1-6]+>)` (printf `${1}<a aria-label="%v" class="paige-header-link" href="#${2}">#</a>${3}` (i18n "paige_aria_section_link")) | safeHTML) $page.Content }}
|
||||
{{ end }}
|
||||
|
||||
{{ with $content }}
|
||||
|
@@ -1,4 +1,12 @@
|
||||
{{ $params := . }}
|
||||
|
||||
{{ $page := . }}
|
||||
{{ $listshowcontent := false }}
|
||||
|
||||
{{ if reflect.IsMap $params }}
|
||||
{{ $page = $params.page }}
|
||||
{{ $listshowcontent = $params.listshowcontent }}
|
||||
{{ end }}
|
||||
|
||||
{{ $authors := cond ($page.Param "paige.main.metadata.authors.hide" | not) (partial "paige/func-authors.html" $page) "" }}
|
||||
{{ $authorsclass := $page.Param "paige.main.metadata.authors.class" | default "paige-authors text-center text-secondary" }}
|
||||
@@ -29,7 +37,7 @@
|
||||
|
||||
<section {{ with $sectionclass }} class="{{ . }}" {{ end }}>
|
||||
{{ with $title }}
|
||||
<h1 {{ with $titleclass }} class="{{ . }}" {{ end }}>{{ with $titlelink }}<a href="{{ . }}">{{ . }}</a>{{ else }}{{ . }}{{ end }}{{ if $page.Scratch.Get "paige_list_show_content" }}<a aria-label="{{ i18n `paige_aria_page_link` }}" class="paige-header-link" href="{{ $titlepage }}">#</a>{{ end }}</h1>
|
||||
<h1 {{ with $titleclass }} class="{{ . }}" {{ end }}>{{ with $titlelink }}<a href="{{ . }}">{{ . }}</a>{{ else }}{{ . }}{{ end }}{{ if $listshowcontent }}<a aria-label="{{ i18n `paige_aria_page_link` }}" class="paige-header-link" href="{{ $titlepage }}">#</a>{{ end }}</h1>
|
||||
{{ end }}
|
||||
|
||||
{{ with $description }}
|
||||
|
@@ -5,8 +5,7 @@
|
||||
{{ $p := $page.Paginate $page.Pages }}
|
||||
<section id="paige-pages">
|
||||
{{ range $p.Pages }}
|
||||
{{ $page.Scratch.Set "paige_list_show_content" true }}
|
||||
{{ partial "paige/article.html" . }}
|
||||
{{ partial "paige/article.html" (dict "listshowcontent" true "page" .) }}
|
||||
{{ end }}
|
||||
</section>
|
||||
{{ if or $p.HasPrev $p.HasNext }}
|
||||
|
@@ -1,8 +1,16 @@
|
||||
{{ $params := . }}
|
||||
|
||||
{{ $page := . }}
|
||||
{{ $listshowcontent := false }}
|
||||
|
||||
{{ if reflect.IsMap $params }}
|
||||
{{ $page = $params.page }}
|
||||
{{ $listshowcontent = $params.listshowcontent }}
|
||||
{{ end }}
|
||||
|
||||
{{ $class := $page.Param "paige.main.table_of_contents.class" | default "border mb-3 pe-3 ps-3 pt-3 rounded" }}
|
||||
|
||||
{{ if and $page.Content ($page.Param "paige.main.table_of_contents.hide" | not) (not (eq ($page.Scratch.Get "paige_list_show_content") true)) (ne $page.TableOfContents `<nav id="TableOfContents"></nav>`) }}
|
||||
{{ if and $page.Content ($page.Param "paige.main.table_of_contents.hide" | not) (not $listshowcontent) (ne $page.TableOfContents `<nav id="TableOfContents"></nav>`) }}
|
||||
<section class="paige-toc">
|
||||
{{ with $class }}
|
||||
<div class="{{ . }}">
|
||||
|
Reference in New Issue
Block a user