use jstrdecode, removed unicode-fix.sed & unicode-chk.sh
Use ``jstrdecode(1)` to decode certain JSON strings, such as "Full Name", "Abstract", "Award" and "Organization". We now rely on a correctly decoding `jstrdecode(1)`. The bin tools now rely on `jstrdecode` with the following version or later: > jstrdecode version: 1.0.6 2024-10-08 > JSON parser version: 1.1.7 2024-10-08 Removed `bin/unicode-fix.sed` and `bin/unicode-chk.sh`. Removed `make unicode_chk`. Fixed a few rule dependencies on `Makefile`. Added information about `bin/jval-wrapper.sh` in `bin/README.md`. Changed `bin/csv2entry.sh` VERSION from "1.4 2024-09-27" to "1.5 2024-10-08". Changed `bin/entry2csv.sh` VERSION from "1.4 2024-09-27" to "1.5 2024-10-08". Changed `bin/gen-authors.sh` VERSION from "1.13 2024-09-23" to "1.14 2024-10-08". Changed `bin/gen-location.sh` VERSION from "1.7 2024-09-23" to "1.8 2024-10-08". Changed `bin/gen-years.sh` VERSION from "1.5 2024-09-23" to "1.6 2024-10-08". Changed `bin/jfmt-wrapper.sh` VERSION from "1.2 2024-09-23" to "1.3 2024-10-08". Changed `bin/jprint-wrapper.sh` VERSION from "1.3 2024-09-23" to "1.4 2024-10-08". Changed `bin/jval-wrapper.sh` VERSION from "1.1 2024-09-23" to "1.2 2024-10-08". Changed `bin/output-index-author.sh` VERSION from "1.9 2024-09-23" to "1.10 2024-10-08". Changed `bin/output-year-index.sh` VERSION from "1.5 2024-09-23" to "1.6 2024-10-08". Changed `bin/subst.entry-index.sh` VERSION from "1.7 2024-09-27" to "1.8 2024-10-08". Perform `make www` to perform the above and test under macOS.
This commit is contained in:
1 parent
c1e09c4097
commit
5c060586e6
16 files changed
+382
-1149
No files matched your search
+26
-32
@@ -88,7 +88,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.13 2024-09-23"
|
||||
export VERSION="1.14 2024-10-08"
|
||||
NAME=$(basename "$0")
|
||||
export NAME
|
||||
export V_FLAG=0
|
||||
@@ -104,6 +104,18 @@ if [[ $status -eq 0 ]]; then
|
||||
TOPDIR=$("$GIT_TOOL" rev-parse --show-toplevel)
|
||||
fi
|
||||
export TOPDIR
|
||||
#
|
||||
JSTRDECODE=$(type -P jstrdecode)
|
||||
export JSTRDECODE
|
||||
if [[ -z $JSTRDECODE ]]; then
|
||||
echo "$0: FATAL: jstrdecode is not installed or not in \$PATH" 1>&2
|
||||
echo "$0: notice: to install jstrdecode:" 1>&2
|
||||
echo "$0: notice: run: git clone https://github.com/ioccc-src/mkiocccentry.git" 1>&2
|
||||
echo "$0: notice: then: cd mkiocccentry && make clobber all" 1>&2
|
||||
echo "$0: notice: then: cd jparse && sudo make install clobber" 1>&2
|
||||
exit 5
|
||||
fi
|
||||
#
|
||||
export DOCROOT_SLASH="./"
|
||||
export TAGLINE="bin/$NAME"
|
||||
export MD2HTML_SH="bin/md2html.sh"
|
||||
@@ -240,13 +252,13 @@ function output_award
|
||||
#
|
||||
PATTERN='$..award'
|
||||
if [[ $V_FLAG -ge 5 ]]; then
|
||||
echo "$0: debug[5]: about to run: $JVAL_WRAPPER -b -q -- $ENTRY_JSON_PATH '$PATTERN'" 1>&2
|
||||
echo "$0: debug[5]: about to run: $JVAL_WRAPPER -b -q -T -- $ENTRY_JSON_PATH '$PATTERN' | $JSTRDECODE -" 1>&2
|
||||
fi
|
||||
"$JVAL_WRAPPER" -b -q "$ENTRY_JSON_PATH" "$PATTERN"
|
||||
status="$?"
|
||||
if [[ $status -ne 0 ]]; then
|
||||
echo "$0: ERROR: in output_award: $JVAL_WRAPPER -b -q -- $ENTRY_JSON_PATH '$PATTERN' failed," \
|
||||
"error code: $status" 1>&2
|
||||
"$JVAL_WRAPPER" -b -q -T "$ENTRY_JSON_PATH" "$PATTERN" | "$JSTRDECODE" -
|
||||
status_codes=("${PIPESTATUS[@]}")
|
||||
if [[ ${status_codes[*]} =~ [1-9] ]]; then
|
||||
echo "$0: ERROR: in output_award: $JVAL_WRAPPER -b -q -T -- $ENTRY_JSON_PATH '$PATTERN' | $JSTRDECODE - failed," \
|
||||
"error codes: ${status_codes[*]}" 1>&2
|
||||
return 5
|
||||
fi
|
||||
return 0
|
||||
@@ -489,32 +501,15 @@ export AUTHORS_HTML="authors.html"
|
||||
#
|
||||
export COMBINE_AUTHOR="$BIN_DIR/combine_author_handle.sh"
|
||||
if [[ ! -e $COMBINE_AUTHOR ]]; then
|
||||
echo "$0: ERROR: bin/unicode-chk.sh does not exist: $COMBINE_AUTHOR" 1>&2
|
||||
echo "$0: ERROR: combine_author_handle.sh does not exist: $COMBINE_AUTHOR" 1>&2
|
||||
exit 5
|
||||
fi
|
||||
if [[ ! -f $COMBINE_AUTHOR ]]; then
|
||||
echo "$0: ERROR: bin/unicode-chk.sh is not a regular file: $COMBINE_AUTHOR" 1>&2
|
||||
echo "$0: ERROR: combine_author_handle.sh is not a regular file: $COMBINE_AUTHOR" 1>&2
|
||||
exit 5
|
||||
fi
|
||||
if [[ ! -x $COMBINE_AUTHOR ]]; then
|
||||
echo "$0: ERROR: bin/unicode-chk.sh is not an executable file: $COMBINE_AUTHOR" 1>&2
|
||||
exit 5
|
||||
fi
|
||||
|
||||
|
||||
# verify that the bin/unicode-fix.sed tool is executable
|
||||
#
|
||||
export UNICODE_FIX_SED="$BIN_DIR/unicode-fix.sed"
|
||||
if [[ ! -e $UNICODE_FIX_SED ]]; then
|
||||
echo "$0: ERROR: bin/unicode-fix.sed does not exist: $UNICODE_FIX_SED" 1>&2
|
||||
exit 5
|
||||
fi
|
||||
if [[ ! -f $UNICODE_FIX_SED ]]; then
|
||||
echo "$0: ERROR: bin/unicode-fix.sed is not a regular file: $UNICODE_FIX_SED" 1>&2
|
||||
exit 5
|
||||
fi
|
||||
if [[ ! -r $UNICODE_FIX_SED ]]; then
|
||||
echo "$0: ERROR: bin/unicode-fix.sed is not an readable file: $UNICODE_FIX_SED" 1>&2
|
||||
echo "$0: ERROR: combine_author_handle.sh is not an executable file: $COMBINE_AUTHOR" 1>&2
|
||||
exit 5
|
||||
fi
|
||||
|
||||
@@ -529,6 +524,7 @@ if [[ $V_FLAG -ge 3 ]]; then
|
||||
echo "$0: debug[3]: V_FLAG=$V_FLAG" 1>&2
|
||||
echo "$0: debug[3]: GIT_TOOL=$GIT_TOOL" 1>&2
|
||||
echo "$0: debug[3]: TOPDIR=$TOPDIR" 1>&2
|
||||
echo "$0: debug[3]: JSTRDECODE=$JSTRDECODE" 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
|
||||
@@ -556,7 +552,6 @@ if [[ $V_FLAG -ge 3 ]]; then
|
||||
echo "$0: debug[3]: LOCATION_TOOL=$LOCATION_TOOL" 1>&2
|
||||
echo "$0: debug[3]: AUTHORS_HTML=$AUTHORS_HTML" 1>&2
|
||||
echo "$0: debug[3]: COMBINE_AUTHOR=$COMBINE_AUTHOR" 1>&2
|
||||
echo "$0: debug[3]: UNICODE_FIX_SED=$UNICODE_FIX_SED" 1>&2
|
||||
fi
|
||||
|
||||
|
||||
@@ -738,7 +733,6 @@ EOF
|
||||
fi
|
||||
export AUTHOR_DATA
|
||||
AUTHOR_DATA=$("$JVAL_WRAPPER" -q -- "$filename" |
|
||||
sed -f "$UNICODE_FIX_SED" |
|
||||
LC_ALL=C sort -d)
|
||||
status_codes=("${PIPESTATUS[@]}")
|
||||
if [[ ${status_codes[*]} =~ [1-9] ]]; then
|
||||
@@ -767,7 +761,7 @@ EOF
|
||||
#
|
||||
case "$NAME" in
|
||||
full_name)
|
||||
FULL_NAME="$VALUE"
|
||||
FULL_NAME=$("$JSTRDECODE" "$VALUE")
|
||||
;;
|
||||
location_code)
|
||||
LOCATION_CODE="$VALUE"
|
||||
@@ -788,7 +782,7 @@ EOF
|
||||
AUTHOR_GITHUB="$VALUE"
|
||||
;;
|
||||
affiliation)
|
||||
AUTHOR_AFFILIATION="$VALUE"
|
||||
AUTHOR_AFFILIATION=$("$JSTRDECODE" "$VALUE")
|
||||
;;
|
||||
author_handle)
|
||||
AUTHOR_HANDLE="$VALUE"
|
||||
@@ -955,7 +949,7 @@ EOF
|
||||
|
||||
# collect the award for this entry id
|
||||
#
|
||||
AWARD=$(output_award "$ENTRY_JSON" | sed -f "$UNICODE_FIX_SED")
|
||||
AWARD=$(output_award "$ENTRY_JSON")
|
||||
export AWARD
|
||||
if [[ -z $AWARD ]]; then
|
||||
echo "$0: ERROR: award not found in .entry.json: $ENTRY_JSON" 1>&2
|
||||
|
||||
Reference in new issue
Block a user