linkable blockquote citations
This commit is contained in:
parent
44cb516ff6
commit
07c6aa6d45
1 changed files with 52 additions and 34 deletions
|
@ -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" -}}
|
||||
|
||||
|
||||
<!-- Variable assignment -->
|
||||
|
||||
{{- $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" ) -}}
|
||||
|
||||
|
||||
<!-- Validation -->
|
||||
|
||||
{{- 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 -}}
|
||||
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
<figure
|
||||
class="figure--blockquote blockquote{{- with $style }} blockquote--{{- . -}}{{- end -}}"
|
||||
itemscope
|
||||
itemtype="Quotation"
|
||||
role="group">
|
||||
role="group"
|
||||
>
|
||||
<blockquote
|
||||
class="blockquote__body"
|
||||
{{- with $cite }} cite="{{ . }}"{{- end -}}>
|
||||
{{- with $cite }}cite="{{ . }}"{{- end -}}
|
||||
>
|
||||
{{- .Inner | .Page.RenderString -}}
|
||||
</blockquote>
|
||||
<figcaption class="blockquote__caption{{- if $isSourceHidden }} blockquote__caption--hidden{{- end -}}">
|
||||
{{- if $ibid -}}
|
||||
<abbr lang="la" title="ibīdem [in the same place]">Ibid.</abbr>
|
||||
{{- else if $source -}}
|
||||
<span temprop="spokenByCharacter">{{- $source | safeHTML -}}</span>
|
||||
{{- 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 "schemaType" .Params.schemaTypeSeries -}}
|
||||
{{- partial "cite.html" . -}}
|
||||
{{- with .Params.numberSeries }}, {{ . | safeHTML -}}{{- end -}}
|
||||
){{- end -}}</span>
|
||||
<figcaption class="blockquote__caption{{- if $isSourceHidden }}blockquote__caption--hidden{{- end -}}">
|
||||
{{- if $ibid -}}
|
||||
<abbr
|
||||
lang="la"
|
||||
title="ibīdem [in the same place]"
|
||||
>Ibid.</abbr
|
||||
>
|
||||
{{- else if $source -}}
|
||||
<span temprop="spokenByCharacter">{{- $source | safeHTML -}}</span>
|
||||
{{- 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 "schemaType" .Params.schemaTypeSeries -}}
|
||||
{{- .Scratch.Set "href" .Params.hrefSeries -}}
|
||||
{{- partial "cite.html" . -}}
|
||||
{{- with .Params.numberSeries }}, {{ . | safeHTML -}}{{- end -}}
|
||||
)
|
||||
{{- end -}}</span
|
||||
>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</figcaption>
|
||||
</figure>
|
||||
|
|
Loading…
Add table
Reference in a new issue