clean up capture templates

pull/21359/head
Karen Bradshaw 2020-06-01 09:40:41 -04:00
parent 4b35d4d401
commit 59dbf9d693
9 changed files with 1 additions and 103 deletions

View File

@ -8,11 +8,7 @@
{{ if not .page.Params.notitle }}
<h1>{{ .page.Title }}</h1>
{{ end }}
{{ with .page.Params.content_template }}
{{ partial . $ }}
{{ else }}
{{ if and (not .page.Params.toc_hide) (not (.page.HasShortcode "toc")) }}
{{ .page.TableOfContents }}
{{ end }}
{{ .page.Content }}
{{ end }}
{{ .page.Content }}

View File

@ -1,4 +0,0 @@
{{- $capture_id := printf "__cid_%s" .id -}}
{{- with .ctx.Scratch.Get $capture_id -}}
{{- . -}}
{{- end -}}

View File

@ -1,14 +0,0 @@
{{/* We need to initialize the shortcode's page's content. This is a very special construct. We are building page blocks by setting state on the Page,
but we are not accessing its content. The .Content is lazily loaded in Hugo, so we must invoke that method before we do anything else. */}}
{{ if .page.Content }}{{ end }}
{{- $capture := printf "__cid_%s" .block -}}
{{- $block := .page.Scratch.Get $capture -}}
{{- if and (not $block) (not $.optional) -}}
{{ partial "templates/errorthrower.html" (dict "block" .block "heading" .heading "purpose" .purpose) . }}
{{- end -}}
{{- with $block -}}
{{- with $.heading }}
<h2 id="{{ . | anchorize }}">{{ . }}</h2>
{{ end -}}
{{ . }}
{{ end -}}

View File

@ -1,22 +0,0 @@
{{ .ctx.Scratch.Set "sections" slice }}
<ul id="markdown-toc">
{{ range .ctx.Scratch.Get "blocks" }}
{{ if .block }}
{{ $.ctx.Scratch.Set "section" (partial "templates/block" .) }}
{{ else}}
{{ $.ctx.Scratch.Set "section" .content }}
{{ end }}
{{ $section := $.ctx.Scratch.Get "section" }}
{{ $headers := findRE "<h2.*?>(.|\n)*?</h2>" $section }}
{{ range $headers }}
{{ $id := . | strings.TrimPrefix "<h2 id=\"" }}
{{ $id := $id | replaceRE "\">.*" "" }}
{{ $header := . | replaceRE "</?h2.*?>" "" | htmlUnescape | safeHTML }}
<li><a href="#{{ $id }}">{{ $header }}</a></li>
{{ end }}
{{ $.ctx.Scratch.Add "sections" $section }}
{{ end }}
</ul>
{{ range .ctx.Scratch.Get "sections" }}
{{ . }}
{{ end }}

View File

@ -1,8 +0,0 @@
{{ partial "templates/block" (dict "page" .page "block" "overview" "purpose" "states, in one or two sentences, the purpose of this document") }}
{{ .ctx.Scratch.Set "blocks" slice }}
{{ .ctx.Scratch.Add "blocks" (dict "page" .page "block" "body" "purpose" "supplies the body of the page content.") }}
{{ .ctx.Scratch.Add "blocks" (dict "content" .page.Content) }}
{{ .ctx.Scratch.Add "blocks" (dict "page" .page "block" "whatsnext" "heading" (i18n "whatsnext_heading") "optional" true ) }}
{{ partial "templates/blocks" . }}

View File

@ -1,14 +0,0 @@
<h2>ERROR</h2>
<p>You must define a <span style="font-family: monospace">{{ .block }}</span></p>
<p>This template requires that you provide text that {{ .purpose }}. The text in this block will
be displayed under the heading <b>{{ .heading }}</b>.
To get rid of this message and take advantage of this template, capture the <i>{{ .block }}</i> variable and populate it with content.
<!-- TEMPLATE_ERROR -->
</p>

View File

@ -1,11 +0,0 @@
{{ partial "templates/block" (dict "page" .page "block" "overview" "purpose" "states, in one or two sentences, the purpose of this document") }}
{{ .ctx.Scratch.Set "blocks" slice }}
{{ .ctx.Scratch.Add "blocks" (dict "page" .page "block" "prerequisites" "heading" (i18n "prerequisites_heading") "purpose" "lists action prerequisites and knowledge prerequisites.") }}
{{ .ctx.Scratch.Add "blocks" (dict "page" .page "block" "steps" "purpose" "lists a sequence of numbered steps that accomplish the task.'") }}
{{ .ctx.Scratch.Add "blocks" (dict "page" .page "block" "discussion" "optional" true ) }}
{{ .ctx.Scratch.Add "blocks" (dict "content" .page.Content) }}
{{ .ctx.Scratch.Add "blocks" (dict "page" .page "block" "whatsnext" "heading" (i18n "whatsnext_heading") "optional" true ) }}
{{ partial "templates/blocks" . }}

View File

@ -1,13 +0,0 @@
{{ partial "templates/block" (dict "page" .page "block" "overview" "purpose" "provides an overview" "optional" true) }}
{{ .ctx.Scratch.Set "blocks" slice }}
{{ .ctx.Scratch.Add "blocks" (dict "page" .page "block" "synopsis" "heading" "Synopsis" "purpose" "describes the component") }}
{{ .ctx.Scratch.Add "blocks" (dict "page" .page "block" "options" "heading" "Options" "purpose" "lists the options for the component") }}
{{ .ctx.Scratch.Add "blocks" (dict "page" .page "block" "parentoptions" "heading" "Options from Parent Commands" "optional" true ) }}
{{ .ctx.Scratch.Add "blocks" (dict "page" .page "block" "examples" "heading" "Examples" "optional" true ) }}
{{ .ctx.Scratch.Add "blocks" (dict "page" .page "block" "body" "purpose" "the body of the page content" "optional" true) }}
{{ .ctx.Scratch.Add "blocks" (dict "content" .page.Content) }}
{{ .ctx.Scratch.Add "blocks" (dict "page" .page "block" "seealso" "heading" "See Also" "optional" true ) }}
{{ partial "templates/blocks" . }}

View File

@ -1,12 +0,0 @@
{{ partial "templates/block" (dict "page" .page "block" "overview" "purpose" "states, in one or two sentences, the purpose of this document") }}
{{ .ctx.Scratch.Set "blocks" slice }}
{{ .ctx.Scratch.Add "blocks" (dict "page" .page "block" "objectives" "heading" (i18n "objectives_heading") "purpose" "lists the objectives for this tutorial.") }}
{{ .ctx.Scratch.Add "blocks" (dict "page" .page "block" "prerequisites" "heading" (i18n "prerequisites_heading") "purpose" "lists action prerequisites and knowledge prerequisites.") }}
{{ .ctx.Scratch.Add "blocks" (dict "page" .page "block" "lessoncontent" "purpose" "provides the lesson content for this tutorial.") }}
{{ .ctx.Scratch.Add "blocks" (dict "content" .page.Content) }}
{{ .ctx.Scratch.Add "blocks" (dict "page" .page "block" "cleanup" "heading" (i18n "cleanup_heading") "optional" true ) }}
{{ .ctx.Scratch.Add "blocks" (dict "page" .page "block" "whatsnext" "heading" (i18n "whatsnext_heading") "optional" true ) }}
{{ partial "templates/blocks" . }}