trwnh.com/unified.test.hugo/layouts/partials/components/quote-block.html

56 lines
1.7 KiB
HTML
Raw Permalink Normal View History

{{- $author := .author }}
2024-10-18 07:33:33 +00:00
{{- $card := .card }}
{{- $content := .content }}
{{- $cite := .cite }}
{{- $title := .title }}
{{- $ref := .ref }}
{{- $caption := .caption }}
<article class="quote-block{{if $cite}} h-cite{{end}}{{ if $author}} h-x-quote{{end}}">
2024-10-18 07:33:33 +00:00
{{- with or $card $author }}
<header class="quote-block__header">
<p class="quote-block__attribution">
{{- with $card }}
<span class="quote-block__card p-author">{{ partial "mf2/h-card.html" . }}</span>
{{- else with $author }}
<span class="quote-block__author p-author h-card">
{{ . | markdownify }}
</span>
2024-10-18 07:33:33 +00:00
{{- end -}}
<span class="quote-block__postpend"> wrote:</span>
</p>
</header>
{{- else }}
2024-10-18 07:33:33 +00:00
<header class="quote-block__header">
<p class="quote-block__prepend">Quote:</p>
</header>
{{- end }}
{{- with $content }}
2024-10-18 07:33:33 +00:00
<section class="quote-block__content">
<blockquote class="e-content"{{ with $cite }} cite="{{.}}"{{end}}>
{{. -}}
</blockquote>
</section>
{{- end }}
{{- if (or $caption $cite) }}
2024-10-18 07:33:33 +00:00
<footer class="quote-block__footer">
<p style="display: contents">
{{- with $caption }} {{/* caption is manually set and overrides cite+title+ref/etc */}}
<span class="quote-block__caption">{{ . | markdownify }}</span>
{{- else }} {{/* no caption, so make one from the cite+title and ref/etc */}}
{{- if $title }}
<span class="quote-block__caption">
<cite><a href="{{$cite}}" class="u-url">{{$title}}</a></cite>
{{- with $ref}} {{/* TODO: make this more modular? break ref into page numbers, edition, etc */}}
{{.}}
{{- end }}
</span>
{{- else }} {{/* no title, so add a basic link */}}
<span class="quote-block__caption">
<a href="{{$cite}}" class="u-url">(View source)</a> {{/* also stop here bc a ref with no title makes no sense? */}}
</span>
{{- end }}
{{- end }}
</p>
</footer>
{{- end }}
</article>