#!/bin/bash # Generate talks HTML page # # Copyright (C) 2019 Mike Gerwitz # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Talks are organized along with abstract in $TALKFILE. Abstracts are # assumed to be Markdown-formatted and are run through Pandoc. A link to # the talk video is provided, along with any supplemental links provided via # $TALKFILE (e.g. slides, source code, bibliography). ## set -euo pipefail # Recfile containing talk abstracts and metadata. declare -r TALKFILE=${TALKFILE:-src/talks.rec} # List ids of all talks in $TALKFILE. talk-list() { recsel -CP id "$TALKFILE" } # Retrieve field FIELD from talk identified by ID in $TALKFILE. talk-field() { local -r id=${1?Missing talk id} local -r field=${2?Missing talk field} recsel -P "$field" -e "id = '$id'" "$TALKFILE" } # Generate abstract for talk. abstract() { local -r id=${1?Missing talk id} local title location locimg date abstract url links title=$( talk-field "$id" title ) location=$( talk-field "$id" location ) locimg=$( talk-field "$id" locimg ) date=$( talk-field "$id" date ) abstract=$( talk-field "$id" abstract ) url=$( talk-field "$id" video-url ) links=$( talk-field "$id" link ) local abstract_html abstract_html=$( pandoc -fmarkdown -thtml5 <<< "$abstract" ) cat <

$title

$abstract_html

Presented on $date.

EOF } # Generate talks page. main() { src/mkheader talks Talks local talks talks=$( recsel -P id src/talks.rec ) echo '

Talks

' talk-list | while read id; do abstract "$id"; done cat src/footer.tpl.htm } main "$@"