various updates

This commit is contained in:
Ben Goldsworthy 2023-06-30 21:16:59 -06:00
parent 4955708f0e
commit ee87009471
37 changed files with 1734 additions and 401 deletions

View file

@ -1,32 +1,35 @@
{{ with where ( $.Site.Data.abbreviations .Params.abbr ) }}
{{ if ( or ( eq .Params.mode "shortTitle" ) ( eq .Params.mode "shortTitlePl" ) ) }}
{{- $abbr := .Get 0 -}}
{{- $mode := default "shortTitle" ( .Get 1 ) -}}
{{- with ( index $.Site.Data.abbreviations $abbr ) -}}
{{- if ( or ( eq $mode "shortTitle" ) ( eq $mode "shortTitlePl" ) ) -}}
<abbr class="abbr" title="
{{- if ( eq .Params.mode "shortTitle" ) }}
{{ .shortTitle }}
{{ else if ( eq .Params.mode "shortTitlePl" ) }}
{{ if .shortTitlePl }}{{ .shortTitlePl }}{{ else }}{{ .shortTitle }}s{{ end }}
{{ end -}}
{{- if ( eq $mode "shortTitle" ) -}}
{{- .longTitle -}}
{{- else if ( eq $mode "shortTitlePl" ) -}}
{{- with .longTitlePl -}}{{- . -}}{{- else -}}{{- .longTitle -}}s{{- end -}}
{{- end -}}
">
{{- if ( eq .Params.mode "shortTitle" ) }}
{{ .shortTitle }}
{{ else if ( eq .Params.mode "shortTitlePl" ) }}
{{ if .shortTitlePl }}{{ .shortTitlePl }}{{ else }}{{ .shortTitle }}s{{ end }}
{{ end -}}
{{- if ( eq $mode "shortTitle" ) -}}
{{- .shortTitle | safeHTML -}}
{{- else if ( eq $mode "shortTitlePl" ) -}}
{{- with .shortTitlePl -}}{{- . | safeHTML -}}{{- else -}}{{- .shortTitle | safeHTML -}}s{{- end -}}
{{- end -}}
</abbr>
{{ else if ( or ( eq .Params.mode "longtitle" ) ( eq .Params.mode "longTitlePl" ) ) }}
{{- if ( eq .Params.mode "longTitle" ) }}
{{ .longTitle }}
{{ else if ( eq .Params.mode "longTitlePl" ) }}
{{ if .longTitlePl }}{{ .longTitlePl }}{{ else }}{{ .longTitle }}s{{ end }}
{{ end -}}
{{ else if ( or ( eq .Params.mode "fullTitle" ) ( eq .Params.mode "fullTitlePl" ) ) }}
{{ if ( eq .Params.mode "fullTitle" ) }}
{{ .longTitle }}&nbsp;(<abbr>{{ .short }}</abbr>)
{{ else if ( eq .Params.mode "fullTitlePl" ) }}
{{- if .longTitlePl }}{{ .longTitlePl }}{{ else }}{{ .longTitle }}s{{ end -}}
&nbsp;(<abbr>{{ if .shortPl }}{{ .shortPl }}{{ else }}{{ .short }}s{{ end }}</abbr>)
{{ end }}
{{ end }}
{{ else }}
{{ errorf "No definition found for abbreviation '%q'" .Params.abbr }}
{{ end }}
{{- else if ( or ( eq $mode "longtitle" ) ( eq $mode "longTitlePl" ) ) -}}
{{- if ( eq $mode "longTitle" ) -}}
{{- .longTitle | safeHTML -}}
{{- else if ( eq $mode "longTitlePl" ) -}}
{{- with .longTitlePl -}}{{- . | safeHTML -}}{{- else -}}{{- .longTitle | safeHTML -}}s{{- end -}}
{{- end -}}
{{- else if ( or ( eq $mode "fullTitle" ) ( eq $mode "fullTitlePl" ) ) -}}
{{- if ( eq $mode "fullTitle" ) -}}
{{- .longTitle | safeHTML -}}&nbsp;(<abbr>{{- .shortTitle | safeHTML -}}</abbr>)
{{- else if ( eq $mode "fullTitlePl" ) -}}
{{- with .longTitlePl -}}{{- . | safeHTML -}}{{- else -}}{{- .longTitle | safeHTML -}}s{{- end -}}
&nbsp;(<abbr>{{- with .shortTitlePl -}}{{- . | safeHTML -}}{{- else -}}{{- .shortTitle | safeHTML -}}s{{- end -}}</abbr>)
{{- end -}}
{{- end -}}
{{- else -}}
{{- errorf "No definition found for abbreviation '%q'" $abbr -}}
{{- end -}}

