add HTML phase 20-22 to readme2index.sh, improve inc/gen-author.sh,
Add code to `readme2index.sh` to implement HTML phases 20, 21 and 22. Improve `inc/gen-author.sh` to put blank lines around the pandoc tool output. Changed `inc/gen-author.sh` VERSION from "1.1 2024-01-01" to "1.2 2024-01-04".
This commit is contained in:
1 parent
d990a4bdf9
commit
cb98c2a3a0
2 files changed
+113
-19
No files matched your search
+6
-14
@@ -56,7 +56,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.1 2024-01-01"
|
||||
export VERSION="1.2 2024-01-04"
|
||||
NAME=$(basename "$0")
|
||||
export NAME
|
||||
export V_FLAG=0
|
||||
@@ -665,7 +665,6 @@ fi
|
||||
# write author header to temporary markdown file
|
||||
#
|
||||
{
|
||||
echo "<!-- START: this line starts content generated by: inc/$NAME -->"
|
||||
AUTHOR_COUNT=$(echo "$AUTHOR_HANDLE_SET" | wc -l)
|
||||
if [[ $AUTHOR_COUNT -gt 1 ]]; then
|
||||
echo '<a name="author">**Authors:**</a>'
|
||||
@@ -714,6 +713,7 @@ for author_handle in $AUTHOR_HANDLE_SET; do
|
||||
if [[ $LOCATION_CODE == null ]]; then
|
||||
echo "Location: [unknown](/location.html#$LOCATION_CODE)"
|
||||
else
|
||||
|
||||
echo "Location: [$LOCATION_CODE](/location.html#$LOCATION_CODE)"
|
||||
fi
|
||||
echo
|
||||
@@ -726,21 +726,11 @@ for author_handle in $AUTHOR_HANDLE_SET; do
|
||||
fi
|
||||
done
|
||||
|
||||
# write END line
|
||||
#
|
||||
{
|
||||
echo "<!-- END: next line ends content generated by: inc/$NAME -->"
|
||||
} | if [[ -z $NOOP ]]; then
|
||||
cat >> "$TMP_FILE"
|
||||
elif [[ $V_FLAG -ge 3 ]]; then
|
||||
sed -e "s;^;$0: debug[3]: -n disabled write: ;" 1>&2
|
||||
else
|
||||
cat >> /dev/null
|
||||
fi
|
||||
|
||||
# convert temporary markdown file into HTML
|
||||
#
|
||||
if [[ -z $NOOP ]]; then
|
||||
echo "<!-- START: this line starts content generated by: inc/$NAME -->"
|
||||
echo
|
||||
if [[ $V_FLAG -ge 1 ]]; then
|
||||
echo "$0: debug[1]: about to execute: $PANDOC_WRAPPER -P \"$PANDOC_WRAPPER_OPTSTR\" $TMP_FILE -" 1>&2
|
||||
fi
|
||||
@@ -750,6 +740,8 @@ if [[ -z $NOOP ]]; then
|
||||
echo "$0: ERROR: pandoc failed, error: $status" 1>&2
|
||||
exit 218
|
||||
fi
|
||||
echo
|
||||
echo "<!-- END: next line ends content generated by: inc/$NAME -->"
|
||||
elif [[ $V_FLAG -ge 1 ]]; then
|
||||
echo "$0: debug[1]: -n disabled execution of: $PANDOC_WRAPPER -P \"$PANDOC_WRAPPER_OPTSTR\" $TMP_FILE -" 1>&2
|
||||
fi
|
||||
|
||||
+107
-5
@@ -838,8 +838,8 @@ function append_html_phase
|
||||
|
||||
# report progress if verbose
|
||||
#
|
||||
if [[ $V_FLAG -ge 5 ]]; then
|
||||
echo "$0: debug[5]: successfully completed HTML phase $PHASE_NUMBER ($NAME_OF_PHASE)" 1>&2
|
||||
if [[ $V_FLAG -ge 3 ]]; then
|
||||
echo "$0: debug[3]: successfully completed HTML phase $PHASE_NUMBER ($NAME_OF_PHASE)" 1>&2
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
@@ -1779,19 +1779,121 @@ fi
|
||||
# HTML phase 20: before tool #
|
||||
##############################
|
||||
|
||||
# XXX - add code for before tool here - XXX
|
||||
# NOTE: See inc/md2html.cfg for details on HTML phase numbers, HTML phase names, and HTML phase files
|
||||
#
|
||||
CUR_PHASE_NUM=20
|
||||
CUR_PHASE_NAME="before-tool"
|
||||
#
|
||||
if [[ -n $BEFORE_TOOL ]]; then
|
||||
if [[ -z $NOOP ]]; then
|
||||
|
||||
# append before tool output
|
||||
#
|
||||
if [[ $V_FLAG -ge 5 ]]; then
|
||||
echo "$0: debug[6]: about to execute:"\
|
||||
"$BEFORE_TOOL $BEFORE_TOOL_OPTSTR $YEAR_DIR/$WINNER_DIR >> $TMP_INDEX_HTML" 1>&2
|
||||
fi
|
||||
# SC2086 (info): Double quote to prevent globbing and word splitting.
|
||||
# shellcheck disable=SC2086
|
||||
eval "$BEFORE_TOOL" $BEFORE_TOOL_OPTSTR "$YEAR_DIR/$WINNER_DIR" >> "$TMP_INDEX_HTML"
|
||||
status="$?"
|
||||
if [[ $status -ne 0 ]]; then
|
||||
echo "$0: ERROR: before tool:" \
|
||||
"$BEFORE_TOOL $BEFORE_TOOL_OPTSTR $YEAR_DIR/$WINNER_DIR failed," \
|
||||
"error code: $status" 1>&2
|
||||
exit 95
|
||||
fi
|
||||
|
||||
elif [[ $V_FLAG -ge 5 ]]; then
|
||||
echo "$0: debug[5]: because of -n, disabled use of before tool: $BEFORE_TOOL" 1>&2
|
||||
fi
|
||||
elif [[ $V_FLAG -ge 5 ]]; then
|
||||
echo "$0: debug[5]: because of -b ., use of before tool was disabled" 1>&2
|
||||
fi
|
||||
#
|
||||
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 #
|
||||
######################################
|
||||
|
||||
# XXX - add code for pandoc wrapper tool here - XXX
|
||||
# NOTE: See inc/md2html.cfg for details on HTML phase numbers, HTML phase names, and HTML phase files
|
||||
#
|
||||
CUR_PHASE_NUM=21
|
||||
CUR_PHASE_NAME="pandoc-wrapper-tool"
|
||||
#
|
||||
if [[ -n $PANDOC_WRAPPER_TOOL ]]; then
|
||||
if [[ -z $NOOP ]]; then
|
||||
|
||||
# append pandoc wrapper tool output
|
||||
#
|
||||
if [[ $V_FLAG -ge 5 ]]; then
|
||||
echo "$0: debug[6]: about to execute:"\
|
||||
"$PANDOC_WRAPPER_TOOL $PANDOC_WRAPPER_TOOL_OPTSTR $YEAR_DIR/$WINNER_DIR >> $TMP_INDEX_HTML" 1>&2
|
||||
fi
|
||||
# SC2086 (info): Double quote to prevent globbing and word splitting.
|
||||
# shellcheck disable=SC2086
|
||||
eval "$PANDOC_WRAPPER_TOOL" $PANDOC_WRAPPER_TOOL_OPTSTR "$YEAR_DIR/$WINNER_DIR" >> "$TMP_INDEX_HTML"
|
||||
status="$?"
|
||||
if [[ $status -ne 0 ]]; then
|
||||
echo "$0: ERROR: pandoc wrapper tool:" \
|
||||
"$PANDOC_WRAPPER_TOOL $PANDOC_WRAPPER_TOOL_OPTSTR $YEAR_DIR/$WINNER_DIR failed," \
|
||||
"error code: $status" 1>&2
|
||||
exit 100
|
||||
fi
|
||||
|
||||
elif [[ $V_FLAG -ge 5 ]]; then
|
||||
echo "$0: debug[5]: because of -n, disabled use of pandoc wrapper tool: $PANDOC_WRAPPER_TOOL" 1>&2
|
||||
fi
|
||||
elif [[ $V_FLAG -ge 5 ]]; then
|
||||
echo "$0: debug[5]: because of -b ., use of pandoc wrapper tool was disabled" 1>&2
|
||||
fi
|
||||
#
|
||||
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 22: after tool #
|
||||
#############################
|
||||
|
||||
# XXX - add code for after tool here - XXX
|
||||
# NOTE: See inc/md2html.cfg for details on HTML phase numbers, HTML phase names, and HTML phase files
|
||||
#
|
||||
CUR_PHASE_NUM=22
|
||||
CUR_PHASE_NAME="after-tool"
|
||||
#
|
||||
if [[ -n $AFTER_TOOL ]]; then
|
||||
if [[ -z $NOOP ]]; then
|
||||
|
||||
# append after tool output
|
||||
#
|
||||
if [[ $V_FLAG -ge 5 ]]; then
|
||||
echo "$0: debug[6]: about to execute:"\
|
||||
"$AFTER_TOOL $AFTER_TOOL_OPTSTR $YEAR_DIR/$WINNER_DIR >> $TMP_INDEX_HTML" 1>&2
|
||||
fi
|
||||
# SC2086 (info): Double quote to prevent globbing and word splitting.
|
||||
# shellcheck disable=SC2086
|
||||
eval "$AFTER_TOOL" $AFTER_TOOL_OPTSTR "$YEAR_DIR/$WINNER_DIR" >> "$TMP_INDEX_HTML"
|
||||
status="$?"
|
||||
if [[ $status -ne 0 ]]; then
|
||||
echo "$0: ERROR: after tool:" \
|
||||
"$AFTER_TOOL $AFTER_TOOL_OPTSTR $YEAR_DIR/$WINNER_DIR failed," \
|
||||
"error code: $status" 1>&2
|
||||
exit 105
|
||||
fi
|
||||
|
||||
elif [[ $V_FLAG -ge 5 ]]; then
|
||||
echo "$0: debug[5]: because of -n, disabled use of after tool: $AFTER_TOOL" 1>&2
|
||||
fi
|
||||
elif [[ $V_FLAG -ge 5 ]]; then
|
||||
echo "$0: debug[5]: because of -b ., use of after tool was disabled" 1>&2
|
||||
fi
|
||||
#
|
||||
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 30: inc/after-content.__name__.html #
|
||||
|
||||
Reference in new issue
Block a user