110 lines
5.1 KiB
HTML
110 lines
5.1 KiB
HTML
{{- define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end -}}
|
|
|
|
{{- define "item" -}}
|
|
<li data-text="{{ printf "%s %s %s" .Title (delimit (.Params.keywords | default slice) " ") (.Description | default "") | lower }}">
|
|
<a href="{{ .Permalink }}">{{ .Title | title }}</a>
|
|
{{ with .Keywords }}<span class="keywords">{{ delimit . ", " }}</span>{{ end }}
|
|
{{ with .Description }}<div class="description">{{ . }}</div>{{ end }}
|
|
</li>
|
|
{{- end }}
|
|
|
|
{{- define "card" -}}
|
|
{{- $id := .Key | urlize }}
|
|
<section class="notes-card" id="{{ $id }}" aria-labelledby="{{ $id }}-h">
|
|
<h3 id="{{ $id }}-h">{{ .Key | title }} <span>{{ len .Pages }}</span></h3>
|
|
{{- $plain := where .Pages "Params.subcategory" "eq" nil }}
|
|
{{- if $plain }}
|
|
<ul>
|
|
{{- range $plain.ByTitle }}{{ template "item" . }}{{ end }}
|
|
</ul>
|
|
{{- end }}
|
|
{{- range (where .Pages "Params.subcategory" "ne" nil).GroupByParam "subcategory" }}
|
|
<div class="notes-sub">
|
|
<h4>{{ .Key | title }} <span>({{ len .Pages }})</span></h4>
|
|
<ul>
|
|
{{- range .Pages.ByTitle }}{{ template "item" . }}{{ end }}
|
|
</ul>
|
|
</div>
|
|
{{- end }}
|
|
</section>
|
|
{{- end }}
|
|
|
|
{{- define "bibcard" -}}
|
|
{{- $label := .label }}
|
|
<section class="notes-card notes-card-flow" id="bib-{{ $label | urlize }}" aria-labelledby="bib-{{ $label | urlize }}-h">
|
|
<h3 id="bib-{{ $label | urlize }}-h">{{ $label }} <span>{{ len .pages }}</span></h3>
|
|
{{- $rows := slice }}
|
|
{{- range .pages }}{{ $m := partial "notes/bibmeta.html" . }}{{ $rows = $rows | append (dict "page" . "m" $m "year" (or $m.year "0")) }}{{ end }}
|
|
<ul>
|
|
{{- range sort $rows "year" "desc" }}
|
|
{{- $m := .m }}{{ with .page }}
|
|
<li data-text="{{ printf "%s %s %s %s %s" .Title $m.author $m.year (delimit (.Params.keywords | default slice) " ") (.Description | default "") | lower }}">
|
|
<a href="{{ .Permalink }}">{{ .Title }}</a>
|
|
{{ with .Keywords }}<span class="keywords">{{ delimit . ", " }}</span>{{ end }}
|
|
{{- if or $m.author $m.year }}
|
|
<div class="description">{{ $m.author }}{{ if and $m.author $m.year }}, {{ end }}{{ $m.year }}</div>
|
|
{{- end }}
|
|
{{- with $m.notes }}
|
|
<div class="description">Notes: {{ range $i, $n := . }}{{ if $i }}, {{ end }}<a href="{{ $n.Permalink }}">{{ $n.Title | title }}</a>{{ end }}</div>
|
|
{{- end }}
|
|
</li>
|
|
{{- end }}{{ end }}
|
|
</ul>
|
|
</section>
|
|
{{- end }}
|
|
|
|
{{- define "content" }}
|
|
{{- partial "notes/styles.html" . }}
|
|
{{- $cats := .Pages.GroupByParam "category" }}
|
|
{{- $uncat := where .Pages "Params.category" "eq" nil }}
|
|
{{- $bibTypes := slice
|
|
(dict "label" "Books" "pages" (where site.RegularPages "Section" "book"))
|
|
(dict "label" "PhD theses" "pages" (where site.RegularPages "Section" "phdthesis"))
|
|
(dict "label" "Journal articles" "pages" (where site.RegularPages "Section" "article"))
|
|
(dict "label" "Conference papers" "pages" (where site.RegularPages "Section" "inproceedings"))
|
|
(dict "label" "Book chapters" "pages" (where site.RegularPages "Section" "inbook"))
|
|
(dict "label" "Reports" "pages" (where site.RegularPages "Section" "techreport"))
|
|
(dict "label" "Websites" "pages" (where site.RegularPages "Section" "websites")) }}
|
|
{{- $bibCount := 0 }}
|
|
{{- range $bibTypes }}{{ $bibCount = add $bibCount (len .pages) }}{{ end }}
|
|
<article class="post">
|
|
<div class="post-content notes-intro">{{ .Content }}</div>
|
|
|
|
<div class="notes-bar">
|
|
<div class="notes-filter">
|
|
<label for="notes-filter">Filter</label>
|
|
<input type="search" id="notes-filter" placeholder="Title, keyword, author, year…" autocomplete="off">
|
|
<span class="notes-count" id="notes-count" aria-live="polite">{{ add (len .Pages) $bibCount }} entries</span>
|
|
</div>
|
|
</div>
|
|
|
|
<section class="notes-block" aria-labelledby="notes-h">
|
|
<h2 id="notes-h">Notes <span>{{ len .Pages }}</span></h2>
|
|
{{- $groups := slice }}
|
|
{{- range $cats }}
|
|
{{- $subs := len ((where .Pages "Params.subcategory" "ne" nil).GroupByParam "subcategory") }}
|
|
{{- $groups = $groups | append (dict "Key" .Key "Pages" .Pages "w" (add (len .Pages) (mul 2 $subs) 3)) }}
|
|
{{- end }}
|
|
{{- if $uncat }}{{ $groups = $groups | append (dict "Key" "Other" "Pages" $uncat "w" (add (len $uncat) 3)) }}{{ end }}
|
|
{{- $colA := slice }}{{ $colB := slice }}{{ $wA := 0 }}{{ $wB := 0 }}
|
|
{{- range sort $groups "w" "desc" }}
|
|
{{- if le $wA $wB }}{{ $colA = $colA | append . }}{{ $wA = add $wA .w }}
|
|
{{- else }}{{ $colB = $colB | append . }}{{ $wB = add $wB .w }}{{ end }}
|
|
{{- end }}
|
|
<div class="notes-cols">
|
|
<div class="notes-col">{{ range sort $colA "Key" }}{{ template "card" . }}{{ end }}</div>
|
|
<div class="notes-col">{{ range sort $colB "Key" }}{{ template "card" . }}{{ end }}</div>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="notes-block notes-block-bib" id="bibliography" aria-labelledby="bibliography-h">
|
|
<h2 id="bibliography-h">Bibliography <span>{{ $bibCount }}</span></h2>
|
|
<div class="notes-single">
|
|
{{- range $bibTypes }}{{ if .pages }}{{ template "bibcard" (dict "label" .label "pages" .pages.ByTitle) }}{{ end }}{{ end }}
|
|
</div>
|
|
</section>
|
|
|
|
<p class="notes-empty" id="notes-empty" hidden>Nothing matches this filter.</p>
|
|
</article>
|
|
{{- end }}
|