diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2021-06-09 10:58:18 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2021-06-14 17:00:32 +0200 |
commit | d392893cd73dc00c927f342778f6dca9628d328e (patch) | |
tree | e2ea3eec09f36b7122ecdbc498c3c130e240e85c /docs/layouts/shortcodes/code-toggle.html | |
parent | a886dd53b80322e1edf924f2ede4d4ea037c5baf (diff) |
Misc config loading fixes
The main motivation behind this is simplicity and correctnes, but the new small config library is also faster:
```
BenchmarkDefaultConfigProvider/Viper-16 252418 4546 ns/op 2720 B/op 30 allocs/op
BenchmarkDefaultConfigProvider/Custom-16 450756 2651 ns/op 1008 B/op 6 allocs/op
```
Fixes #8633
Fixes #8618
Fixes #8630
Updates #8591
Closes #6680
Closes #5192
Diffstat (limited to 'docs/layouts/shortcodes/code-toggle.html')
-rw-r--r-- | docs/layouts/shortcodes/code-toggle.html | 59 |
1 files changed, 33 insertions, 26 deletions
diff --git a/docs/layouts/shortcodes/code-toggle.html b/docs/layouts/shortcodes/code-toggle.html index da4b00719..0b92d520d 100644 --- a/docs/layouts/shortcodes/code-toggle.html +++ b/docs/layouts/shortcodes/code-toggle.html @@ -1,34 +1,41 @@ {{ $file := .Get "file" }} {{ $code := "" }} {{ with .Get "config" }} -{{ $file = $file | default "config" }} -{{ $sections := (split . ".") }} -{{ $configSection := index $.Site.Data.docs.config $sections }} -{{ $code = dict $sections $configSection }} + {{ $file = $file | default "config" }} + {{ $sections := (split . ".") }} + {{ $configSection := index $.Site.Data.docs.config $sections }} + {{ $code = dict $sections $configSection }} + {{ if $.Get "skipHeader"}} + {{ $code = $configSection }} + {{ end }} {{ else }} -{{ $code = $.Inner }} + {{ $code = $.Inner }} {{ end }} {{ $langs := (slice "yaml" "toml" "json") }} <div class="code relative" {{ with $file }}id="{{ . | urlize}}"{{ end }}> - <div class="code-nav flex flex-nowrap items-stretch"> - {{- with $file -}} - <div class="san-serif f6 dib lh-solid pl2 pv2 mr2">{{ . }}.</div> - {{- end -}} - {{ range $langs }} - <button data-toggle-tab="{{ . }}" class="tab-button {{ cond (eq . "yaml") "active" ""}} ba san-serif f6 dib lh-solid ph2 pv2">{{ . }}</button> - {{ end }} - </div> - <div class="tab-content"> - {{ range $langs }} - <div data-pane="{{ . }}" class="code-copy-content nt3 tab-pane {{ cond (eq . "yaml") "active" ""}}"> - {{ highlight ($code | transform.Remarshal . | safeHTML) . ""}} - </div> - {{ if ne ($.Get "copy") "false" }} - <button class="needs-js copy copy-toggle bg-accent-color-dark f6 absolute top-0 right-0 lh-solid hover-bg-primary-color-dark bn white ph3 pv2" title="Copy this code to your clipboard." data-clipboard-action="copy" aria-label="copy button"> - </button> - {{/* 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}} - {{ end }} - </div> - + <div class="code-nav flex flex-nowrap items-stretch"> + {{- with $file -}} + <div class="san-serif f6 dib lh-solid pl2 pv2 mr2"> + {{ . }}. + </div> + {{- end -}} + {{ range $langs }} + <button data-toggle-tab="{{ . }}" class="tab-button {{ cond (eq . "yaml") "active" ""}} ba san-serif f6 dib lh-solid ph2 pv2"> + {{ . }} + </button> + + {{ end }} + </div> + <div class="tab-content"> + {{ range $langs }} + <div data-pane="{{ . }}" class="code-copy-content nt3 tab-pane {{ cond (eq . "yaml") "active" ""}}"> + {{ highlight ($code | transform.Remarshal . | safeHTML) . ""}} + </div> + {{ if ne ($.Get "copy") "false" }} + <button class="needs-js copy copy-toggle bg-accent-color-dark f6 absolute top-0 right-0 lh-solid hover-bg-primary-color-dark bn white ph3 pv2" title="Copy this code to your clipboard." data-clipboard-action="copy" aria-label="copy button"></button> + {{/* 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}} + {{ end }} + </div> + </div> |