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:
1 parent
21e29c9a68
commit
317a2a0c2c
3 files changed
+70
-110
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user