Files
FixIt/layouts/_markup/render-codeblock-json.html
T

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 -}}