forked from HPR/hpr-tools
Various updates
Show_Submission/copy_shownotes: Changed the location of the function library Show_Submission/do_brave: Updates to the way local stand-alone HTML is generated for review purposes. Show_Submission/do_index: Changed the location of the function library Show_Submission/do_pandoc: Changed the location of the function library; now uses 'author_title.pl' to generate YAML for Pandoc Show_Submission/do_parse: Trivial change Show_Submission/do_pictures: Changed the location of the function library; better handling of the show specification Show_Submission/do_report: Changed the location of the function library Show_Submission/do_update_reservations: Changed the location of the function library Show_Submission/fix_relative_links: Added features 'say' and 'state' Show_Submission/parse_JSON: New checks: notes too short, trailing spaces on title, summary and tags (needing JSON changes). Check for Markdown in the assets (see 'do_pandoc_assets'). New 'trim' function.
This commit is contained in:
@@ -37,9 +37,9 @@
|
||||
# careful about collisions.
|
||||
#
|
||||
# AUTHOR: Dave Morriss (djm), Dave.Morriss@gmail.com
|
||||
# VERSION: 0.2.10
|
||||
# VERSION: 0.2.11
|
||||
# CREATED: 2016-08-16 15:34:30
|
||||
# REVISION: 2024-02-18 13:27:40
|
||||
# REVISION: 2024-10-18 23:03:25
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
@@ -48,16 +48,16 @@ set -o nounset # Treat unset variables as an error
|
||||
SCRIPT=${0##*/}
|
||||
#DIR=${0%/*}
|
||||
|
||||
VERSION='0.2.10'
|
||||
VERSION='0.2.11'
|
||||
|
||||
STDOUT="/dev/fd/2"
|
||||
|
||||
#
|
||||
# Load library functions
|
||||
#
|
||||
LIB="$HOME/bin/function_lib.sh"
|
||||
LIB="$HOME/HPR/function_lib.sh"
|
||||
[ -e "$LIB" ] || { echo "$SCRIPT: Unable to source functions"; exit 1; }
|
||||
# shellcheck source=/home/cendjm/bin/function_lib.sh
|
||||
# shellcheck source=/home/cendjm/HPR/function_lib.sh
|
||||
source "$LIB"
|
||||
|
||||
#
|
||||
@@ -65,7 +65,7 @@ source "$LIB"
|
||||
#
|
||||
define_colours
|
||||
|
||||
# {{{ Functions: -- _usage -- _DEBUG --
|
||||
# {{{ Functions: -- _usage --
|
||||
#=== FUNCTION ================================================================
|
||||
# NAME: _usage
|
||||
# DESCRIPTION: Report usage
|
||||
@@ -102,19 +102,6 @@ Examples
|
||||
endusage
|
||||
exit
|
||||
}
|
||||
|
||||
#=== FUNCTION ================================================================
|
||||
# NAME: _DEBUG
|
||||
# DESCRIPTION: Writes one or more message lines if in DEBUG mode
|
||||
# PARAMETERS: List of messages
|
||||
# RETURNS: Nothing
|
||||
#===============================================================================
|
||||
_DEBUG () {
|
||||
[ "$DEBUG" == 0 ] && return
|
||||
for msg in "$@"; do
|
||||
printf 'D> %s\n' "$msg"
|
||||
done
|
||||
}
|
||||
# }}}
|
||||
|
||||
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@@ -168,8 +155,8 @@ options[txt2tags]=''
|
||||
#
|
||||
# Sanity checks
|
||||
#
|
||||
JQ=$(command -v jq)
|
||||
[ -n "$JQ" ] || { echo "Program 'jq' was not found"; exit 1; }
|
||||
# JQ=$(command -v jq)
|
||||
# [ -n "$JQ" ] || { echo "Program 'jq' was not found"; exit 1; }
|
||||
# YQ=$(command -v yq)
|
||||
# [ -n "$YQ" ] || { echo "Program 'yq' was not found"; exit 1; }
|
||||
|
||||
@@ -235,7 +222,7 @@ trap 'cleanup_temp $TMP1 $TMP2 $TMP3' SIGHUP SIGINT SIGPIPE SIGTERM EXIT
|
||||
# Main directory
|
||||
BASENAME="$HOME/HPR/Show_Submission"
|
||||
|
||||
# JSON to YAML Perl script
|
||||
# JSON to YAML Perl script - sanity check
|
||||
J2Y="$BASENAME/author_title.pl"
|
||||
[ -e "$J2Y" ] || { echo "Program '$J2Y' was not found"; exit 1; }
|
||||
|
||||
@@ -303,19 +290,23 @@ BASEURL='https://hackerpublicradio.org/eps/'
|
||||
# needed for Pandoc
|
||||
#
|
||||
# Non-YAML alternative - not chosen
|
||||
#jqprog="@text \"author: \(.host.Host_Name)\ntitle: \(.episode.Title)\""
|
||||
# jqprog="@text \"author: \(.host.Host_Name)\ntitle: \(.episode.Title)\""
|
||||
#
|
||||
# Testing another formatter (Journal 2023-03-03)
|
||||
#jqprog="@sh \"---\nauthor: \(.host.Host_Name)\ntitle: \(.episode.Title)\n---\""
|
||||
# jqprog="@sh \"---\nauthor: \(.host.Host_Name)\ntitle: \(.episode.Title)\n---\""
|
||||
# Added quotes around the generated strings (2023-03-31)
|
||||
# jqprog="@text \"---\nauthor: \(.host.Host_Name)\ntitle: \(.episode.Title)\n---\""
|
||||
#
|
||||
# Moved to 'yq' 2023-04-01
|
||||
# jqprog="@text \"---\nauthor: '\(.host.Host_Name)'\ntitle: '\(.episode.Title)'\n---\""
|
||||
# jq -r "$jqprog" "$JSONFILE" > "$TMP1"
|
||||
#
|
||||
# On 2023-10-01 wrote a Perl JSON to YAML generator just for these two
|
||||
# elements. It's called 'author_title.pl'
|
||||
#
|
||||
# yqprog='{author:.host.Host_Name,title:.episode.Title}'
|
||||
# ( echo "---"; $YQ -y "$yqprog" "$JSONFILE"; echo "---"; ) > "$TMP1"
|
||||
#
|
||||
$J2Y "$JSONFILE" "$TMP1"
|
||||
_DEBUG "YAML:" "$(cat "$TMP1")"
|
||||
|
||||
@@ -497,7 +488,7 @@ if [[ $DRYRUN -eq 0 ]]; then
|
||||
#
|
||||
# shellcheck disable=SC2086
|
||||
pandoc -f ${FROM}${POPTIONS} -t html5 --ascii \
|
||||
--standalone --template=hpr.html5 --no-highlight \
|
||||
--standalone --template=hpr_dev.html5 --no-highlight \
|
||||
-c https://hackerpublicradio.org/css/hpr.css \
|
||||
--metadata-file="$TMP1" -o "$FULLHTML" "$TMP3"
|
||||
RES=$?
|
||||
|
Reference in New Issue
Block a user