initial triads stuff works!

This commit is contained in:
Marcell Mars 2020-09-07 04:23:59 +02:00
parent a8abce8c5f
commit 0344d646f8
3 changed files with 30 additions and 19 deletions

View File

@ -16,5 +16,23 @@
"plural": "sessions",
"has": false,
"in": ["topic", "topics"]
},
"book": {
"depth": "core",
"plural": "books",
"has": ["part", "parts"],
"in": false
},
"part": {
"depth": "mantle",
"plural": "parts",
"has": ["chapter", "chapters"],
"in": ["book", "books"]
},
"chapter": {
"depth": "crust",
"plural": "chapters",
"has": false,
"in": ["part", "parts"]
}
}

View File

@ -1,4 +1,10 @@
{{- $text_link := .Text -}}
{{ $_ := newScratch }}
{{- range $k, $v := .Page.Site.Data.sandpointsnamegraph -}}
{{ $_.Add "triads" $k }}
{{- end -}}
{{- if strings.HasPrefix .Destination "bib:" -}}
{{- $destination := (substr .Destination 4) -}}
{{- $c_prefix := .Page.Site.Params.catalogprefix | default "/library/" -}}
@ -12,29 +18,16 @@
{{- else -}}
<a href="{{- $c_prefix | safeURL -}}BROWSE_LIBRARY.html#/book/{{- $destination -}}"{{- with .Title}} title="{{- . -}}"{{- end -}}>{{- $text_link -}}⦚<span class="text-xs font-bold p-1 bg-AuChico text-CoconutCream">bib:{{- $destination -}} not found</span></a>
{{- end -}}
{{- else if strings.HasPrefix .Destination "session:" -}}
{{- $s_destination := printf "/session/%s" (substr .Destination 8) -}}
{{- if $.Page.Site.GetPage $s_destination -}}
{{- $session := $.Page.Site.GetPage $s_destination -}}
{{- else if in ($_.Get "triads") (index (split .Destination ":") 0) -}}
{{- if $.Page.Site.GetPage (printf "/%s" (replace .Destination ":" "/")) -}}
{{- $session := $.Page.Site.GetPage (printf "/%s" (replace .Destination ":" "/")) -}}
{{- if not $text_link -}}
<a href="{{- $session.RelPermalink -}}{{- if eq hugo.Environment "offline" -}}index.html{{- end -}}"{{- with $session.Title}} title="{{- $session.Title -}}"{{- end -}}><span class="sup">session</span>{{- $session.Title -}}</a>
<a href="{{- $session.RelPermalink -}}{{- if eq hugo.Environment "offline" -}}index.html{{- end -}}"{{- with $session.Title}} title="{{- $session.Title -}}"{{- end -}}><span class="sup">{{- index (split .Destination ":") 0 -}}</span>{{- $session.Title -}}</a>
{{- else -}}
<a href="{{- $session.RelPermalink -}}{{- if eq hugo.Environment "offline" -}}index.html{{- end -}}"{{- with .Title}} title="{{- . -}}"{{- end -}}><span class="sup">session</span>{{- $text_link -}}</a>
<a href="{{- $session.RelPermalink -}}{{- if eq hugo.Environment "offline" -}}index.html{{- end -}}"{{- with .Title}} title="{{- . -}}"{{- end -}}><span class="sup">{{- index (split .Destination ":") 0 -}}</span>{{- $text_link -}}</a>
{{- end -}}
{{- else -}}
<a href="{{- $s_destination -}}/{{- if eq hugo.Environment "offline" -}}index.html{{- end -}}">{{- $text_link -}}⦚<span class="text-xs font-bold p-1 bg-AuChico text-CoconutCream">session:{{- $s_destination -}} not found</span></a>
{{- end -}}
{{- else if strings.HasPrefix .Destination "topic:" -}}
{{- $t_destination := printf "/topic/%s" (substr .Destination 6) -}}
{{- if $.Page.Site.GetPage $t_destination -}}
{{- $topic := $.Page.Site.GetPage $t_destination -}}
{{- if not $text_link -}}
<a href="{{- $topic.RelPermalink -}}{{- if eq hugo.Environment "offline" -}}index.html{{- end -}}"{{- with $topic.Title}} title="{{- $topic.Title -}}"{{- end -}}><span class="sup">topic</span>{{- $topic.Title -}}</a>
{{- else -}}
<a href="{{- $topic.RelPermalink -}}{{- if eq hugo.Environment "offline" -}}index.html{{- end -}}"{{- with .Title}} title="{{- . -}}"{{- end -}}><span class="sup">topic</span>{{- $text_link -}}</a>
{{- end -}}
{{- else -}}
<a href="{{- $t_destination -}}/{{- if eq hugo.Environment "offline" -}}index.html{{- end -}}">{{- $text_link -}}⦚<span class="text-xs font-bold p-1 bg-AuChico text-CoconutCream">topic:{{- $t_destination -}} not found</span></a>
<a href="{{- .Destination -}}/{{- if eq hugo.Environment "offline" -}}index.html{{- end -}}">{{- $text_link -}}⦚<span>{{- .Destination -}} not found</span></a>
{{- end -}}
{{- else if strings.HasPrefix .Destination "audio:" -}}
{{- $a_destination := (substr .Destination 6) -}}