refactor: citations

This commit is contained in:
Ben Goldsworthy 2025-05-15 11:08:14 +02:00
parent de341f4191
commit 810805f9ab
No known key found for this signature in database
6 changed files with 76 additions and 54 deletions

View file

@ -9,14 +9,6 @@
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 itemtypeSeries 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.
*/
-}}
@ -35,7 +27,6 @@
{{- $isSourceHidden := default ( not ( or ( isset .Params "source" ) ( isset .Params "ibid" ) ) ) ( index .Params "hideSource" ) -}}
{{- $hasCitedWork := ( isset .Params "title" ) }}
{{- $hasCitedSeries := ( isset .Params "titleSeries" ) -}}
<!-- Validation -->
@ -79,20 +70,8 @@
{{- if $hasCitedWork -}}
,
<span itemprop="isBasedOn"
>{{- 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 "itemtype" .Params.itemtypeSeries -}}
{{- .Scratch.Set "href" .Params.hrefSeries -}}
{{- partial "cite.html" . -}}
{{- with .Params.numberSeries }}, {{ . | safeHTML -}}{{- end -}}
)
{{- end -}}</span
>
>{{- partial "cite.html" ( dict "sc" $ "pc" . "Params" .Params ) -}}
</span>
{{- end -}}
{{- with $comment -}}
{{- printf " (%s)" . -}}