mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
highlight: handle string options in funnel file #169
as it may happen to be called with string options in case of documented `partial (compat)` mode
This commit is contained in:
parent
047606ff45
commit
7e073f9681
2 changed files with 11 additions and 11 deletions
|
@ -12,7 +12,14 @@
|
||||||
{{- else if eq $k "content" }}
|
{{- else if eq $k "content" }}
|
||||||
{{- $content = trim $v "\n\r" }}
|
{{- $content = trim $v "\n\r" }}
|
||||||
{{- else if eq $k "options" }}
|
{{- else if eq $k "options" }}
|
||||||
|
{{- if eq (printf "%T" $v) "string" }}
|
||||||
|
{{- range (split $v ",") }}
|
||||||
|
{{- $pair := split . "=" }}
|
||||||
|
{{- $options = $options | merge (dict (index $pair 0) (index $pair 1)) }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else }}
|
||||||
{{- $options = $v }}
|
{{- $options = $v }}
|
||||||
|
{{- end }}
|
||||||
{{- else if eq $k "type" }}
|
{{- else if eq $k "type" }}
|
||||||
{{- $type = $v }}
|
{{- $type = $v }}
|
||||||
{{- else if eq $k "wrap" }}
|
{{- else if eq $k "wrap" }}
|
||||||
|
@ -27,7 +34,7 @@
|
||||||
{{- if eq $k "wrap" }}
|
{{- if eq $k "wrap" }}
|
||||||
{{- $otherAttributes = (dict $k $v) | merge $otherAttributes }}
|
{{- $otherAttributes = (dict $k $v) | merge $otherAttributes }}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
{{- $otherOptions = $otherOptions | merge (dict $k $v) }}
|
{{- $otherOptions = (dict $k $v) | merge $otherOptions }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $options = $otherOptions }}
|
{{- $options = $otherOptions }}
|
||||||
|
|
|
@ -9,27 +9,20 @@
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $attributes := dict }}
|
{{- $attributes := dict }}
|
||||||
{{- $options := dict }}
|
{{- $options := dict }}
|
||||||
{{- $stringOptions := "" }}
|
|
||||||
{{- $otherOptions := dict }}
|
|
||||||
{{- $type := "" }}
|
{{- $type := "" }}
|
||||||
{{- range $k, $v := .Params }}
|
{{- range $k, $v := .Params }}
|
||||||
{{- if eq $k 0 }}
|
{{- if eq $k 0 }}
|
||||||
{{- $type = $v }}
|
{{- $type = $v }}
|
||||||
{{- else if eq $k 1 }}
|
{{- else if eq $k 1 }}
|
||||||
{{- $stringOptions = trim $v "\n\r\t " }}
|
{{- $options = $v }}
|
||||||
{{- else if eq $k "type" }}
|
{{- else if eq $k "type" }}
|
||||||
{{- $type = $v }}
|
{{- $type = $v }}
|
||||||
{{- else if eq $k "wrap" }}
|
{{- else if eq $k "wrap" }}
|
||||||
{{- $attributes = $attributes | merge (dict $k $v) }}
|
{{- $attributes = $attributes | merge (dict $k $v) }}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
{{- $otherOptions = $otherOptions | merge (dict $k $v) }}
|
{{- $options = $options | merge (dict $k $v) }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- range (split $stringOptions ",") }}
|
|
||||||
{{- $pair := split . "=" }}
|
|
||||||
{{- $options = $options | merge (dict (index $pair 0) (index $pair 1)) }}
|
|
||||||
{{- end }}
|
|
||||||
{{- $options = $options | merge $otherOptions }}
|
|
||||||
{{- partial "shortcodes/highlight.html" (dict
|
{{- partial "shortcodes/highlight.html" (dict
|
||||||
"context" .Page
|
"context" .Page
|
||||||
"attributes" $attributes
|
"attributes" $attributes
|
||||||
|
|
Loading…
Reference in a new issue