various fixes
This commit is contained in:
parent
1fd9adcb52
commit
46bd223627
29 changed files with 6093 additions and 152 deletions
|
@ -24,7 +24,7 @@
|
|||
{{- with .shortTitlePl -}}{{- . | safeHTML -}}{{- else -}}{{- .shortTitle | safeHTML -}}s{{- end -}}
|
||||
{{- end -}}
|
||||
</abbr>{{- /**/ -}}
|
||||
|
||||
|
||||
<!-- Long titles (e.g. 'foo bar baz') -->
|
||||
{{- else if ( or ( eq $mode "longTitle" ) ( eq $mode "longTitlePl" ) ) -}}
|
||||
{{- if ( eq $mode "longTitle" ) -}}
|
||||
|
@ -36,7 +36,7 @@
|
|||
{{- with .longTitlePl -}}{{- . | safeHTML -}}{{- else -}}{{- .longTitle | safeHTML -}}s{{- end -}}
|
||||
{{- if .lang -}}</i>{{- end -}}{{- /**/ -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
<!-- Full titles (e.g. 'foo bar baz (FBB)') -->
|
||||
{{- else if ( or ( eq $mode "fullTitle" ) ( eq $mode "fullTitlePl" ) ) -}}
|
||||
{{- if ( eq $mode "fullTitle" ) -}}
|
||||
|
|
|
@ -1,32 +1,78 @@
|
|||
{{- if ( not .Params ) -}}
|
||||
{{- errorf "No params provided for blockquote" -}}
|
||||
{{- /*
|
||||
Renders a block quotation.
|
||||
|
||||
@params style Force a blockquote style. Optional.
|
||||
@params cite URI for work. Optional.
|
||||
@params source The speaker(s) of the quotation.
|
||||
|
||||
For works cited (optional):
|
||||
@params ibid Whether to use ibidem as the source. Optional.
|
||||
@see partials/cite.html.tmpl for full list of args.
|
||||
|
||||
For works cited that form part of a series (optional):
|
||||
@params schemaTypeSeries The Schema.org `itemtype` value for the work series. Default 'CreativeWork'. Optional.
|
||||
@params titleSeries Title of the work series to display. Optional.
|
||||
@params citeSeries URI for work series. Optional.
|
||||
@params titleSeriesLang Language code of a foreign-language work series' title. Optional.
|
||||
@params titleSeriesTr English translation of a foreign-language work series' title. Optional.
|
||||
@params numberSeries The number or code of the quoted work within its series. Optional.
|
||||
*/ -}}
|
||||
|
||||
{{- $valid_styles := slice "" "epigram" "script" -}}
|
||||
|
||||
<!-- Variable assignment -->
|
||||
|
||||
{{- $style := default "" ( index .Params "style" ) -}}
|
||||
{{- $cite := default "" ( index .Params "cite" ) -}}
|
||||
{{- $ibid := default false ( index .Params "ibid" ) -}}
|
||||
{{- $source := .Params.source -}}
|
||||
|
||||
{{- $isSourceHidden := default ( not ( or ( isset .Params "source" ) ( isset .Params "ibid" ) ) ) ( index .Params "hideSource" ) -}}
|
||||
|
||||
{{- $hasCitedWork := ( isset .Params "title" ) }}
|
||||
{{- $hasCitedSeries := ( isset .Params "titleSeries" ) -}}
|
||||
|
||||
<!-- Validation -->
|
||||
|
||||
{{- if ( not ( in $valid_styles $style ) ) -}}
|
||||
{{- errorf "Invalid blockquote style (%q) provided" $style -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( not ( or ( isset .Params "source" ) ( isset .Params "ibid" ) ) ) -}}
|
||||
{{- erroridf "blockquote-no-params" "No source provided for blockquote" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( not ( isset $.Params "cite" ) ) -}}
|
||||
{{- erroridf "missing-cite" "No cite found for blockquote (%q)" .Page.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
<figure
|
||||
class="figure--blockquote blockquote{{- if .Params.style }} blockquote--{{- .Params.style -}}{{- end -}}"
|
||||
class="figure--blockquote blockquote{{- with $style }} blockquote--{{- . -}}{{- end -}}"
|
||||
itemscope
|
||||
itemtype="Quotation"
|
||||
role="group">
|
||||
<blockquote
|
||||
<blockquote
|
||||
class="blockquote__body"
|
||||
{{- if .Params.cite }} cite="{{ .Params.cite }}"{{- end -}}>
|
||||
{{- with $cite }} cite="{{ . }}"{{- end -}}>
|
||||
{{- .Inner | .Page.RenderString -}}
|
||||
</blockquote>
|
||||
<figcaption class="blockquote__caption">
|
||||
{{- if .Params.ibid -}}
|
||||
<figcaption class="blockquote__caption{{- if $isSourceHidden }} blockquote__caption--hidden{{- end -}}">
|
||||
{{- if $ibid -}}
|
||||
<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.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>
|
||||
{{- else if $source -}}
|
||||
<span temprop="spokenByCharacter">{{- $source | safeHTML -}}</span>
|
||||
{{- if $hasCitedWork -}}, <span itemprop="isBasedOn">{{- partial "cite.html.tmpl" . -}}
|
||||
{{- if $hasCitedSeries }} (
|
||||
{{- .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 -}}
|
||||
{{- end -}}
|
||||
</figcaption>
|
||||
|
|
33
layouts/shortcodes/button.html
Normal file
33
layouts/shortcodes/button.html
Normal file
|
@ -0,0 +1,33 @@
|
|||
{{- /*
|
||||
Renders a button, or no-JS fallback.
|
||||
|
||||
@params id ID for button.
|
||||
@params label Label text for button.
|
||||
@params text Text for button.
|
||||
*/ -}}
|
||||
|
||||
<!-- Validation -->
|
||||
|
||||
{{- if ( not ( isset .Params "id" ) ) -}}
|
||||
{{- errorf "No ID set for button (%q)" .Page.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( not ( isset .Params "label" ) ) -}}
|
||||
{{- errorf "No label set for button '%q' (%q)" .Params.id .Page.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( not ( isset .Params "text" ) ) -}}
|
||||
{{- errorf "No text set for button '%q' (%q)" .Params.id .Page.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
<noscript>You must have JavaScript enabled to interact with this button.</noscript>
|
||||
|
||||
|
||||
<label class="label label--button">
|
||||
{{- .Params.label -}}:
|
||||
<button id="{{- .Params.id -}}" class="button">
|
||||
{{- .Params.text -}}
|
||||
</button>
|
||||
</label>
|
|
@ -4,14 +4,18 @@
|
|||
|
||||
<figure class="article__figure figure figure--chart{{ with .Get "class" }} {{ . }}{{ end }}" role="group">
|
||||
{{- with .Get "chart-id" -}}
|
||||
<canvas class="chart" id="{{ . }}">
|
||||
You must enable Javascript to view this chart.
|
||||
</canvas>
|
||||
<div class="chart-container">
|
||||
<canvas class="chart" id="{{ . }}">
|
||||
You must enable Javascript to view this chart.
|
||||
</canvas>
|
||||
</div>
|
||||
{{- end -}}
|
||||
{{- with .Get "chart-id-2" -}}
|
||||
<canvas class="chart" id="{{ . }}">
|
||||
You must enable Javascript to view this chart.
|
||||
</canvas>
|
||||
<div class="chart-container">
|
||||
<canvas class="chart" id="{{ . }}">
|
||||
You must enable Javascript to view this chart.
|
||||
</canvas>
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
{{- if or ( .Get "caption" ) ( .Get "title" ) -}}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!--
|
||||
{{- /*
|
||||
Renders a work citation with semantic markup.
|
||||
|
||||
@params cite URI for work. Optional.
|
||||
|
@ -9,7 +9,7 @@
|
|||
@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 -->
|
||||
|
||||
|
@ -23,6 +23,6 @@
|
|||
|
||||
<!-- Rendering -->
|
||||
|
||||
{{- $citationId := cond ( .Params.cite | not | not ) .Params.cite .Params.title -}}
|
||||
{{- $citationId := printf "%s%s" ( cond ( isset .Params "cite" ) .Params.cite .Params.title ) ( default "" .Params.shortTitle ) -}}
|
||||
|
||||
{{- /**/ -}}{{- partialCached "cite.html.tmpl" . $citationId -}}{{- /**/ -}}
|
||||
{{- partialCached "cite.html.tmpl" . $citationId -}}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<h3 class="comment__author" itemprop="author">{{ .Params.author }}</h3>
|
||||
{{- $publishDate := time .Params.publishDate -}}
|
||||
<p class="comment__publish-date">
|
||||
<time class="dt-published" datetime="{{ $publishDate.Format "2006-01-02T15:04:05-07:00" }}" itemprop="datePublished">{{ $publishDate.Format "January 2" }}<sup>{{ if in (slice 1 21 31) $publishDate.Day }}st{{ else if in (slice 2 22) $publishDate.Day}}nd{{ else if in (slice 3 23) $publishDate.Day }}rd{{ else }}th{{ end }}</sup>, 1{{ $publishDate.Format "2006" | lang.NumFmt 0 }} <abbr style="font-variant: small-caps; font-size: 0.8em;" title="Holocene Era">HE</abbr></time>
|
||||
<time class="dt-published" datetime="{{ $publishDate.Format "2006-01-02T15:04:05-07:00" }}" itemprop="datePublished">{{ $publishDate.Format "January 2" }}<sup>{{ if in (slice 1 21 31) $publishDate.Day }}st{{ else if in (slice 2 22) $publishDate.Day}}nd{{ else if in (slice 3 23) $publishDate.Day }}rd{{ else }}th{{ end }}</sup>, 1{{ $publishDate.Format "2006" | lang.FormatNumberCustom 0 }} <abbr style="font-variant: small-caps; font-size: 0.8em;" title="Holocene Era">HE</abbr></time>
|
||||
</p>
|
||||
{{- with .Params.source -}}
|
||||
<p class="comment__source">Source: {{ . }}</p>
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
{{- partial "media/audio.html.tmpl" $src -}}
|
||||
|
||||
{{- else -}}
|
||||
{{- partial "media/video.html.tmpl" ( dict "." $src "page_file_path" .Page.File.Path ) -}}
|
||||
{{- partial "media/video.html.tmpl" ( dict "src" $src "page_file_path" .Page.File.Path ) -}}
|
||||
|
||||
{{- end -}}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
{{- end -}}
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
<div>
|
||||
{{- if .Get "link" -}}
|
||||
{{- if $linkedResource -}}
|
||||
<a href="{{- $linkedResource.RelPermalink -}}"{{- with .Get "rel" }} rel="{{- . -}}"{{- end -}}>
|
||||
|
@ -42,4 +42,9 @@
|
|||
|
||||
{{- if .Get "link" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with ( .Get "caption" ) -}}
|
||||
<div class="figure__caption"><p class="figcaption__caption">{{ . | safeHTML }}</p></div>
|
||||
{{- end -}}
|
||||
</div>
|
||||
|
|
|
@ -40,8 +40,8 @@
|
|||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- partial "media/video.html.tmpl" ( dict "." $src "page_file_path" .Page.File.Path ) -}}
|
||||
{{- partial "media/video.html.tmpl" ( dict "src" $src "page_file_path" .Page.File.Path ) -}}
|
||||
|
||||
{{- if .Get "link" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue