You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
3.6 KiB

  1. {{- $text_link := .Text -}}
  2. {{ $_ := newScratch }}
  3. {{- range $k, $v := .Page.Site.Data.sandpointsnamegraph -}}
  4. {{ $_.Add "triads" $k }}
  5. {{- end -}}
  6. {{- if strings.HasPrefix .Destination "bib:" -}}
  7. {{- $destination := (substr .Destination 4) -}}
  8. {{- $c_prefix := .Page.Site.Params.sandpointsCatalogPrefix | default "/library/" -}}
  9. {{- if index $.Page.Site.Data.books.catalog $destination -}}
  10. {{- $b := index $.Page.Site.Data.books.catalog $destination -}}
  11. {{- $bibhref := printf "%sBROWSE_LIBRARY.html#/book/%s" (safeURL ($c_prefix)) $destination }}
  12. {{ $bibtitle := "" }}
  13. {{ with $b.title }}
  14. {{- $bibtitle = printf "%s" $b.title }}
  15. {{ end }}
  16. {{ .Page.Scratch.Add "bibs" (slice (slice $bibhref $bibtitle)) }}
  17. {{- if not $text_link -}}
  18. <span>{{- delimit $b.authors ", " " & " -}}{{- with $b.pubdate -}}, {{- substr . 0 4}}{{- end -}}.<a href="{{- $c_prefix | safeURL -}}BROWSE_LIBRARY.html#/book/{{- $destination -}}"{{- with $b.title}} title="{{- . -}}"{{- end -}} target="_blank"><span class="sup">bib⁄</span><i>‘{{- $b.title -}}’</i></a>. {{- with $b.publisher -}}{{- . -}}.{{- end -}}</span>
  19. {{- else -}}
  20. <span class="sup">bib⁄</span><a href="{{- $c_prefix | safeURL -}}BROWSE_LIBRARY.html#/book/{{- $destination -}}"{{- with $b.title}} title="{{- . -}}"{{- end -}} target="_blank">{{- $text_link -}}</a>
  21. {{- end -}}
  22. {{- else -}}
  23. <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>
  24. {{- end -}}
  25. {{- else if in ($_.Get "triads") (index (split .Destination ":") 0) -}}
  26. {{- if $.Page.Site.GetPage (printf "/%s" (replace .Destination ":" "/")) -}}
  27. {{- $session := $.Page.Site.GetPage (printf "/%s" (replace .Destination ":" "/")) -}}
  28. {{ .Page.Scratch.Add "links" (slice $session) }}
  29. {{- if not $text_link -}}
  30. <a class="triadlink" repoid="{{- $session.File.UniqueID -}}" printhref="#ph-{{- $session.File.UniqueID -}}" 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>
  31. {{- else -}}
  32. <a class="triadlink" repoid="{{- $session.File.UniqueID -}}" printhref="#ph-{{- $session.File.UniqueID -}}" 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>
  33. {{- end -}}
  34. {{- else -}}
  35. <a href="{{- .Destination -}}/{{- if eq hugo.Environment "offline" -}}index.html{{- end -}}">{{- $text_link -}}⦚<span>{{- .Destination -}} not found</span></a>
  36. {{- end -}}
  37. {{- else if strings.HasPrefix .Destination "audio:" -}}
  38. {{- $a_destination := (substr .Destination 6) -}}
  39. {{- if findRE "^.*static" $a_destination -}}
  40. <span class="soundcite" data-url="{{- (replaceRE "^.*static" "" $a_destination ) | safeURL -}}">{{ .Text }}</span>
  41. {{- else -}}
  42. <span class="soundcite" data-url="{{- $a_destination | safeURL -}}">{{ .Text }}</span>
  43. {{- end -}}
  44. {{- else if findRE "^.*static" .Destination -}}
  45. <img src="{{- (replaceRE "^.*static" "" .Destination ) | safeURL -}}" alt="{{- .Text -}}" {{- with .Title}} title="{{- . -}}"{{- end -}} />
  46. {{- else -}}
  47. <img src="{{- .Destination | safeURL -}}" alt="{{- .Text -}}" {{- with .Title}} title="{{- . -}}"{{- end -}} />
  48. {{- end -}}