1
0
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:
Dave Morriss
2024-12-01 20:45:20 +00:00
parent 7e925621f4
commit b7cae1cb90
10 changed files with 215 additions and 118 deletions

View File

@@ -60,9 +60,9 @@
# BUGS: ---
# NOTES: ---
# AUTHOR: Dave Morriss (djm), Dave.Morriss@gmail.com
# VERSION: 0.2.3
# VERSION: 0.2.4
# CREATED: 2020-05-25 13:20:18
# REVISION: 2024-02-22 14:32:03
# REVISION: 2024-07-25 21:39:16
#
#===============================================================================
@@ -71,16 +71,16 @@ set -o nounset # Treat unset variables as an error
SCRIPT=${0##*/}
# DIR=${0%/*}
VERSION="0.2.3"
VERSION="0.2.4"
STDOUT="/dev/fd/2"
#
# Load library functions (make_file_list, range_parse, cleanup_temp)
#
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"
#
@@ -88,7 +88,7 @@ source "$LIB"
#
define_colours
# {{{ -- _usage --
# {{{ -- _usage - _silent -- _dryrun --
#=== FUNCTION ================================================================
# NAME: _usage
# DESCRIPTION: Report usage
@@ -150,9 +150,7 @@ Examples
endusage
exit
}
# }}}
# {{{ -- _silent -- _dryrun -- _DEBUG --
#=== FUNCTION ================================================================
# NAME: _silent
# DESCRIPTION: Output a message unless we're being silent
@@ -179,19 +177,6 @@ _dryrun () {
prefix=
done
}
#=== 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
}
# }}}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -229,12 +214,25 @@ if [[ $# -ne 1 ]]; then
echo "${red}Missing shownumber argument${reset}"
_usage
fi
epno="${1}"
#
# Ensure item spec is correctly formatted. Have to cater for leading zeroes
# being interpreted as octal.
#
if [[ $epno =~ ^(hpr)?([0-9]+)$ ]]; then
epno="$((10#${BASH_REMATCH[-1]}))"
else
coloured 'red' "Incorrect show specification: $epno"
coloured 'yellow' "Use 'hpr9999' or '9999' formats"
exit 1
fi
#
# Paths to files
#
BASEDIR="$HOME/HPR/Show_Submission"
SHOWDIR="$BASEDIR/shownotes/hpr${1}"
SHOWDIR="$BASEDIR/shownotes/hpr${epno}"
# RAWFILE="$SHOWDIR/shownotes.txt"
JSONFILE="$SHOWDIR/shownotes.json"
PICDIR="$SHOWDIR/uploads"