mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-12-24 14:48:44 +00:00
7e073f9681
as it may happen to be called with string options in case of documented `partial (compat)` mode
32 lines
No EOL
882 B
HTML
32 lines
No EOL
882 B
HTML
{{- $version := split hugo.Version "." }}
|
|
{{- $major := int (index $version 0) }}
|
|
{{- $minor := int (index $version 1) }}
|
|
{{- $content := "" }}
|
|
{{- if or (and (eq $major 0) (ge $minor 110)) (gt $major 0) }}
|
|
{{- $content = .InnerDeindent }}
|
|
{{- else }}
|
|
{{- $content = .Inner }}
|
|
{{- end }}
|
|
{{- $attributes := dict }}
|
|
{{- $options := dict }}
|
|
{{- $type := "" }}
|
|
{{- range $k, $v := .Params }}
|
|
{{- if eq $k 0 }}
|
|
{{- $type = $v }}
|
|
{{- else if eq $k 1 }}
|
|
{{- $options = $v }}
|
|
{{- else if eq $k "type" }}
|
|
{{- $type = $v }}
|
|
{{- else if eq $k "wrap" }}
|
|
{{- $attributes = $attributes | merge (dict $k $v) }}
|
|
{{- else }}
|
|
{{- $options = $options | merge (dict $k $v) }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- partial "shortcodes/highlight.html" (dict
|
|
"context" .Page
|
|
"attributes" $attributes
|
|
"content" $content
|
|
"options" $options
|
|
"type" $type
|
|
) }} |