src/talks.sh: Handle display of future dates
Display future dates as "Will be presented on" rather than "Presented on".master
parent
6ece7769d4
commit
825491587f
21
src/talks.sh
21
src/talks.sh
|
@ -49,6 +49,23 @@ talk-field()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Produce string to handle past or future dates.
|
||||||
|
present-relative()
|
||||||
|
{
|
||||||
|
local -r date=${1?Missing date}
|
||||||
|
|
||||||
|
local -i now udate
|
||||||
|
now=$(date +%s)
|
||||||
|
udate=$( date --date="$date" +%s )
|
||||||
|
|
||||||
|
if [ "$now" -lt "$udate" ]; then
|
||||||
|
echo 'Will be presented'
|
||||||
|
else
|
||||||
|
echo Presented
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Generate abstract for talk.
|
# Generate abstract for talk.
|
||||||
abstract()
|
abstract()
|
||||||
{
|
{
|
||||||
|
@ -72,6 +89,8 @@ abstract()
|
||||||
watch_title="Watch $location Talk"
|
watch_title="Watch $location Talk"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
present=$( present-relative "$date" )
|
||||||
|
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
<article class="abstract talk">
|
<article class="abstract talk">
|
||||||
<h2 class="title" id="$id">$title</h2>
|
<h2 class="title" id="$id">$title</h2>
|
||||||
|
@ -87,7 +106,7 @@ abstract()
|
||||||
|
|
||||||
$abstract_html
|
$abstract_html
|
||||||
|
|
||||||
<p class="date">Presented on $date at
|
<p class="date">$present on $date at
|
||||||
<a href="$event_link">$location</a>.</p>
|
<a href="$event_link">$location</a>.</p>
|
||||||
</article>
|
</article>
|
||||||
EOF
|
EOF
|
||||||
|
|
Loading…
Reference in New Issue