feat(shortcode): add script shortcode (#359)

This commit is contained in:
Dillon
2020-05-15 17:43:04 +08:00
committed by GitHub
parent c5a0ec61c9
commit d3d2d751ec
18 changed files with 132 additions and 39 deletions

View File

@@ -2,5 +2,7 @@
{{- $count := (.scratch.Get "this").count | default 1 -}}
{{- $id := printf "id-%d" $count -}}
{{- $count | add 1 | .scratch.SetInMap "this" "count" -}}
{{- dict $id .content | dict "data" | dict "config" | merge (.scratch.Get "this") | .scratch.Set "this" -}}
{{- with .content -}}
{{- dict $id . | dict "data" | dict "config" | merge ($.scratch.Get "this") | $.scratch.Set "this" -}}
{{- end -}}
{{- return $id -}}