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

52 lines
No EOL
2.3 KiB
HTML

{{- $author := .author }}
{{- $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}}">
{{- with $author }}
<header style="display: contents">
<svg class="quote-block__icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 290 290" width="1em" height="1em" fill="currentColor"><title>quote</title><path d="M22.12 145v97.65h97.65V145H70.95c0-26.92 21.9-48.82 48.82-48.82V47.35c-53.93 0-97.65 43.72-97.65 97.65zm245.76-48.82V47.35c-53.93 0-97.65 43.72-97.65 97.65v97.65h97.65V145h-48.82c-.01-26.92 21.89-48.82 48.82-48.82z"></path></svg>
<p style="display: contents">
<span class="p-author">
{{- partial "mf2/h-card.html" . }}
</span>
<span style="display: none"> wrote:</span>
</p>
</header>
{{- else }}
<header style="display: contents">
<svg class="quote-block__icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 290 290" width="1em" height="1em" fill="currentColor"><title>quote</title><path d="M22.12 145v97.65h97.65V145H70.95c0-26.92 21.9-48.82 48.82-48.82V47.35c-53.93 0-97.65 43.72-97.65 97.65zm245.76-48.82V47.35c-53.93 0-97.65 43.72-97.65 97.65v97.65h97.65V145h-48.82c-.01-26.92 21.89-48.82 48.82-48.82z"></path></svg>
</header>
{{- end }}
{{- with $content }}
<section style="display: contents">
<blockquote class="quote-block__content e-content"{{ with $cite }} cite="{{.}}"{{end}}>
{{. -}}
</blockquote>
</section>
{{- end }}
{{- if (or $caption $cite) }}
<footer style="display: contents">
<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>