diff --git a/Makefile b/Makefile
index 8eaeb1e53..ad5d42415 100644
--- a/Makefile
+++ b/Makefile
@@ -303,7 +303,7 @@ indent.c:
.PHONY: help genpath genfilelist verify_entry_files gen_authors quick_authors \
gen_location quick_location gen_years find_missing_links test entry_index gen_top_html \
thanks gen_other_html quick_other_html quick_entry_index \
- gen_year_index quick_www www untar_entry_tarball untar_year_tarball \
+ gen_year_index quick_year_index quick_www www untar_entry_tarball untar_year_tarball \
form_entry_tarball form_year_tarball tar gen_status gen_sitemap \
sitemap timestamp update csv2entry entry2csv
@@ -344,6 +344,7 @@ help:
@echo 'make gen_other_html ;: build entry HTML files from markdown other than README.md'
@echo 'make quick_other_html ;: build entry non-index.html files that might be out of date'
@echo 'make gen_year_index ;: generate year level index.html files using from README.md files'
+ @echo 'make quick_year_index ;: generate year level index.html when year level README.md is newer'
@echo 'make gen_top_html ;: generate a number of the top level HTML files from markdown'
@echo 'make gen_next ;: generate the HTML files in next/'
@echo 'make quick_entry_index ;: build winner index.html files that might be out of date'
@@ -551,6 +552,16 @@ gen_year_index: ${ALL_YEARS} ${GEN_YEAR_INDEX}
${ALL_YEARS} -v 1 ${GEN_YEAR_INDEX} -v 1
@echo '=-=-=-=-= IOCCC complete make $@ =-=-=-=-='
+# generate year level index.html files when year level README.md is newer
+#
+# generate year level index.html files using the
+# ${GEN_YEAR_INDEX} tool (bin/gen-year-index.sh).
+#
+quick_year_index: ${ALL_YEARS} ${GEN_YEAR_INDEX}
+ @echo '=-=-=-=-= IOCCC begin make $@ =-=-=-=-='
+ ${ALL_YEARS} -v 1 -Q ${GEN_YEAR_INDEX} -v 1
+ @echo '=-=-=-=-= IOCCC complete make $@ =-=-=-=-='
+
# build winner index.html files that might be out of date
#
# This rule uses the ${QUICK_README2INDEX} tool
@@ -690,7 +701,7 @@ quick_www:
${MAKE} quick_authors
${MAKE} quick_location
${MAKE} gen_years
- ${MAKE} gen_year_index
+ ${MAKE} quick_year_index
${MAKE} gen_top_html
${MAKE} quick_entry_index
${MAKE} quick_other_html
diff --git a/bin/all-run.sh b/bin/all-run.sh
index a69808e49..17a6f3a23 100755
--- a/bin/all-run.sh
+++ b/bin/all-run.sh
@@ -17,7 +17,7 @@
#
# Each tool run with command line of the form:
#
-# tool [any -D, -t tagline, -T md2html.sh, -p tool, -w site_url] [more_options] YYYY/dir
+# tool [any -D, -t tagline, -w site_url] [more_options] YYYY/dir
#
# For example:
#
@@ -55,6 +55,7 @@
#
# Share and enjoy! :-)
+
# firewall - run only with a bash that is version 5.1.8 or later
#
# The "/usr/bin/env bash" command must result in using a bash that
@@ -111,9 +112,10 @@ shopt -u nocaseglob # disable strict case matching
shopt -u extglob # enable extended globbing patterns
shopt -s globstar # enable ** to match all files and zero or more directories and subdirectories
+
# set variables referenced in the usage message
#
-export VERSION="1.3.6 2024-08-05"
+export VERSION="1.4 2024-08-17"
NAME=$(basename "$0")
export NAME
export V_FLAG=0
@@ -131,8 +133,6 @@ fi
export TOPDIR
export DOCROOT_SLASH="../../"
export TAGLINE="unspecified"
-export MD2HTML_SH="bin/md2html.sh"
-export PANDOC_WRAPPER="bin/pandoc-wrapper.sh"
export REPO_TOP_URL="https://github.com/ioccc-src/temp-test-ioccc"
# GitHub puts individual files under the "blob/master" sub-directory.
export REPO_URL="$REPO_TOP_URL/blob/master"
@@ -142,15 +142,17 @@ export NOOP=
export DO_NOT_PROCESS=
export EXIT_CODE="0"
+
# clear options we will add to tools
#
unset TOOL_OPTION
declare -ag TOOL_OPTION
+
# usage
#
export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
- [-t tagline] [-T md2html.sh] [-p tool] [-w site_url]
+ [-t tagline] [-w site_url]
tool [more_options]
-h print help message and exit
@@ -167,10 +169,6 @@ export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
-t tagline string to write about the tool that formed the markdown content (def: $TAGLINE)
NOTE: The '-t tagline' is passed as leading options on tool command lines.
- -T md2html.sh run 'markdown to html tool' to convert markdown into HTML (def: $MD2HTML_SH)
- NOTE: The '-T md2html.sh' is passed as leading options on tool command lines.
-
- -p tool run 'pandoc wrapper tool' (not pandoc path) during HTML phase number 21 (def: use $PANDOC_WRAPPER)
-w site_url Base URL of the website (def: $SITE_URL)
NOTE: The '-w site_url' is passed as leading options on tool command lines.
@@ -178,7 +176,7 @@ export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
tool the tool to run over all entries
[more_options] additional tool command line options to use before the YYYY/dir argument
-NOTE: Any '-D docroot/', '-t tagline', '-T md2html.sh', '-p tool', '-w site_url'
+NOTE: Any '-D docroot/', '-t tagline', '-w site_url'
are passed to the 'tool' at the beginning of the command line, and
before any optional 'more_options' and before the final YYYY/dir argument.
@@ -195,9 +193,10 @@ Exit codes:
$NAME version: $VERSION"
+
# parse command line
#
-while getopts :hv:Vd:D:nNt:T:p:w: flag; do
+while getopts :hv:Vd:D:nNt:w: flag; do
case "$flag" in
h) echo "$USAGE" 1>&2
exit 2
@@ -246,14 +245,6 @@ while getopts :hv:Vd:D:nNt:T:p:w: flag; do
TOOL_OPTION+=("-t")
TOOL_OPTION+=("$TAGLINE")
;;
- T) MD2HTML_SH="$OPTARG"
- TOOL_OPTION+=("-T")
- TOOL_OPTION+=("$MD2HTML_SH")
- ;;
- p) PANDOC_WRAPPER="$OPTARG"
- TOOL_OPTION+=("-p")
- TOOL_OPTION+=("$PANDOC_WRAPPER")
- ;;
w) SITE_URL="$OPTARG"
TOOL_OPTION+=("-w")
TOOL_OPTION+=("$SITE_URL")
@@ -275,7 +266,7 @@ while getopts :hv:Vd:D:nNt:T:p:w: flag; do
;;
esac
done
-
+#
# remove the options
#
shift $(( OPTIND - 1 ));
@@ -303,6 +294,7 @@ case "$#" in
;;
esac
+
# verify that we have a topdir directory
#
REPO_NAME=$(basename "$REPO_TOP_URL")
@@ -323,6 +315,7 @@ if [[ ! -d $TOPDIR ]]; then
exit 6
fi
+
# cd to topdir
#
if [[ ! -e $TOPDIR ]]; then
@@ -346,6 +339,51 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: now in directory: $(/bin/pwd)" 1>&2
fi
+
+# verify that we have a bin subdirectory
+#
+export BIN_PATH="$TOPDIR/bin"
+if [[ ! -d $BIN_PATH ]]; then
+ echo "$0: ERROR: bin is not a directory under topdir: $BIN_PATH" 1>&2
+ exit 6
+fi
+export BIN_DIR="bin"
+
+
+# verify that the bin/md2html.sh tool is executable
+#
+export MD2HTML_SH="$BIN_DIR/md2html.sh"
+if [[ ! -e $MD2HTML_SH ]]; then
+ echo "$0: ERROR: bin/md2html.sh does not exist: $MD2HTML_SH" 1>&2
+ exit 5
+fi
+if [[ ! -f $MD2HTML_SH ]]; then
+ echo "$0: ERROR: bin/md2html.sh is not a regular file: $MD2HTML_SH" 1>&2
+ exit 5
+fi
+if [[ ! -x $MD2HTML_SH ]]; then
+ echo "$0: ERROR: bin/md2html.sh is not an executable file: $MD2HTML_SH" 1>&2
+ exit 5
+fi
+
+
+# verify that the bin/pandoc-wrapper.sh tool is executable
+#
+export PANDOC_WRAPPER="$BIN_DIR/pandoc-wrapper.sh"
+if [[ ! -e $PANDOC_WRAPPER ]]; then
+ echo "$0: ERROR: bin/md2html.sh does not exist: $PANDOC_WRAPPER" 1>&2
+ exit 5
+fi
+if [[ ! -f $PANDOC_WRAPPER ]]; then
+ echo "$0: ERROR: bin/md2html.sh is not a regular file: $PANDOC_WRAPPER" 1>&2
+ exit 5
+fi
+if [[ ! -x $PANDOC_WRAPPER ]]; then
+ echo "$0: ERROR: bin/md2html.sh is not an executable file: $PANDOC_WRAPPER" 1>&2
+ exit 5
+fi
+
+
# verify we have a non-empty readable .top file
#
export TOP_FILE=".top"
@@ -408,8 +446,6 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: TOPDIR=$TOPDIR" 1>&2
echo "$0: debug[3]: DOCROOT_SLASH=$DOCROOT_SLASH" 1>&2
echo "$0: debug[3]: TAGLINE=$TAGLINE" 1>&2
- echo "$0: debug[3]: MD2HTML_SH=$MD2HTML_SH" 1>&2
- echo "$0: debug[3]: PANDOC_WRAPPER=$PANDOC_WRAPPER" 1>&2
echo "$0: debug[3]: REPO_TOP_URL=$REPO_TOP_URL" 1>&2
echo "$0: debug[3]: REPO_URL=$REPO_URL" 1>&2
echo "$0: debug[3]: SITE_URL=$SITE_URL" 1>&2
@@ -422,9 +458,14 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: TOOL=$TOOL" 1>&2
echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2
echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2
+ echo "$0: debug[3]: BIN_PATH=$BIN_PATH" 1>&2
+ echo "$0: debug[3]: BIN_DIR=$BIN_DIR" 1>&2
+ echo "$0: debug[3]: MD2HTML_SH=$MD2HTML_SH" 1>&2
+ echo "$0: debug[3]: PANDOC_WRAPPER=$PANDOC_WRAPPER" 1>&2
echo "$0: debug[3]: TOP_FILE=$TOP_FILE" 1>&2
fi
+
# -N stops early before any processing is performed
#
if [[ -n $DO_NOT_PROCESS ]]; then
@@ -434,6 +475,7 @@ if [[ -n $DO_NOT_PROCESS ]]; then
exit 0
fi
+
# process each year
#
export YYYY
@@ -620,6 +662,7 @@ for YYYY in $(< "$TOP_FILE"); do
done
done
+
# All Done!!! All Done!!! -- Jessica Noll, Age 2
#
if [[ $EXIT_CODE -ne 0 ]]; then
diff --git a/bin/all-years.sh b/bin/all-years.sh
index c202a65b4..81fa909bc 100755
--- a/bin/all-years.sh
+++ b/bin/all-years.sh
@@ -16,7 +16,7 @@
#
# Each tool run with command line of the form:
#
-# tool [any -D, -t tagline, -T md2html.sh, -p tool, -w site_url] [more_options] YYYY
+# tool [any -D, -t tagline, -w site_url] [more_options] YYYY
#
# For example:
#
@@ -54,6 +54,7 @@
#
# Share and enjoy! :-)
+
# firewall - run only with a bash that is version 5.1.8 or later
#
# The "/usr/bin/env bash" command must result in using a bash that
@@ -97,6 +98,7 @@ if [[ -z ${BASH_VERSINFO[0]} ||
exit 4
fi
+
# setup bash file matching
#
# We must declare arrays with -ag or -Ag, and we need loops to "export" modified variables.
@@ -109,9 +111,10 @@ shopt -u nocaseglob # disable strict case matching
shopt -u extglob # enable extended globbing patterns
shopt -s globstar # enable ** to match all files and zero or more directories and subdirectories
+
# set variables referenced in the usage message
#
-export VERSION="1.0.5 2024-08-05"
+export VERSION="1.1 2024-08-17"
NAME=$(basename "$0")
export NAME
export V_FLAG=0
@@ -129,8 +132,6 @@ fi
export TOPDIR
export DOCROOT_SLASH="../../"
export TAGLINE="unspecified"
-export MD2HTML_SH="bin/md2html.sh"
-export PANDOC_WRAPPER="bin/pandoc-wrapper.sh"
export REPO_TOP_URL="https://github.com/ioccc-src/temp-test-ioccc"
# GitHub puts individual files under the "blob/master" sub-directory.
export REPO_URL="$REPO_TOP_URL/blob/master"
@@ -138,17 +139,20 @@ export SITE_URL="https://ioccc-src.github.io/temp-test-ioccc"
#
export NOOP=
export DO_NOT_PROCESS=
+export QUICK_MODE=
export EXIT_CODE="0"
+
# clear options we will add to tools
#
unset TOOL_OPTION
declare -ag TOOL_OPTION
+
# usage
#
export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
- [-t tagline] [-T md2html.sh] [-p tool] [-w site_url]
+ [-Q] [-t tagline] [-w site_url]
tool [more_options]
-h print help message and exit
@@ -164,12 +168,10 @@ export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
-n go thru the actions, but do not update any files (def: do the action)
-N do not process anything, just parse arguments (def: process something)
+ -Q quick mode, do not run $MD2HTML_SH unless markdown is out of date (def: do)
+
-t tagline string to write about the tool that formed the markdown content (def: $TAGLINE)
NOTE: The '-t tagline' is passed as leading options on tool command lines.
- -T md2html.sh run 'markdown to html tool' to convert markdown into HTML (def: $MD2HTML_SH)
- NOTE: The '-T md2html.sh' is passed as leading options on tool command lines.
-
- -p tool run 'pandoc wrapper tool' (not pandoc path) during HTML phase number 21 (def: use $PANDOC_WRAPPER)
-w site_url Base URL of the website (def: $SITE_URL)
NOTE: The '-w site_url' is passed as leading options on tool command lines.
@@ -177,7 +179,7 @@ export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
tool the tool to run over all entries
[more_options] additional tool command line options to use before the YYYY/dir argument
-NOTE: Any '-t tagline', '-T md2html.sh', '-p tool', '-w site_url'
+NOTE: Any '-Q', '-t tagline', '-w site_url'
are passed to the 'tool' at the beginning of the command line, and
before any optional 'more_options' and before the final YYYY/dir argument.
@@ -194,9 +196,10 @@ Exit codes:
$NAME version: $VERSION"
+
# parse command line
#
-while getopts :hv:Vd:D:nNt:T:p:w: flag; do
+while getopts :hv:Vd:D:nNQt:w: flag; do
case "$flag" in
h) echo "$USAGE" 1>&2
exit 2
@@ -225,6 +228,9 @@ while getopts :hv:Vd:D:nNt:T:p:w: flag; do
;;
N) DO_NOT_PROCESS="-N"
;;
+ Q) QUICK_MODE="-Q"
+ TOOL_OPTION+=("-Q")
+ ;;
t) # parse -t tagline
case "$OPTARG" in
*"'"*)
@@ -245,14 +251,6 @@ while getopts :hv:Vd:D:nNt:T:p:w: flag; do
TOOL_OPTION+=("-t")
TOOL_OPTION+=("$TAGLINE")
;;
- T) MD2HTML_SH="$OPTARG"
- TOOL_OPTION+=("-T")
- TOOL_OPTION+=("$MD2HTML_SH")
- ;;
- p) PANDOC_WRAPPER="$OPTARG"
- TOOL_OPTION+=("-p")
- TOOL_OPTION+=("$PANDOC_WRAPPER")
- ;;
w) SITE_URL="$OPTARG"
TOOL_OPTION+=("-w")
TOOL_OPTION+=("$SITE_URL")
@@ -274,7 +272,7 @@ while getopts :hv:Vd:D:nNt:T:p:w: flag; do
;;
esac
done
-
+#
# remove the options
#
shift $(( OPTIND - 1 ));
@@ -302,6 +300,7 @@ case "$#" in
;;
esac
+
# verify that we have a topdir directory
#
REPO_NAME=$(basename "$REPO_TOP_URL")
@@ -322,6 +321,7 @@ if [[ ! -d $TOPDIR ]]; then
exit 6
fi
+
# cd to topdir
#
if [[ ! -e $TOPDIR ]]; then
@@ -345,6 +345,51 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: now in directory: $(/bin/pwd)" 1>&2
fi
+
+# verify that we have a bin subdirectory
+#
+export BIN_PATH="$TOPDIR/bin"
+if [[ ! -d $BIN_PATH ]]; then
+ echo "$0: ERROR: bin is not a directory under topdir: $BIN_PATH" 1>&2
+ exit 6
+fi
+export BIN_DIR="bin"
+
+
+# verify that the bin/md2html.sh tool is executable
+#
+export MD2HTML_SH="$BIN_DIR/md2html.sh"
+if [[ ! -e $MD2HTML_SH ]]; then
+ echo "$0: ERROR: bin/md2html.sh does not exist: $MD2HTML_SH" 1>&2
+ exit 5
+fi
+if [[ ! -f $MD2HTML_SH ]]; then
+ echo "$0: ERROR: bin/md2html.sh is not a regular file: $MD2HTML_SH" 1>&2
+ exit 5
+fi
+if [[ ! -x $MD2HTML_SH ]]; then
+ echo "$0: ERROR: bin/md2html.sh is not an executable file: $MD2HTML_SH" 1>&2
+ exit 5
+fi
+
+
+# verify that the bin/pandoc-wrapper.sh tool is executable
+#
+export PANDOC_WRAPPER="$BIN_DIR/pandoc-wrapper.sh"
+if [[ ! -e $PANDOC_WRAPPER ]]; then
+ echo "$0: ERROR: bin/md2html.sh does not exist: $PANDOC_WRAPPER" 1>&2
+ exit 5
+fi
+if [[ ! -f $PANDOC_WRAPPER ]]; then
+ echo "$0: ERROR: bin/md2html.sh is not a regular file: $PANDOC_WRAPPER" 1>&2
+ exit 5
+fi
+if [[ ! -x $PANDOC_WRAPPER ]]; then
+ echo "$0: ERROR: bin/md2html.sh is not an executable file: $PANDOC_WRAPPER" 1>&2
+ exit 5
+fi
+
+
# verify we have a non-empty readable .top file
#
export TOP_FILE=".top"
@@ -365,6 +410,7 @@ if [[ ! -s $TOP_FILE ]]; then
exit 6
fi
+
# verify tool is executable
#
if [[ ! -e $TOOL ]]; then
@@ -380,20 +426,6 @@ if [[ ! -x $TOOL ]]; then
exit 5
fi
-# verify that the md2html.sh is an executable file
-#
-if [[ ! -e $MD2HTML_SH ]]; then
- echo "$0: ERROR: md2html.sh does not exist: $MD2HTML_SH" 1>&2
- exit 5
-fi
-if [[ ! -f $MD2HTML_SH ]]; then
- echo "$0: ERROR: md2html.sh is not a regular file: $MD2HTML_SH" 1>&2
- exit 5
-fi
-if [[ ! -x $MD2HTML_SH ]]; then
- echo "$0: ERROR: md2html.sh is not an executable file: $MD2HTML_SH" 1>&2
- exit 5
-fi
# print running info if verbose
#
@@ -407,13 +439,12 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: TOPDIR=$TOPDIR" 1>&2
echo "$0: debug[3]: DOCROOT_SLASH=$DOCROOT_SLASH" 1>&2
echo "$0: debug[3]: TAGLINE=$TAGLINE" 1>&2
- echo "$0: debug[3]: MD2HTML_SH=$MD2HTML_SH" 1>&2
- echo "$0: debug[3]: PANDOC_WRAPPER=$PANDOC_WRAPPER" 1>&2
echo "$0: debug[3]: REPO_TOP_URL=$REPO_TOP_URL" 1>&2
echo "$0: debug[3]: REPO_URL=$REPO_URL" 1>&2
echo "$0: debug[3]: SITE_URL=$SITE_URL" 1>&2
echo "$0: debug[3]: NOOP=$NOOP" 1>&2
echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2
+ echo "$0: debug[3]: QUICK_MODE=$QUICK_MODE" 1>&2
echo "$0: debug[3]: EXIT_CODE=$EXIT_CODE" 1>&2
for index in "${!TOOL_OPTION[@]}"; do
echo "$0: debug[3]: TOOL_OPTION[$index]=${TOOL_OPTION[$index]}" 1>&2
@@ -421,9 +452,14 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: TOOL=$TOOL" 1>&2
echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2
echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2
+ echo "$0: debug[3]: BIN_PATH=$BIN_PATH" 1>&2
+ echo "$0: debug[3]: BIN_DIR=$BIN_DIR" 1>&2
+ echo "$0: debug[3]: MD2HTML_SH=$MD2HTML_SH" 1>&2
+ echo "$0: debug[3]: PANDOC_WRAPPER=$PANDOC_WRAPPER" 1>&2
echo "$0: debug[3]: TOP_FILE=$TOP_FILE" 1>&2
fi
+
# -N stops early before any processing is performed
#
if [[ -n $DO_NOT_PROCESS ]]; then
@@ -433,6 +469,7 @@ if [[ -n $DO_NOT_PROCESS ]]; then
exit 0
fi
+
# process each year
#
export YYYY
@@ -515,6 +552,7 @@ for YYYY in $(< "$TOP_FILE"); do
fi
done
+
# All Done!!! All Done!!! -- Jessica Noll, Age 2
#
if [[ $EXIT_CODE -ne 0 ]]; then
diff --git a/bin/chk-entry.sh b/bin/chk-entry.sh
index c69e4402a..14412049e 100755
--- a/bin/chk-entry.sh
+++ b/bin/chk-entry.sh
@@ -28,6 +28,7 @@
#
# Share and enjoy! :-)
+
# firewall - run only with a bash that is version 5.1.8 or later
#
# The "/usr/bin/env bash" command must result in using a bash that
@@ -71,6 +72,7 @@ if [[ -z ${BASH_VERSINFO[0]} ||
exit 4
fi
+
# setup bash file matching
#
# We must declare arrays with -ag or -Ag, and we need loops to "export" modified variables.
@@ -83,6 +85,7 @@ shopt -u nocaseglob # disable strict case matching
shopt -u extglob # enable extended globbing patterns
shopt -s globstar # enable ** to match all files and zero or more directories and subdirectories
+
# set variables referenced in the usage message
#
export VERSION="1.1.10 2024-08-05"
@@ -105,10 +108,10 @@ export REPO_TOP_URL="https://github.com/ioccc-src/temp-test-ioccc"
# GitHub puts individual files under the "blob/master" sub-directory.
export REPO_URL="$REPO_TOP_URL/blob/master"
+
# set usage message
#
-export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
- [-p tool] [-w site_url]
+export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N] [-w site_url]
YYYY/dir
-h print help message and exit
@@ -121,8 +124,6 @@ export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
-n go thru the actions, but do not update any files (def: do the action)
-N do not process file, just parse arguments and ignore the file (def: process the file)
- -p tool This option is ignored
-
-w site_url This option is ignored
YYYY/dir path from topdir to entry directory: must contain the files: README.md, .path and .entry.json
@@ -140,15 +141,17 @@ Exit codes:
$NAME version: $VERSION"
+
# setup
#
export NOOP=
export DO_NOT_PROCESS=
export EXIT_CODE="0"
+
# parse command line
#
-while getopts :hv:Vd:D:nNp:U:w: flag; do
+while getopts :hv:Vd:D:nNU:w: flag; do
case "$flag" in
h) echo "$USAGE" 1>&2
exit 2
@@ -165,7 +168,6 @@ while getopts :hv:Vd:D:nNp:U:w: flag; do
;;
N) DO_NOT_PROCESS="-N"
;;
- p) ;;
U) ;;
w) ;;
\?) echo "$0: ERROR: invalid option: -$OPTARG" 1>&2
@@ -185,7 +187,7 @@ while getopts :hv:Vd:D:nNp:U:w: flag; do
;;
esac
done
-
+#
# parse the command line arguments
#
if [[ $V_FLAG -ge 3 ]]; then
@@ -204,6 +206,7 @@ fi
#
export ENTRY_PATH="$1"
+
# verify that we have a topdir directory
#
REPO_NAME=$(basename "$REPO_TOP_URL")
@@ -224,6 +227,7 @@ if [[ ! -d $TOPDIR ]]; then
exit 6
fi
+
# cd to topdir
#
if [[ ! -e $TOPDIR ]]; then
@@ -247,6 +251,7 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: now in directory: $(/bin/pwd)" 1>&2
fi
+
# verify that we have a bin subdirectory
#
export BIN_PATH="$TOPDIR/bin"
@@ -256,6 +261,28 @@ if [[ ! -d $BIN_PATH ]]; then
fi
export BIN_DIR="bin"
+
+# verify we have our awk tool
+#
+export FILELIST_ENTRY_JSON_AWK="$BIN_DIR/filelist.entry.json.awk"
+if [[ ! -e $FILELIST_ENTRY_JSON_AWK ]]; then
+ echo "$0: ERROR: filelist.entry.json.awk does not exist: $FILELIST_ENTRY_JSON_AWK" 1>&2
+ exit 5
+fi
+if [[ ! -f $FILELIST_ENTRY_JSON_AWK ]]; then
+ echo "$0: ERROR: filelist.entry.json.awk is not a file: $FILELIST_ENTRY_JSON_AWK" 1>&2
+ exit 5
+fi
+if [[ ! -r $FILELIST_ENTRY_JSON_AWK ]]; then
+ echo "$0: ERROR: filelist.entry.json.awk is not a readable file: $FILELIST_ENTRY_JSON_AWK" 1>&2
+ exit 5
+fi
+if [[ ! -s $FILELIST_ENTRY_JSON_AWK ]]; then
+ echo "$0: ERROR: filelist.entry.json.awk is not a not a non-empty readable file: $FILELIST_ENTRY_JSON_AWK" 1>&2
+ exit 5
+fi
+
+
# verify that ENTRY_PATH is a entry directory
#
if [[ ! -d $ENTRY_PATH ]]; then
@@ -329,25 +356,6 @@ if [[ ! -r $ENTRY_JSON ]]; then
exit 7
fi
-# verify we have our awk tool
-#
-export FILELIST_ENTRY_JSON_AWK="$BIN_DIR/filelist.entry.json.awk"
-if [[ ! -e $FILELIST_ENTRY_JSON_AWK ]]; then
- echo "$0: ERROR: filelist.entry.json.awk does not exist: $FILELIST_ENTRY_JSON_AWK" 1>&2
- exit 5
-fi
-if [[ ! -f $FILELIST_ENTRY_JSON_AWK ]]; then
- echo "$0: ERROR: filelist.entry.json.awk is not a file: $FILELIST_ENTRY_JSON_AWK" 1>&2
- exit 5
-fi
-if [[ ! -r $FILELIST_ENTRY_JSON_AWK ]]; then
- echo "$0: ERROR: filelist.entry.json.awk is not a readable file: $FILELIST_ENTRY_JSON_AWK" 1>&2
- exit 5
-fi
-if [[ ! -s $FILELIST_ENTRY_JSON_AWK ]]; then
- echo "$0: ERROR: filelist.entry.json.awk is not a not a non-empty readable file: $FILELIST_ENTRY_JSON_AWK" 1>&2
- exit 5
-fi
# parameter debugging
#
@@ -367,6 +375,7 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2
echo "$0: debug[3]: BIN_PATH=$BIN_PATH" 1>&2
echo "$0: debug[3]: BIN_DIR=$BIN_DIR" 1>&2
+ echo "$0: debug[3]: FILELIST_ENTRY_JSON_AWK=$FILELIST_ENTRY_JSON_AWK" 1>&2
echo "$0: debug[3]: YEAR_DIR=$YEAR_DIR" 1>&2
echo "$0: debug[3]: ENTRY_DIR=$ENTRY_DIR" 1>&2
echo "$0: debug[3]: ENTRY_ID=$ENTRY_ID" 1>&2
@@ -375,9 +384,9 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: DOT_PATH=$DOT_PATH" 1>&2
echo "$0: debug[3]: DOT_PATH_CONTENT=$DOT_PATH_CONTENT" 1>&2
echo "$0: debug[3]: ENTRY_JSON=$ENTRY_JSON" 1>&2
- echo "$0: debug[3]: FILELIST_ENTRY_JSON_AWK=$FILELIST_ENTRY_JSON_AWK" 1>&2
fi
+
# If -N, time to exit
#
if [[ -n $DO_NOT_PROCESS ]]; then
@@ -387,6 +396,7 @@ if [[ -n $DO_NOT_PROCESS ]]; then
exit 0
fi
+
# create a temporary file manifest list
#
export TMP_MANIFEST_LIST=".tmp.$NAME.MANIFEST_LIST.$$.tmp"
@@ -409,6 +419,7 @@ elif [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: because of -n, temporary file manifest list is not used: $TMP_MANIFEST_LIST" 1>&2
fi
+
# create a temporary find files list
#
export TMP_FILE_LIST=".tmp.$NAME.FILE_LIST.$$.tmp"
@@ -431,6 +442,7 @@ elif [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: because of -n, temporary file manifest list is not used: $TMP_FILE_LIST" 1>&2
fi
+
# generate sorted list of entry files from the entry's manifest
#
# We also add ioccc.css and var.mk from the top level.
@@ -448,6 +460,7 @@ if [[ $status -ne 0 ]]; then
exit 1
fi
+
# generate sorted list of found entry files
#
# We also add ioccc.css and var.mk from the top level.
@@ -470,6 +483,7 @@ if [[ $status -ne 0 ]]; then
exit 1
fi
+
# note if the manifest does NOT match the file list
#
if [[ $V_FLAG -ge 5 ]]; then
@@ -495,6 +509,7 @@ else
EXIT_CODE=1 # exit 1
fi
+
# All Done!!! All Done!!! -- Jessica Noll, Age 2
#
if [[ -z $NOOP ]]; then
diff --git a/bin/csv2entry.sh b/bin/csv2entry.sh
index 86d3cf21d..d5edf38b0 100755
--- a/bin/csv2entry.sh
+++ b/bin/csv2entry.sh
@@ -360,8 +360,7 @@ while getopts :hv:Vd:D:nNj: flag; do
;;
esac
done
-
-
+#
# remove the options
#
shift $(( OPTIND - 1 ));
@@ -489,11 +488,19 @@ fi
export BIN_DIR="bin"
-# find the jval-wrapper.sh tool
+# verify that the bin/jval-wrapper.sh tool is executable
#
-JVAL_WRAPPER="$BIN_PATH/jval-wrapper.sh"
+JVAL_WRAPPER="$BIN_DIR/jval-wrapper.sh"
+if [[ ! -e $JVAL_WRAPPER ]]; then
+ echo "$0: ERROR: bin/jval-wrapper.sh does not exist: $JVAL_WRAPPER" 1>&2
+ exit 5
+fi
+if [[ ! -f $JVAL_WRAPPER ]]; then
+ echo "$0: ERROR: bin/jval-wrapper.sh is not a regular file: $JVAL_WRAPPER" 1>&2
+ exit 5
+fi
if [[ ! -x $JVAL_WRAPPER ]]; then
- echo "$0: ERROR: cannot find the bin/jval-wrapper.sh executable" 1>&2
+ echo "$0: ERROR: bin/jval-wrapper.sh is not an executable file: $JVAL_WRAPPER" 1>&2
exit 5
fi
diff --git a/bin/cvt-submission.sh b/bin/cvt-submission.sh
index 35fece8f9..a83632d38 100755
--- a/bin/cvt-submission.sh
+++ b/bin/cvt-submission.sh
@@ -43,6 +43,7 @@
#
# Share and enjoy! :-)
+
# firewall - run only with a bash that is version 5.1.8 or later
#
# The "/usr/bin/env bash" command must result in using a bash that
@@ -161,6 +162,7 @@ unset TAR_FILE_SET
declare -ag TAR_FILE_SET
export TARBALL_DIR="/var/tmp"
+
# usage
#
export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir]
@@ -402,7 +404,6 @@ function manifest_entry
}
-
# parse command line
#
while getopts :hv:Vd:c:s:i:T:nN flag; do
@@ -446,7 +447,7 @@ while getopts :hv:Vd:c:s:i:T:nN flag; do
;;
esac
done
-
+#
# remove the options
#
shift $(( OPTIND - 1 ));
@@ -465,6 +466,7 @@ if [[ $# -ne 1 ]]; then
fi
export ENTRY_PATH="$1"
+
# if -i input_data, replace stdin with the input data file
#
if [[ -n $INPUT_DATA_FILE ]]; then
@@ -561,32 +563,38 @@ if [[ ! -d $BIN_PATH ]]; then
exit 6
fi
export BIN_DIR="bin"
+
+
+# verify that the bin/md2html.sh tool is executable
#
-export JVAL_WRAPPER="$BIN_DIR/jval-wrapper.sh"
+export MD2HTML_SH="$BIN_DIR/md2html.sh"
+if [[ ! -e $MD2HTML_SH ]]; then
+ echo "$0: ERROR: bin/md2html.sh does not exist: $MD2HTML_SH" 1>&2
+ exit 5
+fi
+if [[ ! -f $MD2HTML_SH ]]; then
+ echo "$0: ERROR: bin/md2html.sh is not a regular file: $MD2HTML_SH" 1>&2
+ exit 5
+fi
+if [[ ! -x $MD2HTML_SH ]]; then
+ echo "$0: ERROR: bin/md2html.sh is not an executable file: $MD2HTML_SH" 1>&2
+ exit 5
+fi
+
+
+# verify that the bin/jval-wrapper.sh tool is executable
+#
+JVAL_WRAPPER="$BIN_DIR/jval-wrapper.sh"
if [[ ! -e $JVAL_WRAPPER ]]; then
- echo "$0: ERROR: bin/jval-wrapper.sh file does not exist: $JVAL_WRAPPER" 1>&2
+ echo "$0: ERROR: bin/jval-wrapper.sh does not exist: $JVAL_WRAPPER" 1>&2
exit 5
fi
if [[ ! -f $JVAL_WRAPPER ]]; then
- echo "$0: ERROR: bin/jval-wrapper.sh is not a file: $JVAL_WRAPPER" 1>&2
+ echo "$0: ERROR: bin/jval-wrapper.sh is not a regular file: $JVAL_WRAPPER" 1>&2
exit 5
fi
if [[ ! -x $JVAL_WRAPPER ]]; then
- echo "$0: ERROR: cannot find an executable bin/jval-wrapper.sh tool: $JVAL_WRAPPER" 1>&2
- exit 5
-fi
-#
-export MD2HTML="$BIN_DIR/md2html.sh"
-if [[ ! -e $MD2HTML ]]; then
- echo "$0: ERROR: bin/md2html.sh file does not exist: $MD2HTML" 1>&2
- exit 5
-fi
-if [[ ! -f $MD2HTML ]]; then
- echo "$0: ERROR: bin/md2html.sh is not a file: $MD2HTML" 1>&2
- exit 5
-fi
-if [[ ! -x $MD2HTML ]]; then
- echo "$0: ERROR: cannot find an executable bin/md2html.sh tool: $MD2HTML" 1>&2
+ echo "$0: ERROR: bin/jval-wrapper.sh is not an executable file: $JVAL_WRAPPER" 1>&2
exit 5
fi
@@ -684,7 +692,7 @@ done
# determine TARBALL filename
#
-NOW=$(/bin/date '+%Y%m%d.%H%M%S')
+NOW=$(date '+%Y%m%d.%H%M%S')
export NOW
export TARBALL="$TARBALL_DIR/$ENTRY_ID.mods.$NOW.tar.bz2"
@@ -718,7 +726,7 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: BIN_PATH=$BIN_PATH" 1>&2
echo "$0: debug[3]: BIN_DIR=$BIN_DIR" 1>&2
echo "$0: debug[3]: JVAL_WRAPPER=$JVAL_WRAPPER" 1>&2
- echo "$0: debug[3]: MD2HTML=$MD2HTML" 1>&2
+ echo "$0: debug[3]: MD2HTML_SH=$MD2HTML_SH" 1>&2
echo "$0: debug[3]: YEAR_DIR=$YEAR_DIR" 1>&2
echo "$0: debug[3]: ENTRY_DIR=$ENTRY_DIR" 1>&2
echo "$0: debug[3]: ENTRY_ID=$ENTRY_ID" 1>&2
@@ -1521,12 +1529,12 @@ if [[ -z $NOOP ]]; then
if [[ ! -f $INDEX_HTML ]]; then
if [[ $V_FLAG -ge 3 ]]; then
- echo "$0: debug[3]: about to run: $MD2HTML -v $V_FLAG -- $README_MD $INDEX_HTML" 1>&2
+ echo "$0: debug[3]: about to run: $MD2HTML_SH -v $V_FLAG -- $README_MD $INDEX_HTML" 1>&2
fi
- "$MD2HTML" -v "$V_FLAG" -- "$README_MD" "$INDEX_HTML"
+ "$MD2HTML_SH" -v "$V_FLAG" -- "$README_MD" "$INDEX_HTML"
status="$?"
if [[ $status -ne 0 ]]; then
- echo "$0: ERROR: $MD2HTML -v $V_FLAG -- $README_MD $INDEX_HTML filed," \
+ echo "$0: ERROR: $MD2HTML_SH -v $V_FLAG -- $README_MD $INDEX_HTML filed," \
"error code: $status" 1>&2
exit 32
fi
diff --git a/bin/entry2csv.sh b/bin/entry2csv.sh
index 682d04503..11a1f4208 100755
--- a/bin/entry2csv.sh
+++ b/bin/entry2csv.sh
@@ -304,8 +304,7 @@ while getopts :hv:Vd:D:nNj: flag; do
;;
esac
done
-
-
+#
# remove the options
#
shift $(( OPTIND - 1 ));
@@ -433,11 +432,19 @@ fi
export BIN_DIR="bin"
-# find the jval-wrapper.sh tool
+# verify that the bin/jval-wrapper.sh tool is executable
#
-JVAL_WRAPPER="$BIN_PATH/jval-wrapper.sh"
+JVAL_WRAPPER="$BIN_DIR/jval-wrapper.sh"
+if [[ ! -e $JVAL_WRAPPER ]]; then
+ echo "$0: ERROR: bin/jval-wrapper.sh does not exist: $JVAL_WRAPPER" 1>&2
+ exit 5
+fi
+if [[ ! -f $JVAL_WRAPPER ]]; then
+ echo "$0: ERROR: bin/jval-wrapper.sh is not a regular file: $JVAL_WRAPPER" 1>&2
+ exit 5
+fi
if [[ ! -x $JVAL_WRAPPER ]]; then
- echo "$0: ERROR: cannot find the bin/jval-wrapper.sh executable" 1>&2
+ echo "$0: ERROR: bin/jval-wrapper.sh is not an executable file: $JVAL_WRAPPER" 1>&2
exit 5
fi
diff --git a/bin/find-missing-links.sh b/bin/find-missing-links.sh
index 865cbf610..eb81e682f 100755
--- a/bin/find-missing-links.sh
+++ b/bin/find-missing-links.sh
@@ -45,6 +45,7 @@
#
# Share and enjoy! :-)
+
# firewall - run only with a bash that is version 5.1.8 or later
#
# The "/usr/bin/env bash" command must result in using a bash that
@@ -233,7 +234,7 @@ while getopts :hv:Vd:nN flag; do
;;
esac
done
-
+#
# remove the options
#
shift $(( OPTIND - 1 ));
@@ -257,6 +258,7 @@ if [[ $V_FLAG -ge 1 ]]; then
echo "$0: debug[1]: start scan for missing links" 1>&2
fi
+
# print running info if verbose
#
# If -v 3 or higher, print exported variables in order that they were exported.
@@ -505,18 +507,21 @@ find . -name '*.md' ! -name markdown.md ! -path './tmp/*' -print |
done
done > "$TMP_MISSING_LINK"
+
# count the missing links
#
MISSING_LINK_COUNT=$(wc -l < "$TMP_MISSING_LINK" | tr -d ' ')
export MISSING_LINK_COUNT
((MISSING_LINK_COUNT=MISSING_LINK_COUNT/4))
+
# report on any missing links
#
if [[ -s $TMP_MISSING_LINK ]]; then
sed -e "s;^$TOPDIR/;;" "$TMP_MISSING_LINK" 1>&2
fi
+
# All Done!!! All Done!!! -- Jessica Noll, Age 2
#
if [[ -s $TMP_MISSING_LINK ]]; then
diff --git a/bin/format-headers.sh b/bin/format-headers.sh
index bde03e468..8ea5160ad 100755
--- a/bin/format-headers.sh
+++ b/bin/format-headers.sh
@@ -33,6 +33,9 @@
#
# Share and enjoy! :-)
+
+# modify well known markdown headers that are not in canonical form
+#
for i in $(git ls-files '[0-9][0-9][0-9][0-9]/*README.md'); do
perl -0777 -p -i -e 's/([^\n]\n)\n*##*[[:space:]]*(To build):?\n\n*([^\n])?/$1\n\n## $2:\n\n$3/' "$i"
perl -0777 -p -i -e 's/([^\n]\n)\n*##*[[:space:]]*(Bugs and \(Mis\)features):?\n\n*([^\n])?/$1\n\n### $2:\n\n$3/' "$i"
diff --git a/bin/gen-authors.sh b/bin/gen-authors.sh
index 2ed8973e3..b3a25cd79 100755
--- a/bin/gen-authors.sh
+++ b/bin/gen-authors.sh
@@ -28,6 +28,7 @@
#
# Share and enjoy! :-)
+
# firewall - run only with a bash that is version 5.1.8 or later
#
# The "/usr/bin/env bash" command must result in using a bash that
@@ -71,6 +72,7 @@ if [[ -z ${BASH_VERSINFO[0]} ||
exit 4
fi
+
# setup bash file matching
#
# We must declare arrays with -ag or -Ag, and we need loops to "export" modified variables.
@@ -83,9 +85,10 @@ shopt -u nocaseglob # disable strict case matching
shopt -u extglob # enable extended globbing patterns
shopt -s globstar # enable ** to match all files and zero or more directories and subdirectories
+
# set variables referenced in the usage message
#
-export VERSION="1.11 2024-08-13"
+export VERSION="1.12 2024-08-18"
NAME=$(basename "$0")
export NAME
export V_FLAG=0
@@ -115,6 +118,7 @@ export DO_NOT_PROCESS=
export QUICK_MODE=
export EXIT_CODE="0"
+
# Letter "is for" text
#
unset IS_FOR
@@ -146,15 +150,17 @@ IS_FOR[x]="x is for xor"
IS_FOR[y]="y is for y0"
IS_FOR[z]="z is for zlib"
+
# clear options we will add to tools
#
unset TOOL_OPTION
declare -ag TOOL_OPTION
+
# usage
#
export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
- [-t tagline] [-T md2html.sh] [-p tool] [-Q]
+ [-t tagline] [-Q]
-h print help message and exit
-v level set verbosity level (def level: 0)
@@ -172,10 +178,6 @@ export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
-t tagline string to write about the tool that formed the markdown content (def: $TAGLINE)
NOTE: 'tagline' may be enclosed within, but may NOT contain an internal single-quote, or double-quote.
- -T md2html.sh run 'markdown to html tool' to convert markdown into HTML (def: $MD2HTML_SH)
-
- -p tool run 'pandoc wrapper tool' (not pandoc path) during HTML phase number 21 (def: use $PANDOC_WRAPPER)
- NOTE: The '-p tool' is passed as leading options on tool command lines.
-Q quick mode, do not run $MD2HTML_SH unless markdown is out of date (def: do)
@@ -184,7 +186,7 @@ export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
NOTE: The '-v level' is passed as initial command line options to the 'markdown to html tool' (md2html.sh).
The 'tagline' is passed as '-t tagline' to the 'markdown to html tool' (md2html.sh), after the '-v level'.
- Any '-T md2html.sh', '-p tool', '-P pandoc_opts', '-U top_url'
+ Any '-P pandoc_opts', '-U top_url'
are passed to the 'markdown to html tool' (md2html.sh), and will be before any command line arguments.
Exit codes:
@@ -200,6 +202,7 @@ Exit codes:
$NAME version: $VERSION"
+
# output_entry_ids
#
# Write the entry ids from an author/author_handle.json file to standard output (stdout)
@@ -242,6 +245,7 @@ function output_entry_ids
return 0
}
+
# output_author_handle
#
# Write the author handles from an author/author_handle.json file to standard output (stdout)
@@ -283,6 +287,7 @@ function output_author_handle
return 0
}
+
# output_full_name
#
# Write the Full Name from an author/author_handle.json file to standard output (stdout)
@@ -324,6 +329,7 @@ function output_full_name
return 0
}
+
# output_location_code
#
# Write the Location Code from an author/author_handle.json file to standard output (stdout)
@@ -365,6 +371,7 @@ function output_location_code
return 0
}
+
# output_award
#
# Write the award name to standard output (stdout)
@@ -406,6 +413,7 @@ function output_award
return 0
}
+
# output_url
#
# Write the url from an author/author_handle.json file to standard output (stdout)
@@ -451,6 +459,7 @@ function output_url
return 0
}
+
# output_alt_url
#
# Write the alternate url from an author/author_handle.json file to standard output (stdout)
@@ -496,6 +505,7 @@ function output_alt_url
return 0
}
+
# output_mastodon
#
# Write the mastodon handle from an author/author_handle.json file to standard output (stdout)
@@ -541,6 +551,7 @@ function output_mastodon
return 0
}
+
# output_mastodon_url
#
# Write the mastodon handle from an author/author_handle.json file to standard output (stdout)
@@ -586,6 +597,7 @@ function output_mastodon_url
return 0
}
+
# output_github
#
# Write the GitHub handle from an author/author_handle.json file to standard output (stdout)
@@ -631,6 +643,7 @@ function output_github
return 0
}
+
# output_affiliation
#
# Write the affiliation from an author/author_handle.json file to standard output (stdout)
@@ -676,9 +689,10 @@ function output_affiliation
return 0
}
+
# parse command line
#
-while getopts :hv:Vd:D:nNt:T:p:Qw: flag; do
+while getopts :hv:Vd:D:nNt:Qw: flag; do
case "$flag" in
h) echo "$USAGE" 1>&2
exit 2
@@ -727,14 +741,6 @@ while getopts :hv:Vd:D:nNt:T:p:Qw: flag; do
TAGLINE="$OPTARG"
# -t tagline always added after arg parsing
;;
- T) MD2HTML_SH="$OPTARG"
- TOOL_OPTION+=("-T")
- TOOL_OPTION+=("$MD2HTML_SH")
- ;;
- p) PANDOC_WRAPPER="$OPTARG"
- TOOL_OPTION+=("-p")
- TOOL_OPTION+=("$PANDOC_WRAPPER")
- ;;
Q) QUICK_MODE="-Q"
;;
w) SITE_URL="$OPTARG"
@@ -758,7 +764,7 @@ while getopts :hv:Vd:D:nNt:T:p:Qw: flag; do
;;
esac
done
-
+#
# remove the options
#
shift $(( OPTIND - 1 ));
@@ -774,6 +780,7 @@ if [[ $# -ne 0 ]]; then
exit 3
fi
+
# always add the '-v level' option, unless level is empty, to the set of options passed to the md2html.sh tool
#
if [[ -n $V_FLAG ]]; then
@@ -788,16 +795,19 @@ if [[ -n $TAGLINE ]]; then
TOOL_OPTION+=("$TAGLINE")
fi
+
# always add the '-U URL' for the top level authors.html file
#
TOOL_OPTION+=("-U")
TOOL_OPTION+=("$SITE_URL/authors.html")
+
# always add the '-D docroot/' for the top level authors.html file
#
TOOL_OPTION+=("-D")
TOOL_OPTION+=("$DOCROOT_SLASH")
+
# verify that we have a topdir directory
#
REPO_NAME=$(basename "$REPO_TOP_URL")
@@ -818,6 +828,7 @@ if [[ ! -d $TOPDIR ]]; then
exit 6
fi
+
# cd to topdir
#
if [[ ! -e $TOPDIR ]]; then
@@ -841,6 +852,7 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: now in directory: $(/bin/pwd)" 1>&2
fi
+
# verify that the md2html tool is executable
#
if [[ ! -e $MD2HTML_SH ]]; then
@@ -856,6 +868,7 @@ if [[ ! -x $MD2HTML_SH ]]; then
exit 5
fi
+
# verify that we have an author subdirectory
#
export AUTHOR_PATH="$TOPDIR/author"
@@ -865,6 +878,7 @@ if [[ ! -d $AUTHOR_PATH ]]; then
fi
export AUTHOR_DIR="author"
+
# verify that we have a bin subdirectory
#
export BIN_PATH="$TOPDIR/bin"
@@ -874,33 +888,40 @@ if [[ ! -d $BIN_PATH ]]; then
fi
export BIN_DIR="bin"
-# find the jval-wrapper.sh tool
+
+# verify that the bin/jval-wrapper.sh tool is executable
#
-JVAL_WRAPPER="$BIN_PATH/jval-wrapper.sh"
-if [[ ! -x $JVAL_WRAPPER ]]; then
- echo "$0: ERROR: cannot find the bin/jval-wrapper.sh executable" 1>&2
+JVAL_WRAPPER="$BIN_DIR/jval-wrapper.sh"
+if [[ ! -e $JVAL_WRAPPER ]]; then
+ echo "$0: ERROR: bin/jval-wrapper.sh does not exist: $JVAL_WRAPPER" 1>&2
exit 5
fi
+if [[ ! -f $JVAL_WRAPPER ]]; then
+ echo "$0: ERROR: bin/jval-wrapper.sh is not a regular file: $JVAL_WRAPPER" 1>&2
+ exit 5
+fi
+if [[ ! -x $JVAL_WRAPPER ]]; then
+ echo "$0: ERROR: bin/jval-wrapper.sh is not an executable file: $JVAL_WRAPPER" 1>&2
+ exit 5
+fi
+
# find the location tool
#
LOCATION_TOOL=$(type -P location)
export LOCATION_TOOL
-if [[ -z $LOCATION_TOOL ]]; then
- # guess we have a location tool in bin
- #
- LOCATION_TOOL="$BIN_DIR/location"
-fi
if [[ ! -x $LOCATION_TOOL ]]; then
- echo "$0: ERROR: cannot find the location executable" 1>&2
+ echo "$0: ERROR: cannot find the location executable along \$PATH" 1>&2
echo "$0: notice: location tool comes from this repo: https://github.com/ioccc-src/mkiocccentry" 1>&2
exit 5
fi
+
# note authors.html file
#
export AUTHORS_HTML="authors.html"
+
# print running info if verbose
#
# If -v 3 or higher, print exported variables in order that they were exported.
@@ -939,6 +960,7 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: AUTHORS_HTML=$AUTHORS_HTML" 1>&2
fi
+
# -N stops early before any processing is performed
#
if [[ -n $DO_NOT_PROCESS ]]; then
@@ -948,7 +970,8 @@ if [[ -n $DO_NOT_PROCESS ]]; then
exit 0
fi
-# case: -Q
+
+# case: -Q (quick mode)
#
# Do nothing if authors.html is newer than all author/author_handle.json files.
#
@@ -959,6 +982,7 @@ if [[ -n $QUICK_MODE ]]; then
fi
fi
+
# create a temporary entry markdown file
#
export TMP_AUTHORS_MD=".tmp.$NAME.AUTHORS_MD.$$.tmp"
@@ -981,6 +1005,7 @@ elif [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: because of -n, temporary entry markdown file is not used: $TMP_AUTHORS_MD" 1>&2
fi
+
# create a temporary sort word list file
#
export TMP_SORT_WORD=".tmp.$NAME.SORT_WORD.$$.tmp"
@@ -1003,12 +1028,14 @@ elif [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: because of -n, temporary sort word list file is not used: $TMP_SORT_WORD" 1>&2
fi
+
# load initial letter . lines into the temporary sort word list file
#
for letter in "${!IS_FOR[@]}"; do
echo "$letter ."
done > "$TMP_SORT_WORD"
+
# add author sort_word filename to the temporary sort word list file
#
if [[ $V_FLAG -ge 1 ]]; then
@@ -1018,6 +1045,7 @@ find "$AUTHOR_DIR" -mindepth 1 -maxdepth 1 -type f -name '*.json' 2>/dev/null |
echo "$(bin/jval-wrapper.sh -w -b "$json_file" '$..sort_word') $json_file"
done >> "$TMP_SORT_WORD"
+
# sort the temporary sort word list file
#
LC_ALL=C sort -f -d "$TMP_SORT_WORD" -o "$TMP_SORT_WORD"
@@ -1027,6 +1055,7 @@ if [[ $status -ne 0 ]]; then
exit 14
fi
+
# generate the temporary entry markdown file
#
{
@@ -1299,9 +1328,13 @@ else
fi
fi
-# use the md2html.sh tool to form a location HTML file, unless -n
+
+# use the md2html.sh tool to update authors.html, unless -n
#
if [[ -z $NOOP ]]; then
+
+ # possibly update authors.html
+ #
if [[ $V_FLAG -ge 1 ]]; then
echo "$0: debug[1]: about to run: $MD2HTML_SH ${TOOL_OPTION[*]} -- authors.md $TMP_AUTHORS_MD $AUTHORS_HTML" 1>&2
fi
@@ -1316,12 +1349,23 @@ if [[ -z $NOOP ]]; then
echo "$0: debug[3]: now up to date: $AUTHORS_HTML" 1>&2
fi
+ # case -Q: (quick mode)
+ #
+ # If we are here, then the early quick mode test indicated that the prerequisite files are newer.
+ # We will force the authors.html file to be touched so that a later run with -Q will quickly exit.
+ # We do this because by default, the md2html.sh tool does not modify the target HTML unless it was modified.
+ #
+ if [[ -n $QUICK_MODE ]]; then
+ touch "$AUTHORS_HTML"
+ fi
+
# report disabled by -n
#
elif [[ $V_FLAG -ge 5 ]]; then
echo "$0: debug[5]: because of -n, did not run: $MD2HTML_SH ${TOOL_OPTION[*]} -- authors.md $TMP_AUTHORS_MD $AUTHORS_HTML" 1>&2
fi
+
# file cleanup
#
if [[ -z $NOOP ]]; then
@@ -1330,6 +1374,7 @@ elif [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: because of -n, disabled: rm -f -- $TMP_AUTHORS_MD" 1>&2
fi
+
# All Done!!! All Done!!! -- Jessica Noll, Age 2
#
if [[ $EXIT_CODE -ne 0 ]]; then
diff --git a/bin/gen-location.sh b/bin/gen-location.sh
index 0a1ec3de3..132fc1310 100755
--- a/bin/gen-location.sh
+++ b/bin/gen-location.sh
@@ -26,6 +26,7 @@
#
# Share and enjoy! :-)
+
# firewall - run only with a bash that is version 5.1.8 or later
#
# The "/usr/bin/env bash" command must result in using a bash that
@@ -84,7 +85,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an
# set variables referenced in the usage message
#
-export VERSION="1.5 2024-08-17"
+export VERSION="1.6 2024-08-18"
NAME=$(basename "$0")
export NAME
export V_FLAG=0
@@ -110,17 +111,19 @@ export SITE_URL="https://ioccc-src.github.io/temp-test-ioccc"
#
export NOOP=
export DO_NOT_PROCESS=
-QUICK_MODE=
+export QUICK_MODE=
+
# clear options we will add to tools
#
unset TOOL_OPTION
declare -ag TOOL_OPTION
+
# usage
#
export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
- [-t tagline] [-p tool] [-Q] [-w site_url]
+ [-t tagline] [-Q] [-w site_url]
-h print help message and exit
-v level set verbosity level (def level: 0)
@@ -139,9 +142,6 @@ export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
-t tagline string to write about the tool that formed the markdown content (def: $TAGLINE)
NOTE: 'tagline' may be enclosed within, but may NOT contain an internal single-quote, or double-quote.
- -p tool run 'pandoc wrapper tool' (not pandoc path) during HTML phase number 21 (def: use $PANDOC_WRAPPER)
- NOTE: The '-p tool' is passed as leading options on tool command lines.
-
-Q quick mode, do not run $MD2HTML_SH unless markdown is out of date (def: do)
-w site_url Base URL of the website (def: $SITE_URL)
@@ -149,7 +149,7 @@ export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
NOTE: The '-v level' is passed as initial command line options to the 'markdown to html tool' (md2html.sh).
The 'tagline' is passed as '-t tagline' to the 'markdown to html tool' (md2html.sh), after the '-v level'.
- Any '-T md2html.sh', '-p tool', '-P pandoc_opts', '-U top_url'
+ Any '-P pandoc_opts', '-U top_url'
are passed to the 'markdown to html tool' (md2html.sh), and will be before any command line arguments.
Exit codes:
@@ -165,9 +165,10 @@ Exit codes:
$NAME version: $VERSION"
+
# parse command line
#
-while getopts :hv:Vd:D:nNt:p:Qw: flag; do
+while getopts :hv:Vd:D:nNt:Qw: flag; do
case "$flag" in
h) echo "$USAGE" 1>&2
exit 2
@@ -216,10 +217,6 @@ while getopts :hv:Vd:D:nNt:p:Qw: flag; do
TAGLINE="$OPTARG"
# -t tagline always added after arg parsing
;;
- p) PANDOC_WRAPPER="$OPTARG"
- TOOL_OPTION+=("-p")
- TOOL_OPTION+=("$PANDOC_WRAPPER")
- ;;
Q) QUICK_MODE="-Q"
;;
w) SITE_URL="$OPTARG"
@@ -243,7 +240,7 @@ while getopts :hv:Vd:D:nNt:p:Qw: flag; do
;;
esac
done
-
+#
# remove the options
#
shift $(( OPTIND - 1 ));
@@ -259,6 +256,7 @@ if [[ $# -ne 0 ]]; then
exit 3
fi
+
# always add the '-v level' option, unless level is empty, to the set of options passed to the md2html.sh tool
#
if [[ -n $V_FLAG ]]; then
@@ -266,6 +264,7 @@ if [[ -n $V_FLAG ]]; then
TOOL_OPTION+=("$V_FLAG")
fi
+
# always add the '-t tagline' option, unless tagline is empty, to the set of options passed to the md2html.sh tool
#
if [[ -n $TAGLINE ]]; then
@@ -273,16 +272,19 @@ if [[ -n $TAGLINE ]]; then
TOOL_OPTION+=("$TAGLINE")
fi
+
# always add the '-U URL' for the top level location.html file
#
TOOL_OPTION+=("-U")
TOOL_OPTION+=("$SITE_URL/location.html")
+
# always add the '-D docroot/' for the top level location.html file
#
TOOL_OPTION+=("-D")
TOOL_OPTION+=("$DOCROOT_SLASH")
+
# verify that we have a topdir directory
#
REPO_NAME=$(basename "$REPO_TOP_URL")
@@ -303,6 +305,7 @@ if [[ ! -d $TOPDIR ]]; then
exit 6
fi
+
# cd to topdir
#
if [[ ! -e $TOPDIR ]]; then
@@ -326,6 +329,7 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: now in directory: $(/bin/pwd)" 1>&2
fi
+
# verify that we have an author subdirectory
#
export AUTHOR_PATH="$TOPDIR/author"
@@ -335,6 +339,7 @@ if [[ ! -d $AUTHOR_PATH ]]; then
fi
export AUTHOR_DIR="author"
+
# verify that we have a bin subdirectory
#
export BIN_PATH="$TOPDIR/bin"
@@ -344,7 +349,8 @@ if [[ ! -d $BIN_PATH ]]; then
fi
export BIN_DIR="bin"
-# verify that the md2html tool is executable
+
+# verify that the bin/md2html.sh tool is executable
#
export MD2HTML_SH="$BIN_DIR/md2html.sh"
if [[ ! -e $MD2HTML_SH ]]; then
@@ -360,42 +366,40 @@ if [[ ! -x $MD2HTML_SH ]]; then
exit 5
fi
-# verify jval-wrapper tool is executable
+
+# verify that the bin/jval-wrapper.sh tool is executable
#
-export JVAL_WRAPPER="$BIN_DIR/jval-wrapper.sh"
+JVAL_WRAPPER="$BIN_DIR/jval-wrapper.sh"
if [[ ! -e $JVAL_WRAPPER ]]; then
- echo "$0: ERROR: bin/jval-wrapper.sh file does not exist: $JVAL_WRAPPER" 1>&2
+ echo "$0: ERROR: bin/jval-wrapper.sh does not exist: $JVAL_WRAPPER" 1>&2
exit 5
fi
if [[ ! -f $JVAL_WRAPPER ]]; then
- echo "$0: ERROR: bin/jval-wrapper.sh is not a file: $JVAL_WRAPPER" 1>&2
+ echo "$0: ERROR: bin/jval-wrapper.sh is not a regular file: $JVAL_WRAPPER" 1>&2
exit 5
fi
if [[ ! -x $JVAL_WRAPPER ]]; then
- echo "$0: ERROR: cannot find an executable bin/jval-wrapper.sh tool: $JVAL_WRAPPER" 1>&2
+ echo "$0: ERROR: bin/jval-wrapper.sh is not an executable file: $JVAL_WRAPPER" 1>&2
exit 5
fi
-#
+
# find the location tool
#
LOCATION_TOOL=$(type -P location)
export LOCATION_TOOL
-if [[ -z $LOCATION_TOOL ]]; then
- # guess we have a location tool in bin
- #
- LOCATION_TOOL="$BIN_DIR/location"
-fi
if [[ ! -x $LOCATION_TOOL ]]; then
- echo "$0: ERROR: cannot find the location executable" 1>&2
+ echo "$0: ERROR: cannot find the location executable along \$PATH" 1>&2
echo "$0: notice: location tool comes from this repo: https://github.com/ioccc-src/mkiocccentry" 1>&2
exit 5
fi
+
# note location.html file
#
export LOCATION_HTML="location.html"
+
# print running info if verbose
#
# If -v 3 or higher, print exported variables in order that they were exported.
@@ -440,7 +444,8 @@ if [[ -n $DO_NOT_PROCESS ]]; then
exit 0
fi
-# case: -Q
+
+# case: -Q (quick mode)
#
# Do nothing if authors.html is newer than all author/author_handle.json files.
#
@@ -451,6 +456,7 @@ if [[ -n $QUICK_MODE ]]; then
fi
fi
+
# create a temporary location markdown file
#
export TMP_LOC_MD=".tmp.$NAME.LOC_MD.$$.tmp"
@@ -473,6 +479,7 @@ elif [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: because of -n, temporary location markdown file is not used: $TMP_LOC_MD" 1>&2
fi
+
# create a temporary location sort_word handle name set
#
export TMP_LOC_WORD_HANDLE_NAME_SET=".tmp.$NAME.LOC_AUTHOR_HANDLE.$$.tmp"
@@ -495,6 +502,7 @@ elif [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: because of -n, temporary location sort_word handle name set is not used: $TMP_LOC_WORD_HANDLE_NAME_SET" 1>&2
fi
+
# create a temporary location count set
#
export TMP_LOC_COUNT=".tmp.$NAME.LOC_COUNT.$$.tmp"
@@ -722,6 +730,9 @@ done < "$TMP_LOC_WORD_HANDLE_NAME_SET" > "$TMP_LOC_MD"
# use the md2html.sh tool to form a location HTML file, unless -n
#
if [[ -z $NOOP ]]; then
+
+ # possibly update location.html
+ #
if [[ $V_FLAG -ge 1 ]]; then
echo "$0: debug[1]: about to run: $MD2HTML_SH ${TOOL_OPTION[*]} -- location.md $TMP_LOC_MD $LOCATION_HTML" 1>&2
fi
@@ -735,6 +746,16 @@ if [[ -z $NOOP ]]; then
echo "$0: debug[3]: now up to date: $LOCATION_HTML" 1>&2
fi
+ # case -Q: (quick mode)
+ #
+ # If we are here, then the early quick mode test indicated that the prerequisite files are newer.
+ # We will force the authors.html file to be touched so that a later run with -Q will quickly exit.
+ # We do this because by default, the md2html.sh tool does not modify the target HTML unless it was modified.
+ #
+ if [[ -n $QUICK_MODE ]]; then
+ touch "$LOCATION_HTML"
+ fi
+
# report disabled by -n
#
elif [[ $V_FLAG -ge 5 ]]; then
diff --git a/bin/gen-other-html.sh b/bin/gen-other-html.sh
index 5377545f1..7ee0fe78b 100755
--- a/bin/gen-other-html.sh
+++ b/bin/gen-other-html.sh
@@ -26,6 +26,7 @@
#
# Share and enjoy! :-)
+
# firewall - run only with a bash that is version 5.1.8 or later
#
# The "/usr/bin/env bash" command must result in using a bash that
@@ -82,9 +83,10 @@ shopt -u nocaseglob # disable strict case matching
shopt -u extglob # enable extended globbing patterns
shopt -s globstar # enable ** to match all files and zero or more directories and subdirectories
+
# set variables referenced in the usage message
#
-export VERSION="1.3 2024-08-11"
+export VERSION="1.4 2024-08-17"
NAME=$(basename "$0")
export NAME
export V_FLAG=0
@@ -114,15 +116,17 @@ export DO_NOT_PROCESS=
export QUICK_MODE=
export EXIT_CODE="0"
+
# clear options we will add to tools
#
unset TOOL_OPTION
declare -ag TOOL_OPTION
+
# usage
#
export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
- [-t tagline] [-T md2html.sh] [-p tool] [-Q] [-w site_url]
+ [-t tagline] [-Q] [-w site_url]
-h print help message and exit
-v level set verbosity level (def level: 0)
@@ -138,17 +142,13 @@ export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
-t tagline string to write about the tool that formed the markdown content (def: $TAGLINE)
NOTE: The '-t tagline' is passed as leading options on tool command lines.
- -T md2html.sh run 'markdown to html tool' to convert markdown into HTML (def: $MD2HTML_SH)
- NOTE: The '-T md2html.sh' is passed as leading options on tool command lines.
-Q quick mode, do not run $MD2HTML_SH unless markdown is out of date (def: do)
- -p tool run 'pandoc wrapper tool' (not pandoc path) during HTML phase number 21 (def: use $PANDOC_WRAPPER)
-
-w site_url Base URL of the website (def: $SITE_URL)
NOTE: The '-w site_url' is passed as leading options on tool command lines.
-NOTE: Any '-D docroot/', '-t tagline', '-T md2html.sh', '-p tool', '-w site_url'
+NOTE: Any '-D docroot/', '-t tagline', '-w site_url'
are passed to the 'tool' at the beginning of the command line, and
before any optional 'more_options' and before the final YYYY/dir argument.
@@ -168,7 +168,7 @@ $NAME version: $VERSION"
# parse command line
#
-while getopts :hv:Vd:D:nNt:T:p:Qw: flag; do
+while getopts :hv:Vd:D:nNt:Qw: flag; do
case "$flag" in
h) echo "$USAGE" 1>&2
exit 2
@@ -215,14 +215,6 @@ while getopts :hv:Vd:D:nNt:T:p:Qw: flag; do
esac
TAGLINE="$OPTARG"
;;
- T) MD2HTML_SH="$OPTARG"
- TOOL_OPTION+=("-T")
- TOOL_OPTION+=("$MD2HTML_SH")
- ;;
- p) PANDOC_WRAPPER="$OPTARG"
- TOOL_OPTION+=("-p")
- TOOL_OPTION+=("$PANDOC_WRAPPER")
- ;;
Q) QUICK_MODE="-Q"
;;
w) SITE_URL="$OPTARG"
@@ -244,7 +236,7 @@ while getopts :hv:Vd:D:nNt:T:p:Qw: flag; do
;;
esac
done
-
+#
# remove the options
#
shift $(( OPTIND - 1 ));
@@ -259,6 +251,7 @@ if [[ $# -ne 0 ]]; then
exit 3
fi
+
# verify that we have a topdir directory
#
REPO_NAME=$(basename "$REPO_TOP_URL")
@@ -279,6 +272,7 @@ if [[ ! -d $TOPDIR ]]; then
exit 6
fi
+
# cd to topdir
#
if [[ ! -e $TOPDIR ]]; then
@@ -302,6 +296,34 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: now in directory: $(/bin/pwd)" 1>&2
fi
+
+# verify that we have a bin subdirectory
+#
+export BIN_PATH="$TOPDIR/bin"
+if [[ ! -d $BIN_PATH ]]; then
+ echo "$0: ERROR: bin is not a directory under topdir: $BIN_PATH" 1>&2
+ exit 6
+fi
+export BIN_DIR="bin"
+
+
+# verify that the bin/md2html.sh tool is executable
+#
+export MD2HTML_SH="$BIN_DIR/md2html.sh"
+if [[ ! -e $MD2HTML_SH ]]; then
+ echo "$0: ERROR: bin/md2html.sh does not exist: $MD2HTML_SH" 1>&2
+ exit 5
+fi
+if [[ ! -f $MD2HTML_SH ]]; then
+ echo "$0: ERROR: bin/md2html.sh is not a regular file: $MD2HTML_SH" 1>&2
+ exit 5
+fi
+if [[ ! -x $MD2HTML_SH ]]; then
+ echo "$0: ERROR: bin/md2html.sh is not an executable file: $MD2HTML_SH" 1>&2
+ exit 5
+fi
+
+
# verify we have a non-empty readable .top file
#
export TOP_FILE=".top"
@@ -322,20 +344,6 @@ if [[ ! -s $TOP_FILE ]]; then
exit 6
fi
-# verify that the md2html.sh is an executable file
-#
-if [[ ! -e $MD2HTML_SH ]]; then
- echo "$0: ERROR: md2html.sh does not exist: $MD2HTML_SH" 1>&2
- exit 5
-fi
-if [[ ! -f $MD2HTML_SH ]]; then
- echo "$0: ERROR: md2html.sh is not a regular file: $MD2HTML_SH" 1>&2
- exit 5
-fi
-if [[ ! -x $MD2HTML_SH ]]; then
- echo "$0: ERROR: md2html.sh is not an executable file: $MD2HTML_SH" 1>&2
- exit 5
-fi
# always set the tagline
#
@@ -344,6 +352,7 @@ TOOL_OPTION+=("$TAGLINE")
TOOL_OPTION+=("-w")
TOOL_OPTION+=("$SITE_URL")
+
# print running info if verbose
#
# If -v 3 or higher, print exported variables in order that they were exported.
@@ -356,7 +365,6 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: TOPDIR=$TOPDIR" 1>&2
echo "$0: debug[3]: DOCROOT_SLASH=$DOCROOT_SLASH" 1>&2
echo "$0: debug[3]: TAGLINE=$TAGLINE" 1>&2
- echo "$0: debug[3]: MD2HTML_SH=$MD2HTML_SH" 1>&2
echo "$0: debug[3]: PANDOC_WRAPPER=$PANDOC_WRAPPER" 1>&2
echo "$0: debug[3]: REPO_TOP_URL=$REPO_TOP_URL" 1>&2
echo "$0: debug[3]: REPO_URL=$REPO_URL" 1>&2
@@ -370,9 +378,13 @@ if [[ $V_FLAG -ge 3 ]]; then
done
echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2
echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2
+ echo "$0: debug[3]: BIN_PATH=$BIN_PATH" 1>&2
+ echo "$0: debug[3]: BIN_DIR=$BIN_DIR" 1>&2
+ echo "$0: debug[3]: MD2HTML_SH=$MD2HTML_SH" 1>&2
echo "$0: debug[3]: TOP_FILE=$TOP_FILE" 1>&2
fi
+
# -N stops early before any processing is performed
#
if [[ -n $DO_NOT_PROCESS ]]; then
@@ -382,6 +394,7 @@ if [[ -n $DO_NOT_PROCESS ]]; then
exit 0
fi
+
# create a temporary exit code
#
# It is a pain to set the EXIT_CODE deep inside a loop, so we write the EXIT_CODE into a file
@@ -407,6 +420,7 @@ elif [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: because of -n, temporary exit code is not used: $TMP_EXIT_CODE" 1>&2
fi
+
# process each year
#
export YYYY
@@ -585,6 +599,8 @@ for YYYY in $(< "$TOP_FILE"); do
HTML_BASENAME=$(basename "$HTML_FILE")
export HTML_BASENAME
+ # case: -Q (quick mode)
+ #
# determine if we need to run the tool
#
# Check if the non-empty foo.html is newer than foo.md.
@@ -599,6 +615,14 @@ for YYYY in $(< "$TOP_FILE"); do
if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: does not need to be updated: $HTML_FILE" 1>&2
fi
+
+ # case -Q: (quick mode)
+ #
+ # If we are here, then the early quick mode test indicated that the prerequisite files are newer.
+ # We will force the authors.html file to be touched so that a later run with -Q will quickly exit.
+ # We do this because by default, the md2html.sh tool does not modify the target HTML unless it was modified.
+ #
+ touch "$HTML_FILE"
continue
fi
fi
@@ -651,6 +675,8 @@ for YYYY in $(< "$TOP_FILE"); do
#
if [[ -z $NOOP ]]; then
+ # possibly update the HTML file
+ #
if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: about to run: $MD2HTML_SH ${TOOL_OPTION[*]}" \
"-U $SITE_URL/$HTML_FILE" \
@@ -678,6 +704,16 @@ for YYYY in $(< "$TOP_FILE"); do
continue
fi
+ # case -Q: (quick mode)
+ #
+ # If we are here, then the early quick mode test indicated that the prerequisite files are newer.
+ # We will force the authors.html file to be touched so that a later run with -Q will quickly exit.
+ # We do this because by default, the md2html.sh tool does not modify the target HTML unless it was modified.
+ #
+ if [[ -n $QUICK_MODE ]]; then
+ touch "$HTML_FILE"
+ fi
+
# report disabled by -n
#
elif [[ $V_FLAG -ge 5 ]]; then
@@ -697,6 +733,7 @@ if [[ -z $NOOP ]]; then
fi
fi
+
# All Done!!! All Done!!! -- Jessica Noll, Age 2
#
if [[ $EXIT_CODE -ne 0 ]]; then
diff --git a/bin/gen-sitemap.sh b/bin/gen-sitemap.sh
index 3b246d58a..c46396bef 100755
--- a/bin/gen-sitemap.sh
+++ b/bin/gen-sitemap.sh
@@ -26,6 +26,7 @@
#
# Share and enjoy! :-)
+
# firewall - run only with a bash that is version 5.1.8 or later
#
# The "/usr/bin/env bash" command must result in using a bash that
@@ -82,6 +83,7 @@ shopt -u nocaseglob # disable strict case matching
shopt -u extglob # enable extended globbing patterns
shopt -s globstar # enable ** to match all files and zero or more directories and subdirectories
+
# set variables referenced in the usage message
#
export VERSION="1.3.14 2024-08-19"
@@ -194,6 +196,7 @@ function output_modtime
return 0
}
+
# set usage message
#
export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-n] [-N]
@@ -228,12 +231,14 @@ Exit codes:
$NAME version: $VERSION"
+
# setup
#
export NOOP=
export DO_NOT_PROCESS=
export EXIT_CODE="0"
+
# parse command line
#
while getopts :hv:Vd:nNw:W flag; do
@@ -273,7 +278,7 @@ while getopts :hv:Vd:nNw:W flag; do
;;
esac
done
-
+#
# parse the command line arguments
#
if [[ $V_FLAG -ge 3 ]]; then
@@ -289,7 +294,7 @@ if [[ $# -ne 0 ]]; then
echo "$0: ERROR: expected 0 args, found: $#" 1>&2
exit 3
fi
-#
+
# verify that we have a topdir directory
#
@@ -311,6 +316,7 @@ if [[ ! -d $TOPDIR ]]; then
exit 6
fi
+
# cd to topdir
#
if [[ ! -e $TOPDIR ]]; then
@@ -334,6 +340,7 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: now in directory: $(/bin/pwd)" 1>&2
fi
+
# verify that we have an archive/historic subdirectory
#
export ARCHIVE_HISTORIC_PATH="$TOPDIR/archive/historic"
@@ -343,6 +350,7 @@ if [[ ! -d $ARCHIVE_HISTORIC_PATH ]]; then
fi
export ARCHIVE_HISTORIC_DIR="archive/historic"
+
# verify that we have an author subdirectory
#
export AUTHOR_PATH="$TOPDIR/author"
@@ -352,6 +360,7 @@ if [[ ! -d $AUTHOR_PATH ]]; then
fi
export AUTHOR_DIR="author"
+
# verify that we have a bin subdirectory
#
export BIN_PATH="$TOPDIR/bin"
@@ -361,18 +370,6 @@ if [[ ! -d $BIN_PATH ]]; then
fi
export BIN_DIR="bin"
-# verify that we have an inc subdirectory
-#
-export INC_PATH="$TOPDIR/inc"
-if [[ ! -d $INC_PATH ]]; then
- echo "$0: ERROR: inc is not a directory under topdir: $INC_PATH" 1>&2
- exit 6
-fi
-export INC_DIR="inc"
-
-# determine the name of sitemap
-#
-export SITEMAP="sitemap.xml"
# verify we have our awk tool
#
@@ -394,6 +391,22 @@ if [[ ! -s $FILELIST_ENTRY_JSON_AWK ]]; then
exit 5
fi
+
+# verify that we have an inc subdirectory
+#
+export INC_PATH="$TOPDIR/inc"
+if [[ ! -d $INC_PATH ]]; then
+ echo "$0: ERROR: inc is not a directory under topdir: $INC_PATH" 1>&2
+ exit 6
+fi
+export INC_DIR="inc"
+
+
+# determine the name of sitemap
+#
+export SITEMAP="sitemap.xml"
+
+
# verify we have a non-empty readable .top file
#
export TOP_FILE=".top"
@@ -414,6 +427,7 @@ if [[ ! -s $TOP_FILE ]]; then
exit 6
fi
+
# determine how we can determine the file modification time in W3C Datetime format:
#
# https://www.w3.org/TR/NOTE-datetime
@@ -471,6 +485,7 @@ else
fi
fi
+
# parameter debugging
#
if [[ $V_FLAG -ge 3 ]]; then
@@ -498,12 +513,13 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: BIN_PATH=$BIN_PATH" 1>&2
echo "$0: debug[3]: BIN_DIR=$BIN_DIR" 1>&2
echo "$0: debug[3]: INC_PATH=$INC_PATH" 1>&2
+ echo "$0: debug[3]: FILELIST_ENTRY_JSON_AWK=$FILELIST_ENTRY_JSON_AWK" 1>&2
echo "$0: debug[3]: INC_DIR=$INC_DIR" 1>&2
echo "$0: debug[3]: SITEMAP=$SITEMAP" 1>&2
- echo "$0: debug[3]: FILELIST_ENTRY_JSON_AWK=$FILELIST_ENTRY_JSON_AWK" 1>&2
echo "$0: debug[3]: TOP_FILE=$TOP_FILE" 1>&2
fi
+
# If -N, time to exit
#
if [[ -n $DO_NOT_PROCESS ]]; then
@@ -513,6 +529,7 @@ if [[ -n $DO_NOT_PROCESS ]]; then
exit 0
fi
+
# create a temporary file manifest list
#
export TMP_MANIFEST_LIST=".tmp.$NAME.MANIFEST_LIST.$$.tmp"
@@ -531,6 +548,7 @@ if [[ ! -e $TMP_MANIFEST_LIST ]]; then
exit 11
fi
+
# create a temporary exit code
#
# It is a pain to set the EXIT_CODE deep inside a loop, so we write the EXIT_CODE into a file
@@ -552,6 +570,7 @@ if [[ ! -e $TMP_EXIT_CODE ]]; then
exit 15
fi
+
# create a temporary sitemap
#
export TMP_SITEMAP=".tmp.$NAME.SITEMAP.$$.tmp"
@@ -570,6 +589,7 @@ if [[ ! -e $TMP_SITEMAP ]]; then
exit 17
fi
+
# add top level files to the file manifest list
#
# We do not (yet?) include these files:
@@ -611,10 +631,12 @@ winners.html
years.html
EOF0
+
# add files from selected sub-directories
#
find "$ARCHIVE_HISTORIC_DIR" "$AUTHOR_DIR" "$BIN_DIR" "$INC_DIR" -type f -print >> "$TMP_MANIFEST_LIST"
+
# generate sorted list of entry files from the full IOCCC manifest
#
# We also include the YYYY/.filelist contents.
@@ -796,6 +818,7 @@ if [[ $EXIT_CODE -ne 0 ]]; then
exit "$EXIT_CODE"
fi
+
# sort the manifest list
#
LC_ALL=C sort -d "$TMP_MANIFEST_LIST" -o "$TMP_MANIFEST_LIST"
@@ -805,6 +828,7 @@ if [[ $status -ne 0 ]]; then
exit 1
fi
+
# verify that the manifest list contains only readable files
#
for FILE in $(< "$TMP_MANIFEST_LIST"); do
@@ -844,6 +868,7 @@ if [[ $EXIT_CODE -ne 0 ]]; then
exit "$EXIT_CODE"
fi
+
# form the sitemap
#
if [[ -z $NOOP ]]; then
@@ -897,6 +922,7 @@ if [[ -z $EXIT_CODE ]]; then
exit 19
fi
+
# move the sitemap in place only if different
#
if [[ -z $NOOP ]]; then
@@ -938,6 +964,7 @@ elif [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: because of -n, temporary file manifest list was not formed: $TMP_MANIFEST_LIST" 1>&2
fi
+
# All Done!!! All Done!!! -- Jessica Noll, Age 2
#
if [[ -z $NOOP ]]; then
diff --git a/bin/gen-status.sh b/bin/gen-status.sh
index 8e89fcb51..11ed4ec5c 100755
--- a/bin/gen-status.sh
+++ b/bin/gen-status.sh
@@ -26,6 +26,7 @@
#
# Share and enjoy! :-)
+
# firewall - run only with a bash that is version 5.1.8 or later
#
# The "/usr/bin/env bash" command must result in using a bash that
@@ -82,9 +83,10 @@ shopt -u nocaseglob # disable strict case matching
shopt -u extglob # enable extended globbing patterns
shopt -s globstar # enable ** to match all files and zero or more directories and subdirectories
+
# set variables referenced in the usage message
#
-export VERSION="1.5.8 2024-08-05"
+export VERSION="1.6 2024-08-17"
NAME=$(basename "$0")
export NAME
export V_FLAG=0
@@ -102,7 +104,6 @@ fi
export TOPDIR
export DOCROOT_SLASH="./"
export TAGLINE="bin/$NAME"
-export MD2HTML_SH="bin/md2html.sh"
export REPO_TOP_URL="https://github.com/ioccc-src/temp-test-ioccc"
# GitHub puts individual files under the "blob/master" sub-directory.
export REPO_URL="$REPO_TOP_URL/blob/master"
@@ -124,19 +125,21 @@ if [[ -z "$LS_TOOL" ]]; then
echo "$0: FATAL: ls tool is not installed or not in \$PATH" 1>&2
exit 5
fi
-
+#
export IOCCC_STATUS_VERSION="1.0 2024-03-09"
#
export NOOP=
export DO_NOT_PROCESS=
export EXIT_CODE="0"
+
# clear options we will add to tools
#
unset TOOL_OPTION
declare -ag TOOL_OPTION
export MODTIME_METHOD=""
+
# output_modtime - file modification time in W3C Datetime format:
#
# https://www.w3.org/TR/NOTE-datetime
@@ -212,6 +215,7 @@ function output_modtime
return 0
}
+
# output_status_json
#
# write a status.json file to standard output (stdout)
@@ -290,13 +294,11 @@ function output_status_json
# determine the "contest_status" that was in status.json
#
- OLD_CONTEST_STATUS=$(grep '"contest_status"[[:space:]]*:[[:space:]]*"' "$STATUS_PATH" |
- sed -e 's/^.*:[[:space:]]*"//' -e 's/",*//')
+ OLD_CONTEST_STATUS=$("$JVAL_WRAPPER" -w -b "$STATUS_PATH" '$..contest_status')
# determine the "status_update" that was in status.json
#
- OLD_STATUS_UPDATE=$(grep '"status_update"[[:space:]]*:[[:space:]]*"' "$STATUS_PATH" |
- sed -e 's/^.*:[[:space:]]*"//' -e 's/",*//')
+ OLD_STATUS_UPDATE=$("$JVAL_WRAPPER" -w -b "$STATUS_PATH" '$..status_update')
# update the status.json file modification date if the "contest_status" changed
#
@@ -333,11 +335,11 @@ function output_status_json
return 0
}
+
# usage
#
export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-n] [-N]
- [-t tagline] [-T md2html.sh]
- [p | pending | o | open | j | judging | c | closed]
+ [-t tagline] [p | pending | o | open | j | judging | c | closed]
-h print help message and exit
-v level set verbosity level (def level: 0)
@@ -355,7 +357,6 @@ export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-n] [-N]
-t tagline string to write about the tool that formed the markdown content (def: $TAGLINE)
NOTE: 'tagline' may be enclosed within, but may NOT contain an internal single-quote, or double-quote.
- -T md2html.sh run 'markdown to html tool' to convert markdown into HTML (def: $MD2HTML_SH)
-w site_url Base URL of the website (def: $SITE_URL)
NOTE: The '-w site_url' is passed as leading options on tool command lines.
@@ -368,7 +369,7 @@ export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-n] [-N]
NOTE: The '-v level' is passed as initial command line options to the 'markdown to html tool' (md2html.sh).
The 'tagline' is passed as '-t tagline' to the 'markdown to html tool' (md2html.sh), after the '-v level'.
- Any '-T md2html.sh', '-p tool', '-P pandoc_opts', '-U top_url'
+ Any '-P pandoc_opts', '-U top_url'
are passed to the 'markdown to html tool' (md2html.sh), and will be before any command line arguments.
Exit codes:
@@ -383,9 +384,10 @@ Exit codes:
$NAME version: $VERSION"
+
# parse command line
#
-while getopts :hv:Vd:D:nNt:T:w: flag; do
+while getopts :hv:Vd:D:nNt:w: flag; do
case "$flag" in
h) echo "$USAGE" 1>&2
exit 2
@@ -434,10 +436,6 @@ while getopts :hv:Vd:D:nNt:T:w: flag; do
TAGLINE="$OPTARG"
# -t tagline always added after arg parsing
;;
- T) MD2HTML_SH="$OPTARG"
- TOOL_OPTION+=("-T")
- TOOL_OPTION+=("$MD2HTML_SH")
- ;;
w) SITE_URL="$OPTARG"
TOOL_OPTION+=("-w")
TOOL_OPTION+=("$SITE_URL")
@@ -459,7 +457,7 @@ while getopts :hv:Vd:D:nNt:T:w: flag; do
;;
esac
done
-
+#
# remove the options
#
shift $(( OPTIND - 1 ));
@@ -493,6 +491,7 @@ if [[ $# -eq 1 ]]; then
esac
fi
+
# always add the '-v level' option, unless level is empty, to the set of options passed to the md2html.sh tool
#
if [[ -n $V_FLAG ]]; then
@@ -500,6 +499,7 @@ if [[ -n $V_FLAG ]]; then
TOOL_OPTION+=("$V_FLAG")
fi
+
# always add the '-t tagline' option, unless tagline is empty, to the set of options passed to the md2html.sh tool
#
if [[ -n $TAGLINE ]]; then
@@ -507,16 +507,19 @@ if [[ -n $TAGLINE ]]; then
TOOL_OPTION+=("$TAGLINE")
fi
+
# always add the '-U URL' for the top level status.html file
#
TOOL_OPTION+=("-U")
TOOL_OPTION+=("$SITE_URL/status.html")
+
# always add the '-D docroot/' for the top level status.html file
#
TOOL_OPTION+=("-D")
TOOL_OPTION+=("$DOCROOT_SLASH")
+
# verify that we have a topdir directory
#
REPO_NAME=$(basename "$REPO_TOP_URL")
@@ -537,6 +540,7 @@ if [[ ! -d $TOPDIR ]]; then
exit 6
fi
+
# cd to topdir
#
if [[ ! -e $TOPDIR ]]; then
@@ -560,21 +564,51 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: now in directory: $(/bin/pwd)" 1>&2
fi
-# verify that the md2html tool is executable
+
+# verify that we have a bin subdirectory
#
+export BIN_PATH="$TOPDIR/bin"
+if [[ ! -d $BIN_PATH ]]; then
+ echo "$0: ERROR: bin is not a directory under topdir: $BIN_PATH" 1>&2
+ exit 6
+fi
+export BIN_DIR="bin"
+
+
+# verify that the bin/md2html.sh tool is executable
+#
+export MD2HTML_SH="$BIN_DIR/md2html.sh"
if [[ ! -e $MD2HTML_SH ]]; then
- echo "$0: ERROR: md2html.sh does not exist: $MD2HTML_SH" 1>&2
+ echo "$0: ERROR: bin/md2html.sh does not exist: $MD2HTML_SH" 1>&2
exit 5
fi
if [[ ! -f $MD2HTML_SH ]]; then
- echo "$0: ERROR: md2html.sh is not a regular file: $MD2HTML_SH" 1>&2
+ echo "$0: ERROR: bin/md2html.sh is not a regular file: $MD2HTML_SH" 1>&2
exit 5
fi
if [[ ! -x $MD2HTML_SH ]]; then
- echo "$0: ERROR: md2html.sh is not an executable file: $MD2HTML_SH" 1>&2
+ echo "$0: ERROR: bin/md2html.sh is not an executable file: $MD2HTML_SH" 1>&2
exit 5
fi
+
+# verify that the bin/jval-wrapper.sh tool is executable
+#
+JVAL_WRAPPER="$BIN_DIR/jval-wrapper.sh"
+if [[ ! -e $JVAL_WRAPPER ]]; then
+ echo "$0: ERROR: bin/jval-wrapper.sh does not exist: $JVAL_WRAPPER" 1>&2
+ exit 5
+fi
+if [[ ! -f $JVAL_WRAPPER ]]; then
+ echo "$0: ERROR: bin/jval-wrapper.sh is not a regular file: $JVAL_WRAPPER" 1>&2
+ exit 5
+fi
+if [[ ! -x $JVAL_WRAPPER ]]; then
+ echo "$0: ERROR: bin/jval-wrapper.sh is not an executable file: $JVAL_WRAPPER" 1>&2
+ exit 5
+fi
+
+
# verify readable non-empty news.md file
#
export NEWS_MD="news.md"
@@ -595,6 +629,7 @@ if [[ ! -s $NEWS_MD ]]; then
exit 1
fi
+
# verify readable non-empty status.json file
#
export STATUS_JSON="status.json"
@@ -615,6 +650,7 @@ if [[ ! -s $STATUS_JSON ]]; then
exit 1
fi
+
# verify readable non-empty status.md file
#
export STATUS_MD="status.md"
@@ -635,10 +671,12 @@ if [[ ! -s $STATUS_MD ]]; then
exit 1
fi
+
# note status.html file
#
export STATUS_HTML="status.html"
+
# verify we have a non-empty readable .top file
#
export TOP_FILE=".top"
@@ -659,6 +697,7 @@ if [[ ! -s $TOP_FILE ]]; then
exit 6
fi
+
# verify that we have an inc subdirectory
#
export INC_PATH="$TOPDIR/inc"
@@ -668,6 +707,7 @@ if [[ ! -d $INC_PATH ]]; then
fi
export INC_DIR="inc"
+
# verify that we have an next subdirectory
#
export NEXT_PATH="$TOPDIR/next"
@@ -677,6 +717,7 @@ if [[ ! -d $NEXT_PATH ]]; then
fi
export NEXT_DIR="next"
+
# determine how we can determine the file modification time in W3C Datetime format:
#
# https://www.w3.org/TR/NOTE-datetime
@@ -734,6 +775,7 @@ else
fi
fi
+
# print running info if verbose
#
# If -v 3 or higher, print exported variables in order that they were exported.
@@ -746,13 +788,10 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: TOPDIR=$TOPDIR" 1>&2
echo "$0: debug[3]: DOCROOT_SLASH=$DOCROOT_SLASH" 1>&2
echo "$0: debug[3]: TAGLINE=$TAGLINE" 1>&2
- echo "$0: debug[3]: MD2HTML_SH=$MD2HTML_SH" 1>&2
echo "$0: debug[3]: REPO_TOP_URL=$REPO_TOP_URL" 1>&2
echo "$0: debug[3]: REPO_URL=$REPO_URL" 1>&2
echo "$0: debug[3]: SITE_URL=$SITE_URL" 1>&2
echo "$0: debug[3]: JPARSE_TOOL=$JPARSE_TOOL" 1>&2
- echo "$0: debug[3]: STAT_TOOL=$STAT_TOOL" 1>&2
- echo "$0: debug[3]: LS_TOOL=$LS_TOOL" 1>&2
echo "$0: debug[3]: IOCCC_STATUS_VERSION=$IOCCC_STATUS_VERSION" 1>&2
echo "$0: debug[3]: NOOP=$NOOP" 1>&2
echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2
@@ -761,9 +800,16 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: TOOL_OPTION[$index]=${TOOL_OPTION[$index]}" 1>&2
done
echo "$0: debug[3]: MODTIME_METHOD=$MODTIME_METHOD" 1>&2
+ echo "$0: debug[3]: STAT_TOOL=$STAT_TOOL" 1>&2
+ echo "$0: debug[3]: LS_TOOL=$LS_TOOL" 1>&2
+ echo "$0: debug[3]: IOCCC_STATUS_VERSION=$IOCCC_STATUS_VERSION" 1>&2
echo "$0: debug[3]: CONTEST_STATUS=$CONTEST_STATUS" 1>&2
echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2
echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2
+ echo "$0: debug[3]: BIN_DIR=$BIN_DIR" 1>&2
+ echo "$0: debug[3]: BIN_PATH=$BIN_PATH" 1>&2
+ echo "$0: debug[3]: MD2HTML_SH=$MD2HTML_SH" 1>&2
+ echo "$0: debug[3]: JVAL_WRAPPER=$JVAL_WRAPPER" 1>&2
echo "$0: debug[3]: NEWS_MD=$NEWS_MD" 1>&2
echo "$0: debug[3]: STATUS_JSON=$STATUS_JSON" 1>&2
echo "$0: debug[3]: STATUS_MD=$STATUS_MD" 1>&2
@@ -775,6 +821,7 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: NEXT_DIR=$NEXT_DIR" 1>&2
fi
+
# validate JSON in status.json
#
"$JPARSE_TOOL" -q "$STATUS_JSON"
@@ -786,18 +833,11 @@ fi
# obtain contest_status if CONTEST_STATUS was not set in the arg
#
-# XXX - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - XXX
-# XXX - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - XXX
-# XXX - until we have the jnamval command, we must FAKE PARSE the author/author_handle.json file - XXX
-# XXX - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - XXX
-# XXX - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - XXX
-#
if [[ -z $CONTEST_STATUS ]]; then
# obtain the contest_status from status.json
#
- CONTEST_STATUS=$(grep '"contest_status"[[:space:]]*:[[:space:]]*"' "$STATUS_JSON" |
- sed -e 's/^.*:[[:space:]]*"//' -e 's/",*//')
+ CONTEST_STATUS=$("$JVAL_WRAPPER" -w -b "$STATUS_JSON" '$..contest_status')
if [[ -z $CONTEST_STATUS ]]; then
echo "$0: ERROR: cannot determine contest_status from status.json: $STATUS_JSON" 1>&2
exit 1
@@ -806,13 +846,13 @@ if [[ -z $CONTEST_STATUS ]]; then
# validate and normalize the contest_status from status.json
#
case "$CONTEST_STATUS" in
- p|pending) CONTEST_STATUS="pending"
+ pending) CONTEST_STATUS="pending"
;;
- o|open) CONTEST_STATUS="open"
+ open) CONTEST_STATUS="open"
;;
- j|judging) CONTEST_STATUS="judging"
+ judging) CONTEST_STATUS="judging"
;;
- c|closed) CONTEST_STATUS="closed"
+ closed) CONTEST_STATUS="closed"
;;
*) echo "$0: ERROR: unexpected status from $status.json: $CONTEST_STATUS" 1>&2
echo 1>&2
@@ -822,6 +862,7 @@ if [[ -z $CONTEST_STATUS ]]; then
esac
fi
+
# determine the rules.md markdown file
#
export RULES_MD="$NEXT_DIR/rules.md"
@@ -843,6 +884,7 @@ if [[ ! -s $RULES_MD ]]; then
fi
export RULES_HTML="$NEXT_DIR/rules.html"
+
# determine the rules.md markdown file
#
export GUIDELINES_MD="$NEXT_DIR/guidelines.md"
@@ -864,6 +906,7 @@ if [[ ! -s $GUIDELINES_MD ]]; then
fi
export GUIDELINES_HTML="$NEXT_DIR/guidelines.html"
+
# determine the rules hdr file
#
export RULES_HDR="$INC_PATH/rules.$CONTEST_STATUS.hdr"
@@ -884,6 +927,7 @@ if [[ ! -s $RULES_HDR ]]; then
exit 1
fi
+
# determine the guidelines hdr file
#
export GUIDELINES_HDR="$INC_PATH/guidelines.$CONTEST_STATUS.hdr"
@@ -904,6 +948,7 @@ if [[ ! -s $GUIDELINES_HDR ]]; then
exit 1
fi
+
# -N stops early before any processing is performed
#
if [[ -n $DO_NOT_PROCESS ]]; then
@@ -913,6 +958,7 @@ if [[ -n $DO_NOT_PROCESS ]]; then
exit 0
fi
+
# create a temporary status.json file
#
export TMP_STATUS_JSON=".tmp.$NAME.STATUS_JSON.$$.tmp"
@@ -935,6 +981,7 @@ elif [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: because of -n, temporary status.json file is not used: $TMP_STATUS_JSON" 1>&2
fi
+
# create a temporary rules.md file
#
export TMP_RULES_MD=".tmp.$NAME.RULES_MD.$$.tmp"
@@ -957,6 +1004,7 @@ elif [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: because of -n, temporary rules.md file is not used: $TMP_RULES_MD" 1>&2
fi
+
# create a temporary guidelines.md file
#
export TMP_GUIDELINES_MD=".tmp.$NAME.GUIDELINES_MD.$$.tmp"
@@ -979,6 +1027,7 @@ elif [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: because of -n, temporary guidelines.md file is not used: $TMP_GUIDELINES_MD" 1>&2
fi
+
# generate the temporary status.json file
#
# In this stage, we use the date of the actual status.json file.
@@ -1069,6 +1118,7 @@ elif [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: because of -n, temporary status.json file is NOT written into: $TMP_STATUS_JSON" 1>&2
fi
+
# use the md2html.sh tool to form the status.html file, unless -n
#
if [[ -z $NOOP ]]; then
@@ -1095,6 +1145,7 @@ elif [[ $V_FLAG -ge 5 ]]; then
"status.md $STATUS_HTML" 1>&2
fi
+
# update rules.md
#
if [[ -z $NOOP ]]; then
@@ -1179,6 +1230,7 @@ elif [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: because of -n, rules.md was not updated: $RULES_MD" 1>&2
fi
+
# update guidelines.md
#
if [[ -z $NOOP ]]; then
@@ -1263,6 +1315,7 @@ elif [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: because of -n, guidelines.md was not updated: $GUIDELINES_MD" 1>&2
fi
+
# file cleanup
#
if [[ -z $NOOP ]]; then
@@ -1271,6 +1324,7 @@ elif [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: because of -n, disabled: rm -f -- $TMP_STATUS_JSON" 1>&2
fi
+
# All Done!!! All Done!!! -- Jessica Noll, Age 2
#
exit 0
diff --git a/bin/gen-top-html.sh b/bin/gen-top-html.sh
index 7c5da8026..771ea1407 100755
--- a/bin/gen-top-html.sh
+++ b/bin/gen-top-html.sh
@@ -36,6 +36,7 @@
#
# Share and enjoy! :-)
+
# firewall - run only with a bash that is version 5.1.8 or later
#
# The "/usr/bin/env bash" command must result in using a bash that
@@ -79,6 +80,7 @@ if [[ -z ${BASH_VERSINFO[0]} ||
exit 4
fi
+
# setup bash file matching
#
# We must declare arrays with -ag or -Ag, and we need loops to "export" modified variables.
@@ -91,6 +93,7 @@ shopt -u nocaseglob # disable strict case matching
shopt -u extglob # enable extended globbing patterns
shopt -s globstar # enable ** to match all files and zero or more directories and subdirectories
+
# set variables referenced in the usage message
#
export VERSION="1.4.9 2024-08-11"
@@ -111,8 +114,6 @@ fi
export TOPDIR
export DOCROOT_SLASH="./"
export TAGLINE="bin/$NAME"
-export MD2HTML_SH="bin/md2html.sh"
-export PANDOC_WRAPPER="bin/pandoc-wrapper.sh"
export REPO_TOP_URL="https://github.com/ioccc-src/temp-test-ioccc"
# GitHub puts individual files under the "blob/master" sub-directory.
export REPO_URL="$REPO_TOP_URL/blob/master"
@@ -147,15 +148,17 @@ export NOOP=
export DO_NOT_PROCESS=
export EXIT_CODE="0"
+
# clear options we will add to tools
#
unset TOOL_OPTION
declare -ag TOOL_OPTION
+
# usage
#
export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
- [-t tagline] [-T md2html.sh] [-p tool] [file...]
+ [-t tagline] [file...]
-h print help message and exit
-v level set verbosity level (def level: 0)
@@ -173,17 +176,13 @@ export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
-t tagline string to write about the tool that formed the markdown content (def: $TAGLINE)
NOTE: 'tagline' may be enclosed within, but may NOT contain an internal single-quote, or double-quote.
- -T md2html.sh run 'markdown to html tool' to convert markdown into HTML (def: $MD2HTML_SH)
-
- -p tool run 'pandoc wrapper tool' (not pandoc path) during HTML phase number 21 (def: use $PANDOC_WRAPPER)
- NOTE: The '-p tool' is passed as leading options on tool command lines.
-w site_url Base URL of the website (def: $SITE_URL)
NOTE: The '-w site_url' is passed as leading options on tool command lines.
NOTE: The '-v level' is passed as initial command line options to the 'markdown to html tool' (md2html.sh).
The 'tagline' is passed as '-t tagline' to the 'markdown to html tool' (md2html.sh), after the '-v level'.
- Any '-T md2html.sh', '-p tool', '-P pandoc_opts', '-U top_url'
+ Any '-P pandoc_opts', '-U top_url'
are passed to the 'markdown to html tool' (md2html.sh), and will be before any command line arguments.
Exit codes:
@@ -199,9 +198,10 @@ Exit codes:
$NAME version: $VERSION"
+
# parse command line
#
-while getopts :hv:Vd:D:nNt:T:p:w: flag; do
+while getopts :hv:Vd:D:nNt:w: flag; do
case "$flag" in
h) echo "$USAGE" 1>&2
exit 2
@@ -250,14 +250,6 @@ while getopts :hv:Vd:D:nNt:T:p:w: flag; do
TAGLINE="$OPTARG"
# -t tagline always added after arg parsing
;;
- T) MD2HTML_SH="$OPTARG"
- TOOL_OPTION+=("-T")
- TOOL_OPTION+=("$MD2HTML_SH")
- ;;
- p) PANDOC_WRAPPER="$OPTARG"
- TOOL_OPTION+=("-p")
- TOOL_OPTION+=("$PANDOC_WRAPPER")
- ;;
w) SITE_URL="$OPTARG"
TOOL_OPTION+=("-w")
TOOL_OPTION+=("$SITE_URL")
@@ -279,7 +271,7 @@ while getopts :hv:Vd:D:nNt:T:p:w: flag; do
;;
esac
done
-
+#
# remove the options
#
shift $(( OPTIND - 1 ));
@@ -289,8 +281,9 @@ shift $(( OPTIND - 1 ));
if [[ $V_FLAG -ge 5 ]]; then
echo "$0: debug[5]: file argument count: $#" 1>&2
fi
-
+#
# allow specifying specific files to generate
+#
FILE_COUNT="$#"
while [[ $# -ne 0 ]]; do
for (( index=0; index < ${#TOP_MD_SET[@]}; index++ )); do
@@ -304,12 +297,13 @@ if [[ "$FILE_COUNT" != 0 && ${#TOP_MD_SELECT_SET[@]} = 0 ]]; then
echo "$0: ERROR: no select files specified are in allowed set" 1>&2
exit 3
fi
-
+#
if [[ $# -ne 0 ]]; then
echo "$0: ERROR: expected 0 args, found: $#" 1>&2
exit 3
fi
+
# always add the '-v level' option, unless level is empty, to the set of options passed to the md2html.sh tool
#
if [[ -n $V_FLAG ]]; then
@@ -317,6 +311,7 @@ if [[ -n $V_FLAG ]]; then
TOOL_OPTION+=("$V_FLAG")
fi
+
# always add the '-t tagline' option, unless tagline is empty, to the set of options passed to the md2html.sh tool
#
if [[ -n $TAGLINE ]]; then
@@ -324,11 +319,13 @@ if [[ -n $TAGLINE ]]; then
TOOL_OPTION+=("$TAGLINE")
fi
+
# always add the '-D docroot/' for the top level files
#
TOOL_OPTION+=("-D")
TOOL_OPTION+=("$DOCROOT_SLASH")
+
# verify that we have a topdir directory
#
REPO_NAME=$(basename "$REPO_TOP_URL")
@@ -349,6 +346,7 @@ if [[ ! -d $TOPDIR ]]; then
exit 6
fi
+
# cd to topdir
#
if [[ ! -e $TOPDIR ]]; then
@@ -372,6 +370,7 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: now in directory: $(/bin/pwd)" 1>&2
fi
+
# verify that we have an author subdirectory
#
export AUTHOR_PATH="$TOPDIR/author"
@@ -381,6 +380,7 @@ if [[ ! -d $AUTHOR_PATH ]]; then
fi
export AUTHOR_DIR="author"
+
# verify that we have a bin subdirectory
#
export BIN_PATH="$TOPDIR/bin"
@@ -390,35 +390,51 @@ if [[ ! -d $BIN_PATH ]]; then
fi
export BIN_DIR="bin"
-# verify that the md2html tool is executable
+
+# verify that the bin/md2html.sh tool is executable
#
+export MD2HTML_SH="$BIN_DIR/md2html.sh"
if [[ ! -e $MD2HTML_SH ]]; then
- echo "$0: ERROR: md2html.sh does not exist: $MD2HTML_SH" 1>&2
+ echo "$0: ERROR: bin/md2html.sh does not exist: $MD2HTML_SH" 1>&2
exit 5
fi
if [[ ! -f $MD2HTML_SH ]]; then
- echo "$0: ERROR: md2html.sh is not a regular file: $MD2HTML_SH" 1>&2
+ echo "$0: ERROR: bin/md2html.sh is not a regular file: $MD2HTML_SH" 1>&2
exit 5
fi
if [[ ! -x $MD2HTML_SH ]]; then
- echo "$0: ERROR: md2html.sh is not an executable file: $MD2HTML_SH" 1>&2
+ echo "$0: ERROR: bin/md2html.sh is not an executable file: $MD2HTML_SH" 1>&2
exit 5
fi
+
+# verify that the bin/pandoc-wrapper.sh tool is executable
+#
+export PANDOC_WRAPPER="$BIN_DIR/pandoc-wrapper.sh"
+if [[ ! -e $PANDOC_WRAPPER ]]; then
+ echo "$0: ERROR: bin/md2html.sh does not exist: $PANDOC_WRAPPER" 1>&2
+ exit 5
+fi
+if [[ ! -f $PANDOC_WRAPPER ]]; then
+ echo "$0: ERROR: bin/md2html.sh is not a regular file: $PANDOC_WRAPPER" 1>&2
+ exit 5
+fi
+if [[ ! -x $PANDOC_WRAPPER ]]; then
+ echo "$0: ERROR: bin/md2html.sh is not an executable file: $PANDOC_WRAPPER" 1>&2
+ exit 5
+fi
+
+
# find the location tool
#
LOCATION_TOOL=$(type -P location)
-if [[ -z $LOCATION_TOOL ]]; then
- # guess we have a location tool in bin
- #
- LOCATION_TOOL="$BIN_DIR/location"
-fi
if [[ ! -x $LOCATION_TOOL ]]; then
echo "$0: ERROR: cannot find the location executable" 1>&2
echo "$0: notice: location tool comes from this repo: https://github.com/ioccc-src/mkiocccentry" 1>&2
exit 5
fi
+
# print running info if verbose
#
# If -v 3 or higher, print exported variables in order that they were exported.
@@ -431,7 +447,6 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: TOPDIR=$TOPDIR" 1>&2
echo "$0: debug[3]: DOCROOT_SLASH=$DOCROOT_SLASH" 1>&2
echo "$0: debug[3]: TAGLINE=$TAGLINE" 1>&2
- echo "$0: debug[3]: MD2HTML_SH=$MD2HTML_SH" 1>&2
echo "$0: debug[3]: PANDOC_WRAPPER=$PANDOC_WRAPPER" 1>&2
echo "$0: debug[3]: REPO_TOP_URL=$REPO_TOP_URL" 1>&2
echo "$0: debug[3]: REPO_URL=$REPO_URL" 1>&2
@@ -456,8 +471,10 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: AUTHOR_DIR=$AUTHOR_DIR" 1>&2
echo "$0: debug[3]: BIN_PATH=$BIN_PATH" 1>&2
echo "$0: debug[3]: BIN_DIR=$BIN_DIR" 1>&2
+ echo "$0: debug[3]: MD2HTML_SH=$MD2HTML_SH" 1>&2
fi
+
# -N stops early before any processing is performed
#
if [[ -n $DO_NOT_PROCESS ]]; then
@@ -467,6 +484,7 @@ if [[ -n $DO_NOT_PROCESS ]]; then
exit 0
fi
+
# process the entire markdown set
#
if (( ${#TOP_MD_SELECT_SET[@]} )); then
@@ -629,6 +647,7 @@ else
done
fi
+
# All Done!!! All Done!!! -- Jessica Noll, Age 2
#
if [[ $EXIT_CODE -ne 0 ]]; then
diff --git a/bin/gen-year-index.sh b/bin/gen-year-index.sh
index 552d36298..a3bb8e066 100755
--- a/bin/gen-year-index.sh
+++ b/bin/gen-year-index.sh
@@ -28,6 +28,7 @@
#
# Share and enjoy! :-)
+
# firewall - run only with a bash that is version 5.1.8 or later
#
# The "/usr/bin/env bash" command must result in using a bash that
@@ -71,6 +72,7 @@ if [[ -z ${BASH_VERSINFO[0]} ||
exit 4
fi
+
# setup bash file matching
#
# We must declare arrays with -ag or -Ag, and we need loops to "export" modified variables.
@@ -83,9 +85,10 @@ shopt -u nocaseglob # disable strict case matching
shopt -u extglob # enable extended globbing patterns
shopt -s globstar # enable ** to match all files and zero or more directories and subdirectories
+
# set variables referenced in the usage message
#
-export VERSION="1.1.2 2024-08-05"
+export VERSION="1.2 2024-08-17"
NAME=$(basename "$0")
export NAME
export V_FLAG=0
@@ -103,21 +106,22 @@ fi
export TOPDIR
export DOCROOT_SLASH="../../"
export TAGLINE="bin/$NAME"
-export MD2HTML_SH="bin/md2html.sh"
export REPO_TOP_URL="https://github.com/ioccc-src/temp-test-ioccc"
# GitHub puts individual files under the "blob/master" sub-directory.
export REPO_URL="$REPO_TOP_URL/blob/master"
export SITE_URL="https://ioccc-src.github.io/temp-test-ioccc"
+
# clear options we will add to tools
#
unset TOOL_OPTION
declare -ag TOOL_OPTION
+
# set usage message
#
export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-n] [-N]
- [-t tagline] [-T md2html.sh] [-w site_url]
+ [-Q] [-t tagline] [-w site_url]
YYYY [more_options]
-h print help message and exit
@@ -131,8 +135,9 @@ export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-n] [-N]
-n go thru the actions, but do not update any files (def: do the action)
-N do not process file, just parse arguments and ignore the file (def: process the file)
+ -Q quick mode, do not run $MD2HTML_SH unless markdown is out of date (def: do)
+
-t tagline string to write about the tool that formed the markdown content (def: $TAGLINE)
- -T md2html.sh run 'markdown to html tool' to convert markdown into HTML (def: $MD2HTML_SH)
-w site_url Base URL of the website (def: $SITE_URL)
NOTE: The '-w site_url' is passed as leading options on tool command lines.
@@ -153,14 +158,17 @@ Exit codes:
$NAME version: $VERSION"
+
# setup
#
export NOOP=
export DO_NOT_PROCESS=
+export QUICK_MODE=
+
# parse command line
#
-while getopts :hv:Vd:D:nNt:T:w: flag; do
+while getopts :hv:Vd:D:nNQt:w: flag; do
case "$flag" in
h) echo "$USAGE" 1>&2
exit 2
@@ -189,6 +197,8 @@ while getopts :hv:Vd:D:nNt:T:w: flag; do
;;
N) DO_NOT_PROCESS="-N"
;;
+ Q) QUICK_MODE="-Q"
+ ;;
t) # parse -t tagline
case "$OPTARG" in
*"'"*)
@@ -208,10 +218,6 @@ while getopts :hv:Vd:D:nNt:T:w: flag; do
TAGLINE="$OPTARG"
# -t tagline is always added further down
;;
- T) MD2HTML_SH="$OPTARG"
- TOOL_OPTION+=("-T")
- TOOL_OPTION+=("$MD2HTML_SH")
- ;;
w) SITE_URL="$OPTARG"
TOOL_OPTION+=("-w")
TOOL_OPTION+=("$SITE_URL")
@@ -233,7 +239,7 @@ while getopts :hv:Vd:D:nNt:T:w: flag; do
;;
esac
done
-
+#
# parse the command line arguments
#
if [[ $V_FLAG -ge 3 ]]; then
@@ -267,6 +273,7 @@ if [[ -z $YYYY ]]; then
exit 3
fi
+
# verify that we have a topdir directory
#
REPO_NAME=$(basename "$REPO_TOP_URL")
@@ -287,6 +294,7 @@ if [[ ! -d $TOPDIR ]]; then
exit 6
fi
+
# cd to topdir
#
if [[ ! -e $TOPDIR ]]; then
@@ -310,6 +318,34 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: now in directory: $(/bin/pwd)" 1>&2
fi
+
+# verify that we have a bin subdirectory
+#
+export BIN_PATH="$TOPDIR/bin"
+if [[ ! -d $BIN_PATH ]]; then
+ echo "$0: ERROR: bin is not a directory under topdir: $BIN_PATH" 1>&2
+ exit 6
+fi
+export BIN_DIR="bin"
+
+
+# verify that the bin/md2html.sh tool is executable
+#
+export MD2HTML_SH="$BIN_DIR/md2html.sh"
+if [[ ! -e $MD2HTML_SH ]]; then
+ echo "$0: ERROR: bin/md2html.sh does not exist: $MD2HTML_SH" 1>&2
+ exit 5
+fi
+if [[ ! -f $MD2HTML_SH ]]; then
+ echo "$0: ERROR: bin/md2html.sh is not a regular file: $MD2HTML_SH" 1>&2
+ exit 5
+fi
+if [[ ! -x $MD2HTML_SH ]]; then
+ echo "$0: ERROR: bin/md2html.sh is not an executable file: $MD2HTML_SH" 1>&2
+ exit 5
+fi
+
+
# verify that YYYY is an IOCCC year directory
#
if [[ ! -e $YYYY ]]; then
@@ -325,6 +361,7 @@ if [[ ! -r $YYYY ]]; then
exit 6
fi
+
# verify that YYYY has a non-empty readable .year file
#
export DOT_YEAR="$YYYY/.year"
@@ -345,6 +382,7 @@ if [[ ! -s $DOT_YEAR ]]; then
exit 6
fi
+
# verify that YYYY/README.md is a non-empty readable file
#
export README_FILE="$YYYY/README.md"
@@ -365,26 +403,13 @@ if [[ ! -s $README_FILE ]]; then
exit 6
fi
-# verify that the md2html.sh is an executable file
-#
-if [[ ! -e $MD2HTML_SH ]]; then
- echo "$0: ERROR: md2html.sh does not exist: $MD2HTML_SH" 1>&2
- exit 5
-fi
-if [[ ! -f $MD2HTML_SH ]]; then
- echo "$0: ERROR: md2html.sh is not a regular file: $MD2HTML_SH" 1>&2
- exit 5
-fi
-if [[ ! -x $MD2HTML_SH ]]; then
- echo "$0: ERROR: md2html.sh is not an executable file: $MD2HTML_SH" 1>&2
- exit 5
-fi
# always add -t tagline
#
TOOL_OPTION+=("-t")
TOOL_OPTION+=("$TAGLINE")
+
# parameter debugging
#
if [[ $V_FLAG -ge 3 ]]; then
@@ -395,7 +420,6 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: TOPDIR=$TOPDIR" 1>&2
echo "$0: debug[3]: DOCROOT_SLASH=$DOCROOT_SLASH" 1>&2
echo "$0: debug[3]: TAGLINE=$TAGLINE" 1>&2
- echo "$0: debug[3]: MD2HTML_SH=$MD2HTML_SH" 1>&2
echo "$0: debug[3]: REPO_TOP_URL=$REPO_TOP_URL" 1>&2
echo "$0: debug[3]: REPO_URL=$REPO_URL" 1>&2
echo "$0: debug[3]: SITE_URL=$SITE_URL" 1>&2
@@ -404,13 +428,18 @@ if [[ $V_FLAG -ge 3 ]]; then
done
echo "$0: debug[3]: NOOP=$NOOP" 1>&2
echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2
+ echo "$0: debug[3]: QUICK_MODE=$QUICK_MODE" 1>&2
echo "$0: debug[3]: YYYY=$YYYY" 1>&2
echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2
echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2
+ echo "$0: debug[3]: BIN_PATH=$BIN_PATH" 1>&2
+ echo "$0: debug[3]: BIN_DIR=$BIN_DIR" 1>&2
+ echo "$0: debug[3]: MD2HTML_SH=$MD2HTML_SH" 1>&2
echo "$0: debug[3]: DOT_YEAR=$DOT_YEAR" 1>&2
echo "$0: debug[3]: README_FILE=$README_FILE" 1>&2
fi
+
# If -N, time to exit
#
if [[ -n $DO_NOT_PROCESS ]]; then
@@ -420,10 +449,24 @@ if [[ -n $DO_NOT_PROCESS ]]; then
exit 0
fi
+
+# case: -Q (quick mode)
+#
+# Do nothing if authors.html is newer than all author/author_handle.json files.
+#
+if [[ -n $QUICK_MODE ]]; then
+ if [[ $YYYY/index.html -nt $YYYY/README.md ]]; then
+ exit 0
+ fi
+fi
+
+
# form the YYYY index.html unless -n
#
if [[ -z $NOOP ]]; then
+ # possibly update YYYY index.html
+ #
if [[ $V_FLAG -ge 1 ]]; then
echo "$0: debug[1]: about to run: $MD2HTML_SH -U $SITE_URL/$YYYY/index.html ${TOOL_OPTION[*]}" \
"-m $YYYY/README.md -- $YYYY/README.md $YYYY/index.html" 1>&2
@@ -437,6 +480,16 @@ if [[ -z $NOOP ]]; then
exit 1
fi
+ # case -Q: (quick mode)
+ #
+ # If we are here, then the early quick mode test indicated that the prerequisite files are newer.
+ # We will force the authors.html file to be touched so that a later run with -Q will quickly exit.
+ # We do this because by default, the md2html.sh tool does not modify the target HTML unless it was modified.
+ #
+ if [[ -n $QUICK_MODE ]]; then
+ touch "$YYYY/index.html"
+ fi
+
# report disabled by -n
#
elif [[ $V_FLAG -ge 5 ]]; then
@@ -444,6 +497,7 @@ elif [[ $V_FLAG -ge 5 ]]; then
"$YYYY/README.md $YYYY/index.html" 1>&2
fi
+
# All Done!!! All Done!!! -- Jessica Noll, Age 2
#
exit 0
diff --git a/bin/gen-years.sh b/bin/gen-years.sh
index ef3940ec4..0ad9ce4e8 100755
--- a/bin/gen-years.sh
+++ b/bin/gen-years.sh
@@ -28,6 +28,7 @@
#
# Share and enjoy! :-)
+
# firewall - run only with a bash that is version 5.1.8 or later
#
# The "/usr/bin/env bash" command must result in using a bash that
@@ -71,6 +72,7 @@ if [[ -z ${BASH_VERSINFO[0]} ||
exit 4
fi
+
# setup bash file matching
#
# We must declare arrays with -ag or -Ag, and we need loops to "export" modified variables.
@@ -83,9 +85,10 @@ shopt -u nocaseglob # disable strict case matching
shopt -u extglob # enable extended globbing patterns
shopt -s globstar # enable ** to match all files and zero or more directories and subdirectories
+
# set variables referenced in the usage message
#
-export VERSION="1.3.7 2024-08-05"
+export VERSION="1.4 2024-08-17"
NAME=$(basename "$0")
export NAME
export V_FLAG=0
@@ -115,8 +118,6 @@ if [[ ! -x $FMT_TOOL ]]; then
fi
export DOCROOT_SLASH="./"
export TAGLINE="bin/$NAME"
-export MD2HTML_SH="bin/md2html.sh"
-export PANDOC_WRAPPER="bin/pandoc-wrapper.sh"
export REPO_TOP_URL="https://github.com/ioccc-src/temp-test-ioccc"
# GitHub puts individual files under the "blob/master" sub-directory.
export REPO_URL="$REPO_TOP_URL/blob/master"
@@ -126,15 +127,17 @@ export NOOP=
export DO_NOT_PROCESS=
export EXIT_CODE="0"
+
# clear options we will add to tools
#
unset TOOL_OPTION
declare -ag TOOL_OPTION
+
# usage
#
export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
- [-t tagline] [-T md2html.sh] [-p tool]
+ [-t tagline] [-w site_url]
-h print help message and exit
-v level set verbosity level (def level: 0)
@@ -152,17 +155,13 @@ export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
-t tagline string to write about the tool that formed the markdown content (def: $TAGLINE)
NOTE: 'tagline' may be enclosed within, but may NOT contain an internal single-quote, or double-quote.
- -T md2html.sh run 'markdown to html tool' to convert markdown into HTML (def: $MD2HTML_SH)
-
- -p tool run 'pandoc wrapper tool' (not pandoc path) during HTML phase number 21 (def: use $PANDOC_WRAPPER)
- NOTE: The '-p tool' is passed as leading options on tool command lines.
-w site_url Base URL of the website (def: $SITE_URL)
NOTE: The '-w site_url' is passed as leading options on tool command lines.
NOTE: The '-v level' is passed as initial command line options to the 'markdown to html tool' (md2html.sh).
The 'tagline' is passed as '-t tagline' to the 'markdown to html tool' (md2html.sh), after the '-v level'.
- Any '-T md2html.sh', '-p tool', '-P pandoc_opts', '-U top_url'
+ Any '-P pandoc_opts', '-U top_url'
are passed to the 'markdown to html tool' (md2html.sh), and will be before any command line arguments.
Exit codes:
@@ -178,16 +177,11 @@ Exit codes:
$NAME version: $VERSION"
+
# output_award
#
# Write the award name to standard output (stdout)
#
-# XXX - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - XXX
-# XXX - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - XXX
-# XXX - until we have the jnamval command, we must FAKE PARSE the .entry.json file - XXX
-# XXX - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - XXX
-# XXX - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - XXX
-#
# usage:
# output_award YYYY/dir/.entry.json
#
@@ -222,7 +216,7 @@ function output_award
# obtain the award string
#
- AWARD_STRING=$(grep -F '"award" : "' "$ENTRY_JSON_PATH" | sed -e 's/^.*"award" : "//' -e 's/",//')
+ AWARD_STRING=$("$JVAL_WRAPPER" -w -b "$ENTRY_JSON_PATH" '$..award')
if [[ -z $AWARD_STRING ]]; then
echo "$0: ERROR: in output_award: no award found in .entry.json file: $ENTRY_JSON_PATH" 1>&2
return 5
@@ -231,6 +225,7 @@ function output_award
return 0
}
+
# output_ordinal
#
# Write the numerical ordinal form of a non-negative integer to standard output (stdout)
@@ -292,9 +287,10 @@ function output_ordinal
return 0
}
+
# parse command line
#
-while getopts :hv:Vd:D:nNt:T:p:w: flag; do
+while getopts :hv:Vd:D:nNt:w: flag; do
case "$flag" in
h) echo "$USAGE" 1>&2
exit 2
@@ -343,14 +339,6 @@ while getopts :hv:Vd:D:nNt:T:p:w: flag; do
TAGLINE="$OPTARG"
# -t tagline always added after arg parsing
;;
- T) MD2HTML_SH="$OPTARG"
- TOOL_OPTION+=("-T")
- TOOL_OPTION+=("$MD2HTML_SH")
- ;;
- p) PANDOC_WRAPPER="$OPTARG"
- TOOL_OPTION+=("-p")
- TOOL_OPTION+=("$PANDOC_WRAPPER")
- ;;
w) SITE_URL="$OPTARG"
TOOL_OPTION+=("-w")
TOOL_OPTION+=("$SITE_URL")
@@ -372,7 +360,7 @@ while getopts :hv:Vd:D:nNt:T:p:w: flag; do
;;
esac
done
-
+#
# remove the options
#
shift $(( OPTIND - 1 ));
@@ -388,6 +376,7 @@ if [[ $# -ne 0 ]]; then
exit 3
fi
+
# always add the '-v level' option, unless level is empty, to the set of options passed to the md2html.sh tool
#
if [[ -n $V_FLAG ]]; then
@@ -395,6 +384,7 @@ if [[ -n $V_FLAG ]]; then
TOOL_OPTION+=("$V_FLAG")
fi
+
# always add the '-t tagline' option, unless tagline is empty, to the set of options passed to the md2html.sh tool
#
if [[ -n $TAGLINE ]]; then
@@ -402,16 +392,19 @@ if [[ -n $TAGLINE ]]; then
TOOL_OPTION+=("$TAGLINE")
fi
+
# always add the '-U URL' for the top level location.html file
#
TOOL_OPTION+=("-U")
TOOL_OPTION+=("$SITE_URL/years.html")
+
# always add the '-D docroot/' for the top level location.html file
#
TOOL_OPTION+=("-D")
TOOL_OPTION+=("$DOCROOT_SLASH")
+
# verify that we have a topdir directory
#
REPO_NAME=$(basename "$REPO_TOP_URL")
@@ -432,6 +425,7 @@ if [[ ! -d $TOPDIR ]]; then
exit 6
fi
+
# cd to topdir
#
if [[ ! -e $TOPDIR ]]; then
@@ -455,6 +449,7 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: now in directory: $(/bin/pwd)" 1>&2
fi
+
# verify that we have a bin subdirectory
#
export BIN_PATH="$TOPDIR/bin"
@@ -464,6 +459,58 @@ if [[ ! -d $BIN_PATH ]]; then
fi
export BIN_DIR="bin"
+
+# verify that the bin/md2html.sh tool is executable
+#
+export MD2HTML_SH="$BIN_DIR/md2html.sh"
+if [[ ! -e $MD2HTML_SH ]]; then
+ echo "$0: ERROR: bin/md2html.sh does not exist: $MD2HTML_SH" 1>&2
+ exit 5
+fi
+if [[ ! -f $MD2HTML_SH ]]; then
+ echo "$0: ERROR: bin/md2html.sh is not a regular file: $MD2HTML_SH" 1>&2
+ exit 5
+fi
+if [[ ! -x $MD2HTML_SH ]]; then
+ echo "$0: ERROR: bin/md2html.sh is not an executable file: $MD2HTML_SH" 1>&2
+ exit 5
+fi
+
+
+# verify that the bin/pandoc-wrapper.sh tool is executable
+#
+export PANDOC_WRAPPER="$BIN_DIR/pandoc-wrapper.sh"
+if [[ ! -e $PANDOC_WRAPPER ]]; then
+ echo "$0: ERROR: bin/md2html.sh does not exist: $PANDOC_WRAPPER" 1>&2
+ exit 5
+fi
+if [[ ! -f $PANDOC_WRAPPER ]]; then
+ echo "$0: ERROR: bin/md2html.sh is not a regular file: $PANDOC_WRAPPER" 1>&2
+ exit 5
+fi
+if [[ ! -x $PANDOC_WRAPPER ]]; then
+ echo "$0: ERROR: bin/md2html.sh is not an executable file: $PANDOC_WRAPPER" 1>&2
+ exit 5
+fi
+
+
+# verify that the bin/jval-wrapper.sh tool is executable
+#
+JVAL_WRAPPER="$BIN_DIR/jval-wrapper.sh"
+if [[ ! -e $JVAL_WRAPPER ]]; then
+ echo "$0: ERROR: bin/jval-wrapper.sh does not exist: $JVAL_WRAPPER" 1>&2
+ exit 5
+fi
+if [[ ! -f $JVAL_WRAPPER ]]; then
+ echo "$0: ERROR: bin/jval-wrapper.sh is not a regular file: $JVAL_WRAPPER" 1>&2
+ exit 5
+fi
+if [[ ! -x $JVAL_WRAPPER ]]; then
+ echo "$0: ERROR: bin/jval-wrapper.sh is not an executable file: $JVAL_WRAPPER" 1>&2
+ exit 5
+fi
+
+
# verify we have a non-empty readable .top file
#
export TOP_FILE=".top"
@@ -484,6 +531,7 @@ if [[ ! -s $TOP_FILE ]]; then
exit 6
fi
+
# verify that the md2html tool is executable
#
if [[ ! -e $MD2HTML_SH ]]; then
@@ -499,10 +547,12 @@ if [[ ! -x $MD2HTML_SH ]]; then
exit 5
fi
+
# note years.html file
#
export YEARS_HTML="years.html"
+
# print running info if verbose
#
# If -v 3 or higher, print exported variables in order that they were exported.
@@ -517,8 +567,6 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: FMT_TOOL=$FMT_TOOL" 1>&2
echo "$0: debug[3]: DOCROOT_SLASH=$DOCROOT_SLASH" 1>&2
echo "$0: debug[3]: TAGLINE=$TAGLINE" 1>&2
- echo "$0: debug[3]: MD2HTML_SH=$MD2HTML_SH" 1>&2
- echo "$0: debug[3]: PANDOC_WRAPPER=$PANDOC_WRAPPER" 1>&2
echo "$0: debug[3]: REPO_TOP_URL=$REPO_TOP_URL" 1>&2
echo "$0: debug[3]: REPO_URL=$REPO_URL" 1>&2
echo "$0: debug[3]: SITE_URL=$SITE_URL" 1>&2
@@ -532,10 +580,14 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2
echo "$0: debug[3]: BIN_PATH=$BIN_PATH" 1>&2
echo "$0: debug[3]: BIN_DIR=$BIN_DIR" 1>&2
+ echo "$0: debug[3]: MD2HTML_SH=$MD2HTML_SH" 1>&2
+ echo "$0: debug[3]: PANDOC_WRAPPER=$PANDOC_WRAPPER" 1>&2
+ echo "$0: debug[3]: JVAL_WRAPPER=$JVAL_WRAPPER" 1>&2
echo "$0: debug[3]: TOP_FILE=$TOP_FILE" 1>&2
echo "$0: debug[3]: YEARS_HTML=$YEARS_HTML" 1>&2
fi
+
# -N stops early before any processing is performed
#
if [[ -n $DO_NOT_PROCESS ]]; then
@@ -545,6 +597,7 @@ if [[ -n $DO_NOT_PROCESS ]]; then
exit 0
fi
+
# create a temporary years markdown file
#
export TMP_YEARS_MD=".tmp.$NAME.YEARS_MD.$$.tmp"
@@ -567,6 +620,7 @@ elif [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: because of -n, temporary years markdown file is not used: $TMP_YEARS_MD" 1>&2
fi
+
# write All IOCCC years markdown data
#
{
@@ -851,6 +905,7 @@ for YYYY in $("$TAC_TOOL" "$TOP_FILE"); do
((--YEAR_COUNT))
done
+
# write year_level links to all the year level tarballs
#
{
@@ -874,6 +929,7 @@ else
fi
fi
+
# use the md2html.sh tool to form a location HTML file, unless -n
#
if [[ -z $NOOP ]]; then
@@ -897,6 +953,7 @@ elif [[ $V_FLAG -ge 5 ]]; then
echo "$0: debug[5]: because of -n, did not run: $MD2HTML_SH ${TOOL_OPTION[*]} -- years.md $TMP_YEARS_MD $YEARS_HTML" 1>&2
fi
+
# file cleanup
#
if [[ -z $NOOP ]]; then
@@ -905,6 +962,7 @@ elif [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: because of -n, disabled: rm -f -- $TMP_YEARS_MD" 1>&2
fi
+
# All Done!!! All Done!!! -- Jessica Noll, Age 2
#
if [[ $EXIT_CODE -ne 0 ]]; then
diff --git a/bin/jfmt-wrapper.sh b/bin/jfmt-wrapper.sh
index 8cebfb46f..dd5746b18 100755
--- a/bin/jfmt-wrapper.sh
+++ b/bin/jfmt-wrapper.sh
@@ -35,6 +35,7 @@
#
# Share and enjoy! :-)
+
# firewall - run only with a bash that is version 5.1.8 or later
#
# The "/usr/bin/env bash" command must result in using a bash that
@@ -78,6 +79,7 @@ if [[ -z ${BASH_VERSINFO[0]} ||
exit 4
fi
+
# setup bash file matching
#
# We must declare arrays with -ag or -Ag, and we need loops to "export" modified variables.
@@ -90,6 +92,7 @@ shopt -u nocaseglob # disable strict case matching
shopt -u extglob # enable extended globbing patterns
shopt -s globstar # enable ** to match all files and zero or more directories and subdirectories
+
# set variables referenced in the usage message
#
export VERSION="1.0.2 2024-08-08"
@@ -100,6 +103,7 @@ export V_FLAG=0
JPARSE_TOOL=$(type -P jparse)
export JPARSE_TOOL
+
# Until we have a true jfmt tool, we will use the modified JSONPath.sh
#
# XXX - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - XXX
@@ -153,11 +157,13 @@ Exit codes:
$NAME version: $VERSION"
+
# setup
#
export NOOP=
export DO_NOT_PROCESS=
+
# parse command line
#
while getopts :hv:VnNj: flag; do
@@ -193,7 +199,7 @@ while getopts :hv:VnNj: flag; do
;;
esac
done
-
+#
# parse the command line arguments
#
if [[ $V_FLAG -ge 1 ]]; then
diff --git a/bin/jprint-wrapper.sh b/bin/jprint-wrapper.sh
index 47374b053..90ccd2984 100755
--- a/bin/jprint-wrapper.sh
+++ b/bin/jprint-wrapper.sh
@@ -32,6 +32,7 @@
#
# Share and enjoy! :-)
+
# firewall - run only with a bash that is version 5.1.8 or later
#
# The "/usr/bin/env bash" command must result in using a bash that
@@ -75,6 +76,7 @@ if [[ -z ${BASH_VERSINFO[0]} ||
exit 4
fi
+
# setup bash file matching
#
# We must declare arrays with -ag or -Ag, and we need loops to "export" modified variables.
@@ -87,6 +89,7 @@ shopt -u nocaseglob # disable strict case matching
shopt -u extglob # enable extended globbing patterns
shopt -s globstar # enable ** to match all files and zero or more directories and subdirectories
+
# set variables referenced in the usage message
#
export VERSION="1.0.2 2024-08-08"
@@ -94,6 +97,7 @@ NAME=$(basename "$0")
export NAME
export V_FLAG=0
+
# Until we have a true jprint tool, we will use the modified JSONPath.sh
#
# BTW: A jprint tool might be a special case of a jfmt tool, with a command line
@@ -121,6 +125,7 @@ if ! "$JSONPATH_SH" -S -A -T -p >/dev/null 2>&1; then
exit 5
fi <<< "$FIZZBIN_JSON"
+
# set usage message
#
export USAGE="usage: $0 [-h] [-v level] [-V] [-n] [-N] [-j JSONPath.sh] [file.json]
@@ -148,11 +153,13 @@ Exit codes:
$NAME version: $VERSION"
+
# setup
#
export NOOP=
export DO_NOT_PROCESS=
+
# parse command line
#
while getopts :hv:VnNj: flag; do
@@ -188,7 +195,7 @@ while getopts :hv:VnNj: flag; do
;;
esac
done
-
+#
# parse the command line arguments
#
if [[ $V_FLAG -ge 1 ]]; then
diff --git a/bin/jval-wrapper.sh b/bin/jval-wrapper.sh
index 8d7505d8f..8fe26f5cb 100755
--- a/bin/jval-wrapper.sh
+++ b/bin/jval-wrapper.sh
@@ -46,6 +46,7 @@
#
# Share and enjoy! :-)
+
# firewall - run only with a bash that is version 5.1.8 or later
#
# The "/usr/bin/env bash" command must result in using a bash that
@@ -89,6 +90,7 @@ if [[ -z ${BASH_VERSINFO[0]} ||
exit 4
fi
+
# setup bash file matching
#
# We must declare arrays with -ag or -Ag, and we need loops to "export" modified variables.
@@ -101,6 +103,7 @@ shopt -u nocaseglob # disable strict case matching
shopt -u extglob # enable extended globbing patterns
shopt -s globstar # enable ** to match all files and zero or more directories and subdirectories
+
# set variables referenced in the usage message
#
export VERSION="1.0.3 2024-08-11"
@@ -108,6 +111,7 @@ NAME=$(basename "$0")
export NAME
export V_FLAG=0
+
# Until we have a true jval tool, we will use the modified JSONPath.sh
#
# XXX - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - XXX
@@ -137,6 +141,7 @@ export PATTERN='$*'
unset OPTION
declare -ag OPTION
+
# set usage message
#
export USAGE="usage: $0 [-h] [-v level] [-V] [-n] [-N]
@@ -172,11 +177,13 @@ Exit codes:
$NAME version: $VERSION"
+
# setup
#
export NOOP=
export DO_NOT_PROCESS=
+
# parse command line
#
while getopts :hv:VnNwbiuj: flag; do
@@ -220,7 +227,7 @@ while getopts :hv:VnNwbiuj: flag; do
;;
esac
done
-
+#
# parse the command line arguments
#
if [[ $V_FLAG -ge 1 ]]; then
@@ -281,6 +288,7 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: PATTERN=$PATTERN" 1>&2
fi
+
# -N stops early before any processing is performed
#
if [[ -n $DO_NOT_PROCESS ]]; then
diff --git a/bin/md2html.sh b/bin/md2html.sh
index 2b87da20f..5cf1ebfcc 100755
--- a/bin/md2html.sh
+++ b/bin/md2html.sh
@@ -78,6 +78,7 @@
#
# Share and enjoy! :-)
+
# firewall - run only with a bash that is version 5.1.8 or later
#
# The "/usr/bin/env bash" command must result in using a bash that
@@ -121,6 +122,7 @@ if [[ -z ${BASH_VERSINFO[0]} ||
exit 4
fi
+
# setup bash file matching
#
# We must declare arrays with -ag or -Ag, and we need loops to "export" modified variables.
@@ -133,15 +135,17 @@ shopt -u nocaseglob # disable strict case matching
shopt -u extglob # enable extended globbing patterns
shopt -s globstar # enable ** to match all files and zero or more directories and subdirectories
+
# other required bash options
#
# Requires bash with a version 4.2 or later
#
shopt -s lastpipe # run last command of a pipeline not executed in the background in the current shell environment
+
# set variables referenced in the usage message
#
-export VERSION="1.5.5 2024-08-05"
+export VERSION="1.6 2024-08-17"
NAME=$(basename "$0")
export NAME
export V_FLAG=0
@@ -164,18 +168,18 @@ if [[ -z "$PERL_TOOL" ]]; then
fi
export TOPDIR
export DOCROOT_SLASH="./"
-export PANDOC_WRAPPER="bin/pandoc-wrapper.sh"
export REPO_TOP_URL="https://github.com/ioccc-src/temp-test-ioccc"
# GitHub puts individual files under the "blob/master" sub-directory.
export REPO_URL="$REPO_TOP_URL/blob/master"
export SITE_URL="https://ioccc-src.github.io/temp-test-ioccc"
export URL="#"
+
# set usage message
#
export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
[-c md2html.cfg] [-H phase=name ..] [-t tagline]
- [-b tool] [-p tool] [-a tool]
+ [-b tool] [-a tool]
[-s token=value ..] [-S] [-o tool ..]
[-U url] [-w site_url] [-m mdtag] [-e string ..] [-E exitcode]
[match.md] input.md output.html
@@ -208,10 +212,6 @@ export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
-b tool run 'before tool' during HTML phase number 20 (def: do not output before pandoc wrapper tool)
-b . skip HTML phase number 20 (def: do nothing during HTML phase number 20)
- -p tool run 'pandoc wrapper tool' (not pandoc path) during HTML phase number 21 (def: use $PANDOC_WRAPPER)
- -p . skip HTML phase number 21 (def: do nothing during HTML phase number 21)
- NOTE: The '-p tool' will be passed as leading options on the -b tool and -a tool command lines.
-
-a tool run 'after tool' during HTML phase number 20 (def: do not output after pandoc wrapper tool)
-a . skip HTML phase number 22 (def: do nothing during HTML phase number 22)
@@ -256,10 +256,12 @@ Exit codes:
$NAME version: $VERSION"
+
##################################
# command line parsing functions #
##################################
+
# global_variable_setup - setup global variables
#
# Call this once at the start of the shell script.
@@ -338,7 +340,7 @@ function global_variable_setup
unset PHASE_NAME
declare -ag PHASE_NAME
PHASE_NAME=(top head body topbar header navbar before-content
- after-content footer bottom)
+ after-content footer bottom)
unset HTML_PHASE_NAME
declare -Ag HTML_PHASE_NAME
for n in "${PHASE_NAME[@]}"; do
@@ -351,6 +353,7 @@ function global_variable_setup
return 0
}
+
# print_usage - print the usage message, exit code and version information
#
# Call this to print the usage message, by default to stdout.
@@ -366,6 +369,7 @@ function print_usage
return 0
}
+
# parse_command_line - parse command line arguments
#
# You MUST call this function at least once AND after calling global_variable_setup.
@@ -412,7 +416,7 @@ function parse_command_line
# parse command line
#
- while getopts :hv:VnNd:D:c:H:t:m:b:p:a:s:So:U:w:e:E: flag; do
+ while getopts :hv:VnNd:D:c:H:t:m:b:a:s:So:U:w:e:E: flag; do
case "$flag" in
h) print_usage 1>&2
exit 2
@@ -546,7 +550,7 @@ function parse_command_line
;;
m) MDTAG="$OPTARG"
;;
- b) # parse: -p tool
+ b) # parse: -b tool
if [[ $OPTARG == . ]]; then
# unset before tool
BEFORE_TOOL=
@@ -555,19 +559,6 @@ function parse_command_line
BEFORE_TOOL="$OPTARG"
fi
;;
- p) # parse -p tool
- if [[ $OPTARG == . ]]; then
- # unset pandoc wrapper tool
- PANDOC_WRAPPER=
- else
- # change pandoc wrapper tool
- PANDOC_WRAPPER="$OPTARG"
- fi
- B_OPTION+=("-p")
- B_OPTION+=("$PANDOC_WRAPPER")
- A_OPTION+=("-p")
- A_OPTION+=("$PANDOC_WRAPPER")
- ;;
a) # parse: -a tool
if [[ $OPTARG == . ]]; then
# unset after tool
@@ -678,6 +669,7 @@ function parse_command_line
return 0
}
+
# debug_parameters - if verbose enough, print parameters
#
# usage:
@@ -716,7 +708,6 @@ function debug_parameters
echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: PERL_TOOL=$PERL_TOOL" 1>&2
echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: TOPDIR=$TOPDIR" 1>&2
echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: DOCROOT_SLASH=$DOCROOT_SLASH" 1>&2
- echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: PANDOC_WRAPPER=$PANDOC_WRAPPER" 1>&2
echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: REPO_TOP_URL=$REPO_TOP_URL" 1>&2
echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: REPO_URL=$REPO_URL" 1>&2
echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: SITE_URL=$SITE_URL" 1>&2
@@ -766,10 +757,12 @@ function debug_parameters
return 0
}
+
#################################
# md2html.cfg related functions #
#################################
+
# match_md2html - first file_glob match for md2html.cfg file
#
# usage:
@@ -897,10 +890,12 @@ function match_md2html
return 1
}
+
################################
# HTML phase related functions #
################################
+
# append_html_phase - append a sed modified HTML phase file to a growing temporary HTML file
#
# usage:
@@ -1033,24 +1028,30 @@ function append_html_phase
return 0
}
+
###################################
# required initial variable setup #
###################################
+
global_variable_setup
+
##################
# getopt phase 0 #
##################
+
# set getopt phase to 0
#
GETOPT_PHASE=0
+
# process command line options
#
parse_command_line "$@"
+
# parse the command line arguments
#
if [[ $V_FLAG -ge 3 ]]; then
@@ -1088,6 +1089,7 @@ if [[ $MATCH_MD == - ]]; then
exit 3
fi
+
# determine working directory
#
# We will use the dirname of match.md as our working directory. This is path from
@@ -1099,6 +1101,7 @@ fi
WORKING_DIR=$(dirname "$MATCH_MD")
export WORKING_DIR
+
# verify that we have a topdir directory
#
REPO_NAME=$(basename "$REPO_TOP_URL")
@@ -1119,6 +1122,7 @@ if [[ ! -d $TOPDIR ]]; then
exit 6
fi
+
# cd to topdir
#
if [[ ! -e $TOPDIR ]]; then
@@ -1142,14 +1146,6 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: now in directory: $(/bin/pwd)" 1>&2
fi
-# verify that we have an inc subdirectory
-#
-export INC_PATH="$TOPDIR/inc"
-if [[ ! -d $INC_PATH ]]; then
- echo "$0: ERROR: inc is not a directory under topdir: $INC_PATH" 1>&2
- exit 6
-fi
-export INC_DIR="inc"
# verify that we have a bin subdirectory
#
@@ -1161,6 +1157,33 @@ fi
export BIN_DIR="bin"
+# verify that the bin/pandoc-wrapper.sh tool is executable
+#
+export PANDOC_WRAPPER="$BIN_DIR/pandoc-wrapper.sh"
+if [[ ! -e $PANDOC_WRAPPER ]]; then
+ echo "$0: ERROR: bin/md2html.sh does not exist: $PANDOC_WRAPPER" 1>&2
+ exit 5
+fi
+if [[ ! -f $PANDOC_WRAPPER ]]; then
+ echo "$0: ERROR: bin/md2html.sh is not a regular file: $PANDOC_WRAPPER" 1>&2
+ exit 5
+fi
+if [[ ! -x $PANDOC_WRAPPER ]]; then
+ echo "$0: ERROR: bin/md2html.sh is not an executable file: $PANDOC_WRAPPER" 1>&2
+ exit 5
+fi
+
+
+# verify that we have an inc subdirectory
+#
+export INC_PATH="$TOPDIR/inc"
+if [[ ! -d $INC_PATH ]]; then
+ echo "$0: ERROR: inc is not a directory under topdir: $INC_PATH" 1>&2
+ exit 6
+fi
+export INC_DIR="inc"
+
+
# verify that we have a readable .top file
#
export TOP="$TOPDIR/.top"
@@ -1177,6 +1200,7 @@ if [[ ! -r $TOP ]]; then
exit 6
fi
+
# verify we have a readable md2html.cfg file
#
if [[ -z $MD2HTML_CFG ]]; then
@@ -1195,6 +1219,7 @@ if [[ ! -r $MD2HTML_CFG ]]; then
exit 5
fi
+
# new parameter debugging
#
debug_parameters 5 "after parse in getopt phase: $GETOPT_PHASE"
@@ -1203,10 +1228,12 @@ if [[ $V_FLAG -ge 5 ]]; then
echo "$0: debug[5]: end getopt phase ${GETOPT_PHASE} debug level: $V_FLAG" 1>&2
fi
+
##################
# getopt phase 1 #
##################
+
# set getopt phase to 1
#
GETOPT_PHASE=1
@@ -1215,6 +1242,7 @@ if [[ $V_FLAG -ge 5 ]]; then
echo "$0: debug[5]: begin getopt phase ${GETOPT_PHASE} debug level: $V_FLAG" 1>&2
fi
+
# run output tools and parse output as more options
#
# report output tools and output tool options
@@ -1224,6 +1252,7 @@ if [[ $V_FLAG -ge 5 ]]; then
done
fi
+
# verify output tools are executable
#
for n in "${!OUTPUT_TOOL[@]}"; do
@@ -1242,6 +1271,7 @@ for n in "${!OUTPUT_TOOL[@]}"; do
fi
done
+
# pre-clear our output tool options array
#
# NOTE: The OUTPUT_TOOL_OPTIONS array contains the options that an "output tool" produces.
@@ -1250,6 +1280,7 @@ done
unset OUTPUT_TOOL_OPTIONS
declare -ag OUTPUT_TOOL_OPTIONS
+
# execute each output tool and parse the output tool's options and arguments
#
for n in "${!OUTPUT_TOOL[@]}"; do
@@ -1272,6 +1303,7 @@ for n in "${!OUTPUT_TOOL[@]}"; do
done
done
+
# process command line arguments from all output tools
#
if [[ ${#OUTPUT_TOOL_OPTIONS[@]} -gt 0 ]]; then
@@ -1286,6 +1318,7 @@ fi
#
debug_parameters 5 "after parse in getopt phase: $GETOPT_PHASE"
+
# clear output tools and output tool options
#
unset OUTPUT_TOOL
@@ -1297,10 +1330,12 @@ if [[ $V_FLAG -ge 5 ]]; then
echo "$0: debug[5]: end getopt phase ${GETOPT_PHASE} debug level: $V_FLAG" 1>&2
fi
+
##################
# getopt phase 2 #
##################
+
# set getopt phase to 2
#
GETOPT_PHASE=2
@@ -1309,11 +1344,13 @@ if [[ $V_FLAG -ge 5 ]]; then
echo "$0: debug[5]: begin getopt phase ${GETOPT_PHASE} debug level: $V_FLAG" 1>&2
fi
+
# setup an empty MATCH_OPTIONS array for match_md2html to append options
#
unset MATCH_OPTIONS
declare -ag MATCH_OPTIONS
+
# find the first match md2html.cfg for the 'match.md' argument
#
match_md2html "$MD2HTML_CFG" "$MATCH_MD"
@@ -1323,6 +1360,7 @@ status="$?"
if [[ $status -ne 0 ]]; then
echo "$0: Warning: $MATCH_MD does not match any lines in: $MD2HTML_CFG, match_md2html return code: $status" 1>&2
+
# case: MATCH_MD matched and command line options were appended to MATCH_OPTIONS
#
elif [[ ${#MATCH_OPTIONS[@]} -gt 0 ]]; then
@@ -1341,6 +1379,7 @@ elif [[ ${#MATCH_OPTIONS[@]} -gt 0 ]]; then
#
parse_command_line "${MATCH_OPTIONS[@]}"
+
# case: MATCH_MD matched and no command line options found
#
elif [[ $V_FLAG -ge 5 ]]; then
@@ -1353,10 +1392,12 @@ if [[ $V_FLAG -ge 5 ]]; then
echo "$0: debug[5]: end getopt phase ${GETOPT_PHASE} debug level: $V_FLAG" 1>&2
fi
+
##################
# getopt phase 3 #
##################
+
# set getopt phase to 3
#
GETOPT_PHASE=3
@@ -1365,6 +1406,7 @@ if [[ $V_FLAG -ge 5 ]]; then
echo "$0: debug[5]: begin getopt phase ${GETOPT_PHASE} debug level: $V_FLAG" 1>&2
fi
+
# run output tools and parse output as more options
#
# report output tools and output tool options
@@ -1374,6 +1416,7 @@ if [[ $V_FLAG -ge 5 ]]; then
done
fi
+
# verify output tools are executable
#
for n in "${!OUTPUT_TOOL[@]}"; do
@@ -1392,6 +1435,7 @@ for n in "${!OUTPUT_TOOL[@]}"; do
fi
done
+
# pre-clear our output tool options array
#
# NOTE: The OUTPUT_TOOL_OPTIONS array contains the options that an "output tool" produces.
@@ -1400,6 +1444,7 @@ done
unset OUTPUT_TOOL_OPTIONS
declare -ag OUTPUT_TOOL_OPTIONS
+
# execute each output tool and parse the output tool's options and arguments
#
for n in "${!OUTPUT_TOOL[@]}"; do
@@ -1422,6 +1467,7 @@ for n in "${!OUTPUT_TOOL[@]}"; do
done
done
+
# process command line arguments from all output tools
#
if [[ ${#OUTPUT_TOOL_OPTIONS[@]} -gt 0 ]]; then
@@ -1436,6 +1482,7 @@ fi
#
debug_parameters 5 "after parse in getopt phase: $GETOPT_PHASE"
+
# clear output tools and output tool options
#
unset OUTPUT_TOOL
@@ -1447,10 +1494,12 @@ if [[ $V_FLAG -ge 5 ]]; then
echo "$0: debug[5]: end getopt phase ${GETOPT_PHASE} debug level: $V_FLAG" 1>&2
fi
+
############################################
# debugging after getopt phase is complete #
############################################
+
# set getopt phase to 4
#
GETOPT_PHASE=4
@@ -1464,7 +1513,6 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: after parse in getopt phase: $GETOPT_PHASE: V_FLAG=$V_FLAG" 1>&2
echo "$0: debug[3]: after parse in getopt phase: $GETOPT_PHASE: GIT_TOOL=$GIT_TOOL" 1>&2
echo "$0: debug[3]: after parse in getopt phase: $GETOPT_PHASE: DOCROOT_SLASH=$DOCROOT_SLASH" 1>&2
- echo "$0: debug[3]: after parse in getopt phase: $GETOPT_PHASE: PANDOC_WRAPPER=$PANDOC_WRAPPER" 1>&2
echo "$0: debug[3]: after parse in getopt phase: $GETOPT_PHASE: REPO_TOP_URL=$REPO_TOP_URL" 1>&2
echo "$0: debug[3]: after parse in getopt phase: $GETOPT_PHASE: REPO_URL=$REPO_URL" 1>&2
echo "$0: debug[3]: after parse in getopt phase: $GETOPT_PHASE: SITE_URL=$SITE_URL" 1>&2
@@ -1473,12 +1521,16 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: after parse in getopt phase: $GETOPT_PHASE: REPO_NAME=$REPO_NAME" 1>&2
echo "$0: debug[3]: after parse in getopt phase: $GETOPT_PHASE: INC_PATH=$INC_PATH" 1>&2
echo "$0: debug[3]: after parse in getopt phase: $GETOPT_PHASE: INC_DIR=$INC_DIR" 1>&2
+ echo "$0: debug[3]: after parse in getopt phase: $GETOPT_PHASE: BIN_PATH=$BIN_PATH" 1>&2
+ echo "$0: debug[3]: after parse in getopt phase: $GETOPT_PHASE: BIN_DIR=$BIN_DIR" 1>&2
+ echo "$0: debug[3]: after parse in getopt phase: $GETOPT_PHASE: PANDOC_WRAPPER=$PANDOC_WRAPPER" 1>&2
echo "$0: debug[3]: after parse in getopt phase: $GETOPT_PHASE: TOP=$TOP" 1>&2
fi
if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: finished all getopt parsing" 1>&2
fi
+
# validate HTML phase names
#
for n in "${PHASE_NAME[@]}"; do
@@ -1506,6 +1558,7 @@ for n in "${PHASE_NAME[@]}"; do
fi
done
+
# validate before tool
#
if [[ -n $BEFORE_TOOL ]]; then
@@ -1528,27 +1581,6 @@ if [[ -n $BEFORE_TOOL ]]; then
fi
fi
-# validate pandoc wrapper tool
-#
-if [[ -n $PANDOC_WRAPPER ]]; then
- if [[ $V_FLAG -ge 5 ]]; then
- if [[ -n $PANDOC_WRAPPER ]]; then
- echo "$0: debug[5]: -p pandoc wrapper tool: $PANDOC_WRAPPER" 1>&2
- fi
- fi
- if [[ ! -e "$PANDOC_WRAPPER" ]]; then
- echo "$0: ERROR: -p pandoc wrapper tool not found: $PANDOC_WRAPPER" 1>&2
- exit 5
- fi
- if [[ ! -f "$PANDOC_WRAPPER" ]]; then
- echo "$0: ERROR: -p pandoc wrapper tool not a file: $PANDOC_WRAPPER" 1>&2
- exit 5
- fi
- if [[ ! -x "$PANDOC_WRAPPER" ]]; then
- echo "$0: ERROR: -p pandoc wrapper tool not an executable file: $PANDOC_WRAPPER" 1>&2
- exit 5
- fi
-fi
# validate after tool
#
@@ -1572,6 +1604,7 @@ if [[ -n $AFTER_TOOL ]]; then
fi
fi
+
# report TOKEN sed patterns
#
if [[ $V_FLAG -ge 7 ]]; then
@@ -1589,10 +1622,12 @@ if [[ -n $DO_NOT_PROCESS ]]; then
exit 0
fi
+
##########################
# HTML pre-0 phase setup #
##########################
+
# create a temporary sed script
#
export TMP_SED_SCRIPT=".tmp.$NAME.SED_SCRIPT.$$.tmp"
@@ -1634,6 +1669,7 @@ elif [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: the temporary sed script that would have been written ends above: $TMP_SED_SCRIPT" 1>&2
fi
+
# create a temporary HTML phase file
#
# NOTE: This file, when we are finished building it, will be come the final index.html file.
@@ -1661,6 +1697,7 @@ elif [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: because of -n, temporary HTML file is not formed: $TMP_PHASE" 1>&2
fi
+
# create a temporary index HTML file
#
# NOTE: This file, when we are finished building it, will be come the final index.html file.
@@ -1688,6 +1725,7 @@ elif [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: because of -n, temporary index HTML file is not formed: $TMP_INDEX_HTML" 1>&2
fi
+
# input.md is -, we will need to capture standard input into a new temporary file
#
export ORIG_INPUT_MD="$MATCH_MD"
@@ -1733,6 +1771,7 @@ elif [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: because of -n, temporary stdin file is not formed: $TMP_INPUT_MD" 1>&2
fi
+
# strip commented language after markdown code block
#
if [[ -z $NOOP ]]; then
@@ -1784,6 +1823,7 @@ fi
# HTML phase 0: inc/top.__name__.html #
#######################################
+
# NOTE: See bin/md2html.cfg for details on HTML phase numbers, HTML phase names, and HTML phase files
#
export CUR_PHASE_NUM=0
@@ -1799,10 +1839,12 @@ if [[ $status -ne 0 ]]; then
exit "$status"
fi
+
########################################
# HTML phase 1: inc/head.__name__.html #
########################################
+
# NOTE: See bin/md2html.cfg for details on HTML phase numbers, HTML phase names, and HTML phase files
#
CUR_PHASE_NUM=1
@@ -1818,6 +1860,7 @@ if [[ $status -ne 0 ]]; then
exit "$status"
fi
+
# Special output to indicate which tool was used
#
if [[ -z $NOOP && ${HTML_PHASE_NAME[$CUR_PHASE_NAME]} != . ]]; then
@@ -1849,10 +1892,12 @@ fi
} >> "$TMP_INDEX_HTML"
fi
+
########################################
# HTML phase 2: inc/body.__name__.html #
########################################
+
# NOTE: See bin/md2html.cfg for details on HTML phase numbers, HTML phase names, and HTML phase files
#
CUR_PHASE_NUM=2
@@ -1868,10 +1913,12 @@ if [[ $status -ne 0 ]]; then
exit "$status"
fi
+
########################################
# HTML phase 3: inc/topbar.__name__.html #
########################################
+
# NOTE: See bin/md2html.cfg for details on HTML phase numbers, HTML phase names, and HTML phase files
#
CUR_PHASE_NUM=3
@@ -1887,10 +1934,12 @@ if [[ $status -ne 0 ]]; then
exit "$status"
fi
+
##########################################
# HTML phase 4: inc/header.__name__.html #
##########################################
+
# NOTE: See bin/md2html.cfg for details on HTML phase numbers, HTML phase names, and HTML phase files
#
CUR_PHASE_NUM=4
@@ -1906,10 +1955,12 @@ if [[ $status -ne 0 ]]; then
exit "$status"
fi
+
##########################################
# HTML phase 5: inc/navbar.__name__.html #
##########################################
+
# NOTE: See bin/md2html.cfg for details on HTML phase numbers, HTML phase names, and HTML phase files
#
CUR_PHASE_NUM=5
@@ -1925,10 +1976,12 @@ if [[ $status -ne 0 ]]; then
exit "$status"
fi
+
###################################################
# HTML phase 6: inc/before-content.__name__.html #
###################################################
+
# NOTE: See bin/md2html.cfg for details on HTML phase numbers, HTML phase names, and HTML phase files
#
CUR_PHASE_NUM=6
@@ -1944,10 +1997,12 @@ if [[ $status -ne 0 ]]; then
exit "$status"
fi
+
##############################
# HTML phase 20: before tool #
##############################
+
# NOTE: See bin/md2html.cfg for details on HTML phase numbers, HTML phase names, and HTML phase files
#
CUR_PHASE_NUM=20
@@ -2004,10 +2059,12 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: successfully completed HTML phase $CUR_PHASE_NUM ($CUR_PHASE_NAME)" 1>&2
fi
+
######################################
# HTML phase 21: pandoc wrapper tool #
######################################
+
# NOTE: See bin/md2html.cfg for details on HTML phase numbers, HTML phase names, and HTML phase files
#
CUR_PHASE_NUM=21
@@ -2019,100 +2076,98 @@ if [[ $V_FLAG -ge 5 ]]; then
done
fi
#
-if [[ -n $PANDOC_WRAPPER ]]; then
- if [[ -z $NOOP ]]; then
+if [[ -z $NOOP ]]; then
- # write START of section comment
- #
- {
- echo ""
- echo
- } >> "$TMP_INDEX_HTML"
+ # write START of section comment
+ #
+ {
+ echo ""
+ echo
+ } >> "$TMP_INDEX_HTML"
- # append pandoc wrapper tool output
- #
- if [[ $V_FLAG -ge 5 ]]; then
- echo "$0: debug[5]: about to execute:" \
- "$PANDOC_WRAPPER ${P_OPTION[*]} -- $TMP_STRIPPED_MD - >> $TMP_INDEX_HTML" 1>&2
- fi
- "$PANDOC_WRAPPER" "${P_OPTION[@]}" -- "$TMP_STRIPPED_MD" - >> "$TMP_INDEX_HTML"
- status="$?"
- if [[ $status -ne 0 ]]; then
- echo "$0: ERROR: pandoc wrapper tool:" \
- "$PANDOC_WRAPPER ${P_OPTION[*]} -- $TMP_STRIPPED_MD - failed," \
- "error code: $status" 1>&2
- exit 100
- fi
-
- # fix any pandoc footnote bogons
- #
- # The pandoc(1) tool will generate the following BOGUS HTML 5 code
- # when any markdown footnotes are used:
- #
- #
- #