View file

@ -0,0 +1,35 @@
{{- if ( not .Params ) -}}
{{- errorf "No params provided for blockquote" -}}
{{- end -}}
<figure
class="figure--blockquote blockquote{{- if .Params.style }} blockquote--{{- .Params.style -}}{{- end -}}"
itemscope
itemtype="Quotation"
>
<blockquote
class="blockquote__body"
{{- if .Params.cite }} cite="{{ .Params.cite }}"{{- end -}}
>
{{ .Inner | markdownify | safeHTML }}
</blockquote>
<figcaption class="blockquote__caption">
{{- if .Params.ibid -}}
<abbr lang="la" title="ibīdem [in the same place]">Ibid.</abbr>
{{- else -}}
<span itemprop="spokenByCharacter">{{- .Params.source -}}</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.Set "parentCite" ( .Scratch.Get "Params" ) -}}
{{- partial "cite.html" ( .Scratch.Get "parentCite" ) -}}
{{- with .Params.numberSeries }}, {{ . | safeHTML -}}{{- end -}}
){{- end -}}</span>
{{- end -}}
{{- end -}}
</figcaption>
</figure>

View file

@ -1,16 +1 @@
{{ if .Params.href }}
<a href="{{ if eq .Params.href "asCite" }}{{ .Params.cite }}{{ else }}{{ .Params.href }}{{end}}" target="_blank" rel="noopener noreferrer">
<cite class="cite {{ with .Params.citeStyle }}cite--{{ . }}{{ end }}"
{{ with .Params.cite }}cite="{{ . }}"{{ end }}
itemscope
itemtype="https://schema.org/
{{- with .Params.schemaType -}}
{{- . -}}
{{- else -}}
CreativeWork
{{- end -}}"
>
{{- .Params.title -}}
</cite>
</a>
{{ end }}
{{- /**/ -}}{{- partial "cite.html" . -}}{{- /**/ -}}

View file

