whitespaces in templates...

This commit is contained in:
Marcell Mars 2020-04-01 14:17:49 +02:00
parent b44ecb91ca
commit 852f10e217
2 changed files with 50 additions and 54 deletions

View File

@ -39,10 +39,9 @@ do
cd $TMP_WEBSITE
[ -d $WEBSITE ] || mkdir -p $WEBSITE
if [ -d $WEBSITE ]
then
safe-rm -rf ${WEBSITE}*
fi
if [ -d $WEBSITE ]; then
safe-rm -rf ${WEBSITE}*
fi
$HUGO_PATH -e gitea -d $WEBSITE > ${TMP_WEBSITE}/last-commit-log.txt
printf "\n>> $d\n>> `date`" >> ${TMP_WEBSITE}/last-commit-log.txt
@ -74,10 +73,9 @@ do
[ -d $WEBSITE ] || mkdir -p $WEBSITE
if [ -d $WEBSITE ]
then
if [ -d $WEBSITE ]; then
safe-rm -rf ${WEBSITE}*
fi
fi
$HUGO_PATH -e gitea -d $WEBSITE > ${TMP_WEBSITE}/last-commit-log.txt
printf "\n>> $d\n>> `date`" >> ${TMP_WEBSITE}/last-commit-log.txt
@ -103,8 +101,7 @@ cd $TMP_WEBSITEPREVIEW
echo 'edit = true' > data/myvars.toml
echo 'giturl="'${GIT_URL}'"' >> data/myvars.toml
if [ -d $WEBSITEPREVIEW ]
then
if [ -d $WEBSITEPREVIEW ]; then
safe-rm -rf $WEBSITEPREVIEW
fi
@ -113,8 +110,7 @@ $HUGO_PATH -e gitea -d $WEBSITEPREVIEW > ${TMP_WEBSITEPREVIEW}/last-commit-log.t
printf "\n>> $d\n>> `date`" >> ${TMP_WEBSITEPREVIEW}/last-commit-log.txt
mv ${TMP_WEBSITEPREVIEW}/last-commit-log.txt $WEBSITEPREVIEW
if [ -d $TMP_WEBSITEPREVIEW ]
then
if [ -d $TMP_WEBSITEPREVIEW ]; then
safe-rm -rf $TMP_WEBSITEPREVIEW
fi

View File

@ -1,42 +1,42 @@
{{ $text_link := .Text }}
{{ 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 ", " " & " }}{{ with $b.pubdate }}, {{ substr . 0 4}}{{ end }}.<a href="/library/BROWSE_LIBRARY.html#/book/{{ $destination }}"{{ with $b.title}} title="{{ . }}"{{ end }} target="_blank"><i>{{ $b.title }}</i></a>. {{ with $b.publisher }}{{ . }}.{{ end }}</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 }}
{{ 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 }}
{{ if not $text_link }}
<a href="{{ $session.RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}"{{ with $session.Title}} title="{{ $session.Title }}"{{ end }}>{{ $session.Title }}</a>
{{ else }}
<a href="{{ $session.RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ $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 }}>{{ $topic.Title }}</a>
{{ else }}
<a href="{{ $topic.RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ $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>
{{ end }}
{{ else if findRE "^.*static" .Destination }}
<img src="{{ (replaceRE "^.*static" "" .Destination ) | safeURL }}" alt="{{ .Text }}" {{ with .Title}} title="{{ . }}"{{ end }} />
{{ else }}
<img src="{{ .Destination | safeURL }}" alt="{{ .Text }}" {{ with .Title}} title="{{ . }}"{{ end }} />
{{ end }}
{{- $text_link := .Text -}}
{{- 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 ", " " & " -}}{{- with $b.pubdate -}}, {{- substr . 0 4}}{{- end -}}.<a href="/library/BROWSE_LIBRARY.html#/book/{{- $destination -}}"{{- with $b.title}} title="{{- . -}}"{{- end -}} target="_blank"><i>{{- $b.title -}}</i></a>. {{- with $b.publisher -}}{{- . -}}.{{- end -}}</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 -}}
{{- 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 -}}
{{- if not $text_link -}}
<a href="{{- $session.RelPermalink -}}{{- if eq hugo.Environment "offline" -}}index.html{{- end -}}"{{- with $session.Title}} title="{{- $session.Title -}}"{{- end -}}>{{- $session.Title -}}</a>
{{- else -}}
<a href="{{- $session.RelPermalink -}}{{- if eq hugo.Environment "offline" -}}index.html{{- end -}}"{{- with .Title}} title="{{- . -}}"{{- end -}}>{{- $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 -}}>{{- $topic.Title -}}</a>
{{- else -}}
<a href="{{- $topic.RelPermalink -}}{{- if eq hugo.Environment "offline" -}}index.html{{- end -}}"{{- with .Title}} title="{{- . -}}"{{- end -}}>{{- $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>
{{- end -}}
{{- else if findRE "^.*static" .Destination -}}
<img src="{{- (replaceRE "^.*static" "" .Destination ) | safeURL -}}" alt="{{- .Text -}}" {{- with .Title}} title="{{- . -}}"{{- end -}} />
{{- else -}}
<img src="{{- .Destination | safeURL -}}" alt="{{- .Text -}}" {{- with .Title}} title="{{- . -}}"{{- end -}} />
{{- end -}}