update
This commit is contained in:
parent
187900fd5b
commit
1fd9adcb52
23 changed files with 1800 additions and 98 deletions
78
layouts/partials/cite.html.tmpl
Normal file
78
layouts/partials/cite.html.tmpl
Normal file
|
@ -0,0 +1,78 @@
|
|||
<!--
|
||||
Renders a work citation with semantic markup, called using the `cite` shortcode.
|
||||
|
||||
@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.
|
||||
-->
|
||||
|
||||
<!-- Optional parameter overrides (for nested citations) -->
|
||||
|
||||
{{- $cite := default .Params.cite ( .Scratch.Get "cite" ) -}}
|
||||
{{- $title := default .Params.title ( .Scratch.Get "title" ) -}}
|
||||
{{- $titleLang := default .Params.titleLang ( .Scratch.Get "titleLang" ) -}}
|
||||
{{- $titleTr := default .Params.titleTr ( .Scratch.Get "titleTr" ) -}}
|
||||
{{- $schemaType := default .Params.schemaType ( .Scratch.Get "schemaType" ) -}}
|
||||
|
||||
<!-- Validation -->
|
||||
|
||||
<!-- TODO: check `.Params.cite` is URI -->
|
||||
|
||||
{{- if ( and ( isset .Params "citeStyle" ) ( not ( in ( slice "inherit" "enquote" "normal" ) .Params.citeStyle ) ) ) -}}
|
||||
{{- erroridf "invalid-citeStyle" "Invalid `citeStyle` value %q for %q" .Params.citeStyle $title -}}
|
||||
{{- end -}}
|
||||
|
||||
<!-- TODO: check `.Params.href` is URI or 'asCite' -->
|
||||
|
||||
{{- if ( and $schemaType ( not ( in $.Site.Data.itemtypes $schemaType ) ) ) -}}
|
||||
{{- erroridf "invalid-schemaType" "Invalid Schema.org type value %q for %q" $schemaType $title -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( or $titleLang $titleTr ) -}}
|
||||
{{- if ( not ( and $titleLang $titleTr ) ) -}}
|
||||
{{- erroridf "invalid-foreign-title" "Must have both title translation and language set for foreign language title %q" $title -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
{{- $itemType := default "CreativeWork" $schemaType -}}
|
||||
{{- if ( or ( in $.Site.Data.itemtypes $itemType ) ( eq .Params.suppress "true" ) ) -}}
|
||||
{{- with .Params.href -}}
|
||||
<a href="{{ if eq . "asCite" }}{{ $cite }}{{ else }}{{ . }}{{ end }}">
|
||||
{{- end -}}
|
||||
<cite
|
||||
class="cite{{ with .Params.citeStyle }} cite--{{ . }}{{ end }}"
|
||||
itemscope
|
||||
itemprop="citation"
|
||||
itemtype="https://schema.org/{{- $itemType -}}"
|
||||
{{- if $titleLang -}}
|
||||
lang="{{- $titleLang -}}"
|
||||
title="{{- $titleTr -}}"
|
||||
{{- end -}}>
|
||||
{{- with $cite -}}
|
||||
<meta itemprop="url" content="{{ . }}">
|
||||
{{- end -}}
|
||||
<span itemprop="name">
|
||||
{{- if $titleLang -}}
|
||||
<i lang="{{ $titleLang }}" title="{{ $titleTr }}">
|
||||
{{- end -}}
|
||||
|
||||
{{- ( default $title .Params.shortTitle ) | markdownify | safeHTML -}}
|
||||
|
||||
{{- if $titleLang -}}
|
||||
</i>
|
||||
{{- end -}}
|
||||
</span>{{- /**/ -}}
|
||||
</cite>
|
||||
{{- with .Params.href -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- erroridf "invalid-schema-type" "Invalid Schema.org type value %q for %q" $itemType $title -}}
|
||||
{{- end -}}
|
|
@ -1,3 +1,7 @@
|
|||
<!--
|
||||
Renders the table list of organisations.
|
||||
-->
|
||||
|
||||
<section class="site-content__body">
|
||||
<table class="organisations-table">
|
||||
<thead>
|
||||
|
|
16
layouts/partials/cv/timeline-legend.html.tmpl
Normal file
16
layouts/partials/cv/timeline-legend.html.tmpl
Normal file
|
@ -0,0 +1,16 @@
|
|||
<aside class="timeline__legend">
|
||||
<div>
|
||||
<label for="legend__past">Past</label>
|
||||
<div id="legend__past">
|
||||
<button id="past-unpaid" class="legend__button"><p><span class="colour-square colour-square--unpaid-past"></span> Unpaid</p></button>
|
||||
<button id="past-paid" class="legend__button"><p><span class="colour-square colour-square--paid-past"></span> Paid</p></button>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label for="legend__current">Current</label>
|
||||
<div id="legend__current">
|
||||
<button id="current-unpaid" class="legend__button"><p><span class="colour-square colour-square--unpaid-current"></span> Unpaid</p></button>
|
||||
<button id="current-paid" class="legend__button"><p><span class="colour-square colour-square--paid-current"></span> Paid</p></button>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
12
layouts/partials/media/audio.html.tmpl
Normal file
12
layouts/partials/media/audio.html.tmpl
Normal file
|
@ -0,0 +1,12 @@
|
|||
<!--
|
||||
Render an audio track in an interactive player.
|
||||
|
||||
@params context The audio media file.
|
||||
-->
|
||||
|
||||
{{- $src := . -}}
|
||||
|
||||
<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>
|
37
layouts/partials/media/picture.html.tmpl
Normal file
37
layouts/partials/media/picture.html.tmpl
Normal file
|
@ -0,0 +1,37 @@
|
|||
<!--
|
||||
Render an image in a context-appropriate format and size.
|
||||
|
||||
@params context Image media file.
|
||||
-->
|
||||
|
||||
<!-- Variable assignment -->
|
||||
|
||||
{{- $src := . -}}
|
||||
{{- $isResizable := not ( in ( slice "svg" "gif" ) $src.MediaType.SubType ) -}}
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
<picture
|
||||
class="picture"
|
||||
itemprop="image"
|
||||
>
|
||||
{{- if $isResizable -}}
|
||||
<source srcset="{{- ($src.Resize "1200x webp").RelPermalink -}}" />
|
||||
<source srcset="{{- ($src.Resize "800x png").RelPermalink -}}" media="(max-width: 800px)"/>
|
||||
{{- end -}}
|
||||
|
||||
<img
|
||||
class="u-photo picture__image"
|
||||
{{- if not $isResizable -}}
|
||||
src="{{- $src.RelPermalink -}}"
|
||||
{{- else -}}
|
||||
src="{{- ($src.Resize "1200x webp").RelPermalink -}}"
|
||||
width="{{- $src.Width -}}"
|
||||
height="{{- $src.Height -}}"
|
||||
{{- end -}}
|
||||
{{- with $src.Params.alt -}}alt="{{- . -}}"{{- end -}}
|
||||
{{- with $src.Params.title -}}title="{{- . -}}" {{- end -}}
|
||||
loading="lazy"
|
||||
role="img"
|
||||
/>
|
||||
</picture>
|
27
layouts/partials/media/video.html.tmpl
Normal file
27
layouts/partials/media/video.html.tmpl
Normal file
|
@ -0,0 +1,27 @@
|
|||
<!--
|
||||
Render a video in an interactive player.
|
||||
|
||||
@params context Video media file.
|
||||
@params page_file_path Filepath of the calling file for error messages.
|
||||
-->
|
||||
|
||||
{{- $src := . -}}
|
||||
|
||||
<video
|
||||
class="u-video figure__video"
|
||||
controls
|
||||
itemprop="video"
|
||||
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 -}}
|
||||
"
|
||||
>
|
||||
Your browser doesn't support embedded video, <a href="{{ $src.RelPermalink }}">view the video here</a>.
|
||||
</video>
|
11
layouts/partials/util/get_content_by_section.html
Normal file
11
layouts/partials/util/get_content_by_section.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
<!--
|
||||
Given a top-level section title slug [blog|cv|portfolio], returns all
|
||||
`Pages` within that top-level section.
|
||||
|
||||
@param sc The site content (`$`)
|
||||
@param section_slug The slug of the section to use [blog|cv|portfolio]
|
||||
|
||||
@returns Pages|nil
|
||||
-->
|
||||
|
||||
{{- where ( ( .sc.GetPage "cv" ).Sections ) "Title" .section_title -}}
|
14
layouts/partials/util/get_location_by_index.html
Normal file
14
layouts/partials/util/get_location_by_index.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
{{- $locations := .Params.location }}
|
||||
{{- $location := .Params.location }}
|
||||
|
||||
{{- range $k, $v := $locations -}}
|
||||
{{- if ( isset $v "lat" ) -}}
|
||||
{{- partialCached "util/get_location_by_index.html" ( dict "locations" $v "location" $location ) $location -}}
|
||||
{{- else if ( eq $k $location ) -}}
|
||||
{{- with $v -}}
|
||||
{{- return . -}}
|
||||
{{- else -}}
|
||||
{{- warnf "Location %q has no co-ordinates set" $k -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
18
layouts/partials/util/get_location_leaf_nodes.html.tmpl
Normal file
18
layouts/partials/util/get_location_leaf_nodes.html.tmpl
Normal file
|
@ -0,0 +1,18 @@
|
|||
<!--
|
||||
Returns all locations from `data/locations.json`.
|
||||
|
||||
@params locations dict<dict>
|
||||
@returns dict<dict>
|
||||
-->
|
||||
|
||||
{{- $locations := ( dict ) -}}
|
||||
|
||||
{{- range $k, $v := . -}}
|
||||
{{- if ( isset $v "lat" ) -}}
|
||||
{{- $locations = merge $locations ( dict $k $v ) -}}
|
||||
{{- else -}}
|
||||
{{- $locations = merge $locations ( partial "util/get_location_leaf_nodes.html.tmpl" . ) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- return $locations -}}
|
7
layouts/partials/util/get_valid_rel_values.html.tmpl
Normal file
7
layouts/partials/util/get_valid_rel_values.html.tmpl
Normal file
|
@ -0,0 +1,7 @@
|
|||
<!--
|
||||
Returns a list of valid values for the `rel` HTML attribute.
|
||||
|
||||
@returns slice
|
||||
-->
|
||||
|
||||
{{- return slice "alternate" "author" "external" "help" "license" "me" "next" "nofollow" "noopener" "noreferrer" "opener" "prev" "privacy-policy" "search" "tag" "terms-of-service" -}}
|
56
layouts/partials/util/render_recursive_list.html.tmpl
Normal file
56
layouts/partials/util/render_recursive_list.html.tmpl
Normal file
|
@ -0,0 +1,56 @@
|
|||
<!--
|
||||
Recursively render an ordered or unordered list from a set of arbitrarily-
|
||||
deeply-nested items.
|
||||
|
||||
@params sc Site context
|
||||
@params pc Page context
|
||||
@params items Set of items to render a list from.
|
||||
@params schemaType Schema.org type to apply. Optional.
|
||||
@params listType "unordered" or "ordered". Default "unordered".
|
||||
-->
|
||||
|
||||
<!-- Validation -->
|
||||
|
||||
{{- if not .sc.Site.Data.itemtypes -}}
|
||||
{{- errorf "Can't access site context in partial (%q)" .pc.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if not .items -}}
|
||||
{{- warnf "No items passed to list partial (%q)" .pc.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( and .schemaType ( not ( in .sc.Site.Data.itemtypes .schemaType ) ) ) -}}
|
||||
{{- erroridf "invalid-schemaType" "Invalid Schema.org type value %q (%q)" .schemaType .pc.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( and .listType ( not ( in ( slice "unordered" "ordered" ) .listType ) ) ) -}}
|
||||
{{- erroridf "invalid-listType" "Invalid list type value %q (%q)" .listType .pc.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
<!-- Default Assignment -->
|
||||
|
||||
{{- $schemaType := default "" .schemaType -}}
|
||||
{{- $listType := default "unordered" .listType -}}
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
{{- if ( eq $listType "unordered" ) -}}
|
||||
<ul>
|
||||
{{- else -}}
|
||||
<ol>
|
||||
{{- end -}}
|
||||
|
||||
{{- range $k, $v := .items -}}
|
||||
<li itemscope itemtype="https://schema.org/Place">
|
||||
{{- $k -}}
|
||||
{{- if ( not ( isset $v "lat" ) ) -}}
|
||||
{{- partial "util/render_recursive_list.html.tmpl" ( dict "sc" $.sc "pc" $.pc "items" $v "schemaType" $schemaType "listType" $listType ) -}}
|
||||
{{- end -}}
|
||||
</li>
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( eq $listType "unordered" ) -}}
|
||||
</ul>
|
||||
{{- else -}}
|
||||
</ol>
|
||||
{{- end -}}
|
Loading…
Add table
Add a link
Reference in a new issue