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.4 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 ", " " & " -}},&ensp;<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 -}}.&ensp;{{- . -}}.{{- end -}}</span>{{- with $b.pubdate -}}&ensp;({{- substr . 0 4}}){{- end -}}
  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_parts := split (substr .Destination 6) "|" -}}
  32. {{- $a_destination := index ($a_parts) 0 -}}
  33. {{- if findRE "^.*static" $a_destination -}}
  34. <span class="soundcite" data-url="{{- (replaceRE "^.*static" "" $a_destination ) | safeURL -}}"
  35. {{- else if hasPrefix $a_destination "http" -}}
  36. <span class="soundcite" data-url="{{- $a_destination | safeURL -}}"
  37. {{- else -}}
  38. <span class="soundcite" data-id="{{- $a_destination -}}"
  39. {{- end -}}
  40. {{- if (gt (len $a_parts) 2) -}}
  41. data-start="{{ index ($a_parts) 1 }}" data-end="{{ index ($a_parts) 2 }}"
  42. {{- end -}}
  43. data-plays="1">{{ .Text }}</span>
  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 -}}