mirror of https://github.com/istio/istio.io.git
Upgrade to Hugo 0.48 (#2471)
Take advantage of the simplified template syntax introduced in 0.48 in a bunch of places.
This commit is contained in:
parent
65bd311d78
commit
77a5540c04
|
@ -2,7 +2,7 @@ version: 2
|
|||
jobs:
|
||||
build:
|
||||
docker:
|
||||
- image: gcr.io/istio-testing/website-builder:2018-08-17
|
||||
- image: gcr.io/istio-testing/website-builder:2018-08-30
|
||||
|
||||
working_directory: ~/site
|
||||
|
||||
|
|
2
Makefile
2
Makefile
|
@ -1,5 +1,5 @@
|
|||
|
||||
img := gcr.io/istio-testing/website-builder:2018-08-17
|
||||
img := gcr.io/istio-testing/website-builder:2018-08-30
|
||||
docker := docker run -t -i --sig-proxy=true --rm -v $(shell pwd):/site -w /site $(img)
|
||||
|
||||
ifeq ($(CONTEXT),production)
|
||||
|
|
|
@ -8,28 +8,25 @@
|
|||
{{ $words := .Resources.ByType "page" }}
|
||||
|
||||
<div class="trampolines d-print-none">
|
||||
{{ $scratch := .Scratch }}
|
||||
{{ $scratch.Set "previous" "-" }}
|
||||
{{ $previous := "-" }}
|
||||
|
||||
{{ range $w := $words }}
|
||||
{{ $first := (upper (slicestr $w.Title 0 1)) }}
|
||||
{{ $previous := ($scratch.Get "previous") }}
|
||||
{{ $first := upper (slicestr $w.Title 0 1) }}
|
||||
|
||||
{{ if ne $first $previous }}
|
||||
{{ if ne $previous "-" }}
|
||||
|
|
||||
{{ end }}
|
||||
<a href="#{{ $first }}" aria-label="Words starting with the letter {{ $first }}">{{ $first }}</a>
|
||||
{{ $scratch.Set "previous" $first }}
|
||||
{{ $previous = $first }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<div class="entries">
|
||||
{{ $scratch.Set "previous" "-" }}
|
||||
{{ $previous := "-" }}
|
||||
{{ range $w := $words }}
|
||||
{{ $first := (upper (slicestr $w.Title 0 1)) }}
|
||||
{{ $previous := ($scratch.Get "previous") }}
|
||||
{{ $first := upper (slicestr $w.Title 0 1) }}
|
||||
|
||||
{{ if ne $first $previous }}
|
||||
{{ if ne $previous "-" }}
|
||||
|
@ -37,7 +34,7 @@
|
|||
{{ end }}
|
||||
<h4 id="{{ $first }}">{{ $first }}</h4>
|
||||
<dl>
|
||||
{{ $scratch.Set "previous" $first }}
|
||||
{{ $previous = $first }}
|
||||
{{ end }}
|
||||
|
||||
{{ $name := $w.Title | urlize }}
|
||||
|
|
|
@ -38,7 +38,6 @@ MARKDOWN ERROR: image caption ends with a period.
|
|||
{{ end }}
|
||||
|
||||
{{/* Turn relative values for $link into absolute URLs */}}
|
||||
{{ .Scratch.Set "link" $link }}
|
||||
|
||||
{{ $prefix := slicestr $link 0 1 }}
|
||||
{{ if (ne $prefix "/") }}
|
||||
|
@ -46,13 +45,12 @@ MARKDOWN ERROR: image caption ends with a period.
|
|||
{{ if (ne $prefix "https://") }}
|
||||
{{ $prefix := slicestr $link 0 3 }}
|
||||
{{ if (eq $prefix "../") }}
|
||||
{{ .Scratch.Set "link" (printf "/%s%s" .Page.Dir (slicestr $link 3)) }}
|
||||
{{ $link = printf "/%s%s" .Page.Dir (slicestr $link 3) }}
|
||||
{{ else }}
|
||||
{{ .Scratch.Set "link" (printf "/%s%s" .Page.Dir $link) }}
|
||||
{{ $link = printf "/%s%s" .Page.Dir $link }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ $link := .Scratch.Get "link" }}
|
||||
|
||||
<figure style="width: {{ $width }}">
|
||||
<div class="wrapper-with-intrinsic-ratio" style="padding-bottom: {{ $ratio }}">
|
||||
|
|
|
@ -1,30 +1,27 @@
|
|||
{{ $dir_name := index (last 2 (split .Page.Dir "/" )) 0 }}
|
||||
{{ $parts := split $dir_name "." }}
|
||||
{{ if eq (len $parts) 2 }}
|
||||
{{ .Scratch.Set "short_version" $dir_name }}
|
||||
{{ .Scratch.Set "full_version" (printf "%s.0" $dir_name) }}
|
||||
{{ .Scratch.Set "patch" false }}
|
||||
{{ else }}
|
||||
{{ .Scratch.Set "short_version" (printf "%s.%s" (index $parts 0) (index $parts 1)) }}
|
||||
{{ .Scratch.Set "full_version" $dir_name }}
|
||||
{{ .Scratch.Set "patch" true }}
|
||||
|
||||
{{ $short_version := $dir_name }}
|
||||
{{ $full_version := printf "%s.0" $dir_name }}
|
||||
{{ $patch := false }}
|
||||
|
||||
{{ if ne (len $parts) 2 }}
|
||||
{{ $short_version = printf "%s.%s" (index $parts 0) (index $parts 1) }}
|
||||
{{ $full_version = $dir_name }}
|
||||
{{ $patch = true }}
|
||||
{{ end }}
|
||||
{{ $short_version := .Scratch.Get "short_version" }}
|
||||
{{ $full_version := .Scratch.Get "full_version" }}
|
||||
{{ $patch := .Scratch.Get "patch" }}
|
||||
|
||||
{{ $first := index .Site.Data.releases 0 }}
|
||||
{{ $second := index .Site.Data.releases 1 }}
|
||||
|
||||
{{ .Scratch.Set "type_of_note" "current" }}
|
||||
{{ $type_of_note := "current" }}
|
||||
{{ if eq $short_version $first.name }}
|
||||
{{ .Scratch.Set "type_of_note" "prelim" }}
|
||||
{{ $type_of_note = "prelim" }}
|
||||
{{ else if eq $short_version $second.name }}
|
||||
{{ .Scratch.Set "type_of_note" "current" }}
|
||||
{{ $type_of_note = "current" }}
|
||||
{{ else }}
|
||||
{{ .Scratch.Set "type_of_note" "archive" }}
|
||||
{{ $type_of_note = "archive" }}
|
||||
{{ end }}
|
||||
{{ $type_of_note := .Scratch.Get "type_of_note" }}
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
|
@ -47,7 +44,7 @@
|
|||
<a class="btn btn-istio" href="https://istio.io">{{ $dir_name }} DOCS</a>
|
||||
{{ end }}
|
||||
|
||||
{{ if $patch}}
|
||||
{{ if $patch }}
|
||||
<a class="btn btn-istio" href="https://github.com/istio/istio/compare/{{ $short_version }}.0...{{ $full_version }}">{{ $dir_name }} CHANGES</a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
@ -58,7 +55,7 @@
|
|||
<a class="btn btn-istio" href="https://archive.istio.io/v{{ $short_version }}">{{ $dir_name }} DOCS</a>
|
||||
{{ end }}
|
||||
|
||||
{{ if $patch}}
|
||||
{{ if $patch }}
|
||||
<a class="btn btn-istio" href="https://github.com/istio/istio/compare/{{ $short_version }}.0...{{ $full_version }}">{{ $dir_name }} CHANGES</a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
|
|
@ -1,65 +1,73 @@
|
|||
{{/* Inserts a text block into the HTML. See https://preliminary.istio.io/about/contribute/writing-a-new-topic/#embedding-preformatted-blocks for details
|
||||
|
||||
NOTE: The stuff below cannot be indented. If it is, it can cause the markdown
|
||||
parser to insert spurious paragraphs around the PRE blocks, which turns out to
|
||||
be invalid HTML
|
||||
*/}}
|
||||
{{ $scratch := .Scratch }}
|
||||
{{/* Inserts a text block into the HTML. See https://preliminary.istio.io/about/contribute/writing-a-new-topic/#embedding-preformatted-blocks for details */}}
|
||||
{{ $downloadas := "" }}
|
||||
{{ if .Get 2 }}
|
||||
{{ $scratch.Set "downloadas" (.Get 2) }}
|
||||
{{ $downloadas = .Get 2 }}
|
||||
{{ end }}
|
||||
|
||||
{{ $syntax := "error" }}
|
||||
{{ $text := "MARKDOWN ERROR: text block does not specify syntax" }}
|
||||
{{ $output := "" }}
|
||||
|
||||
{{ if .Get 0 }}
|
||||
{{ $lines := split (strings.TrimRight " " (trim .Inner "\n")) "\n" }}
|
||||
{{ $line0 := index $lines 0 }}
|
||||
{{ if hasPrefix $line0 " "}}{{ $scratch.Set "indent" 16 }}
|
||||
{{ else if hasPrefix $line0 " "}}{{ $scratch.Set "indent" 12 }}
|
||||
{{ else if hasPrefix $line0 " "}}{{ $scratch.Set "indent" 8 }}
|
||||
{{ else if hasPrefix $line0 " "}}{{ $scratch.Set "indent" 4 }}
|
||||
{{ else }}{{ $scratch.Set "indent" 0 }}
|
||||
{{ $lines := split (strings.TrimRight " " (trim .Inner "\n")) "\n" }}
|
||||
|
||||
{{ $line0 := index $lines 0 }}
|
||||
{{ $indent := 0 }}
|
||||
{{ if hasPrefix $line0 " "}}{{ $indent = 16 }}
|
||||
{{ else if hasPrefix $line0 " "}}{{ $indent = 12 }}
|
||||
{{ else if hasPrefix $line0 " "}}{{ $indent = 8 }}
|
||||
{{ else if hasPrefix $line0 " "}}{{ $indent = 4 }}
|
||||
{{ end }}
|
||||
|
||||
{{ $text = "" }}
|
||||
{{ range $line := $lines }}
|
||||
{{ if gt (len $line) $indent }}
|
||||
{{ $l := substr $line $indent }}
|
||||
{{ $text = printf "%s\n%s" $text $l }}
|
||||
{{ else }}
|
||||
{{ $text = printf "%s\n%s" $text $line }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ $text = trim $text "\n" }}
|
||||
{{ $syntax = .Get 0 }}
|
||||
{{ $output = .Get 1 }}
|
||||
{{ end }}
|
||||
{{ $scratch.Set "text" "" }}
|
||||
{{ range $line := $lines }}
|
||||
{{ if gt (len $line) ($scratch.Get "indent") }}
|
||||
{{ $l := substr $line ($scratch.Get "indent") }}
|
||||
{{ $scratch.Set "text" (printf "%s\n%s" ($scratch.Get "text") $l )}}
|
||||
|
||||
{{ if (hasPrefix $text " ") }}
|
||||
{{ $syntax = "error" }}
|
||||
{{ $text = "MARKDOWN ERROR: text blocks need to not be indented, or indented by a multiple of 4 spaces" }}
|
||||
{{ end }}
|
||||
|
||||
{{ if eq $syntax "bash" }}
|
||||
{{ if not (hasPrefix $text "$") }}
|
||||
{{ $syntax = "error" }}
|
||||
{{ $text = "MARKDOWN ERROR: text block specifies a bash syntax, but first line does not start with $" }}
|
||||
{{ else }}
|
||||
{{ if hasPrefix (trim $text " ") "$ cat <<EOF " }}
|
||||
{{ $text = replace $text "$ cat" "cat" }}
|
||||
{{ else }}
|
||||
{{ $syntax = "command" }}
|
||||
{{ if $output }}
|
||||
{{ $syntax = printf "command-output-as-%s" $output }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if $downloadas }}
|
||||
<pre><code class='language-{{ $syntax }}' data-downloadas='{{ $downloadas }}'>{{ $text }}</code></pre>
|
||||
{{ else }}
|
||||
{{ $scratch.Set "text" (printf "%s\n%s" ($scratch.Get "text") $line )}}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ $scratch.Set "text" (trim ($scratch.Get "text") "\n") }}
|
||||
{{ $scratch.Set "syntax" (.Get 0) }}
|
||||
{{ $scratch.Set "output" (.Get 1) }}
|
||||
{{ else }}
|
||||
{{ $scratch.Set "syntax" "error" }}
|
||||
{{ $scratch.Set "text" "MARKDOWN ERROR: text block does not specify syntax" }}
|
||||
{{ end }}
|
||||
{{ if (hasPrefix ($scratch.Get "text") " ") }}
|
||||
{{ $scratch.Set "syntax" "error" }}
|
||||
{{ $scratch.Set "text" "MARKDOWN ERROR: text blocks need to not be indented, or indented by a multiple of 4 spaces" }}
|
||||
{{ end }}
|
||||
{{ if eq ($scratch.Get "syntax") "bash" }}
|
||||
{{ if not (hasPrefix ($scratch.Get "text") "$") }}
|
||||
{{ $scratch.Set "syntax" "error" }}
|
||||
{{ $scratch.Set "text" "MARKDOWN ERROR: text block specifies a bash syntax, but first line does not start with $" }}
|
||||
{{ else }}
|
||||
{{ if hasPrefix (trim ($scratch.Get "text") " ") "$ cat <<EOF " }}{{ $scratch.Set "text" (replace ($scratch.Get "text") "$ cat" "cat") }}
|
||||
{{ else }}{{ $scratch.Set "syntax" "command" }}
|
||||
{{ if ($scratch.Get "output") }}{{ $scratch.Set "syntax" (printf "command-output-as-%s" ($scratch.Get "output")) }}{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ if $scratch.Get "downloadas"}}
|
||||
<pre><code class='language-{{ $scratch.Get "syntax" }}' data-downloadas='{{ $scratch.Get "downloadas" }}'>{{ $scratch.Get "text" }}</code></pre>
|
||||
{{ else }}
|
||||
<pre><code class='language-{{ $scratch.Get "syntax" }}'>{{ $scratch.Get "text" }}</code></pre>
|
||||
<pre><code class='language-{{ $syntax }}'>{{ $text }}</code></pre>
|
||||
{{ end }}
|
||||
|
||||
{{/* include a link to the special embedded @@ references so the links are statically checked as we build the site */}}
|
||||
{{ $branch := .Site.Data.args.branch_name }}
|
||||
{{ $links := findRE "@(.*?)@" ($scratch.Get "text") }}
|
||||
{{ $links := findRE "@(.*?)@" $text }}
|
||||
{{ range $link := $links }}
|
||||
{{ $target := trim $link "@" }}
|
||||
{{ if gt (len $target) 0 }}
|
||||
{{ $href := printf "https://raw.githubusercontent.com/istio/istio/%s/%s" $branch $target }}
|
||||
<a hidden style="display:none" href="{{ $href }}"></a>
|
||||
{{ end }}
|
||||
{{ $target := trim $link "@" }}
|
||||
{{ if gt (len $target) 0 }}
|
||||
{{ $href := printf "https://raw.githubusercontent.com/istio/istio/%s/%s" $branch $target }}
|
||||
<a hidden style="display:none" href="{{ $href }}"></a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
{{ $scratch := .Scratch }}
|
||||
{{ $name := split (.Get "url") "/" | last 1 }}
|
||||
{{ $scratch.Set "downloadas" (index $name 0) }}
|
||||
{{ $downloadas := index $name 0 }}
|
||||
{{ if .Get "downloadas" }}
|
||||
{{ $scratch.Set "downloadas" (.Get "downloadas") }}
|
||||
{{ $downloadas = .Get "downloadas" }}
|
||||
{{ end }}
|
||||
<pre data-src='{{ .Get "url" }}'><code class='language-{{ .Get "syntax" }}' data-downloadas='{{ $scratch.Get "downloadas" }}'></code></pre>
|
||||
<pre data-src='{{ .Get "url" }}'><code class='language-{{ .Get "syntax" }}' data-downloadas='{{ $downloadas }}'></code></pre>
|
|
@ -1,15 +1,14 @@
|
|||
{{/* Inserts a text file into the HTML. See https://preliminary.istio.io/about/contribute/writing-a-new-topic/#embedding-preformatted-blocks for details */}}
|
||||
{{ $scratch := .Scratch }}
|
||||
{{ $name := split (.Get "file") "/" | last 1 }}
|
||||
{{ $scratch.Set "downloadas" (index $name 0) }}
|
||||
{{ $downloadas := index $name 0 }}
|
||||
{{ if .Get "downloadas" }}
|
||||
{{ $scratch.Set "downloadas" (.Get "downloadas") }}
|
||||
{{ $downloadas = .Get "downloadas" }}
|
||||
{{ end }}
|
||||
{{ $file := readFile (.Get "file") }}
|
||||
{{ if (.Get "snippet") }}
|
||||
{{ $pattern := printf "(?msU)(.*\\$snippet %s.*$\\n)(.*)(?-s)(\\n^.*\\$endsnippet.*$)(?s-U)(.*)" (.Get "snippet") }}
|
||||
{{ $match := replaceRE $pattern "$2" $file }}
|
||||
<pre><code class='language-{{ .Get "syntax" }}' data-downloadas='{{ $scratch.Get "downloadas" }}'>{{ $match }}</code></pre>
|
||||
<pre><code class='language-{{ .Get "syntax" }}' data-downloadas='{{ $downloadas }}'>{{ $match }}</code></pre>
|
||||
{{ else }}
|
||||
<pre><code class='language-{{ .Get "syntax" }}' data-downloadas='{{ $scratch.Get "downloadas" }}'>{{ $file }}</code></pre>
|
||||
<pre><code class='language-{{ .Get "syntax" }}' data-downloadas='{{ $downloadas }}'>{{ $file }}</code></pre>
|
||||
{{ end }}
|
||||
|
|
|
@ -3,4 +3,4 @@
|
|||
command = "make netlify"
|
||||
|
||||
[build.environment]
|
||||
HUGO_VERSION = "0.47"
|
||||
HUGO_VERSION = "0.48"
|
||||
|
|
|
@ -16,7 +16,7 @@ RUN apk add --no-cache \
|
|||
git \
|
||||
&& apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ --allow-untrusted gnu-libiconv
|
||||
|
||||
ENV HUGO_VERSION=0.47
|
||||
ENV HUGO_VERSION=0.48
|
||||
ADD https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.tar.gz /tmp
|
||||
RUN tar -xf /tmp/hugo_${HUGO_VERSION}_Linux-64bit.tar.gz -C /tmp \
|
||||
&& mkdir -p /usr/local/sbin \
|
||||
|
|
Loading…
Reference in New Issue