mirror of
https://github.com/hyzendust/hyzendust.github.io.git
synced 2026-04-16 05:38:33 +02:00
84 lines
3.4 KiB
HTML
84 lines
3.4 KiB
HTML
{{ define "main" }}
|
|
|
|
<nav class="uninotes-breadcrumbs breadcrumbs">
|
|
<a href="/uninotes/">UniNotes</a>
|
|
</nav>
|
|
|
|
<h1>UniNotes</h1>
|
|
|
|
<h3>Contents</h3>
|
|
|
|
{{/* Build full tree: semester → subjectcode → units → self/live */}} {{ $semesters :=
|
|
site.Taxonomies.semester.Alphabetical }}
|
|
|
|
<div class="uninotes-contents">
|
|
{{ range $semesters }} {{ $semName := .Page.Title }} {{ $semPages := .Pages }} {{/* Collect
|
|
unique subject codes for this semester */}} {{ $subjectCodes := slice }} {{ range $semPages }}
|
|
{{ $raw := .Params.subjectcode }} {{ $code := "" }} {{ if reflect.IsSlice $raw }}{{ $code =
|
|
index $raw 0 }}{{ else }}{{ $code = $raw }}{{ end }} {{ if and $code (not (in $subjectCodes
|
|
$code)) }} {{ $subjectCodes = $subjectCodes | append $code }} {{ end }} {{ end }} {{
|
|
$subjectCodes = sort $subjectCodes }} {{ if $subjectCodes }}
|
|
<div class="uninotes-contents__semester">
|
|
<a class="uninotes-contents__sem-link" href="{{ .Page.RelPermalink }}">{{ $semName }}</a>
|
|
|
|
{{ range $subjectCodes }} {{ $code := . }} {{ $subPage := site.GetPage (printf
|
|
"/subjectcode/%s" ($code | urlize)) }} {{/* Collect one representative page per unit for
|
|
this subject */}} {{ $units := slice }} {{ $seenUnits := slice }} {{ range
|
|
$semPages.ByWeight }} {{ $raw := .Params.subjectcode }} {{ $sc := "" }} {{ if
|
|
reflect.IsSlice $raw }}{{ $sc = index $raw 0 }}{{ else }}{{ $sc = $raw }}{{ end }} {{ if eq
|
|
$sc $code }} {{ $unitLabel := (.Params.unit | default .Title) }} {{ if not (in $seenUnits
|
|
$unitLabel) }} {{ $seenUnits = $seenUnits | append $unitLabel }} {{ $units = $units | append
|
|
. }} {{ end }} {{ end }} {{ end }}
|
|
|
|
<div class="uninotes-contents__subject">
|
|
{{ if $subPage }}
|
|
<a class="uninotes-contents__subject-link" href="{{ $subPage.RelPermalink }}"
|
|
>{{ $code }}</a
|
|
>
|
|
{{ else }}
|
|
<span class="uninotes-contents__subject-link">{{ $code }}</span>
|
|
{{ end }}
|
|
<ul class="uninotes-contents__units">
|
|
{{ range $units }} {{ $unitLabel := (.Params.unit | default .Title) }} {{ $unitUrl
|
|
:= .Params.uniturl }} {{/* Find Self and Live URLs for this unit */}} {{ $selfUrl :=
|
|
"" }} {{ $liveUrl := "" }} {{ range $semPages }} {{ $raw := .Params.subjectcode }}
|
|
{{ $sc := "" }} {{ if reflect.IsSlice $raw }}{{ $sc = index $raw 0 }}{{ else }}{{
|
|
$sc = $raw }}{{ end }} {{ $ul := (.Params.unit | default .Title) }} {{ if and (eq
|
|
$sc $code) (eq $ul $unitLabel) }} {{ $cat := lower .Params.notecategory }} {{ if eq
|
|
$cat "self" }}{{ $selfUrl = .RelPermalink }}{{ end }} {{ if eq $cat "live" }}{{
|
|
$liveUrl = .RelPermalink }}{{ end }} {{ end }} {{ end }}
|
|
|
|
<li class="uninotes-contents__unit">
|
|
<a class="uninotes-contents__unit-link" href="{{ $unitUrl }}"
|
|
>{{ $unitLabel }}</a
|
|
>
|
|
<span class="uninotes-contents__unit-cats">
|
|
{{ if $selfUrl }}
|
|
<a
|
|
class="uninotes-contents__cat uninotes-contents__cat--self"
|
|
href="{{ $selfUrl }}"
|
|
>Self</a
|
|
>
|
|
{{ else }}
|
|
<span class="uninotes-contents__cat uninotes-contents__cat--na">Self</span>
|
|
{{ end }} {{ if $liveUrl }}
|
|
<a
|
|
class="uninotes-contents__cat uninotes-contents__cat--live"
|
|
href="{{ $liveUrl }}"
|
|
>Live</a
|
|
>
|
|
{{ else }}
|
|
<span class="uninotes-contents__cat uninotes-contents__cat--na">Live</span>
|
|
{{ end }}
|
|
</span>
|
|
</li>
|
|
{{ end }}
|
|
</ul>
|
|
</div>
|
|
{{ end }}
|
|
</div>
|
|
{{ end }} {{ end }}
|
|
</div>
|
|
|
|
{{ end }}
|