Omphaloskepsis-2/layouts/shortcodes/cite.html

32 lines
1.1 KiB
HTML
Raw Normal View History

2024-07-23 10:08:36 +02:00
{{- /*
2025-05-15 11:08:14 +02:00
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 itemtype 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.
*/
-}}
2024-04-02 20:36:21 +01:00
<!-- Validation -->
{{- if ( not ( isset .Params "title" ) ) -}}
2025-05-15 11:08:14 +02:00
{{- errorf "No title found for citation (%q)" .Page.File.Path -}}
2023-10-03 13:08:35 +01:00
{{- end -}}
2024-04-02 20:36:21 +01:00
{{- if ( not ( isset $.Params "cite" ) ) -}}
2025-05-15 11:08:14 +02:00
{{- erroridf "missing-cite" "No cite found for citation '%q' (%q)" .Params.title .Page.File.Path -}}
2024-04-02 20:36:21 +01:00
{{- end -}}
2025-05-15 11:08:14 +02:00
2024-04-02 20:36:21 +01:00
<!-- Rendering -->
2024-07-23 10:08:36 +02:00
{{- $citationId := printf "%s%s" ( cond ( isset .Params "cite" ) .Params.cite .Params.title ) ( default "" .Params.shortTitle ) -}}
2023-10-03 13:08:35 +01:00
2025-05-15 11:08:14 +02:00
{{- partial "cite.html" ( dict "sc" $ "pc" . "Params" .Params ) -}}