update
This commit is contained in:
parent
187900fd5b
commit
1fd9adcb52
23 changed files with 1800 additions and 98 deletions
|
@ -17,16 +17,14 @@
|
|||
<abbr lang="la" title="ibīdem [in the same place]">Ibid.</abbr>
|
||||
{{- else -}}
|
||||
<span itemprop="spokenByCharacter">{{- .Params.source | safeHTML -}}</span>
|
||||
{{- if .Params.title -}}, <span itemprop="isBasedOn">{{- partial "cite.html" . -}}
|
||||
{{- if .Params.titleSeries }} (
|
||||
{{- .Scratch.SetInMap "Params" "title" .Params.titleSeries -}}
|
||||
{{- .Scratch.SetInMap "Params" "titleLang" .Params.titleSeriesLang -}}
|
||||
{{- .Scratch.SetInMap "Params" "titleTr" .Params.titleSeriesTr -}}
|
||||
{{- .Scratch.SetInMap "Params" "cite" .Params.citeSeries -}}
|
||||
{{- .Scratch.SetInMap "Params" "schemaType" .Params.schemaTypeSeries -}}
|
||||
{{- .Scratch.SetInMap "Params" "suppress" "true" -}}
|
||||
{{- .Scratch.SetInMap "parentCite" "Params" ( .Scratch.Get "Params" ) -}}
|
||||
{{- partial "cite.html" ( .Scratch.Get "parentCite" ) -}}
|
||||
{{- if .Params.title -}}, <span itemprop="isBasedOn">{{- partial "cite.html.tmpl" . -}}
|
||||
{{- if ( isset .Params "titleSeries" ) }} (
|
||||
{{- .Scratch.Set "cite" .Params.citeSeries -}}
|
||||
{{- .Scratch.Set "title" .Params.titleSeries -}}
|
||||
{{- .Scratch.Set "titleLang" .Params.titleSeriesLang -}}
|
||||
{{- .Scratch.Set "titleTr" .Params.titleSeriesTr -}}
|
||||
{{- .Scratch.Set "schemaType" .Params.schemaTypeSeries -}}
|
||||
{{- partial "cite.html.tmpl" . -}}
|
||||
{{- with .Params.numberSeries }}, {{ . | safeHTML -}}{{- end -}}
|
||||
){{- end -}}</span>
|
||||
{{- end -}}
|
||||
|
|
|
@ -2,22 +2,22 @@
|
|||
{{- erroridf "a11y-chart-longdesc" "No longdesc found for chart '%q' (%q)" ( .Get "chart-id" ) .Page.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
<figure class="article__figure figure{{ with .Get "class" }} {{ . }}{{ end }}" role="group">
|
||||
<figure class="article__figure figure figure--chart{{ with .Get "class" }} {{ . }}{{ end }}" role="group">
|
||||
{{- with .Get "chart-id" -}}
|
||||
<canvas class="figure__chart" id="{{ . }}">
|
||||
You must enable Javascript to view this chart.
|
||||
</canvas>
|
||||
<canvas class="chart" id="{{ . }}">
|
||||
You must enable Javascript to view this chart.
|
||||
</canvas>
|
||||
{{- end -}}
|
||||
{{- with .Get "chart-id-2" -}}
|
||||
<canvas class="figure__chart" id="{{ . }}">
|
||||
You must enable Javascript to view this chart.
|
||||
</canvas>
|
||||
<canvas class="chart" id="{{ . }}">
|
||||
You must enable Javascript to view this chart.
|
||||
</canvas>
|
||||
{{- end -}}
|
||||
|
||||
{{- if or ( .Get "caption" ) ( .Get "title" ) -}}
|
||||
<figcaption class="figure__caption{{ if not ( or ( .Get "caption" ) ( .Get "title" ) ) }} figure__caption--no-height{{ end }}">
|
||||
{{- with .Get "title" -}}<h4 class="figcaption__title">{{ . | markdownify | safeHTML }}</h4>{{- end -}}
|
||||
{{- with .Get "caption" -}}<p class="figcaption__caption">{{ . | markdownify | safeHTML }}</p>{{- end -}}
|
||||
</figcaption>
|
||||
<figcaption class="figure__caption{{ if not ( or ( .Get "caption" ) ( .Get "title" ) ) }} figure__caption--no-height{{ end }}">
|
||||
{{- with .Get "title" -}}<h4 class="figcaption__title">{{ . | markdownify | safeHTML }}</h4>{{- end -}}
|
||||
{{- with .Get "caption" -}}<p class="figcaption__caption">{{ . | markdownify | safeHTML }}</p>{{- end -}}
|
||||
</figcaption>
|
||||
{{- end -}}
|
||||
</figure>
|
||||
|
|
|
@ -1,11 +1,28 @@
|
|||
{{- if .Params.title -}}
|
||||
{{- if not $.Params.cite -}}
|
||||
{{- erroridf "missing-cite" "No cite found for citation '%q' (%q)" .Params.title .Page.File.Path -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
<!--
|
||||
Renders a work citation with semantic markup.
|
||||
|
||||
@params cite URI for work. Optional.
|
||||
@params citeStyle Force a citation style. Optional.
|
||||
@params href URI for citation, or 'asCite' to use value of `cite`. Optional.
|
||||
@params schemaType The Schema.org `itemtype` value. Default 'CreativeWork'.
|
||||
@params shortTitle Abbreviated display title. Optional.
|
||||
@params title Title of the work to display.
|
||||
@params titleLang Language code of a foreign-language work's title. Optional.
|
||||
@params titleTr English translation of a foreign-language work's title. Optional.
|
||||
-->
|
||||
|
||||
<!-- Validation -->
|
||||
|
||||
{{- if ( not ( isset .Params "title" ) ) -}}
|
||||
{{- errorf "No title found for citation (%q)" .Page.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $citeID := cond ( .Params.cite | not | not ) .Params.cite .Params.title -}}
|
||||
{{- if ( not ( isset $.Params "cite" ) ) -}}
|
||||
{{- erroridf "missing-cite" "No cite found for citation '%q' (%q)" .Params.title .Page.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /**/ -}}{{- partialCached "cite.html" . $citeID -}}{{- /**/ -}}
|
||||
<!-- Rendering -->
|
||||
|
||||
{{- $citationId := cond ( .Params.cite | not | not ) .Params.cite .Params.title -}}
|
||||
|
||||
{{- /**/ -}}{{- partialCached "cite.html.tmpl" . $citationId -}}{{- /**/ -}}
|
||||
|
|
|
@ -1,8 +1,34 @@
|
|||
{{- $src := $.Page.Resources.GetMatch (.Get "src") -}}
|
||||
<!--
|
||||
Shortcode to render a media file as part of content where the place in text flow is not important.
|
||||
|
||||
@params src Resource `src` path.
|
||||
@params link URI or Page Resource to wrap resource in. Optional.
|
||||
@params rel Force relationship value. Optional.
|
||||
-->
|
||||
|
||||
<!-- Variable assignment -->
|
||||
|
||||
{{- $src := $.Page.Resources.GetMatch ( .Get "src" ) -}}
|
||||
{{- $linkedResource := $.Page.Resources.GetMatch ( .Get "link" ) -}}
|
||||
{{- $valid_rel_values := partialCached "util/get_valid_rel_values.html.tmpl" . -}}
|
||||
|
||||
<!-- Validation -->
|
||||
|
||||
{{- if not ( in ( slice "image" "video" ) $src.ResourceType ) -}}
|
||||
{{- errorf "Resource '%q' resource type '%q' is not valid (%q)" ( .Get "src" ) $src.ResourceType .Page.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( not $src ) -}}
|
||||
{{- errorf "No Page Resource found for src '%q' (%q)" ( .Get "src" ) .Page.File.Path -}}
|
||||
{{- end -}}
|
||||
{{- $linkedResource := $.Page.Resources.GetMatch (.Get "link") -}}
|
||||
|
||||
{{- with .Get "rel" -}}
|
||||
{{- if not ( in $valid_rel_values . ) -}}
|
||||
{{- errorf "Invalid rel value '%q' (%q)" . .Page.File.Path -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
<figure class="article__figure figure{{ with .Get "class" }} {{ . }}{{ end }}" role="group">
|
||||
{{- if .Get "link" -}}
|
||||
|
@ -14,53 +40,21 @@
|
|||
{{- end -}}
|
||||
|
||||
{{- if eq $src.ResourceType "image" -}}
|
||||
<picture class="figure__picture"
|
||||
itemprop="image">
|
||||
<img class="u-photo figure__image"
|
||||
{{ if ( or ( eq $src.MediaType.SubType "svg" ) ( eq $src.MediaType.SubType "gif" ) ) }}
|
||||
src="{{ $src.RelPermalink }}"
|
||||
{{ else }}
|
||||
{{ with $src.Resize "1200x webp" }}
|
||||
src="{{ .RelPermalink }}"
|
||||
{{ end }}
|
||||
width="{{ $src.Width }}"
|
||||
height="{{ $src.Height }}"
|
||||
{{ end }}
|
||||
{{- with $src.Params.alt }}
|
||||
alt="{{ . }}"
|
||||
{{- end -}}
|
||||
{{- with $src.Params.title }} title="{{ . }}" {{ end -}}
|
||||
loading="lazy"
|
||||
role="img"
|
||||
/>
|
||||
</picture>
|
||||
{{- partial "media/picture.html.tmpl" $src -}}
|
||||
|
||||
{{- else if eq $src.ResourceType "video" -}}
|
||||
{{- if eq $src.MediaType "video/ogg" -}}
|
||||
<audio class="u-audio figure__audio" itemprop="audio" controls>
|
||||
<source src="{{ $src.RelPermalink }}" type="{{ $src.MediaType }}" />
|
||||
<p>Your browser doesn't support embedded audio, <a href="{{ $src.RelPermalink }}">view the audio here</a>.</p>
|
||||
</audio>
|
||||
{{- partial "media/audio.html.tmpl" $src -}}
|
||||
|
||||
{{- else -}}
|
||||
<video class="u-video figure__video"
|
||||
controls
|
||||
src="{{ $src.RelPermalink }}"
|
||||
poster="
|
||||
{{- if $src.Params.poster -}}
|
||||
{{- $posterSrc := $.Page.Resources.GetMatch ( .Get $src.Params.poster ) -}}
|
||||
{{- with $posterSrc.Resize "1200x webp" -}}
|
||||
{{- .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- erroridf "a11y-video-poster" "No poster defined for resource %q (%q)" $src.RelPermalink .Page.File.Path -}}
|
||||
{{- end -}}
|
||||
"
|
||||
itemprop="video">
|
||||
Your browser doesn't support embedded video, <a href="{{ $src.RelPermalink }}">view the video here</a>.
|
||||
</video>
|
||||
{{- partial "media/video.html.tmpl" ( dict "." $src "page_file_path" .Page.File.Path ) -}}
|
||||
|
||||
{{- end -}}
|
||||
|
||||
{{- else if ( or ( ne $src.ResourceType "image" ) ( ne $src.ResourceType "video" ) ) -}}
|
||||
{{- errorf "No handling for resource of type %q" $src.ResourceType -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if .Get "link" }}</a>{{ end -}}
|
||||
|
||||
{{- if or ( .Get "caption" ) ( .Get "title" ) ( $src.Params.attr ) -}}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{{- $src := $.Page.Resources.GetMatch ($.Get 0) -}}
|
||||
{{- if ( not $src ) -}}
|
||||
{{- errorf "No Page Resource found for src '%q' (%q)" ( $.Get 0 ) .Page.File.Path -}}
|
||||
{{- errorf "No Page Resource found for src '%q' (%q).\n\n\tAvailable Page Resources are:\n\t\t%v" ( $.Get 0 ) .Page.File.Path $.Page.Resources -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with $src -}}
|
||||
|
|
45
layouts/shortcodes/picture.html
Normal file
45
layouts/shortcodes/picture.html
Normal file
|
@ -0,0 +1,45 @@
|
|||
<!--
|
||||
Shortcode to render an image as part of content where the place in text flow is important.
|
||||
|
||||
@params src Image `src` path.
|
||||
@params link URI or Page Resource to wrap image in. Optional.
|
||||
@params rel Force relationship value. Optional.
|
||||
-->
|
||||
|
||||
<!-- Variable assignment -->
|
||||
|
||||
{{- $src := $.Page.Resources.GetMatch ( .Get "src" ) -}}
|
||||
{{- $linkedResource := $.Page.Resources.GetMatch ( .Get "link" ) -}}
|
||||
{{- $valid_rel_values := partialCached "util/get_valid_rel_values.html.tmpl" . -}}
|
||||
|
||||
<!-- Validation -->
|
||||
|
||||
{{- if ( not $src ) -}}
|
||||
{{- errorf "No Page Resource found for src %q (%q)" ( .Get "src" ) .Page.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if not ( eq $src.ResourceType "image" ) -}}
|
||||
{{- errorf "Resource %q has resource type %q (expected \"image\") (%q)" ( .Get "src" ) $src.ResourceType .Page.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with .Get "rel" -}}
|
||||
{{- if not ( in $valid_rel_values . ) -}}
|
||||
{{- errorf "Invalid rel value %q (%q)" . .Page.File.Path -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
{{- if .Get "link" -}}
|
||||
{{- if $linkedResource -}}
|
||||
<a href="{{- $linkedResource.RelPermalink -}}"{{- with .Get "rel" }} rel="{{- . -}}"{{- end -}}>
|
||||
{{- else -}}
|
||||
<a href="{{- .Get "link" -}}">
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- partial "media/picture.html.tmpl" $src -}}
|
||||
|
||||
{{- if .Get "link" -}}
|
||||
</a>
|
||||
{{- end -}}
|
47
layouts/shortcodes/video.html
Normal file
47
layouts/shortcodes/video.html
Normal file
|
@ -0,0 +1,47 @@
|
|||
<!--
|
||||
Shortcode to render a video as part of content where the place in text flow is important.
|
||||
|
||||
@params src Video `src` path.
|
||||
@params link URI or Page Resource to wrap video in. Optional.
|
||||
@params rel Force relationship value. Optional.
|
||||
-->
|
||||
|
||||
<!-- Variable assignment -->
|
||||
|
||||
{{- $src := $.Page.Resources.GetMatch ( .Get "src" ) -}}
|
||||
{{- $linkedResource := $.Page.Resources.GetMatch ( .Get "link" ) -}}
|
||||
{{- $valid_rel_values := partialCached "util/get_valid_rel_values.html.tmpl" . -}}
|
||||
|
||||
<!-- Validation -->
|
||||
|
||||
{{- if ( not $src ) -}}
|
||||
{{- errorf "No Page Resource found for src %q (%q)" ( .Get "src" ) .Page.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if not ( eq $src.ResourceType "video" ) -}}
|
||||
{{- errorf "Resource %q has resource type %q (expected \"video\") (%q)" ( .Get "src" ) $src.ResourceType .Page.File.Path -}}
|
||||
{{- else if ( eq $src.MediaType "video/ogg" ) -}}
|
||||
{{- errorf "Resource %q has 'video/ogg' media type %q (expected \"video/webm\" or other video type) (%q)" ( .Get "src" ) $src.MediaType .Page.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with .Get "rel" -}}
|
||||
{{- if not ( in $valid_rel_values . ) -}}
|
||||
{{- errorf "Invalid rel value %q (%q)" . .Page.File.Path -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
{{- if .Get "link" -}}
|
||||
{{- if $linkedResource -}}
|
||||
<a href="{{- $linkedResource.RelPermalink -}}"{{- with .Get "rel" }} rel="{{- . -}}"{{- end -}}>
|
||||
{{- else -}}
|
||||
<a href="{{- .Get "link" -}}">
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- partial "media/video.html.tmpl" ( dict "." $src "page_file_path" .Page.File.Path ) -}}
|
||||
|
||||
{{- if .Get "link" -}}
|
||||
</a>
|
||||
{{- end -}}
|
Loading…
Add table
Add a link
Reference in a new issue