Make it compatible with Hugo 0.55 (#13680)

This commit adds two backwards compatible changes to prepare for the next Hugo version, most notable:

* All the `File` methods on `Page` has been deprecated and will give a warning in the next Hugo version. Adjust this by changing `.Dir` to ´.File.Dir` and similar.
* Version the capture shortcode to use the old behaviour for markdown rendering of shortcode inner content.
This commit is contained in:
Bjørn Erik Pedersen
2019-04-09 03:19:05 +02:00
committed by Kubernetes Prow Robot
parent 2d1fdb0666
commit b51bdc88cc
10 changed files with 19 additions and 12 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
{{ $menuSections := (where $docs.Sections ".Params.main_menu" true) }}
{{ range $menuSections }}
{{ if $p.IsDescendant . }}
<h1>{{ if not (strings.Contains .Dir "home")}}{{ .Params.bigheader | default .Title }}{{ end }}</h1>
<h1>{{ if not (strings.Contains .Path "home")}}{{ .Params.bigheader | default .Title }}{{ end }}</h1>
<h5>{{ .Params.abstract }}</h5>
{{ end }}
{{ end }}
+1 -1
View File
@@ -19,7 +19,7 @@
{{ end }}
{{ end }}
{{ if not .Params.noedit }}
<a href="https://github.com/kubernetes/website/edit/master/content/{{ site.Language.Lang }}/{{ .File.Path }}" class="button issue">{{ T "main_edit_this_page" }}</a>
{{ if .File }}<a href="https://github.com/kubernetes/website/edit/master/content/{{ site.Language.Lang }}/{{ .File.Path }}" class="button issue">{{ T "main_edit_this_page" }}</a>{{ end }}
{{ end }}
</div>
{{ if and (not .Params.showcommit) $.GitInfo }}
+3 -3
View File
@@ -1,10 +1,10 @@
{{ .ctx.Scratch.Set "sections" slice }}
<ul id="markdown-toc">
{{ range .ctx.Scratch.Get "blocks" }}
{{ if .content }}
{{ $.ctx.Scratch.Set "section" .content }}
{{ else}}
{{ 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 }}