From 44cb516ff6c6a7dde18ca3e7bca8881962457829 Mon Sep 17 00:00:00 2001 From: Ben Goldsworthy Date: Fri, 21 Feb 2025 23:17:58 +0100 Subject: [PATCH 1/3] render chart caption templates --- layouts/shortcodes/chart.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/shortcodes/chart.html b/layouts/shortcodes/chart.html index 970729b..5dffc48 100644 --- a/layouts/shortcodes/chart.html +++ b/layouts/shortcodes/chart.html @@ -32,7 +32,7 @@ {{- if or ( .Get "caption" ) ( .Get "title" ) -}}
{{- with .Get "title" -}}

{{ . | markdownify | safeHTML }}

{{- end -}} - {{- with .Get "caption" -}}

{{ . | markdownify | safeHTML }}

{{- end -}} + {{- with .Get "caption" -}}

{{ . | $.Page.RenderString }}

{{- end -}}
{{- end -}} From 07c6aa6d4585579b6e5ec21e8b39e99cb62fd495 Mon Sep 17 00:00:00 2001 From: Ben Goldsworthy Date: Fri, 21 Feb 2025 23:18:07 +0100 Subject: [PATCH 2/3] linkable blockquote citations --- layouts/shortcodes/blockquote.html | 86 ++++++++++++++++++------------ 1 file changed, 52 insertions(+), 34 deletions(-) diff --git a/layouts/shortcodes/blockquote.html b/layouts/shortcodes/blockquote.html index 7b2e36f..9a36dd8 100644 --- a/layouts/shortcodes/blockquote.html +++ b/layouts/shortcodes/blockquote.html @@ -1,29 +1,32 @@ {{- /* - Renders a block quotation. + 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. + @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 for full list of args. + For works cited (optional): + @params ibid Whether to use ibidem as the source. Optional. + @see partials/cite.html 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. -*/ -}} + 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" -}} + {{- $style := default "" ( index .Params "style" ) -}} {{- $cite := default "" ( index .Params "cite" ) -}} +{{- $href := default "" ( index .Params "href" ) -}} {{- $ibid := default false ( index .Params "ibid" ) -}} {{- $source := .Params.source -}} @@ -32,6 +35,7 @@ {{- $hasCitedWork := ( isset .Params "title" ) }} {{- $hasCitedSeries := ( isset .Params "titleSeries" ) -}} + {{- if ( not ( in $valid_styles $style ) ) -}} @@ -43,37 +47,51 @@ {{- end -}} {{- if ( not ( isset $.Params "cite" ) ) -}} - {{- erroridf "missing-cite" "No cite found for blockquote (%q)" .Page.File.Path -}} + {{- erroridf "missing-cite" "No cite found for blockquote (%q)" .Page.File.Path -}} {{- end -}} +
+ role="group" +>
+ {{- with $cite }}cite="{{ . }}"{{- end -}} + > {{- .Inner | .Page.RenderString -}}
-
- {{- if $ibid -}} - Ibid. - {{- else if $source -}} - {{- $source | safeHTML -}} - {{- if $hasCitedWork -}}, {{- partial "cite.html" . -}} - {{- 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" . -}} - {{- with .Params.numberSeries }}, {{ . | safeHTML -}}{{- end -}} - ){{- end -}} +
+ {{- if $ibid -}} + Ibid. + {{- else if $source -}} + {{- $source | safeHTML -}} + {{- if $hasCitedWork -}} + , + {{- partial "cite.html" . -}} + {{- 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 -}} + {{- .Scratch.Set "href" .Params.hrefSeries -}} + {{- partial "cite.html" . -}} + {{- with .Params.numberSeries }}, {{ . | safeHTML -}}{{- end -}} + ) + {{- end -}} + {{- end -}} {{- end -}} - {{- end -}}
From 8f593203b597eb5f892b1bb0853fc14b9011e4f6 Mon Sep 17 00:00:00 2001 From: Ben Goldsworthy Date: Fri, 21 Feb 2025 23:18:16 +0100 Subject: [PATCH 3/3] redact locations in location view --- content/locations/_index.md | 3 ++- layouts/partials/util/get_location_by_index.html | 16 ++++++++-------- layouts/partials/util/render_recursive_list.html | 2 ++ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/content/locations/_index.md b/content/locations/_index.md index b800e3a..9e4b40a 100644 --- a/content/locations/_index.md +++ b/content/locations/_index.md @@ -4,4 +4,5 @@ date: 2024-02-13 layout: locations --- -Test +This page shows a geospatial visualisation of where the various things recorded +on this site took place. diff --git a/layouts/partials/util/get_location_by_index.html b/layouts/partials/util/get_location_by_index.html index 782cce1..da54992 100644 --- a/layouts/partials/util/get_location_by_index.html +++ b/layouts/partials/util/get_location_by_index.html @@ -2,13 +2,13 @@ {{- $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 -}} + {{- 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 -}} diff --git a/layouts/partials/util/render_recursive_list.html b/layouts/partials/util/render_recursive_list.html index c33e9d3..8dc2882 100644 --- a/layouts/partials/util/render_recursive_list.html +++ b/layouts/partials/util/render_recursive_list.html @@ -41,12 +41,14 @@ {{- end -}} {{- range $k, $v := .items -}} + {{- if not ( isset $v "redact" ) -}}
  • {{- $k -}} {{- if ( not ( isset $v "lat" ) ) -}} {{- partial "util/render_recursive_list.html" ( dict "sc" $.sc "pc" $.pc "items" $v "schemaType" $schemaType "listType" $listType ) -}} {{- end -}}
  • + {{- end -}} {{- end -}} {{- if ( eq $listType "unordered" ) -}}