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.
 
 
 
 
 

46 lines
3.2 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.catalogprefix | default "/library/" -}}
  9. {{- if index $.Page.Site.Data.books.catalog $destination -}}
  10. {{- $b := index $.Page.Site.Data.books.catalog $destination -}}
  11. {{- if not $text_link -}}
  12. <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>
  13. {{- else -}}
  14. <a href="{{- $c_prefix | safeURL -}}BROWSE_LIBRARY.html#/book/{{- $destination -}}"{{- with $b.title}} title="{{- . -}}"{{- end -}} target="_blank">{{- $text_link -}}</a>
  15. {{- end -}}
  16. {{- else -}}
  17. <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>
  18. {{- end -}}
  19. {{- else if in ($_.Get "triads") (index (split .Destination ":") 0) -}}
  20. {{- if $.Page.Site.GetPage (printf "/%s" (replace .Destination ":" "/")) -}}
  21. {{- $session := $.Page.Site.GetPage (printf "/%s" (replace .Destination ":" "/")) -}}
  22. {{- if not $text_link -}}
  23. <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>
  24. {{- else -}}
  25. <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>
  26. {{- end -}}
  27. {{- else -}}
  28. <a href="{{- .Destination -}}/{{- if eq hugo.Environment "offline" -}}index.html{{- end -}}">{{- $text_link -}}⦚<span>{{- .Destination -}} not found</span></a>
  29. {{- end -}}
  30. {{- else if strings.HasPrefix .Destination "audio:" -}}
  31. {{- $a_destination := (substr .Destination 6) -}}
  32. {{- if findRE "^.*static" $a_destination -}}
  33. <div>{{ .Text }}</div>
  34. <audio src="{{- (replaceRE "^.*static" "" $a_destination ) | safeURL -}}" preload="metadata" controls="true"></audio>
  35. {{- else -}}
  36. <div>{{ .Text }}</div>
  37. <audio src="{{- $a_destination | safeURL -}}" preload="metadata" controls="true"></audio>
  38. {{- end -}}
  39. {{- else if findRE "^.*static" .Destination -}}
  40. <img src="{{- (replaceRE "^.*static" "" .Destination ) | safeURL -}}" alt="{{- .Text -}}" {{- with .Title}} title="{{- . -}}"{{- end -}} />
  41. {{- else -}}
  42. <img src="{{- .Destination | safeURL -}}" alt="{{- .Text -}}" {{- with .Title}} title="{{- . -}}"{{- end -}} />
  43. {{- end -}}