Replace scratch with param

This commit is contained in:
Will Faught
2023-02-12 17:23:11 -08:00
parent c47d3be282
commit 9e484bc707
5 changed files with 41 additions and 8 deletions

View File

@@ -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 }}