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 cd $TMP_WEBSITE
[ -d $WEBSITE ] || mkdir -p $WEBSITE [ -d $WEBSITE ] || mkdir -p $WEBSITE
if [ -d $WEBSITE ] if [ -d $WEBSITE ]; then
then safe-rm -rf ${WEBSITE}*
safe-rm -rf ${WEBSITE}* fi
fi
$HUGO_PATH -e gitea -d $WEBSITE > ${TMP_WEBSITE}/last-commit-log.txt $HUGO_PATH -e gitea -d $WEBSITE > ${TMP_WEBSITE}/last-commit-log.txt
printf "\n>> $d\n>> `date`" >> ${TMP_WEBSITE}/last-commit-log.txt printf "\n>> $d\n>> `date`" >> ${TMP_WEBSITE}/last-commit-log.txt
@ -61,7 +60,7 @@ do
if [ $BRK = "brk" ]; then if [ $BRK = "brk" ]; then
break break
fi fi
cd $CWD cd $CWD
refs=`$GIT_PATH show --format="%s" -s` refs=`$GIT_PATH show --format="%s" -s`
IFS=$' ' IFS=$' '
@ -74,10 +73,9 @@ do
[ -d $WEBSITE ] || mkdir -p $WEBSITE [ -d $WEBSITE ] || mkdir -p $WEBSITE
if [ -d $WEBSITE ] if [ -d $WEBSITE ]; then
then
safe-rm -rf ${WEBSITE}* safe-rm -rf ${WEBSITE}*
fi fi
$HUGO_PATH -e gitea -d $WEBSITE > ${TMP_WEBSITE}/last-commit-log.txt $HUGO_PATH -e gitea -d $WEBSITE > ${TMP_WEBSITE}/last-commit-log.txt
printf "\n>> $d\n>> `date`" >> ${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 'edit = true' > data/myvars.toml
echo 'giturl="'${GIT_URL}'"' >> data/myvars.toml echo 'giturl="'${GIT_URL}'"' >> data/myvars.toml
if [ -d $WEBSITEPREVIEW ] if [ -d $WEBSITEPREVIEW ]; then
then
safe-rm -rf $WEBSITEPREVIEW safe-rm -rf $WEBSITEPREVIEW
fi 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 printf "\n>> $d\n>> `date`" >> ${TMP_WEBSITEPREVIEW}/last-commit-log.txt
mv ${TMP_WEBSITEPREVIEW}/last-commit-log.txt $WEBSITEPREVIEW mv ${TMP_WEBSITEPREVIEW}/last-commit-log.txt $WEBSITEPREVIEW
if [ -d $TMP_WEBSITEPREVIEW ] if [ -d $TMP_WEBSITEPREVIEW ]; then
then
safe-rm -rf $TMP_WEBSITEPREVIEW safe-rm -rf $TMP_WEBSITEPREVIEW
fi fi

View File

@ -1,42 +1,42 @@
{{ $text_link := .Text }} {{- $text_link := .Text -}}
{{ if strings.HasPrefix .Destination "bib:" }} {{- if strings.HasPrefix .Destination "bib:" -}}
{{ $destination := (substr .Destination 4) }} {{- $destination := (substr .Destination 4) -}}
{{ if index $.Page.Site.Data.books.piratecarecollection $destination }} {{- if index $.Page.Site.Data.books.piratecarecollection $destination -}}
{{ $b := index $.Page.Site.Data.books.piratecarecollection $destination }} {{- $b := index $.Page.Site.Data.books.piratecarecollection $destination -}}
{{ if not $text_link }} {{- 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> <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 }} {{- else -}}
<a href="/library/BROWSE_LIBRARY.html#/book/{{ $destination }}"{{ with $b.title}} title="{{ . }}"{{ end }} target="_blank">{{ $text_link }}</a> <a href="/library/BROWSE_LIBRARY.html#/book/{{- $destination -}}"{{- with $b.title}} title="{{- . -}}"{{- end -}} target="_blank">{{- $text_link -}}</a>
{{ end }} {{- end -}}
{{ else }} {{- 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> <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 }} {{- end -}}
{{ else if strings.HasPrefix .Destination "session:" }} {{- else if strings.HasPrefix .Destination "session:" -}}
{{ $s_destination := printf "/session/%s" (substr .Destination 8) }} {{- $s_destination := printf "/session/%s" (substr .Destination 8) -}}
{{ if $.Page.Site.GetPage $s_destination }} {{- if $.Page.Site.GetPage $s_destination -}}
{{ $session := $.Page.Site.GetPage $s_destination }} {{- $session := $.Page.Site.GetPage $s_destination -}}
{{ if not $text_link }} {{- 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> <a href="{{- $session.RelPermalink -}}{{- if eq hugo.Environment "offline" -}}index.html{{- end -}}"{{- with $session.Title}} title="{{- $session.Title -}}"{{- end -}}>{{- $session.Title -}}</a>
{{ else }} {{- else -}}
<a href="{{ $session.RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ $text_link }}</a> <a href="{{- $session.RelPermalink -}}{{- if eq hugo.Environment "offline" -}}index.html{{- end -}}"{{- with .Title}} title="{{- . -}}"{{- end -}}>{{- $text_link -}}</a>
{{ end }} {{- end -}}
{{ else }} {{- 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> <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 }} {{- end -}}
{{ else if strings.HasPrefix .Destination "topic:" }} {{- else if strings.HasPrefix .Destination "topic:" -}}
{{ $t_destination := printf "/topic/%s" (substr .Destination 6) }} {{- $t_destination := printf "/topic/%s" (substr .Destination 6) -}}
{{ if $.Page.Site.GetPage $t_destination }} {{- if $.Page.Site.GetPage $t_destination -}}
{{ $topic := $.Page.Site.GetPage $t_destination }} {{- $topic := $.Page.Site.GetPage $t_destination -}}
{{ if not $text_link }} {{- 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> <a href="{{- $topic.RelPermalink -}}{{- if eq hugo.Environment "offline" -}}index.html{{- end -}}"{{- with $topic.Title}} title="{{- $topic.Title -}}"{{- end -}}>{{- $topic.Title -}}</a>
{{ else }} {{- else -}}
<a href="{{ $topic.RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ $text_link }}</a> <a href="{{- $topic.RelPermalink -}}{{- if eq hugo.Environment "offline" -}}index.html{{- end -}}"{{- with .Title}} title="{{- . -}}"{{- end -}}>{{- $text_link -}}</a>
{{ end }} {{- end -}}
{{ else }} {{- 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> <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 }} {{- end -}}
{{ else if findRE "^.*static" .Destination }} {{- else if findRE "^.*static" .Destination -}}
<img src="{{ (replaceRE "^.*static" "" .Destination ) | safeURL }}" alt="{{ .Text }}" {{ with .Title}} title="{{ . }}"{{ end }} /> <img src="{{- (replaceRE "^.*static" "" .Destination ) | safeURL -}}" alt="{{- .Text -}}" {{- with .Title}} title="{{- . -}}"{{- end -}} />
{{ else }} {{- else -}}
<img src="{{ .Destination | safeURL }}" alt="{{ .Text }}" {{ with .Title}} title="{{ . }}"{{ end }} /> <img src="{{- .Destination | safeURL -}}" alt="{{- .Text -}}" {{- with .Title}} title="{{- . -}}"{{- end -}} />
{{ end }} {{- end -}}