This repository has been archived on 2020-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
Syllabus/themes/piratecare/layouts/_default/_markup/render-image.html

44 lines
3.1 KiB
HTML
Raw Normal View History

2020-03-05 04:10:52 +00:00
{{ $text_link := .Text }}
2020-03-05 15:15:30 +00:00
{{ .Destination }}
2020-03-05 04:10:52 +00:00
{{ if strings.HasPrefix .Destination "bib:" }}
{{ $destination := (substr .Destination 4) }}
{{ if index $.Page.Site.Data.books.piratecarecollection $destination }}
{{ $b := index $.Page.Site.Data.books.piratecarecollection $destination }}
{{ if not $text_link }}
<span>{{ delimit $b.authors ", " " & " }}, {{ substr $b.pubdate 0 4}}.<a href="/library/BROWSE_LIBRARY.html#/book/{{ $destination }}"{{ with $b.title}} title="{{ . }}"{{ end }} target="_blank"><i>{{ $b.title }}</i></a>. {{ $b.publisher }}.</span>
{{ else }}
<a href="/library/BROWSE_LIBRARY.html#/book/{{ $destination }}"{{ with $b.title}} title="{{ . }}"{{ end }} target="_blank">{{ $text_link }}</a>
{{ end }}
{{ else }}
<a href="/library/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 }}
2020-03-05 15:27:58 +00:00
{{ else if strings.HasPrefix .Destination "session:" }}
2020-03-05 15:31:20 +00:00
{{ $s_destination := (substr .Destination 9) }}
{{ if $.Page.Site.GetPage $s_destination }}
{{ $session := $.Page.Site.GetPage $s_destination }}
2020-03-05 04:10:52 +00:00
{{ if not $text_link }}
2020-03-05 15:31:20 +00:00
<a href="/session/{{ $s_destination }}/{{ if eq hugo.Environment "offline" }}index.html{{ end }}"{{ with $session.Title}} title="{{ $session.Title }}"{{ end }}>{{ $session.Title }}</a>
2020-03-05 04:10:52 +00:00
{{ else }}
2020-03-05 15:31:20 +00:00
<a href="/session/{{ $s_destination }}/{{ if eq hugo.Environment "offline" }}index.html{{ end }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ $text_link }}</a>
2020-03-05 04:10:52 +00:00
{{ end }}
{{ else }}
2020-03-05 15:31:20 +00:00
<a href="/session/{{ $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>
2020-03-05 04:10:52 +00:00
{{ end }}
{{ else if strings.HasPrefix .Destination "topic:" }}
2020-03-05 15:31:20 +00:00
{{ $t_destination := (substr .Destination 6) }}
{{ if $.Page.Site.GetPage $t_destination }}
{{ $topic := $.Page.Site.GetPage $t_destination }}
2020-03-05 04:10:52 +00:00
{{ if not $text_link }}
2020-03-05 15:31:20 +00:00
<a href="/topic/{{ $t_destination }}/{{ if eq hugo.Environment "offline" }}index.html{{ end }}"{{ with $topic.Title}} title="{{ $topic.Title }}"{{ end }}>{{ $topic.Title }}</a>
2020-03-05 04:10:52 +00:00
{{ else }}
2020-03-05 15:31:20 +00:00
<a href="/topic/{{ $t_destination }}/{{ if eq hugo.Environment "offline" }}index.html{{ end }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ $text_link }}</a>
2020-03-05 04:10:52 +00:00
{{ end }}
{{ else }}
2020-03-05 15:31:20 +00:00
<a href="/topic/{{ $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>
2020-03-05 04:10:52 +00:00
{{ end }}
2020-03-05 11:54:42 +00:00
{{ else if findRE "^.*static" .Destination }}
2020-03-05 11:58:29 +00:00
<img src="{{ (replaceRE "^.*static" "" .Destination ) | safeURL }}" alt="{{ .Text }}" {{ with .Title}} title="{{ . }}"{{ end }} />
2020-03-05 04:10:52 +00:00
{{ else }}
<img src="{{ .Destination | safeURL }}" alt="{{ .Text }}" {{ with .Title}} title="{{ . }}"{{ end }} />
{{ end }}