use bin/jval-wrapper.sh instead of direct grep of JSON files

We use the `bin/jval-wrapper.sh` tool to obtain information from JSON
files instead of attempting using a "GROSS HACK" that involved using
`grep(1)` (and friends) as those "GROSS HACK"s assumed that the layout of
the JSON was canonical.  The `bin/jval-wrapper.sh` tool is able to deal
with various layouts of JSON including non-canonical layouts.  Moreover,
by using the `bin/jval-wrapper.sh` tool we greatly reduce the places in
bin tools that contain "GROSS HACK"s.

Improve `-v 1` debug messages for `bin/gen-authors.sh` to give some
level of progress instead of a long pause.  Improve `-v 3` as well.

While the `bin/jval-wrapper.sh` tool is slower, it is also more accurate
in that various non-canonical JSON layouts will not confuse the tool.

Apologies for the slowdown.  Once the `jval(1)` tool is ready, it should
be faster than the `JSONPath.sh` tool that `bin/jval-wrapper.sh` uses now.

Added `-Q` to  `bin/jval-wrapper.sh` tool to perform a quick exit if
`authors.html` is newer than all `author/author_handle.json` files.

Updated the top level `Makefile` by adding `make quick_authors` rule
that will invoke `bin/gen-authors.sh -Q`.  Also changed `make quick_www`
to call `make quick_authors` instead of `make authors`.

Changed `bin/gen-authors.sh` VERSION from "1.10.7 2024-08-05"
to "1.11 2024-08-13".

Make a minor improvement in the usage message for `bin/gen-other-html.sh`.

Performed `make www` to test the above under macOS.

Performed `make quick_www` to test the above under macOS.
This commit is contained in:
Landon Curt Noll committed 2024-08-13 16:51:34 -07:00
1 parent 21e29c9a68
commit 317a2a0c2c
3 files changed
+70 -110

No files matched your search

