129 lines
3.0 KiB
Bash
Executable File
129 lines
3.0 KiB
Bash
Executable File
#!/bin/bash -
|
|
#===============================================================================
|
|
#
|
|
# FILE: make_reports
|
|
#
|
|
# USAGE: ./make_reports
|
|
#
|
|
# DESCRIPTION: Script to generate all the feedWatcher reports needed for
|
|
# conferences, etc
|
|
#
|
|
# OPTIONS: ---
|
|
# REQUIREMENTS: ---
|
|
# BUGS: ---
|
|
# NOTES: ---
|
|
# AUTHOR: Dave Morriss (djm), Dave.Morriss@gmail.com
|
|
# VERSION: 0.0.3
|
|
# CREATED: 2023-01-09 17:07:23
|
|
# REVISION: 2023-01-28 14:10:48
|
|
#
|
|
#===============================================================================
|
|
|
|
set -o nounset # Treat unset variables as an error
|
|
|
|
# SCRIPT=${0##*/}
|
|
# DIR=${0%/*}
|
|
|
|
#
|
|
# Paths
|
|
#
|
|
BASEDIR="$HOME/HPR/feed_watcher"
|
|
|
|
cd "$BASEDIR" || { echo "Failed to cd to $BASEDIR"; exit 1; }
|
|
|
|
FOSDEM23="$BASEDIR/Conferences/FOSDEM/2023"
|
|
|
|
#
|
|
# Files and sanity checks
|
|
#
|
|
FW="$BASEDIR/feedWatcher"
|
|
[ -e "$FW" ] || {
|
|
echo "Script $FW appears to be missing"
|
|
exit 1
|
|
}
|
|
FWTPL3="$BASEDIR/feedWatcher_3.tpl"
|
|
[ -e "$FWTPL3" ] || {
|
|
echo "Template $FWTPL3 appears to be missing"
|
|
exit 1
|
|
}
|
|
FWTPL4="$BASEDIR/feedWatcher_4.tpl"
|
|
[ -e "$FWTPL4" ] || {
|
|
echo "Template $FWTPL4 appears to be missing"
|
|
exit 1
|
|
}
|
|
FWHTML="$BASEDIR/feedWatcher.html"
|
|
FWMKD="$BASEDIR/feedWatcher.mkd"
|
|
FWPDF="$BASEDIR/feedWatcher.pdf"
|
|
|
|
FDMKD4="$FOSDEM23/feedWatcher_4.mkd"
|
|
FDODT="$FOSDEM23/fosdem_23.odt"
|
|
FDODT_LIVE="$BASEDIR/fosdem_23.odt"
|
|
|
|
#
|
|
# Generate HTML, JSON and OPML reports.
|
|
# The template defaults to 'feedWatcher.tpl', the JSON file to
|
|
# 'feedWatcher.json' and the OPML file to 'feedWatcher.opml'. The script
|
|
# reports information about this, except for the HTML.
|
|
#
|
|
$FW -template -json -opml -out="$FWHTML"
|
|
if [[ -e "$FWHTML" ]]; then
|
|
echo "HTML written to $FWHTML"
|
|
else
|
|
echo "$FWHTML doesn't seem to have been written"
|
|
fi
|
|
|
|
#
|
|
# Generate Markdown
|
|
#
|
|
$FW -tem="$FWTPL3" -out="$FWMKD"
|
|
if [[ -e "$FWMKD" ]]; then
|
|
echo "Markdown written to $FWMKD"
|
|
else
|
|
echo "$FWMKD doesn't seem to have been written"
|
|
fi
|
|
|
|
#
|
|
# Use the Makefile to create PDF
|
|
#
|
|
make all
|
|
RES=$?
|
|
[ $RES -ne 0 ] && {
|
|
echo "Problem running 'make'; aborting!"
|
|
exit $RES
|
|
}
|
|
|
|
if [[ -e "$FWPDF" ]]; then
|
|
echo "PDF written to $FWPDF"
|
|
else
|
|
echo "$FWPDF doesn't seem to have been written"
|
|
fi
|
|
|
|
#
|
|
# The ODF for FOSDEM. The template for Markdown first. The output is in the
|
|
# directory Conferences/FOSDEM/2023/. Then pandoc to generate ODT from the
|
|
# Markdown. We use a reference document (an older FOSDEM report) to set some
|
|
# attributes.
|
|
#
|
|
$FW -tem="$FWTPL4" -out="$FDMKD4"
|
|
if [[ -e "$FDMKD4" ]]; then
|
|
echo "PDF written to $FDMKD4"
|
|
|
|
pandoc -f markdown --standalone -t odt --reference-doc=reference.odt \
|
|
-o "$FDODT" "$FDMKD4"
|
|
if [[ -e "$FDODT" ]]; then
|
|
echo "Wrote the ODT file $FDODT"
|
|
cp "$FDODT" "$FDODT_LIVE"
|
|
echo "Copied ODT to $FDODT_LIVE"
|
|
else
|
|
echo "$FDODT doesn't seem to have been written"
|
|
fi
|
|
else
|
|
echo "$FDMKD4 doesn't seem to have been written"
|
|
echo "Can't run Pandoc"
|
|
fi
|
|
|
|
exit
|
|
|
|
# vim: syntax=sh:ts=8:sw=4:ai:et:tw=78:fo=tcrqn21
|
|
|