Mike Gerwitz

Free Software Hacker+Activist

aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMike Gerwitz <mtg@gnu.org>2019-03-25 21:10:48 -0400
committerMike Gerwitz <mtg@gnu.org>2019-03-25 21:10:48 -0400
commit73510764686c2b72257d1deaf52479e9b766e017 (patch)
tree9bcb579c8ea9cf1d28eb74b11af8d0d8c048b425 /src
parent2325d0609c4d6504446519fc66359aae32e17b38 (diff)
downloadthoughts-73510764686c2b72257d1deaf52479e9b766e017.zip
thoughts-73510764686c2b72257d1deaf52479e9b766e017.tar.gz
thoughts-73510764686c2b72257d1deaf52479e9b766e017.tar.bz2
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.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/talks.sh15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/talks.sh b/src/talks.sh
index 15f87dd..7a33379 100755
--- a/src/talks.sh
+++ b/src/talks.sh
@@ -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"