+13 -5
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env make
#build authors.html if out of date with author JSON files'!/usr/bin/env make
#
# IOCCC Makefile
@@ -300,9 +300,9 @@ indent.c:
# Finally: The rules in this section are NOT needed if you
# simple want to examine, run / test winning IOCCC entries.
.PHONY: help genpath genfilelist verify_entry_files gen_authors gen_location gen_years \
find_missing_links test entry_index gen_top_html thanks gen_other_html \
quick_other_html quick_entry_index \
.PHONY: help genpath genfilelist verify_entry_files gen_authors quick_authors \
gen_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 \
form_entry_tarball form_year_tarball tar gen_status gen_sitemap \
sitemap timestamp update csv2entry entry2csv
@@ -336,6 +336,7 @@ help:
@echo 'make genfilelist ;: generate YYYY level .filelist'
@echo 'make verify_entry_files ;: check to be sure all files in all entries exist'
@echo 'make gen_authors ;: generate the top level authors.html page'
@echo 'make quick_authors ;: build authors.html if out of date with author JSON files'
@echo 'make gen_location ;: generate the top level location.html page'
@echo 'make gen_years ;: generate the top level years.html page'
@echo 'make entry_index ;: force the build of ALL winner index.html files'
@@ -475,6 +476,13 @@ gen_authors: ${GEN_AUTHORS} authors.html
${GEN_AUTHORS} -v 1
@echo '=-=-=-=-= IOCCC complete make $@ =-=-=-=-='
# build authors.html if it is out of date from any author/author_handle.json file
#
quick_authors: ${GEN_AUTHORS} authors.html
@echo '=-=-=-=-= IOCCC begin make $@ =-=-=-=-='
${GEN_AUTHORS} -v 1 -Q
@echo '=-=-=-=-= IOCCC complete make $@ =-=-=-=-='
# generate the top level location.html page using the
# ${GEN_LOCATION} tool (bin/gen-location.sh).
#
@@ -668,7 +676,7 @@ quick_www:
@echo '=-=-=-=-= IOCCC complete make genpath =-=-=-=-='
${MAKE} genfilelist
${MAKE} verify_entry_files
${MAKE} gen_authors
${MAKE} quick_authors
${MAKE} gen_location
${MAKE} gen_years
${MAKE} gen_year_index
+52 -101
View File
@@ -85,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.10.7 2024-08-05"
export VERSION="1.11 2024-08-13"
NAME=$(basename "$0")
export NAME
export V_FLAG=0
@@ -112,6 +112,7 @@ export SITE_URL="https://ioccc-src.github.io/temp-test-ioccc"
#
export NOOP=
export DO_NOT_PROCESS=
export QUICK_MODE=
export EXIT_CODE="0"
# Letter "is for" text
@@ -153,7 +154,7 @@ 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] [-T md2html.sh] [-p tool] [-Q]
-h print help message and exit
-v level set verbosity level (def level: 0)
@@ -176,6 +177,8 @@ export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
-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)
NOTE: The '-w site_url' is passed as leading options on tool command lines.
@@ -201,12 +204,6 @@ $NAME version: $VERSION"
#
# Write the entry ids from an author/author_handle.json file to standard output (stdout)
#
# 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
#
# usage:
# output_entry_ids author/author_handle.json
#
@@ -241,7 +238,7 @@ function output_entry_ids
# extract entry ids from the author/author_handle.json file
#
grep -F entry_id "$AUTHOR_HANDLE_JSON_PATH" | awk 'NF == 5 { print $4; }' | tr -d '"'
"$JVAL_WRAPPER" -w -b "$AUTHOR_HANDLE_JSON_PATH" '$..entry_id'
return 0
}
@@ -249,12 +246,6 @@ function output_entry_ids
#
# Write the author handles from an author/author_handle.json file to standard output (stdout)
#
# 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
#
# usage:
# output_author_handle author/author_handle.json
#
@@ -288,7 +279,7 @@ function output_author_handle
# extract entry ids from the author/author_handle.json file
#
grep -F author_handle "$AUTHOR_HANDLE_JSON_PATH" | sed -e 's/.*"author_handle" : "//' -e 's/",.*//'
"$JVAL_WRAPPER" -w -b "$AUTHOR_HANDLE_JSON_PATH" '$..author_handle'
return 0
}
@@ -296,12 +287,6 @@ function output_author_handle
#
# Write the Full Name from an author/author_handle.json file to standard output (stdout)
#
# 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
#
# usage:
# output_full_name author/author_handle.json
#
@@ -335,7 +320,7 @@ function output_full_name
# extract Full Name from the author/author_handle.json file
#
grep -F full_name "$AUTHOR_HANDLE_JSON_PATH" | sed -e 's/.*"full_name" : "//' -e 's/",.*//'
"$JVAL_WRAPPER" -w -b "$AUTHOR_HANDLE_JSON_PATH" '$..full_name'
return 0
}
@@ -343,12 +328,6 @@ function output_full_name
#
# Write the Location Code from an author/author_handle.json file to standard output (stdout)
#
# 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
#
# usage:
# output_location_code author/author_handle.json
#
@@ -382,7 +361,7 @@ function output_location_code
# extract Location Code from the author/author_handle.json file
#
grep -F location_code "$AUTHOR_HANDLE_JSON_PATH" | sed -e 's/.*"location_code" : "*//' -e 's/"*,.*//'
"$JVAL_WRAPPER" -w -b "$AUTHOR_HANDLE_JSON_PATH" '$..location_code'
return 0
}
@@ -390,12 +369,6 @@ function output_location_code
#
# 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
#
@@ -406,7 +379,6 @@ function output_location_code
function output_award
{
local ENTRY_JSON_PATH; # the .entry.json path
local AWARD_STRING; # winning entry award string
# parse args
#
@@ -430,12 +402,7 @@ function output_award
# obtain the award string
#
AWARD_STRING=$(grep -F '"award" : "' "$ENTRY_JSON_PATH" | sed -e 's/^.*"award" : "//' -e 's/",//')
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
fi
echo "$AWARD_STRING"
"$JVAL_WRAPPER" -w -b "$ENTRY_JSON_PATH" '$..award'
return 0
}
@@ -445,12 +412,6 @@ function output_award
#
# NOTE: If the url for the author is null, nothing is written to standard output.
#
# 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
#
# usage:
# output_url author/author_handle.json
#
@@ -486,7 +447,7 @@ function output_url
#
# NOTE: We output nothing if the JSON member value is null.
#
grep -F '"url"' "$AUTHOR_HANDLE_JSON_PATH" | grep -v -E ':\s*null' | sed -e 's/.*"url" : "//' -e 's/",.*//'
"$JVAL_WRAPPER" -w -b "$AUTHOR_HANDLE_JSON_PATH" '$..url' | grep -F -v null
return 0
}
@@ -496,12 +457,6 @@ function output_url
#
# NOTE: If the alternate url for the author is null, nothing is written to standard output.
#
# 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
#
# usage:
# output_alt_url author/author_handle.json
#
@@ -537,7 +492,7 @@ function output_alt_url
#
# NOTE: We output nothing if the JSON member value is null.
#
grep -F '"alt_url"' "$AUTHOR_HANDLE_JSON_PATH" | grep -v -E ':\s*null' | sed -e 's/.*"alt_url" : "//' -e 's/",.*//'
"$JVAL_WRAPPER" -w -b "$AUTHOR_HANDLE_JSON_PATH" '$..alt_url' | grep -F -v null
return 0
}
@@ -547,12 +502,6 @@ function output_alt_url
#
# NOTE: If the mastodon handle for the author is null, nothing is written to standard output.
#
# 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
#
# usage:
# output_mastodon author/author_handle.json
#
@@ -588,7 +537,7 @@ function output_mastodon
#
# NOTE: We output nothing if the JSON member value is null.
#
grep -F '"mastodon"' "$AUTHOR_HANDLE_JSON_PATH" | grep -v -E ':\s*null' | sed -e 's/.*"mastodon" : "//' -e 's/",.*//'
"$JVAL_WRAPPER" -w -b "$AUTHOR_HANDLE_JSON_PATH" '$..mastodon' | grep -F -v null
return 0
}
@@ -598,12 +547,6 @@ function output_mastodon
#
# NOTE: If the mastodon URL for the author is null, nothing is written to standard output.
#
# 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
#
# usage:
# output_mastodon_url author/author_handle.json
#
@@ -639,7 +582,7 @@ function output_mastodon_url
#
# NOTE: We output nothing if the JSON member value is null.
#
grep -F '"mastodon_url"' "$AUTHOR_HANDLE_JSON_PATH" | grep -v -E ':\s*null' | sed -e 's/.*"mastodon_url" : "//' -e 's/",.*//'
"$JVAL_WRAPPER" -w -b "$AUTHOR_HANDLE_JSON_PATH" '$..mastodon_url' | grep -F -v null
return 0
}
@@ -649,12 +592,6 @@ function output_mastodon_url
#
# NOTE: If the GitHub handle for the author is null, nothing is written to standard output.
#
# 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
#
# usage:
# output_github author/author_handle.json
#
@@ -690,7 +627,7 @@ function output_github
#
# NOTE: We output nothing if the JSON member value is null.
#
grep -F '"github"' "$AUTHOR_HANDLE_JSON_PATH" | grep -v -E ':\s*null' | sed -e 's/.*"github" : "//' -e 's/",.*//'
"$JVAL_WRAPPER" -w -b "$AUTHOR_HANDLE_JSON_PATH" '$..github' | grep -F -v null
return 0
}
@@ -700,12 +637,6 @@ function output_github
#
# NOTE: If the affiliation for the author is null, nothing is written to standard output.
#
# 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
#
# usage:
# output_affiliation author/author_handle.json
#
@@ -741,13 +672,13 @@ function output_affiliation
#
# NOTE: We output nothing if the JSON member value is null.
#
grep -F '"affiliation"' "$AUTHOR_HANDLE_JSON_PATH" | grep -v -E ':\s*null' | sed -e 's/.*"affiliation" : "//' -e 's/",.*//'
"$JVAL_WRAPPER" -w -b "$AUTHOR_HANDLE_JSON_PATH" '$..affiliation' | grep -F -v null
return 0
}
# parse command line
#
while getopts :hv:Vd:D:nNt:T:p:w: flag; do
while getopts :hv:Vd:D:nNt:T:p:Qw: flag; do
case "$flag" in
h) echo "$USAGE" 1>&2
exit 2
@@ -804,6 +735,8 @@ while getopts :hv:Vd:D:nNt:T:p:w: flag; do
TOOL_OPTION+=("-p")
TOOL_OPTION+=("$PANDOC_WRAPPER")
;;
Q) QUICK_MODE="-Q"
;;
w) SITE_URL="$OPTARG"
TOOL_OPTION+=("-w")
TOOL_OPTION+=("$SITE_URL")
@@ -941,6 +874,14 @@ if [[ ! -d $BIN_PATH ]]; then
fi
export BIN_DIR="bin"
# find the jval-wrapper.sh tool
#
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
exit 5
fi
# find the location tool
#
LOCATION_TOOL=$(type -P location)
@@ -980,6 +921,7 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: NOOP=$NOOP" 1>&2
echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2
echo "$0: debug[3]: EXIT_CODE=$EXIT_CODE" 1>&2
echo "$0: debug[3]: QUICK_MODE=$QUICK_MODE" 1>&2
for index in "${!IS_FOR[@]}"; do
echo "$0: debug[3]: IS_FOR[$index]=${IS_FOR[$index]}" 1>&2
done
@@ -992,6 +934,7 @@ 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]: JVAL_WRAPPER=$JVAL_WRAPPER" 1>&2
echo "$0: debug[3]: LOCATION_TOOL=$LOCATION_TOOL" 1>&2
echo "$0: debug[3]: AUTHORS_HTML=$AUTHORS_HTML" 1>&2
fi
@@ -1005,6 +948,17 @@ if [[ -n $DO_NOT_PROCESS ]]; then
exit 0
fi
# case: -Q
#
# Do nothing if authors.html is newer than all author/author_handle.json files.
#
if [[ -n $QUICK_MODE ]]; then
NEWER=$(find "$AUTHOR_DIR" -mindepth 1 -maxdepth 1 -type f -name '*.json' -newer "$AUTHORS_HTML" 2>/dev/null)
if [[ -z $NEWER ]]; then
exit 0
fi
fi
# create a temporary entry markdown file
#
export TMP_AUTHORS_MD=".tmp.$NAME.AUTHORS_MD.$$.tmp"
@@ -1055,18 +1009,13 @@ for letter in "${!IS_FOR[@]}"; do
echo "$letter ."
done > "$TMP_SORT_WORD"
# 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
# add author sort_word filename to the temporary sort word list file
#
if [[ $V_FLAG -ge 1 ]]; then
echo "$0: debug[1]: Forming temporary sort word list file: $TMP_SORT_WORD"
fi
find "$AUTHOR_DIR" -mindepth 1 -maxdepth 1 -type f -name '*.json' 2>/dev/null | while read -r json_file; do
SORT_WORD=$(grep -F '"sort_word" : "' "$json_file" 2>/dev/null | sed -e 's/",//' -e 's/^.*"//')
export SORT_WORD
echo "$SORT_WORD $json_file"
echo "$(bin/jval-wrapper.sh -w -b "$json_file" '$..sort_word') $json_file"
done >> "$TMP_SORT_WORD"
# sort the temporary sort word list file
@@ -1080,12 +1029,6 @@ fi
# generate the temporary entry markdown file
#
# 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
#
{
# output top of content
#
@@ -1144,6 +1087,11 @@ EOF
echo "</div>"
echo '<hr style="width:10%;text-align:left;margin-left:0">'
echo
if [[ $V_FLAG -ge 1 ]]; then
echo 1>&2
echo "$0: debug[1]: Processing author_handles that begin with $l for: $AUTHORS_HTML" 1>&2
echo 1>&2
fi
# case: we have a "sort_word file" line
#
@@ -1204,6 +1152,9 @@ EOF
echo "$0: ERROR: author handle is empty in: $filename" 1>&2
exit 22
fi
if [[ $V_FLAG -ge 1 ]]; then
echo "$0: debug[1]: Processing author_handle $AUTHOR_HANDLE for: $AUTHORS_HTML" 1>&2
fi
# NOTE: AUTHOR_AFFILIATION will be empty if there is no affiliation
AUTHOR_AFFILIATION=$(output_affiliation "$filename")
+5 -4
View File
@@ -122,7 +122,7 @@ declare -ag TOOL_OPTION
# usage
#
export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
[-t tagline] [-T md2html.sh] [-Q] [-p tool] [-w site_url]
[-t tagline] [-T md2html.sh] [-p tool] [-Q] [-w site_url]
-h print help message and exit
-v level set verbosity level (def level: 0)
@@ -140,6 +140,7 @@ export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
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)
@@ -167,7 +168,7 @@ $NAME version: $VERSION"
# parse command line
#
while getopts :hv:Vd:D:nNt:T:Qp:w: flag; do
while getopts :hv:Vd:D:nNt:T:p:Qw: flag; do
case "$flag" in
h) echo "$USAGE" 1>&2
exit 2
@@ -218,12 +219,12 @@ while getopts :hv:Vd:D:nNt:T:Qp:w: flag; do
TOOL_OPTION+=("-T")
TOOL_OPTION+=("$MD2HTML_SH")
;;
Q) QUICK_MODE="-Q"
;;
p) PANDOC_WRAPPER="$OPTARG"
TOOL_OPTION+=("-p")
TOOL_OPTION+=("$PANDOC_WRAPPER")
;;
Q) QUICK_MODE="-Q"
;;
w) SITE_URL="$OPTARG"
;;
\?) echo "$0: ERROR: invalid option: -$OPTARG" 1>&2