From 69c38e0a48b5acdb4dec39802e065be89a6f6a33 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Sun, 19 May 2024 14:15:31 -0700 Subject: [PATCH] correctly process non-zero EXIT_CODE, fix 2020/endoh2/README.md We found cases where pandoc reported a conversion from markdown to HTML problem that, while reported by the `bin/pandoc-wrapper.sh` to `bin/md2html.sh`, which in turn reported to error to the tool calling it, the tool calling `bin/md2html.sh` set `$EXIT_CODE` to a non-zero value in order to delay the abort but then failed to act on the non-zero `$EXIT_CODE` value at the end. In a number of cases when `$EXIT_CODE` was set to non-zero, the stderr message was labeled as a "Warning" instead of an "ERROR". Fixed a bug in `bin/gen-authors.sh` that resulted the generation of invalid markdown/HTML. An `
` HTML tag inside a `
` span caused pandoc to issue "Div at .. closing implicitly" at the _hr_ HTML tag line. For some reason, one cannot place a `
` (horizontal line) inside a `
` span. Fixed a broken markdown links in `2020/endoh2/README.md` whose error was hidden by one of the above mentioned problems. Changed `bin/gen-authors.sh` VERSION from "1.10.1 2024-05-07" to "1.10.2 2024-05-19" as a result of the above changes. Changed `bin/gen-location.sh` VERSION from "1.4.1 2024-04-28" to "1.4.2 2024-05-19" as a result of the above changes. Changed `bin/gen-top-html.sh` VERSION from "1.4.6 2024-05-05" to "1.4.5 2024-05-19" as a result of the above changes. Changed `bin/gen-years.sh` VERSION from "1.3.1 2024-04-28" to "1.3.2 2024-05-19" as a result of the above changes. Changed `bin/quick-readme2index.sh` VERSION from "1.1.4 2024-04-13" to "1.1.5 2024-05-19" as a result of the above changes. Changed `bin/readme2index.sh` VERSION from "1.2.4 2024-04-14" to "1.2.5 2024-05-19" as a result of the above changes. Performed `make www` to test the above under macOS. --- 2020/endoh2/README.md | 4 +-- 2020/endoh2/index.html | 4 +-- authors.html | 52 +++++++++++++++++++-------------------- bin/gen-authors.sh | 11 ++++++--- bin/gen-location.sh | 7 ++++-- bin/gen-top-html.sh | 25 ++++++++++--------- bin/gen-years.sh | 9 ++++--- bin/pandoc-wrapper.sh | 4 +++ bin/quick-readme2index.sh | 9 ++++--- bin/readme2index.sh | 4 +-- 10 files changed, 74 insertions(+), 55 deletions(-) diff --git a/2020/endoh2/README.md b/2020/endoh2/README.md index 0c9794131..d5c4174d3 100644 --- a/2020/endoh2/README.md +++ b/2020/endoh2/README.md @@ -29,11 +29,11 @@ What happens if you do ## Judges' remarks: -Clever use of the C99 complex data type. The [spoiler](spoiler/spoiler.html) directory +Clever use of the C99 complex data type. The [spoiler](spoiler/index.html) directory contains clues as to how some winning authors create / edit programs into ASCII shapes. -With the source from the [spoiler](spoiler/spoiler.html) directory could you make the code +With the source from the [spoiler](spoiler/index.html) directory could you make the code render for a larger terminal window? How about adding more glyphs? diff --git a/2020/endoh2/index.html b/2020/endoh2/index.html index 7aba7a071..77e4b1555 100644 --- a/2020/endoh2/index.html +++ b/2020/endoh2/index.html @@ -405,10 +405,10 @@ Location: JP - Japan
    ./prog prog.c

?

Judges’ remarks:

-

Clever use of the C99 complex data type. The spoiler directory +

Clever use of the C99 complex data type. The spoiler directory contains clues as to how some winning authors create / edit programs into ASCII shapes.

-

With the source from the spoiler directory could you make the code +

With the source from the spoiler directory could you make the code render for a larger terminal window? How about adding more glyphs?

Author’s remarks:

No! Try not. Do, or do not. There is no try.

