diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-09-14 08:35:23 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-09-14 08:35:23 +0200 |
commit | b7ca3e1b3a83ef27bef841c319edb5b377cc4102 (patch) | |
tree | 9f93b8449d3c12312414f79a71e0d30dc248fd8b /docs/layouts | |
parent | 9b26b5487b5c5142fe9fb58681fe7d1dac95a291 (diff) | |
parent | 13e64d72763bf8d6d92d4cdfc15ed45ee9debfab (diff) |
Merge commit '13e64d72763bf8d6d92d4cdfc15ed45ee9debfab'
Diffstat (limited to 'docs/layouts')
-rw-r--r-- | docs/layouts/shortcodes/code.html | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/docs/layouts/shortcodes/code.html b/docs/layouts/shortcodes/code.html index 2ee20b1eb..eafc02e6b 100644 --- a/docs/layouts/shortcodes/code.html +++ b/docs/layouts/shortcodes/code.html @@ -1,12 +1,12 @@ {{ $file := .Get "file" }} -{{ $.Scratch.Set "codeLang" "" }} +{{ $codeLang := "" }} {{ $suffix := findRE "(\\.[^.]+)$" $file 1 }} {{ with $suffix }} -{{ $.Scratch.Set "codeLang" (index . 0 | strings.TrimPrefix ".") }} +{{ $codeLang = (index . 0 | strings.TrimPrefix ".") }} {{ end }} -{{ with .Get "codeLang" }}{{ $.Scratch.Set "codeLang" . }}{{ end }} -{{ if eq (.Scratch.Get "codeLang") "html"}} -{{ $.Scratch.Set "codeLang" "go-html-template" }} +{{ with .Get "codeLang" }}{{ $codeLang = . }}{{ end }} +{{ if eq $codeLang "html"}} +{{ $codeLang = "go-html-template" }} {{ end }} <div class="code relative" id="{{ $file | urlize}}"> {{- with $file -}} @@ -19,7 +19,7 @@ {{/* Functionality located within filesaver.js The copy here is located in the css with .copy class so it can be replaced with JS on success */}} {{end}} <div class="code-copy-content nt3" {{with .Get "download"}}id="{{.}}"{{end}}> - {{ if .Get "nocode" }}{{ $.Inner }}{{ else }}{{ with $.Scratch.Get "codeLang" }}{{- highlight $.Inner . "" | -}}{{ else }}<pre><code>{{- .Inner | string -}}</code></pre>{{ end }}{{ end }} + {{ if .Get "nocode" }}{{ $.Inner }}{{ else }}{{ with $codeLang }}{{- highlight $.Inner . "" | -}}{{ else }}<pre><code>{{- .Inner | string -}}</code></pre>{{ end }}{{ end }} </div> </div> |