Initial version
This commit is contained in:
commit
ed5653a7fc
211 changed files with 11043 additions and 0 deletions
41
themes/zen/layouts/shortcodes/audio.html
Normal file
41
themes/zen/layouts/shortcodes/audio.html
Normal file
|
@ -0,0 +1,41 @@
|
|||
{{ $caption := .Get "caption" -}}
|
||||
{{ $class := .Get "class" -}}
|
||||
{{ $preload := .Get "preload" | default "metadata" -}}
|
||||
{{ $src := .Get "src" -}}
|
||||
|
||||
{{ $resource := false -}}
|
||||
{{ $static := false -}}
|
||||
{{ $type := false -}}
|
||||
|
||||
{{ if and $src (fileExists (path.Join "/static" $src)) -}}
|
||||
{{ $static = true -}}
|
||||
{{ $src = relURL $src -}}
|
||||
{{ else if $src -}}
|
||||
{{ $src = strings.TrimLeft "/" $src -}}
|
||||
{{ with resources.Get $src -}}
|
||||
{{ $resource = . -}}
|
||||
{{ end -}}
|
||||
{{ with .Page.Resources.Get $src -}}
|
||||
{{ $resource = . -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ if $resource -}}
|
||||
{{ $src = $resource.RelPermalink -}}
|
||||
{{ $type = $resource.MediaType }}
|
||||
{{ end -}}
|
||||
|
||||
{{ if not $src -}}
|
||||
{{ warnf "%s shortcode number %d in \"content/%s\" is missing the \"src\" attribute." .Name .Ordinal .Page.File.Path -}}
|
||||
{{ else if not (or $static $resource) -}}
|
||||
{{ warnf "%s shortcode number %d in \"content/%s\" has an error in the \"src\" attribute." .Name .Ordinal .Page.File.Path -}}
|
||||
{{ end -}}
|
||||
|
||||
<figure class="audio{{ with $class }} {{ . }}{{ end }}">
|
||||
<audio controls preload="{{ $preload }}">
|
||||
<source src="{{ $src }}" {{ with $type }}type="{{ . }}"{{ end }}>
|
||||
</audio>
|
||||
{{ with $caption -}}
|
||||
<figcaption>{{ . | markdownify }}</figcaption>
|
||||
{{ end -}}
|
||||
</figure>
|
5
themes/zen/layouts/shortcodes/button.html
Normal file
5
themes/zen/layouts/shortcodes/button.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
{{ $class := .Get "class" -}}
|
||||
{{ $newtab := .Get "newtab" | default false -}}
|
||||
{{ $src := .Get "src" -}}
|
||||
{{ $text := .Get "text" -}}
|
||||
<a class="button{{ with $class }} {{ . }}{{ end }}" href="{{ $src }}"{{ if $newtab }} target="_blank" rel="noopener noreferrer"{{ end }}>{{ $text }}</a>
|
1
themes/zen/layouts/shortcodes/clear.html
Normal file
1
themes/zen/layouts/shortcodes/clear.html
Normal file
|
@ -0,0 +1 @@
|
|||
<div class="clearfix"></div>
|
16
themes/zen/layouts/shortcodes/contact.html
Normal file
16
themes/zen/layouts/shortcodes/contact.html
Normal file
|
@ -0,0 +1,16 @@
|
|||
<p class="error message js-hidden">{{ i18n "js_required" }}</p>
|
||||
<p class="contact-submitted status message hidden">{{ i18n "contact_submitted" }}</p>
|
||||
<p class="contact-error error message hidden">{{ i18n "contact_error" }}</p>
|
||||
|
||||
<form class="contact-form hidden" data-protect="/php/contact.php" action="#" method="post" accept-charset="UTF-8">
|
||||
<label for="edit-name">{{ i18n "contact_name" }}</label>
|
||||
<input type="text" id="edit-name" name="name" placeholder="{{ i18n "contact_name_placeholder" }}" required autofocus>
|
||||
<label for="edit-mail">{{ i18n "contact_mail" }}</label>
|
||||
<input type="email" id="edit-mail" name="email" placeholder="{{ i18n "contact_mail_placeholder" }}" required>
|
||||
<input type="text" id="edit-url" class="hidden" name="url" placeholder="{{ i18n "contact_honeypot" }}">
|
||||
<label for="edit-subject">{{ i18n "contact_subject" }}</label>
|
||||
<input type="text" id="edit-subject" name="subject" placeholder="{{ i18n "contact_subject_placeholder" }}" required>
|
||||
<label for="edit-message">{{ i18n "contact_message" }}</label>
|
||||
<textarea id="edit-message" name="message" rows="5" placeholder="{{ i18n "contact_message_placeholder" }}" required></textarea>
|
||||
<button type="submit" name="submit" disabled>{{ i18n "contact_submit" }}</button>
|
||||
</form>
|
6
themes/zen/layouts/shortcodes/details.html
Normal file
6
themes/zen/layouts/shortcodes/details.html
Normal file
|
@ -0,0 +1,6 @@
|
|||
{{ $class := .Get "class" -}}
|
||||
{{ $summary := .Get "summary" -}}
|
||||
<details{{ with $class }} class="{{ . }}"{{ end }}>
|
||||
{{ with $summary }}<summary>{{ . }}</summary>{{ end }}
|
||||
{{ .Inner | $.Page.RenderString (dict "display" "block") }}
|
||||
</details>
|
107
themes/zen/layouts/shortcodes/figure.html
Normal file
107
themes/zen/layouts/shortcodes/figure.html
Normal file
|
@ -0,0 +1,107 @@
|
|||
{{ $alt := .Get "alt" -}}
|
||||
{{ $attr := .Get "attr" -}}
|
||||
{{ $attrlink := .Get "attrlink" -}}
|
||||
{{ $caption := .Get "caption" -}}
|
||||
{{ $class := .Get "class" -}}
|
||||
{{ $height := .Get "height" -}}
|
||||
{{ $link := .Get "link" -}}
|
||||
{{ $size := .Get "size" -}}
|
||||
{{ $src := .Get "src" -}}
|
||||
{{ $srcset := .Get "srcset" -}}
|
||||
{{ $title := .Get "title" -}}
|
||||
{{ $width := .Get "width" -}}
|
||||
|
||||
{{ $maxwidth := site.Params.imageMaxWidth -}}
|
||||
{{ $realwidth := 0 -}}
|
||||
{{ $realheight := 0 -}}
|
||||
{{ $resource := false -}}
|
||||
{{ $srcsetw := (slice) -}}
|
||||
{{ $static := false -}}
|
||||
|
||||
{{ if and $src (fileExists (path.Join "/static" $src)) -}}
|
||||
{{ with (imageConfig (path.Join "/static" $src)) -}}
|
||||
{{ $realwidth = .Width -}}
|
||||
{{ $realheight = .Height -}}
|
||||
{{ end -}}
|
||||
{{ $static = true -}}
|
||||
{{ $src = relURL $src -}}
|
||||
{{ else if $src -}}
|
||||
{{ $src = strings.TrimLeft "/" $src -}}
|
||||
{{ with resources.Get $src -}}
|
||||
{{ $resource = . -}}
|
||||
{{ end -}}
|
||||
{{ with .Page.Resources.Get $src -}}
|
||||
{{ $resource = . -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ if $resource -}}
|
||||
{{ if $size -}}
|
||||
{{ $image := $resource.Resize $size -}}
|
||||
{{ $src = $image.RelPermalink -}}
|
||||
{{ if or $width $height -}}
|
||||
{{ $realwidth = $image.Width -}}
|
||||
{{ $realheight = $image.Height -}}
|
||||
{{ else -}}
|
||||
{{ $width = $image.Width -}}
|
||||
{{ $height = $image.Height -}}
|
||||
{{ end -}}
|
||||
{{ if $srcset -}}
|
||||
{{ $srcsetw = $srcsetw | append (printf "%s %sw" $src (strings.TrimRight "x" $size)) -}}
|
||||
{{ end -}}
|
||||
{{ else -}}
|
||||
{{ $src = $resource.RelPermalink -}}
|
||||
{{ $realwidth = $resource.Width -}}
|
||||
{{ $realheight = $resource.Height -}}
|
||||
{{ end -}}
|
||||
{{ if $srcset -}}
|
||||
{{ range $set := split $srcset " " -}}
|
||||
{{ $image := $resource.Resize (printf "%sx" $set) -}}
|
||||
{{ $srcsetw = $srcsetw | append (printf "%s %sw" $image.RelPermalink $set) -}}
|
||||
{{ end -}}
|
||||
{{ $width = "" -}}
|
||||
{{ $height = "" -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ if and $width $height -}}
|
||||
{{ $width = int $width -}}
|
||||
{{ $height = int $height -}}
|
||||
{{ else if $width -}}
|
||||
{{ $width = int $width -}}
|
||||
{{ $height = $realheight -}}
|
||||
{{ if and ($realwidth) (lt ($width) ($realwidth)) -}}
|
||||
{{ $height = (mul ($realheight) (div (add ($width) 0.0) ($realwidth))) -}}
|
||||
{{ $height = (math.Round $height) -}}
|
||||
{{ end -}}
|
||||
{{ else if $height -}}
|
||||
{{ $width = $realwidth -}}
|
||||
{{ $height = int $height -}}
|
||||
{{ if and ($realheight) (lt ($height) ($realheight)) -}}
|
||||
{{ $width = (mul ($realwidth) (div (add ($height) 0.0) ($realheight))) -}}
|
||||
{{ $width = (math.Round $width) -}}
|
||||
{{ end -}}
|
||||
{{ else if and ($maxwidth) (lt ($maxwidth) ($realwidth)) -}}
|
||||
{{ $width = ($maxwidth) -}}
|
||||
{{ $height = (mul ($realheight) (div (add ($width) 0.0) ($realwidth))) -}}
|
||||
{{ $height = (math.Round $height) -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ if not $src -}}
|
||||
{{ warnf "%s shortcode number %d in \"content/%s\" is missing the \"src\" attribute." .Name .Ordinal .Page.File.Path -}}
|
||||
{{ else if not (or $static $resource) -}}
|
||||
{{ warnf "%s shortcode number %d in \"content/%s\" has an error in the \"src\" attribute." .Name .Ordinal .Page.File.Path -}}
|
||||
{{ end -}}
|
||||
|
||||
<figure class="image{{ with $class }} {{ . }}{{ end }}">
|
||||
{{ with $link }}<a href="{{ . }}">{{ end -}}
|
||||
<img src="{{ $src }}"{{ with $srcsetw }} srcset="{{ delimit . ", " }}"{{ end }}{{ if isset .Params "alt" }} alt="{{ $alt }}"{{ end }}{{ with $width }} width="{{ . }}"{{ end }}{{ with $height }} height="{{ . }}"{{ end }}>
|
||||
{{- if $link }}</a>{{ end }}
|
||||
{{ if or $title $caption $attr -}}
|
||||
<figcaption>
|
||||
{{ with $title }}<strong>{{ . }}</strong><br>{{ end -}}
|
||||
{{- $caption | markdownify }}{{ if and $caption $attr }} {{ end -}}
|
||||
{{ with $attrlink }}<a href="{{ . }}">{{ end }}{{ $attr | markdownify }}{{ if $attrlink }}</a>{{ end -}}
|
||||
</figcaption>
|
||||
{{ end -}}
|
||||
</figure>
|
36
themes/zen/layouts/shortcodes/file.html
Normal file
36
themes/zen/layouts/shortcodes/file.html
Normal file
|
@ -0,0 +1,36 @@
|
|||
{{ $class := .Get "class" -}}
|
||||
{{ $newtab := .Get "newtab" | default false -}}
|
||||
{{ $src := .Get "src" -}}
|
||||
{{ $text := .Get "text" -}}
|
||||
|
||||
{{ $resource := false -}}
|
||||
{{ $static := false -}}
|
||||
|
||||
{{ if and $src (fileExists (path.Join "/static" $src)) -}}
|
||||
{{ $static = true -}}
|
||||
{{ $src = relURL $src -}}
|
||||
{{ else if $src -}}
|
||||
{{ $src = strings.TrimLeft "/" $src -}}
|
||||
{{ with resources.Get $src -}}
|
||||
{{ $resource = . -}}
|
||||
{{ end -}}
|
||||
{{ with .Page.Resources.Get $src -}}
|
||||
{{ $resource = . -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ if $resource -}}
|
||||
{{ $src = $resource.RelPermalink -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ if not $text -}}
|
||||
{{ $text = path.Base $src -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ if not $src -}}
|
||||
{{ warnf "%s shortcode number %d in \"content/%s\" is missing the \"src\" attribute." .Name .Ordinal .Page.File.Path -}}
|
||||
{{ else if not (or $static $resource) -}}
|
||||
{{ warnf "%s shortcode number %d in \"content/%s\" has an error in the \"src\" attribute." .Name .Ordinal .Page.File.Path -}}
|
||||
{{ end -}}
|
||||
|
||||
<a class="file{{ with $class }} {{ . }}{{ end }}" href="{{ $src }}"{{ if $newtab }} target="_blank" rel="noopener noreferrer"{{ end }}>{{ $text }}</a>
|
94
themes/zen/layouts/shortcodes/img.html
Normal file
94
themes/zen/layouts/shortcodes/img.html
Normal file
|
@ -0,0 +1,94 @@
|
|||
{{ $alt := .Get "alt" -}}
|
||||
{{ $class := .Get "class" -}}
|
||||
{{ $height := .Get "height" -}}
|
||||
{{ $link := .Get "link" -}}
|
||||
{{ $size := .Get "size" -}}
|
||||
{{ $src := .Get "src" -}}
|
||||
{{ $srcset := .Get "srcset" -}}
|
||||
{{ $width := .Get "width" -}}
|
||||
|
||||
{{ $maxwidth := site.Params.imageMaxWidth -}}
|
||||
{{ $realwidth := 0 -}}
|
||||
{{ $realheight := 0 -}}
|
||||
{{ $resource := false -}}
|
||||
{{ $srcsetw := (slice) -}}
|
||||
{{ $static := false -}}
|
||||
|
||||
{{ if and $src (fileExists (path.Join "/static" $src)) -}}
|
||||
{{ with (imageConfig (path.Join "/static" $src)) -}}
|
||||
{{ $realwidth = .Width -}}
|
||||
{{ $realheight = .Height -}}
|
||||
{{ end -}}
|
||||
{{ $static = true -}}
|
||||
{{ $src = relURL $src -}}
|
||||
{{ else if $src -}}
|
||||
{{ $src = strings.TrimLeft "/" $src -}}
|
||||
{{ with resources.Get $src -}}
|
||||
{{ $resource = . -}}
|
||||
{{ end -}}
|
||||
{{ with .Page.Resources.Get $src -}}
|
||||
{{ $resource = . -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ if $resource -}}
|
||||
{{ if $size -}}
|
||||
{{ $image := $resource.Resize $size -}}
|
||||
{{ $src = $image.RelPermalink -}}
|
||||
{{ if or $width $height -}}
|
||||
{{ $realwidth = $image.Width -}}
|
||||
{{ $realheight = $image.Height -}}
|
||||
{{ else -}}
|
||||
{{ $width = $image.Width -}}
|
||||
{{ $height = $image.Height -}}
|
||||
{{ end -}}
|
||||
{{ if $srcset -}}
|
||||
{{ $srcsetw = $srcsetw | append (printf "%s %sw" $src (strings.TrimRight "x" $size)) -}}
|
||||
{{ end -}}
|
||||
{{ else -}}
|
||||
{{ $src = $resource.RelPermalink -}}
|
||||
{{ $realwidth = $resource.Width -}}
|
||||
{{ $realheight = $resource.Height -}}
|
||||
{{ end -}}
|
||||
{{ if $srcset -}}
|
||||
{{ range $set := split $srcset " " -}}
|
||||
{{ $image := $resource.Resize (printf "%sx" $set) -}}
|
||||
{{ $srcsetw = $srcsetw | append (printf "%s %sw" $image.RelPermalink $set) -}}
|
||||
{{ end -}}
|
||||
{{ $width = "" -}}
|
||||
{{ $height = "" -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ if and $width $height -}}
|
||||
{{ $width = int $width -}}
|
||||
{{ $height = int $height -}}
|
||||
{{ else if $width -}}
|
||||
{{ $width = int $width -}}
|
||||
{{ $height = $realheight -}}
|
||||
{{ if and ($realwidth) (lt ($width) ($realwidth)) -}}
|
||||
{{ $height = (mul ($realheight) (div (add ($width) 0.0) ($realwidth))) -}}
|
||||
{{ $height = (math.Round $height) -}}
|
||||
{{ end -}}
|
||||
{{ else if $height -}}
|
||||
{{ $width = $realwidth -}}
|
||||
{{ $height = int $height -}}
|
||||
{{ if and ($realheight) (lt ($height) ($realheight)) -}}
|
||||
{{ $width = (mul ($realwidth) (div (add ($height) 0.0) ($realheight))) -}}
|
||||
{{ $width = (math.Round $width) -}}
|
||||
{{ end -}}
|
||||
{{ else if and ($maxwidth) (lt ($maxwidth) ($realwidth)) -}}
|
||||
{{ $width = ($maxwidth) -}}
|
||||
{{ $height = (mul ($realheight) (div (add ($width) 0.0) ($realwidth))) -}}
|
||||
{{ $height = (math.Round $height) -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ if not $src -}}
|
||||
{{ warnf "%s shortcode number %d in \"content/%s\" is missing the \"src\" attribute." .Name .Ordinal .Page.File.Path -}}
|
||||
{{ else if not (or $static $resource) -}}
|
||||
{{ warnf "%s shortcode number %d in \"content/%s\" has an error in the \"src\" attribute." .Name .Ordinal .Page.File.Path -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ with $link }}<a class="image-link" href="{{ . }}">{{ end -}}
|
||||
<img class="image{{ with $class }} {{ . }}{{ end }}" src="{{ $src }}"{{ with $srcsetw }} srcset="{{ delimit . ", " }}"{{ end }}{{ if isset .Params "alt" }} alt="{{ $alt }}"{{ end }}{{ with $width }} width="{{ . }}"{{ end }}{{ with $height }} height="{{ . }}"{{ end }}>
|
||||
{{- if $link }}</a>{{ end }}
|
1
themes/zen/layouts/shortcodes/math.html
Normal file
1
themes/zen/layouts/shortcodes/math.html
Normal file
|
@ -0,0 +1 @@
|
|||
${{ .Inner }}$
|
1
themes/zen/layouts/shortcodes/reflink.html
Normal file
1
themes/zen/layouts/shortcodes/reflink.html
Normal file
|
@ -0,0 +1 @@
|
|||
{{ with site.GetPage (.Get 0) }}<a href="{{ .RelPermalink }}">{{ .Title }}</a>{{ end }}
|
21
themes/zen/layouts/shortcodes/search.html
Normal file
21
themes/zen/layouts/shortcodes/search.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
<p class="error message js-hidden">{{ i18n "js_required" }}</p>
|
||||
<p class="search-loading status message hidden">{{ i18n "search_loading" }}</p>
|
||||
|
||||
<div class="search-input hidden">
|
||||
<form id="search-form" class="search-form" action="#" method="post" accept-charset="UTF-8" role="search">
|
||||
<label for="query" class="visually-hidden">{{ i18n "search_title" }}</label>
|
||||
<input type="search" id="query" name="query" class="search-text" placeholder="{{ i18n "search_placeholder" }}" maxlength="128">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="search-results"></div>
|
||||
|
||||
<template>
|
||||
<article class="search-result list-view">
|
||||
<header>
|
||||
<h2 class="title mt--s mb--xxs"><a href="#">Title here</a></h2>
|
||||
<div class="submitted"><time class="created-date">Date here</time></div>
|
||||
</header>
|
||||
<p class="content">Summary here</p>
|
||||
</article>
|
||||
</template>
|
65
themes/zen/layouts/shortcodes/svg.html
Normal file
65
themes/zen/layouts/shortcodes/svg.html
Normal file
|
@ -0,0 +1,65 @@
|
|||
{{ $alt := .Get "alt" -}}
|
||||
{{ $caption := .Get "caption" -}}
|
||||
{{ $class := .Get "class" -}}
|
||||
{{ $height := .Get "height" -}}
|
||||
{{ $inline := .Get "inline" | default false -}}
|
||||
{{ $link := .Get "link" -}}
|
||||
{{ $src := .Get "src" -}}
|
||||
{{ $width := .Get "width" -}}
|
||||
|
||||
{{ $resource := false -}}
|
||||
{{ $static := false -}}
|
||||
|
||||
{{ if and $src (fileExists (path.Join "/static" $src)) -}}
|
||||
{{ $static = true -}}
|
||||
{{ $src = relURL $src -}}
|
||||
{{ if $inline -}}
|
||||
{{ $src = readFile (path.Join "/static" $src) -}}
|
||||
{{ end -}}
|
||||
{{ else if $src -}}
|
||||
{{ $src = strings.TrimLeft "/" $src -}}
|
||||
{{ with resources.Get $src -}}
|
||||
{{ $resource = . -}}
|
||||
{{ end -}}
|
||||
{{ with .Page.Resources.Get $src -}}
|
||||
{{ $resource = . -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ if $resource -}}
|
||||
{{ if $inline -}}
|
||||
{{ $src = $resource.Content -}}
|
||||
{{ else -}}
|
||||
{{ $src = $resource.RelPermalink -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ if and $width $height -}}
|
||||
{{ $width = int $width -}}
|
||||
{{ $height = int $height -}}
|
||||
{{ else if $width -}}
|
||||
{{ $width = int $width -}}
|
||||
{{ else if $height -}}
|
||||
{{ $height = int $height -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ if not $src -}}
|
||||
{{ warnf "%s shortcode number %d in \"content/%s\" is missing the \"src\" attribute." .Name .Ordinal .Page.File.Path -}}
|
||||
{{ else if not (or $static $resource) -}}
|
||||
{{ warnf "%s shortcode number %d in \"content/%s\" has an error in the \"src\" attribute." .Name .Ordinal .Page.File.Path -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ if $caption }}<figure class="image image--svg{{ with $class }} {{ . }}{{ end }}">{{ end -}}
|
||||
{{ with $link }}<a class="image-link" href="{{ . }}">{{ end -}}
|
||||
{{ if $inline -}}
|
||||
<div class="image image--svg{{ with $class }} {{ . }}{{ end }}">{{ $src | safeHTML }}</div>
|
||||
{{ else -}}
|
||||
<img class="image image--svg{{ with $class }} {{ . }}{{ end }}" src="{{ $src }}"{{ if isset .Params "alt" }} alt="{{ $alt }}"{{ end }}{{ with $width }} width="{{ . }}"{{ end }}{{ with $height }} height="{{ . }}"{{ end }}>
|
||||
{{ end -}}
|
||||
{{- if $link }}</a>{{ end }}
|
||||
{{ if $caption -}}
|
||||
<figcaption>
|
||||
{{ $caption | markdownify -}}
|
||||
</figcaption>
|
||||
</figure>
|
||||
{{ end -}}
|
67
themes/zen/layouts/shortcodes/video.html
Normal file
67
themes/zen/layouts/shortcodes/video.html
Normal file
|
@ -0,0 +1,67 @@
|
|||
{{ $autoplay := .Get "autoplay" -}}
|
||||
{{ $caption := .Get "caption" -}}
|
||||
{{ $class := .Get "class" -}}
|
||||
{{ $loop := .Get "loop" -}}
|
||||
{{ $poster := .Get "poster" -}}
|
||||
{{ $preload := .Get "preload" | default "metadata" -}}
|
||||
{{ $src := .Get "src" -}}
|
||||
{{ $width := .Get "width" -}}
|
||||
|
||||
{{ $posterres := false -}}
|
||||
{{ $resource := false -}}
|
||||
{{ $static := false -}}
|
||||
{{ $type := false -}}
|
||||
|
||||
{{ if and $src (fileExists (path.Join "/static" $src)) -}}
|
||||
{{ $static = true -}}
|
||||
{{ $src = relURL $src -}}
|
||||
{{ else if $src -}}
|
||||
{{ $src = strings.TrimLeft "/" $src -}}
|
||||
{{ with resources.Get $src -}}
|
||||
{{ $resource = . -}}
|
||||
{{ end -}}
|
||||
{{ with .Page.Resources.Get $src -}}
|
||||
{{ $resource = . -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ if $resource -}}
|
||||
{{ $src = $resource.RelPermalink -}}
|
||||
{{ $type = $resource.MediaType -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ if and $poster (fileExists (path.Join "/static" $poster)) -}}
|
||||
{{ $poster = relURL $poster -}}
|
||||
{{ else if $poster -}}
|
||||
{{ $poster = strings.TrimLeft "/" $poster -}}
|
||||
{{ with resources.Get $poster -}}
|
||||
{{ $posterres = . -}}
|
||||
{{ end -}}
|
||||
{{ with .Page.Resources.Get $poster -}}
|
||||
{{ $posterres = . -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ if $posterres -}}
|
||||
{{ if $width -}}
|
||||
{{ $image := $posterres.Resize (printf "%sx" $width) -}}
|
||||
{{ $poster = $image.RelPermalink -}}
|
||||
{{ else -}}
|
||||
{{ $poster = $posterres.RelPermalink -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ if not $src -}}
|
||||
{{ warnf "%s shortcode number %d in \"content/%s\" is missing the \"src\" attribute." .Name .Ordinal .Page.File.Path -}}
|
||||
{{ else if not (or $static $resource) -}}
|
||||
{{ warnf "%s shortcode number %d in \"content/%s\" has an error in the \"src\" attribute." .Name .Ordinal .Page.File.Path -}}
|
||||
{{ end -}}
|
||||
|
||||
<figure class="video{{ with $class }} {{ . }}{{ end }}">
|
||||
<video controls preload="{{ $preload }}" {{ with $width }}width="{{ . }}"{{ end }} {{ with $poster }}poster="{{ . }}"{{ end }} {{ with $autoplay }}autoplay="{{ . }}"{{ end }} {{ with $loop }}loop="{{ . }}"{{ end }}>
|
||||
<source src="{{ $src }}" {{ with $type }}type="{{ . }}"{{ end }}>
|
||||
</video>
|
||||
{{ with $caption -}}
|
||||
<figcaption>{{ . | markdownify }}</figcaption>
|
||||
{{ end -}}
|
||||
</figure>
|
1
themes/zen/layouts/shortcodes/wrapper-end.html
Normal file
1
themes/zen/layouts/shortcodes/wrapper-end.html
Normal file
|
@ -0,0 +1 @@
|
|||
</div>
|
1
themes/zen/layouts/shortcodes/wrapper-start.html
Normal file
1
themes/zen/layouts/shortcodes/wrapper-start.html
Normal file
|
@ -0,0 +1 @@
|
|||
<div class="{{ .Get 0 }}">
|
3
themes/zen/layouts/shortcodes/wrapper.html
Normal file
3
themes/zen/layouts/shortcodes/wrapper.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
{{ $display := "inline" -}}
|
||||
{{ if eq (.Get 1) "block" }}{{ $display = "block" }}{{ end -}}
|
||||
<div class="{{ .Get 0 }}">{{ if eq (.Get 1) "nomarkdown" }}{{ .Inner }}{{ else }}{{ .Inner | $.Page.RenderString (dict "display" $display) }}{{ end }}</div>
|
Loading…
Add table
Add a link
Reference in a new issue