diff --git a/bin/gen-years.sh b/bin/gen-years.sh index 3fbba6840..7840b2521 100755 --- a/bin/gen-years.sh +++ b/bin/gen-years.sh @@ -106,7 +106,7 @@ export LC_ALL="C" # set variables referenced in the usage message # -export VERSION="2.1.1 2025-06-06" +export VERSION="2.2.0 2025-07-10" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -279,6 +279,70 @@ function output_award } +# output_abstract +# +# Write the abstract name to standard output (stdout) +# +# usage: +# output_abstract YYYY/dir/.entry.json +# +# returns: +# 0 ==> no errors detected, but output may be empty +# > 0 ==> function error number +# +function output_abstract +{ + local ENTRY_JSON_PATH; # the .entry.json path + local PATTERN; # XPath for JSON pattern + local ABSTRACT; # extracted abstract from .entry.json + + # parse args + # + if [[ $# -ne 1 ]]; then + echo "$0: ERROR: in output_abstract: expected 1 arg, found $#" 1>&2 + return 1 + fi + ENTRY_JSON_PATH="$1" + if [[ ! -e $ENTRY_JSON_PATH ]]; then + echo "$0: ERROR: in output_abstract: .entry.json does not exist: $ENTRY_JSON_PATH" 1>&2 + return 2 + fi + if [[ ! -f $ENTRY_JSON_PATH ]]; then + echo "$0: ERROR: in output_abstract: .entry.json is not a file: $ENTRY_JSON_PATH" 1>&2 + return 3 + fi + if [[ ! -r $ENTRY_JSON_PATH ]]; then + echo "$0: ERROR: in output_abstract: .entry.json is not a readable file: $ENTRY_JSON_PATH" 1>&2 + return 4 + fi + + # obtain the abstract string + # + PATTERN='$..abstract' + if [[ $V_FLAG -ge 5 ]]; then + echo "$0: debug[5]: about to run: $JVAL_WRAPPER -b -q -- $ENTRY_JSON_PATH '$PATTERN' | $JSTRDECODE -d -q -N -" 1>&2 + fi + export ABSTRACT + ABSTRACT=$("$JVAL_WRAPPER" -b -q "$ENTRY_JSON_PATH" "$PATTERN" | "$JSTRDECODE" -d -q -N -) + status_codes=("${PIPESTATUS[@]}") + if [[ ${status_codes[*]} =~ [1-9] || -z $ABSTRACT ]]; then + echo "$0: ERROR: in output_abstract: $JVAL_WRAPPER -b -q -- $ENTRY_JSON_PATH '$PATTERN' | $JSTRDECODE -d -q -N - failed," \ + "error codes: ${status_codes[*]}" 1>&2 + return 5 + fi + if [[ ${#ABSTRACT} -ge 65 ]]; then + echo "$0: ERROR: in output_abstract: abstract length ${#ABSTRACT} >= 65 in $ENTRY_JSON_PATH" 1>&2 + return 6 + fi + if [[ $ABSTRACT =~ [\;$,] ]]; then + echo "$0: ERROR: in output_abstract: abstract contains ; or & or , in $ENTRY_JSON_PATH" 1>&2 + return 7 + fi + echo "${ABSTRACT//[;&,]/}" + return 0 +} + + # output_ordinal # # Write the numerical ordinal form of a non-negative integer to standard output (stdout) @@ -1011,6 +1075,17 @@ for YYYY in $("$TAC_TOOL" "$TOP_FILE"); do continue fi + # determine the abstract for this entry + # + ABSTRACT=$(output_abstract "$ENTRY_JSON") + status="$?" + if [[ $status -ne 0 || -z $ABSTRACT ]]; then + echo "$0: ERROR: cannot find abstract in .entry.json: $ENTRY_JSON" 1>&2 + EXIT_CODE="7" # exit 7 + echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2 + continue + fi + # Verify $YYYY_DIR/README.md # if [[ ! -e $YYYY_DIR/README.md ]]; then @@ -1026,7 +1101,7 @@ for YYYY in $("$TAC_TOOL" "$TOP_FILE"); do # output markdown for this entry # - echo "*
$YYYY_DIR - $AWARD
" + echo "*
$YYYY_DIR - $AWARD - $ABSTRACT
" done | if [[ -z $NOOP ]]; then cat >> "$TMP_YEARS_MD" else diff --git a/sitemap.xml b/sitemap.xml index b7cc08289..850a6fb9e 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -15282,7 +15282,7 @@ https://www.ioccc.org/bin/gen-years.sh - 2025-06-07T02:36:45+00:00 + 2025-07-10T08:42:52+00:00 https://www.ioccc.org/bin/html.sed @@ -15602,7 +15602,7 @@ https://www.ioccc.org/status.html - 2025-07-08T23:40:18+00:00 + 2025-07-10T08:46:27+00:00 https://www.ioccc.org/status.json @@ -15630,6 +15630,6 @@ https://www.ioccc.org/years.html - 2025-06-07T02:38:29+00:00 + 2025-07-10T08:45:52+00:00 diff --git a/years.html b/years.html index 8bdc89399..6e7f39ee5 100644 --- a/years.html +++ b/years.html @@ -480,49 +480,49 @@

 Jump to: top

@@ -533,46 +533,46 @@

 Jump to: top

@@ -583,49 +583,49 @@

 Jump to: top

@@ -636,46 +636,46 @@

 Jump to: top

@@ -686,37 +686,37 @@

 Jump to: top

@@ -727,49 +727,49 @@

 Jump to: top

@@ -780,46 +780,46 @@

 Jump to: top

@@ -830,46 +830,46 @@

 Jump to: top

@@ -880,46 +880,46 @@

 Jump to: top

@@ -930,49 +930,49 @@

 Jump to: top

@@ -983,49 +983,49 @@

 Jump to: top

@@ -1036,49 +1036,49 @@

 Jump to: top

@@ -1089,46 +1089,46 @@

 Jump to: top

@@ -1139,46 +1139,46 @@

 Jump to: top

@@ -1189,37 +1189,37 @@

 Jump to: top

@@ -1230,40 +1230,40 @@

 Jump to: top

@@ -1274,37 +1274,37 @@

 Jump to: top

@@ -1315,37 +1315,37 @@

 Jump to: top

@@ -1356,43 +1356,43 @@

 Jump to: top

@@ -1403,31 +1403,31 @@

 Jump to: top

@@ -1438,37 +1438,37 @@

 Jump to: top

@@ -1479,34 +1479,34 @@

 Jump to: top

@@ -1517,31 +1517,31 @@

 Jump to: top

@@ -1552,25 +1552,25 @@

 Jump to: top

@@ -1581,31 +1581,31 @@

 Jump to: top

@@ -1616,19 +1616,19 @@

 Jump to: top

@@ -1639,16 +1639,16 @@

 Jump to: top