Convert historic pages to new gallery shortcode
This commit is contained in:
parent
9b894a8362
commit
89a0e7e353
87 changed files with 333 additions and 231 deletions
|
|
@ -1,12 +1,20 @@
|
|||
{{- /*
|
||||
Open Graph image for link previews. The theme's head/meta.html writes og:image only for the
|
||||
"image" param; without it, this uses the first image in the page's Markdown, scaled down to at
|
||||
most 1200 pixels wide, with its alt text as og:image:alt.
|
||||
"image" param; without it, this uses the first image in the page, a Markdown image or a
|
||||
gallery-image shortcode, scaled down to at most 1200 pixels wide, with its alt text as
|
||||
og:image:alt.
|
||||
*/ -}}
|
||||
{{- if not ($.Param "image") -}}
|
||||
{{- with findRESubmatch `!\[([^\]]*)\]\(\s*<?([^\s)>]+)` .RawContent 1 -}}
|
||||
{{- /* Whichever comes first: a Markdown image or a gallery-image shortcode (src and alt in "…" or `…`). */ -}}
|
||||
{{- with findRESubmatch `!\[([^\]]*)\]\(\s*<?([^\s)>]+)|\{\{<\s*gallery-image\s([^}]*)>\}\}` .RawContent 1 -}}
|
||||
{{- $alt := index . 0 1 -}}
|
||||
{{- $dest := index . 0 2 -}}
|
||||
{{- 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 -}}
|
||||
{{- end -}}
|
||||
{{- $url := "" -}}
|
||||
{{- $width := 0 -}}
|
||||
{{- $height := 0 -}}
|
||||
|
|
|
|||
Loading…
Reference in a new issue