@ -3,12 +3,12 @@
{{- end -}}
{{ $src := $.Page.Resources.GetMatch (.Get "src") }}
{{ if ( not $src ) }}
{{ if ( and ( not $src ) ( not ( .Get "chart-id" ) ) ) }}
{{- errorf "No Page Resource found for src '%v' for post '%v'" ( .Get "src" ) $.File.Path -}}
{{ end }}
{{ $linkedResource := $.Page.Resources.GetMatch (.Get "link") }}
<figure class="article__figure{{ with .Get "class" }} {{ . }}{{ end }}">
<figure class="article__figure figure{{ with .Get "class" }} {{ . }}{{ end }}">
{{- with .Get "chart-id" -}}
<canvas class="figure__chart" id="{{ . }}">
You must enable Javascript to view this chart.
@ -18,56 +18,57 @@
{{- if $linkedResource }}
<a href="{{ $linkedResource.RelPermalink }}"{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
{{ else }}
<a
href="{{ .Get "link" }}"
{{- with .Get "target" -}}
target="{{ . }}"
{{- else -}}
{{ warnf "No target defined for non-page resource link %q" ( .Get "link" ) -}}
{{- end -}}
{{- with .Get "rel" -}}
rel="{{ . }}"
{{- else -}}
{{- warnf "No rel defined for non-page resource link %q" ( .Get "link" ) -}}
{{- end -}}
>
<a href="{{ .Get "link" }}">
{{ end }}
{{- end -}}
{{- if eq $src.ResourceType "image" -}}
<picture class="figure__picture">
<img class="figure__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 "1500x webp" }}
{{ with $src.Resize "1200x webp" }}
src="{{ .RelPermalink }}"
{{ end }}
width="{{ $src.Width }}"
height="{{ $src.Height }}"
{{ end }}
{{- if or ($src.Params.alt) (.Get "caption") }}
alt="{{ with $src.Params.alt }}{{ . }}{{ else }}{{ .Get "caption" | markdownify | plainify }}{{ end }}"
{{- with $src.Params.alt }}
alt="{{ . }}"
{{- end -}}
{{- with $src.Params.title }} title="{{ . }}"{{ end -}}
{{- with $src.Params.title }} title="{{ . }}" {{ end -}}
loading="lazy"
role="img"
/>
</picture>
{{- else if eq $src.ResourceType "video" -}}
{{- if eq $src.MediaType "video/ogg" -}}
<audio class="figure__audio" controls>
<audio class="u-audio figure__audio" itemprop="audio" controls>
<source src="{{ $src.RelPermalink }}" type="{{ $src.MediaType }}" />
<p>Your browser doesn't support embedded audio, but you can view the audio <a href="{{ $src.RelPermalink }}">here</a>.</p>
<p>Your browser doesn't support embedded audio, <a href="{{ $src.RelPermalink }}">view the audio here</a>.</p>
</audio>
{{- else -}}
<video class="figure__video"
<video class="u-video figure__video"
controls
src="{{ $src.RelPermalink }}"
poster="{{ if $src.Params.poster }}{{ .Get $src.Params.poster }}{{ else }}{{ warnf "No poster defined for resource %q" $src.RelPermalink }}{{ end }}"
poster="
{{- if $src.Params.poster -}}
{{- $posterSrc := $.Page.Resources.GetMatch ( .Get $src.Params.poster ) -}}
{{- with $posterSrc.Resize "1200x webp" -}}
{{- .RelPermalink -}}
{{- end -}}
{{- else -}}
{{- warnf "No poster defined for resource %q" $src.RelPermalink -}}
{{- end -}}
"
itemprop="video"
>
Your browser doesn't support embedded video, but you can view the video <a href="{{ $src.RelPermalink }}">here</a>.
Your browser doesn't support embedded video, <a href="{{ $src.RelPermalink }}">view the video here</a>.
</video>
{{- end -}}
{{- else if or ( ne $src.ResourceType "image" ) ( ne $src.ResourceType "video" ) -}}
{{- 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 -}}
@ -77,20 +78,16 @@
<figcaption class="figure__caption{{ if not ( or ( .Get "caption" ) ( .Get "title" ) ) }} figure__caption--no-height{{ end }}">
{{- with $src -}}
{{ if .Params.attrlink -}}
<a class="figcaption__attrlink" href="{{ .Params.attrlink }}"
{{- with .Params.attrtarget }} target="{{ . }}"{{ end -}}
{{- with .Params.attrrel }} rel="{{ . }}"{{ end -}}
>
<a class="figcaption__attrlink" href="{{ .Params.attrlink }}">
{{- end -}}
{{- if .Params.attr -}}<p class="figcaption__attr">{{ .Params.attr | safeHTML }}{{ with .Params.attrlicence }} <span class="figcaption__licence">{{ . | safeHTML }}</span>{{ end }}</p>{{- end -}}
{{- if .Params.attrlink -}}
</a>
{{- end -}}
{{- with .Params.title -}}<h4 class="figcaption__title">{{ . }}</h4>{{- end -}}
{{- end -}}
{{- with .Get "title" -}}<h4 class="figcaption__title">{{ . }}</h4>{{- end -}}
{{- with .Get "title" -}}<h4 class="figcaption__title">{{ . | markdownify | safeHTML }}</h4>{{- end -}}
{{- with .Get "caption" -}}
<p class="figcaption__caption">{{ . | markdownify }}</p>
<p class="figcaption__caption">{{ . | markdownify | safeHTML }}</p>
{{- end -}}
</figcaption>
{{- end -}}

View file

@ -15,7 +15,7 @@
<div class="box">
<figure itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
<div class="img" style="background-image: url('{{ $linkURL }}');" >
<img itemprop="thumbnail" src="{{ $linkURL }}" alt="{{ $caption }}" /><!-- <img> hidden if in .gallery -->
<img itemprop="thumbnail" loading="lazy" src="{{ $linkURL }}" alt="{{ $caption }}" /><!-- <img> hidden if in .gallery -->
</div>
<a href="{{ $linkURL }}" itemprop="contentUrl"></a><!-- put <a> last so it is stacked on top -->
</figure>

View file

@ -0,0 +1,79 @@
<figure class="figure--gallery gallery" itemscope itemtype="http://schema.org/ImageGallery">
{{- if or ( .Get "caption" ) ( .Get "title" ) -}}
<figcaption class="figure__caption gallery__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 -}}
{{- with (.Get "dir") -}}
<!-- If a directory was specified, generate figures for all of the images in the directory -->
{{- $images := $.Page.Resources.Match ( print . "/*" ) }}
{{- range $images -}}
{{- $caption := .Name | replaceRE "\\..*" "" | humanize }}<!-- humanized filename without extension -->
{{- $linkURL := print $.Page.Permalink ($.Get "dir") "/" .Name | absURL }}<!-- absolute URL to hi-res image -->
<figure class="figure gallery__figure" itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
<a href="{{ .RelPermalink }}" itemprop="contentUrl">
<picture class="figure__picture"
itemprop="image">
<img itemprop="thumbnail"
class="u-photo gallery__thumbnail"
{{ if ( or ( eq .MediaType.SubType "svg" ) ( eq .MediaType.SubType "gif" ) ) }}
src="{{ .RelPermalink }}"
{{ else }}
{{ with .Resize "600x webp" }}
src="{{ .RelPermalink }}"
{{ end }}
width="{{ .Width }}"
height="{{ .Height }}"
{{ end }}
{{- with .Params.alt }}
alt="{{ . }}"
{{- end -}}
{{- with .Params.title }} title="{{ . }}" {{ end -}}
loading="lazy"
>
</picture>
</a>
{{- if or ( .Params.title ) ( .Params.attr ) -}}
<figcaption class="figure__caption{{ if not .Params.title }} figure__caption--no-height{{ end }}">
{{ if .Params.attrlink -}}
<a class="figcaption__attrlink" href="{{ .Params.attrlink }}"
{{- with .Params.attrtarget }} target="{{ . }}"{{ end -}}
{{- with .Params.attrrel }} rel="{{ . }}"{{ end -}}
>
{{- end -}}
{{- if .Params.attr -}}<p class="figcaption__attr">{{ .Params.attr | safeHTML }}{{ with .Params.attrlicence }} <span class="figcaption__licence">{{ . | safeHTML }}</span>{{ end }}</p>{{- end -}}
{{- if .Params.attrlink -}}
</a>
{{- end -}}
{{- if .Params.href -}}
<a href="{{- if ( eq .Params.href "asCite" ) -}}{{ .Params.cite }}{{- else -}}{{ .Params.href }}{{- end -}}">
{{- end -}}
{{- if .Params.title -}}
<h5 class="figcaption__title">
{{- if .Params.titleLang -}}
<i lang="{{ .Params.titleLang }}" title="{{ .Params.titleTr }}">
{{- end -}}
{{ .Params.title | safeHTML }}
{{- if .Params.titleLang -}}
</i>
{{- end -}}
</h5>
{{- else -}}
<p class="figcaption__title">Link</p>
{{- end -}}
{{- if .Params.href -}}
</a>
{{- end -}}
</figcaption>
{{- end -}}
</figure>
{{- end }}
{{- else -}}
<!-- If no directory was specified, include any figure shortcodes called within the gallery -->
{{ .Inner }}
{{- end }}
</figure>

View file

@ -1,4 +1,4 @@
{{ $resource := .Page.Resources.GetMatch ($.Get 0) }}
{{ with $resource }}
{{ $resource.RelPermalink }}
{{ end }}
{{- $resource := .Page.Resources.GetMatch ($.Get 0) -}}
{{- with $resource -}}
{{- $resource.RelPermalink -}}
{{- end -}}