24 lines
739 B
Smarty
24 lines
739 B
Smarty
{{- define "joinListWithComma" -}}
|
|
{{ range $k, $v := . }}{{ if $k }},{{ end }}{{ $v }}{{ end }}
|
|
{{- end -}}
|
|
|
|
{{- define "template" -}}
|
|
{{- $name := index . 0 -}}
|
|
{{- $context := index . 1 -}}
|
|
{{- $v:= $context.Template.Name | split "/" -}}
|
|
{{- $n := len $v -}}
|
|
{{- $last := sub $n 1 | printf "_%d" | index $v -}}
|
|
{{- $wtf := $context.Template.Name | replace $last $name -}}
|
|
{{ include $wtf $context }}
|
|
{{- end -}}
|
|
|
|
{{- define "hash" -}}
|
|
{{- $name := index . 0 -}}
|
|
{{- $context := index . 1 -}}
|
|
{{- $v:= $context.Template.Name | split "/" -}}
|
|
{{- $n := len $v -}}
|
|
{{- $last := sub $n 1 | printf "_%d" | index $v -}}
|
|
{{- $wtf := $context.Template.Name | replace $last $name -}}
|
|
{{- include $wtf $context | sha256sum | quote -}}
|
|
{{- end -}}
|