Merge commit 'c0290655825e7bb36e13fb39f89d85b392cf1adc'

This commit is contained in:
Bjørn Erik Pedersen
2018-03-11 20:40:26 +01:00
88 changed files with 508 additions and 549 deletions

View File

@@ -1,5 +1,10 @@
{{ $file := .Get "file" }}
{{ $isHTML := strings.HasSuffix $file "html" }}
{{ $.Scratch.Set "codeLang" "" }}
{{ $suffix := findRE "(\\.[^.]+)$" $file 1 }}
{{ with $suffix }}
{{ $.Scratch.Set "codeLang" (index . 0 | strings.TrimPrefix ".") }}
{{ end }}
{{ with .Get "codeLang" }}{{ $.Scratch.Set "codeLang" . }}{{ end }}
<div class="code relative" id="{{ $file | urlize}}">
{{- with $file -}}
<div class="filename san-serif f6 dib lh-solid pl2 pv2">{{.}}</div>
@@ -11,7 +16,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 }}{{ if $isHTML }}{{- highlight .Inner "html" "" | -}}{{ else }}<pre><code>{{- .Inner | string -}}</code></pre>{{ end }}{{ end }}
{{ if .Get "nocode" }}{{ $.Inner }}{{ else }}{{ with $.Scratch.Get "codeLang" }}{{- highlight $.Inner . "" | -}}{{ else }}<pre><code>{{- .Inner | string -}}</code></pre>{{ end }}{{ end }}
</div>
</div>