mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
19 lines
875 B
HTML
19 lines
875 B
HTML
{{- $jsonViewer := .Attributes | merge .Page.Params.jsonViewer | merge .Page.Site.Params.jsonViewer -}}
|
|
{{- if $jsonViewer.enable | and (ne hugo.Context.MarkupScope "home") -}}
|
|
{{- $attrs := printf `expand-depth="%v"` $jsonViewer.expanddepth -}}
|
|
{{- $copyable := false -}}
|
|
{{- with $jsonViewer.copyable -}}
|
|
{{- $copyable = dict "copyText" (T "assets.copyText") "copiedText" (T "assets.copiedText") -}}
|
|
{{- end -}}
|
|
{{- with $jsonViewer.sort -}}
|
|
{{- $attrs = " sort" | add $attrs -}}
|
|
{{- end -}}
|
|
{{- with $jsonViewer.boxed -}}
|
|
{{- $attrs = " boxed" | add $attrs -}}
|
|
{{- end -}}
|
|
<json-viewer value="{{ .Inner | jsonify }}" {{ $attrs | safeHTMLAttr }}{{ with $copyable}} copyable="{{ . | jsonify }}"{{ end }}></json-viewer>
|
|
{{- .Page.Store.Set "hasJsonViewer" true -}}
|
|
{{- else -}}
|
|
{{- partial "plugin/code-block-wrapper.html" . -}}
|
|
{{- end -}}
|