| Desktop | Mobile | | --- | --- | |  |  | Co-authored-by: stb <stb@noreply.git.hamburg.ccc.de> Reviewed-on: #73
19 lines
994 B
HTML
19 lines
994 B
HTML
{{- $result := dict -}}
|
|
{{- with findRESubmatch `!\[([^\]]*)\]\(\s*<?([^\s)>]+)|\{\{<\s*gallery-image\s([^}]*)>\}\}` .RawContent 1 -}}
|
|
{{- $alt := index . 0 1 -}}
|
|
{{- $dest := index . 0 2 -}}
|
|
{{- $credit := "" -}}
|
|
{{- with index . 0 3 -}}
|
|
{{- $dest = "" -}}
|
|
{{- $alt = "" -}}
|
|
{{- with findRESubmatch "\\bsrc=(?:\"([^\"]*)\"|`([^`]*)`)" . 1 }}{{ $dest = or (index . 0 1) (index . 0 2) }}{{ end -}}
|
|
{{- with findRESubmatch "\\balt=(?:\"([^\"]*)\"|`([^`]*)`)" . 1 }}{{ $alt = or (index . 0 1) (index . 0 2) }}{{ end -}}
|
|
{{- with findRESubmatch "\\bcredit=(?:\"([^\"]*)\"|`([^`]*)`)" . 1 }}{{ $credit = or (index . 0 1) (index . 0 2) }}{{ end -}}
|
|
{{- end -}}
|
|
{{- $resource := false -}}
|
|
{{- if not (findRE `^https?://` $dest) -}}
|
|
{{- $resource = or ($.Resources.Get (strings.TrimPrefix "./" $dest)) (resources.Get $dest) -}}
|
|
{{- end -}}
|
|
{{- $result = dict "alt" $alt "credit" $credit "dest" $dest "resource" $resource -}}
|
|
{{- end -}}
|
|
{{- return $result -}}
|