refactor: citations
This commit is contained in:
parent
de341f4191
commit
810805f9ab
6 changed files with 76 additions and 54 deletions
|
@ -1,28 +1,31 @@
|
|||
{{- /*
|
||||
Renders a work citation with semantic markup.
|
||||
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.
|
||||
*/
|
||||
-}}
|
||||
|
||||
@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.
|
||||
*/ -}}
|
||||
|
||||
<!-- Validation -->
|
||||
|
||||
{{- if ( not ( isset .Params "title" ) ) -}}
|
||||
{{- errorf "No title found for citation (%q)" .Page.File.Path -}}
|
||||
{{- errorf "No title found for citation (%q)" .Page.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( not ( isset $.Params "cite" ) ) -}}
|
||||
{{- erroridf "missing-cite" "No cite found for citation '%q' (%q)" .Params.title .Page.File.Path -}}
|
||||
{{- erroridf "missing-cite" "No cite found for citation '%q' (%q)" .Params.title .Page.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
{{- $citationId := printf "%s%s" ( cond ( isset .Params "cite" ) .Params.cite .Params.title ) ( default "" .Params.shortTitle ) -}}
|
||||
|
||||
{{- partialCached "cite.html" . $citationId -}}
|
||||
{{- partial "cite.html" ( dict "sc" $ "pc" . "Params" .Params ) -}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue