feat(shortcode): refactor and improve image shortcode (#187)

This commit is contained in:
Dillon
2020-03-19 12:35:37 +08:00
committed by GitHub
parent 84d48f37dc
commit 774e831a21
17 changed files with 651 additions and 280 deletions

View File

@@ -1,12 +1,10 @@
{{- $options := dict -}}
{{- $options := cond .IsNamedParams (.Get "href") (.Get 0) | dict "href" -}}
{{- if .IsNamedParams -}}
{{- $options = dict "href" (.Get "href") | merge $options -}}
{{- $options = dict "title" (.Get "title") | merge $options -}}
{{- $options = dict "rel" (.Get "rel") | merge $options -}}
{{- $options = dict "class" (.Get "class") | merge $options -}}
{{- $options = dict "content" (.Get "content") | merge $options -}}
{{- $options = dict "title" (.Get "title") | merge $options -}}
{{- $options = dict "class" (.Get "class") | merge $options -}}
{{- $options = dict "rel" (.Get "rel") | merge $options -}}
{{- else -}}
{{- $options = dict "href" (.Get 0) | merge $options -}}
{{- $options = dict "content" (.Get 1 | default (.Get 0)) | merge $options -}}
{{- $options = dict "title" (.Get 2) | merge $options -}}
{{- end -}}