Convert site to Hugo (#8316)
This commit converts content and layout to use Hugo.
This commit is contained in:
committed by
k8s-ci-robot
parent
7745f0e0c5
commit
7f3b633aa0
@@ -0,0 +1,14 @@
|
||||
{{/* 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 -}}
|
||||
@@ -0,0 +1,20 @@
|
||||
{{ .ctx.Scratch.Set "sections" slice }}
|
||||
<ul id="markdown-toc">
|
||||
{{ range .ctx.Scratch.Get "blocks" }}
|
||||
{{ if .content }}
|
||||
{{ $.ctx.Scratch.Set "section" .content }}
|
||||
{{ else}}
|
||||
{{ $.ctx.Scratch.Set "section" (partial "templates/block" .) }}
|
||||
{{ end }}
|
||||
{{ $section := $.ctx.Scratch.Get "section" }}
|
||||
{{ $headers := findRE "<h2.*?>(.|\n)*?</h2>" $section }}
|
||||
{{ range $headers }}
|
||||
{{ $header := . | replaceRE "</?h2.*?>" "" | htmlUnescape }}
|
||||
<li><a href="#{{ $header | anchorize }}">{{ $header }}</a></li>
|
||||
{{ end }}
|
||||
{{ $.ctx.Scratch.Add "sections" $section }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ range .ctx.Scratch.Get "sections" }}
|
||||
{{ . }}
|
||||
{{ end }}
|
||||
@@ -0,0 +1,8 @@
|
||||
{{ 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" "What's next" "optional" true ) }}
|
||||
|
||||
{{ partial "templates/blocks" . }}
|
||||
@@ -0,0 +1,14 @@
|
||||
<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>
|
||||
@@ -0,0 +1,29 @@
|
||||
|
||||
<a href="#" id="feature-state-dialog-link" class="ui-state-default ui-corner-all"><span class="ui-icon ui-icon-newwin"></span>{{ .page.Title }}</a>
|
||||
<div id="feature-state-dialog" class="ui-dialog-content" title="{{ .page.Title }}">
|
||||
{{ .page.Content | markdownify }}
|
||||
</div>
|
||||
<script>
|
||||
$(function(){
|
||||
|
||||
$( "#feature-state-dialog" ).dialog({
|
||||
autoOpen: false,
|
||||
width: {{ .width | default "600" }},
|
||||
buttons: [
|
||||
{
|
||||
text: "Ok",
|
||||
click: function() {
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
// Link to open the dialog
|
||||
$( "#feature-state-dialog-link" ).click(function( event ) {
|
||||
$( "#feature-state-dialog" ).dialog( "open" );
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,21 @@
|
||||
<div style="margin-top: 10px; margin-bottom: 10px;">
|
||||
{{ $for_k8s_version := .for_k8s_version | default (.page.Param "version") }}
|
||||
{{ $width := .width | default "600" }}
|
||||
{{ $state := .state }}
|
||||
<b>FEATURE STATE:</b> <code>Kubernetes {{ $for_k8s_version }}</code>
|
||||
{{/* docs/templates is a Hugo page bundle */}}
|
||||
{{ $templates_path := "docs/templates" }}
|
||||
{{ $templates := .page.Site.GetPage "page" $templates_path }}
|
||||
{{ with $templates.Resources }}
|
||||
{{ $template_path := printf "**feature-state-%s*" $state }}
|
||||
{{ $content_template := .GetMatch $template_path }}
|
||||
{{ with $content_template }}
|
||||
{{ $dialog := dict "page" $content_template "for_k8s_version" $for_k8s_version "width" $width }}
|
||||
{{ partial "templates/feature-dialog.html" $dialog }}
|
||||
{{ else }}
|
||||
{{ errorf "[%s] template not found in %s" .page.Site.Language.Lang $template_path }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ errorf "[%s] templates not found in docs/templates" .page.Site.Language.Lang }}
|
||||
{{ end }}
|
||||
</div>
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
{{ 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" "Before you begin" "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" "What's next" "optional" true ) }}
|
||||
|
||||
{{ partial "templates/blocks" . }}
|
||||
@@ -0,0 +1,12 @@
|
||||
{{ 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" "Objectives" "purpose" "lists the objectives for this tutorial.") }}
|
||||
{{ .ctx.Scratch.Add "blocks" (dict "page" .page "block" "prerequisites" "heading" "Before you begin" "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" "Cleaning up" "optional" true ) }}
|
||||
{{ .ctx.Scratch.Add "blocks" (dict "page" .page "block" "whatsnext" "heading" "What's next" "optional" true ) }}
|
||||
|
||||
{{ partial "templates/blocks" . }}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<div class="track">{{ .Params.track }}</div>
|
||||
<div class="topheader">
|
||||
Introduction
|
||||
</div>
|
||||
<div class="sections">sections in this doc</div>
|
||||
<div id="user-journeys-toc" class="tablebar">
|
||||
<!-- This TOC section is populated with Javascript, see js/user-journeys-toc.js -->
|
||||
</div>
|
||||
|
||||
<div class="docsection1">
|
||||
|
||||
{{ partial "templates/block" (dict "page" . "block" "overview" "purpose" "provides an introduction of this level.") }}
|
||||
|
||||
{{- $capture := printf "__cid_%s" "body" -}}
|
||||
{{- $body := .Scratch.Get $capture -}}
|
||||
{{ with $body }}
|
||||
{{ $b := replace $body "<h2" "</div><h2" }}
|
||||
{{ $b := replace $b "</h2>" "</h2><div class=\"docsection1\"" }}
|
||||
{{ $b }}
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<script src="{{ "js/user-journeys/toc.js" | relURL }}"></script>
|
||||
Reference in New Issue
Block a user