Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugoDocs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-08-29 12:03:31 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-08-29 12:03:31 +0300
commit5ea938ad60272ec2cefc9b5279cf5859c331cdd2 (patch)
tree1658ef67e67434503904a4f1c0a454def8afcb0a /layouts
parent2708dcd57bf9a38f83f638ddb7d8ec9146fdc0a7 (diff)
Remove some Scratch
Diffstat (limited to 'layouts')
-rw-r--r--layouts/shortcodes/code.html12
1 files changed, 6 insertions, 6 deletions
diff --git a/layouts/shortcodes/code.html b/layouts/shortcodes/code.html
index 2ee20b1eb..eafc02e6b 100644
--- a/layouts/shortcodes/code.html
+++ b/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>