chore: refactor some code
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
{{- $content := .content -}}
|
||||
{{- $content := .Content -}}
|
||||
|
||||
{{- if .ruby -}}
|
||||
{{- if .Ruby -}}
|
||||
{{- $content = partial "function/ruby.html" $content -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if .fraction -}}
|
||||
{{- if .Fraction -}}
|
||||
{{- $content = partial "function/fraction.html" $content -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if .fontawesome -}}
|
||||
{{- if .Fontawesome -}}
|
||||
{{- $content = partial "function/fontawesome.html" $content -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{{- /* ID */ -}}
|
||||
{{- $count := (.scratch.Get "this").count | default 1 -}}
|
||||
{{- $count := (.Scratch.Get "this").count | default 1 -}}
|
||||
{{- $id := printf "id-%d" $count -}}
|
||||
{{- $count | add 1 | .scratch.SetInMap "this" "count" -}}
|
||||
{{- with .content -}}
|
||||
{{- dict $id . | dict "data" | dict "config" | merge ($.scratch.Get "this") | $.scratch.Set "this" -}}
|
||||
{{- $count | add 1 | .Scratch.SetInMap "this" "count" -}}
|
||||
{{- with .Content -}}
|
||||
{{- dict $id . | dict "data" | dict "config" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
|
||||
{{- end -}}
|
||||
{{- return $id -}}
|
||||
|
||||
Reference in New Issue
Block a user