This commit is contained in:
Ben Goldsworthy 2024-04-02 20:36:21 +01:00
parent 187900fd5b
commit 1fd9adcb52
No known key found for this signature in database
23 changed files with 1800 additions and 98 deletions

View file

@ -1,11 +1,28 @@
{{- if .Params.title -}}
{{- if not $.Params.cite -}}
{{- erroridf "missing-cite" "No cite found for citation '%q' (%q)" .Params.title .Page.File.Path -}}
{{- end -}}
{{- else -}}
<!--
Renders a work citation with semantic markup.
@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.
-->
<!-- Validation -->
{{- if ( not ( isset .Params "title" ) ) -}}
{{- errorf "No title found for citation (%q)" .Page.File.Path -}}
{{- end -}}
{{- $citeID := cond ( .Params.cite | not | not ) .Params.cite .Params.title -}}
{{- if ( not ( isset $.Params "cite" ) ) -}}
{{- erroridf "missing-cite" "No cite found for citation '%q' (%q)" .Params.title .Page.File.Path -}}
{{- end -}}
{{- /**/ -}}{{- partialCached "cite.html" . $citeID -}}{{- /**/ -}}
<!-- Rendering -->
{{- $citationId := cond ( .Params.cite | not | not ) .Params.cite .Params.title -}}
{{- /**/ -}}{{- partialCached "cite.html.tmpl" . $citationId -}}{{- /**/ -}}