chore: refactor some code

This commit is contained in:
Dillon
2020-05-18 21:30:33 +08:00
parent c1016df5d6
commit 8f53c999e5
23 changed files with 90 additions and 90 deletions

View File

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

View File

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