src/talks.sh: Do not output watch link text if missing video-url

This is the case right now with cs4m, since I just gave the talk
and the video will not likely be available for a couple of weeks.
master
Mike Gerwitz 2019-03-25 21:10:48 -04:00
parent 2325d0609c
commit 7351076468
Signed by: mikegerwitz
GPG Key ID: 8C917B7F5DC51BA2
1 changed files with 12 additions and 3 deletions

View File

@ -41,7 +41,11 @@ talk-field()
local -r id=${1?Missing talk id}
local -r field=${2?Missing talk field}
recsel -P "$field" -e "id = '$id'" "$TALKFILE"
local result status
result=$( recsel -P "$field" -e "id = '$id'" "$TALKFILE" )
status=$?
[ $? -a -n "$result" ] && echo "$result"
}
@ -56,18 +60,23 @@ abstract()
locimg=$( talk-field "$id" locimg )
date=$( talk-field "$id" date )
abstract=$( talk-field "$id" abstract )
url=$( talk-field "$id" video-url )
url=$( talk-field "$id" video-url || echo "#$id" )
links=$( talk-field "$id" link )
local abstract_html
abstract_html=$( pandoc -fmarkdown -thtml5 <<< "$abstract" )
local watch_title=
if [[ ! "$url" =~ ^# ]]; then
watch_title="Watch $location Talk"
fi
cat <<EOF
<article class="abstract talk">
<h2 class="title" id="$id">$title</h2>
<ul class="links">
<li><a class="video $locimg" href="$url">Watch $location Talk</a></li>
<li><a class="video $locimg" href="$url">$watch_title</a></li>
$(
while read lurl ltitle; do
printf "<li><a href="%s">%s</a></li>\n" "$lurl" "$ltitle"