diff --git a/authors.html b/authors.html index caa5356d6..ecea12df6 100644 --- a/authors.html +++ b/authors.html @@ -409,9 +409,9 @@ Jump to authors starting with: [

A is for atoi

-
+

@@ -644,9 +644,9 @@ author_handle:

B is for break

-
+

@@ -1057,9 +1057,9 @@ author_handle:

C is for const

-
+

@@ -1182,9 +1182,9 @@ author_handle:

D is for do

-
+

@@ -1439,9 +1439,9 @@ author_handle:

E is for else

-
+

@@ -1529,9 +1529,9 @@ author_handle:

F is for float

-
+

@@ -1663,9 +1663,9 @@ author_handle:

G is for getc

-
+

@@ -1803,9 +1803,9 @@ author_handle:

H is for hypot

-
+

@@ -2113,9 +2113,9 @@ author_handle:

I is for int

-
+

@@ -2135,9 +2135,9 @@ author_handle:

J is for jmp_buf

-
+

@@ -2191,9 +2191,9 @@ author_handle:

K is for killchar

-
+

@@ -2351,9 +2351,9 @@ author_handle:

L is for long

-
+

@@ -2534,9 +2534,9 @@ author_handle:

M is for malloc

-
+

@@ -2793,9 +2793,9 @@ author_handle:

N is for nullptr

-
+

@@ -2864,9 +2864,9 @@ author_handle:

O is for open

-
+

@@ -2941,9 +2941,9 @@ author_handle:

P is for printf

-
+

@@ -3083,15 +3083,15 @@ author_handle:

Q is for qsort

-
+

R is for return

-
+

@@ -3250,9 +3250,9 @@ author_handle:

S is for switch

-
+

@@ -3552,9 +3552,9 @@ author_handle:

T is for true

-
+

@@ -3667,15 +3667,15 @@ author_handle:

U is for union

-
+

V is for volatile

-
+

@@ -3732,9 +3732,9 @@ author_handle:

W is for while

-
+

@@ -3861,15 +3861,15 @@ author_handle:

X is for xor

-
+

Y is for y0

-
+

@@ -3900,9 +3900,9 @@ author_handle:

Z is for zlib

-
+

diff --git a/bin/gen-authors.sh b/bin/gen-authors.sh index eca98d31c..1ccdf4e2f 100755 --- a/bin/gen-authors.sh +++ b/bin/gen-authors.sh @@ -83,7 +83,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.1 2024-05-07" +export VERSION="1.10.2 2024-05-19" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -1141,9 +1141,9 @@ EOF fi echo "
" echo "## ${IS_FOR[$l]}" - echo '
' echo "" echo "
" + echo '
' echo # case: we have a "sort_word file" line @@ -1358,7 +1358,7 @@ if [[ -z $NOOP ]]; then "$MD2HTML_SH" "${TOOL_OPTION[@]}" -- authors.md "$TMP_AUTHORS_MD" "$AUTHORS_HTML" status="$?" if [[ $status -ne 0 ]]; then - echo "$0: Warning: md2html.sh: $MD2HTML_SH ${TOOL_OPTION[*]} -- authors.md $TMP_AUTHORS_MD $AUTHORS_HTML" \ + echo "$0: ERROR: md2html.sh: $MD2HTML_SH ${TOOL_OPTION[*]} -- authors.md $TMP_AUTHORS_MD $AUTHORS_HTML" \ "failed, error: $status" 1>&2 EXIT_CODE="1" # exit 1 echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2 @@ -1382,4 +1382,7 @@ fi # All Done!!! -- Jessica Noll, Age 2 # -exit 0 +if [[ $EXIT_CODE -ne 0 ]]; then + echo "$0: Warning: about to exit $EXIT_CODE" 1>&2 +fi +exit "$EXIT_CODE" diff --git a/bin/gen-location.sh b/bin/gen-location.sh index 52fb74d2c..c9e8314b1 100755 --- a/bin/gen-location.sh +++ b/bin/gen-location.sh @@ -84,7 +84,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.4.1 2024-04-28" +export VERSION="1.4.2 2024-05-19" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -602,4 +602,7 @@ fi # All Done!!! -- Jessica Noll, Age 2 # -exit 0 +if [[ $EXIT_CODE -ne 0 ]]; then + echo "$0: Warning: about to exit $EXIT_CODE" 1>&2 +fi +exit "$EXIT_CODE" diff --git a/bin/gen-top-html.sh b/bin/gen-top-html.sh index dbc536bc4..5e8b3c80c 100755 --- a/bin/gen-top-html.sh +++ b/bin/gen-top-html.sh @@ -93,7 +93,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.4.6 2024-05-05" +export VERSION="1.4.5 2024-05-19" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -476,25 +476,25 @@ if (( ${#TOP_MD_SELECT_SET[@]} )); then # export MD_FILE="$name.md" if [[ ! -e $MD_FILE ]]; then - echo "$0: Warning: markdown file does not exist: $MD_FILE" 1>&2 + echo "$0: ERROR: markdown file does not exist: $MD_FILE" 1>&2 EXIT_CODE=8 # exit 8 echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2 continue fi if [[ ! -f $MD_FILE ]]; then - echo "$0: Warning: markdown file is not a regular file: $MD_FILE" 1>&2 + echo "$0: ERROR: markdown file is not a regular file: $MD_FILE" 1>&2 EXIT_CODE=8 # exit 8 echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2 continue fi if [[ ! -r $MD_FILE ]]; then - echo "$0: Warning: markdown file is not a readable file: $MD_FILE" 1>&2 + echo "$0: ERROR: markdown file is not a readable file: $MD_FILE" 1>&2 EXIT_CODE=8 # exit 8 echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2 continue fi if [[ ! -s $MD_FILE ]]; then - echo "$0: Warning: markdown file is not a non-empty readable file: $MD_FILE" 1>&2 + echo "$0: ERROR: markdown file is not a non-empty readable file: $MD_FILE" 1>&2 EXIT_CODE=8 # exit 8 echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2 continue @@ -528,7 +528,7 @@ if (( ${#TOP_MD_SELECT_SET[@]} )); then -m "$MD_FILE" -- "$MD_FILE" "$HTML_FILE" status="$?" if [[ $status -ne 0 ]]; then - echo "$0: Warning: md2html.sh: $MD2HTML_SH -U $SITE_URL/$HTML_FILE ${TOOL_OPTION[*]}" \ + echo "$0: ERROR: md2html.sh: $MD2HTML_SH -U $SITE_URL/$HTML_FILE ${TOOL_OPTION[*]}" \ "-m $MD_FILE -- $MD_FILE $HTML_FILE" \ "failed, error: $status" 1>&2 EXIT_CODE="1" # exit 1 @@ -551,25 +551,25 @@ else # export MD_FILE="$name.md" if [[ ! -e $MD_FILE ]]; then - echo "$0: Warning: markdown file does not exist: $MD_FILE" 1>&2 + echo "$0: ERROR: markdown file does not exist: $MD_FILE" 1>&2 EXIT_CODE=8 # exit 8 echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2 continue fi if [[ ! -f $MD_FILE ]]; then - echo "$0: Warning: markdown file is not a regular file: $MD_FILE" 1>&2 + echo "$0: ERROR: markdown file is not a regular file: $MD_FILE" 1>&2 EXIT_CODE=8 # exit 8 echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2 continue fi if [[ ! -r $MD_FILE ]]; then - echo "$0: Warning: markdown file is not a readable file: $MD_FILE" 1>&2 + echo "$0: ERROR: markdown file is not a readable file: $MD_FILE" 1>&2 EXIT_CODE=8 # exit 8 echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2 continue fi if [[ ! -s $MD_FILE ]]; then - echo "$0: Warning: markdown file is not a non-empty readable file: $MD_FILE" 1>&2 + echo "$0: ERROR: markdown file is not a non-empty readable file: $MD_FILE" 1>&2 EXIT_CODE=8 # exit 8 echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2 continue @@ -603,7 +603,7 @@ else -m "$MD_FILE" -- "$MD_FILE" "$HTML_FILE" status="$?" if [[ $status -ne 0 ]]; then - echo "$0: Warning: md2html.sh: $MD2HTML_SH -U $SITE_URL/$HTML_FILE ${TOOL_OPTION[*]}" \ + echo "$0: ERROR: md2html.sh: $MD2HTML_SH -U $SITE_URL/$HTML_FILE ${TOOL_OPTION[*]}" \ "-m $MD_FILE -- $MD_FILE $HTML_FILE" \ "failed, error: $status" 1>&2 EXIT_CODE="1" # exit 1 @@ -623,4 +623,7 @@ fi # All Done!!! -- Jessica Noll, Age 2 # +if [[ $EXIT_CODE -ne 0 ]]; then + echo "$0: Warning: about to exit $EXIT_CODE" 1>&2 +fi exit "$EXIT_CODE" diff --git a/bin/gen-years.sh b/bin/gen-years.sh index d47683f58..783615d01 100755 --- a/bin/gen-years.sh +++ b/bin/gen-years.sh @@ -83,7 +83,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.3.1 2024-04-28" +export VERSION="1.3.2 2024-05-19" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -858,7 +858,7 @@ if [[ -z $NOOP ]]; then "$MD2HTML_SH" "${TOOL_OPTION[@]}" -- years.md "$TMP_YEARS_MD" "$YEARS_HTML" status="$?" if [[ $status -ne 0 ]]; then - echo "$0: Warning: md2html.sh: $MD2HTML_SH ${TOOL_OPTION[*]} -- years.md $TMP_YEARS_MD $YEARS_HTML" \ + echo "$0: ERROR: md2html.sh: $MD2HTML_SH ${TOOL_OPTION[*]} -- years.md $TMP_YEARS_MD $YEARS_HTML" \ "failed, error: $status" 1>&2 EXIT_CODE="1" # exit 1 echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2 @@ -882,4 +882,7 @@ fi # All Done!!! -- Jessica Noll, Age 2 # -exit 0 +if [[ $EXIT_CODE -ne 0 ]]; then + echo "$0: Warning: about to exit $EXIT_CODE" 1>&2 +fi +exit "$EXIT_CODE" diff --git a/bin/pandoc-wrapper.sh b/bin/pandoc-wrapper.sh index 31b8bc82e..a490866ba 100755 --- a/bin/pandoc-wrapper.sh +++ b/bin/pandoc-wrapper.sh @@ -413,6 +413,10 @@ else fi if [[ $status -ne 0 ]]; then echo "$0: ERROR: pandoc: $PANDOC_TOOL exited non-zero: $status" 1>&2 + cp -f "$MARKDOWN_INPUT" XXX # XXX + if [[ -n $NOOP ]]; then + cp -f "$HTML_OUTPUT" YYY # XXX + fi exit 1 fi diff --git a/bin/quick-readme2index.sh b/bin/quick-readme2index.sh index ec6a25840..103187920 100755 --- a/bin/quick-readme2index.sh +++ b/bin/quick-readme2index.sh @@ -92,7 +92,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.4 2024-04-13" +export VERSION="1.1.5 2024-05-19" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -549,7 +549,7 @@ if [[ -z $NOOP ]]; then "$README_PATH" "$INDEX_PATH" status="$?" if [[ $status -ne 0 ]]; then - echo "$0: Warning: md2html.sh: $MD2HTML_SH ${TOOL_OPTION[*]} -m $README_PATH --" \ + echo "$0: ERROR: md2html.sh: $MD2HTML_SH ${TOOL_OPTION[*]} -m $README_PATH --" \ "$README_PATH $INDEX_PATH failed, error: $status" 1>&2 EXIT_CODE="1" # exit 1 echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2 @@ -580,4 +580,7 @@ fi # All Done!!! -- Jessica Noll, Age 2 # -exit 0 +if [[ $EXIT_CODE -ne 0 ]]; then + echo "$0: Warning: about to exit $EXIT_CODE" 1>&2 +fi +exit "$EXIT_CODE" diff --git a/bin/readme2index.sh b/bin/readme2index.sh index af9e5a7e4..98d8fe237 100755 --- a/bin/readme2index.sh +++ b/bin/readme2index.sh @@ -86,7 +86,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.2.4 2024-04-14" +export VERSION="1.2.5 2024-05-19" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -512,7 +512,7 @@ if [[ -z $NOOP ]]; then "$README_PATH" "$INDEX_PATH" status="$?" if [[ $status -ne 0 ]]; then - echo "$0: Warning: md2html.sh: $MD2HTML_SH ${TOOL_OPTION[*]} -m $README_PATH --" \ + echo "$0: ERROR: md2html.sh: $MD2HTML_SH ${TOOL_OPTION[*]} -m $README_PATH --" \ "$README_PATH $INDEX_PATH failed, error: $status" 1>&2 EXIT_CODE="1" # exit 1 echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2