From 449205e1a50f6e2dad5aa22301d965689059c885 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Sun, 10 Mar 2024 14:09:00 -0700 Subject: [PATCH] improve the status.html page Changed `bin/gen-status.sh` VERSION from "1.0 2024-03-09" to "1.1 2024-03-10". Changed `bin/status2html.sh` VERSION from "1.0 2024-03-09" to "1.1 2024-03-10". Improved for explanatory text added near the top of the `index.html` page by `bin/status2html.sh`. While `bin/status2html.sh` in intended as tool that is internally called only, we allowed for a 0 arg use for those who are simply curious as to what it does. Tested various _contest_status_ values with `bin/gen-status.sh`. This resulted in a forced change of _status_update_ in `status.json`. Removed extraneous whitespace from `bin/output-index-author.sh`. Performed `make www` to finalize all of the above, although a `make gen_status` followed by `make gen_sitemap` would have been sufficient. --- bin/gen-status.sh | 28 +++++++++++-- bin/output-index-author.sh | 2 +- bin/status2html.sh | 83 ++++++++++++++++++++++++++++++++++++-- sitemap.xml | 8 ++-- status.html | 12 +++++- status.json | 2 +- status.md | 2 + 7 files changed, 123 insertions(+), 14 deletions(-) diff --git a/bin/gen-status.sh b/bin/gen-status.sh index ac66643e0..dfb9f6e71 100755 --- a/bin/gen-status.sh +++ b/bin/gen-status.sh @@ -49,7 +49,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.0 2024-03-09" +export VERSION="1.1 2024-03-10" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -586,12 +586,33 @@ fi # XXX - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - XXX # if [[ -z $CONTEST_STATUS ]]; then + + # obtain the contest_status from status.json + # CONTEST_STATUS=$(grep '"contest_status"\s*:\s*"[^"][^"]*"' "$STATUS_JSON" | sed -e 's/",\s*$//' -e 's/^.*"//') status="$?" if [[ $status -ne 0 || -z $CONTEST_STATUS ]]; then echo "$0: ERROR: cannot determine contest_status from status.json: $STATUS_JSON" 1>&2 exit 1 fi + + # validate and normalize the contest_status cfrom status.json + # + case "$CONTEST_STATUS" in + p|pending) CONTEST_STATUS="pending" + ;; + o|open) CONTEST_STATUS="open" + ;; + j|judging) CONTEST_STATUS="judging" + ;; + c|closed) CONTEST_STATUS="closed" + ;; + *) echo "$0: ERROR: unexpected status from $status.json: $CONTEST_STATUS" 1>&2 + echo 1>&2 + echo "$USAGE" 1>&2 + exit 1 + ;; + esac fi # -N stops early before any processing is performed @@ -726,11 +747,10 @@ if [[ -z $NOOP ]]; then status.md "$STATUS_HTML" status="$?" if [[ $status -ne 0 ]]; then - echo "$0: Warning: md2html.sh: $MD2HTML_SH ${TOOL_OPTION[*]} --" \ + echo "$0: ERROR: md2html.sh: $MD2HTML_SH ${TOOL_OPTION[*]} --" \ "status.md $STATUS_HTML" \ "failed, error: $status" 1>&2 - EXIT_CODE="1" # exit 1 - echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2 + exit 20 elif [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: now up to date: $STATUS_HTML" 1>&2 fi diff --git a/bin/output-index-author.sh b/bin/output-index-author.sh index 145ad5be3..30a53a4dd 100755 --- a/bin/output-index-author.sh +++ b/bin/output-index-author.sh @@ -114,7 +114,7 @@ Exit codes: 5 some internal tool is not found or not an executable file 6 problems found with or in the topdir or topdir/YYYY directory 7 problems found with or in the entry topdir/YYYY/dir directory - 8 error in author/author_handle.json file + 8 error in author/author_handle.json file >= 10 internal error $NAME version: $VERSION" diff --git a/bin/status2html.sh b/bin/status2html.sh index 4283fd199..5994d2964 100755 --- a/bin/status2html.sh +++ b/bin/status2html.sh @@ -53,7 +53,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.0 2024-03-09" +export VERSION="1.1 2024-03-10" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -189,8 +189,8 @@ shift $(( OPTIND - 1 )); if [[ $V_FLAG -ge 5 ]]; then echo "$0: debug[5]: file argument count: $#" 1>&2 fi -if [[ $# -ne 1 ]]; then - echo "$0: ERROR: expected 1 arg, found: $#" 1>&2 +if [[ $# -ge 2 ]]; then + echo "$0: ERROR: expected 0 or 1 args, found: $#" 1>&2 exit 3 fi if [[ $V_FLAG -ge 5 ]]; then @@ -336,9 +336,86 @@ elif [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: because of -n, temporary markdown file is not used: $TMP_FILE" 1>&2 fi +# obtain the contest_status from status.json +# +CONTEST_STATUS=$(grep '"contest_status"\s*:\s*"[^"][^"]*"' "$STATUS_JSON" | sed -e 's/",\s*$//' -e 's/^.*"//') +status="$?" +if [[ $status -ne 0 || -z $CONTEST_STATUS ]]; then + echo "$0: ERROR: cannot determine contest_status from status.json: $STATUS_JSON" 1>&2 + exit 8 +fi + +# validate and normalize the contest_status cfrom status.json +# +case "$CONTEST_STATUS" in +p|pending) CONTEST_STATUS="pending" + ;; +o|open) CONTEST_STATUS="open" + ;; +j|judging) CONTEST_STATUS="judging" + ;; +c|closed) CONTEST_STATUS="closed" + ;; +*) echo "$0: ERROR: unexpected status from $status.json: $CONTEST_STATUS" 1>&2 + echo 1>&2 + echo "$USAGE" 1>&2 + exit 8 + ;; +esac + # write temporary markdown file for status.json # { + # write status of the contest + # + case "$CONTEST_STATUS" in + pending) echo "# The IOCCC is not yet open" + echo + echo "While the IOCCC is not open now, there is a tentative opening date for the next IOCCC." + echo + echo "See the [IOCCC news](news.html) for details including the tentative" \ + "scheduled opening date." + echo + echo "A preliminary IOCCC rules, guidelines, and tools have been posted." \ + "Comments and suggestions on these preliminary items are welcome." + ;; + open) echo "# The IOCCC open for submissions" + echo + echo "See the [IOCCC news](news.html) page for details on rules, guidelines, tools and deadlines." + echo + echo "See [How to enter the IOCCC](faq.html#submit) FAQ for additional information." + echo + echo "**IMPORTANT**: If you viewed the preliminary IOCCC rules, guidelines, and tools while the IOCCC status" \ + "was pending, be sure to review the official IOCCC rules, guidelines, and tools for any changes that may" \ + "have been recently made before submitting to the IOCCC." + ;; + judging) echo "# The IOCCC is closed to new submissions" + echo + echo "The [IOCCC judges](judges.html) are in the process of judging the submissions they received" \ + "the IOCCC was open." + echo + echo "Watch the [@IOCCC mastodon feed](https://fosstodon.org/@ioccc), as well as the" \ + "[IOCCC news](news.html) page for updates." + ;; + closed) echo "# The IOCCC is closed" + echo + echo "The IOCCC is **NOT** accepting new submissions at this time. See the" \ + "[IOCCC winning entries page](years.html) for the entires that have won the IOCCC." + echo + echo "Watch both [the IOCCC status page](status.html) and the" \ + "[@IOCCC mastodon feed](https://fosstodon.org/@ioccc) for information about future IOCCC openings." + ;; + *) echo "# The IOCCC status is unknown" + echo + echo "The IOCCC status is an unexpected status value: $CONTEST_STATUS" + echo + echo "This is a **BUG**, not a feature. Feel free to report it!" + ;; + esac + echo + + # write status.json content + # echo '# status.json' echo '```json' cat "$STATUS_JSON" diff --git a/sitemap.xml b/sitemap.xml index 93e8f435e..ac5d02318 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -19150,7 +19150,7 @@ https://ioccc-src.github.io/temp-test-ioccc/bin/gen-status.sh - 2024-03-10T03:06:23+00:00 + 2024-03-10T20:23:09+00:00 https://ioccc-src.github.io/temp-test-ioccc/bin/gen-top-html.sh @@ -19178,7 +19178,7 @@ https://ioccc-src.github.io/temp-test-ioccc/bin/output-index-author.sh - 2024-03-09T00:06:59+00:00 + 2024-03-10T20:58:58+00:00 https://ioccc-src.github.io/temp-test-ioccc/bin/output-index-inventory.sh @@ -19210,7 +19210,7 @@ https://ioccc-src.github.io/temp-test-ioccc/bin/status2html.sh - 2024-03-10T03:16:40+00:00 + 2024-03-10T20:59:43+00:00 https://ioccc-src.github.io/temp-test-ioccc/bin/subst.default.sh @@ -19414,7 +19414,7 @@ https://ioccc-src.github.io/temp-test-ioccc/status.json - 2024-03-10T17:01:12+00:00 + 2024-03-10T20:55:10+00:00 https://ioccc-src.github.io/temp-test-ioccc/thanks-for-help.html diff --git a/status.html b/status.html index f18c681ee..f1b35d760 100644 --- a/status.html +++ b/status.html @@ -115,6 +115,14 @@ +

The IOCCC is closed

+

The IOCCC is NOT accepting new submissions at this +time. See the IOCCC winning entries page for +the entires that have won the IOCCC.

+

Watch both the IOCCC status page and the @IOCCC mastodon feed for information about +future IOCCC openings.

status.json

{
@@ -122,7 +130,7 @@ class="sourceCode json">    "IOCCC_status_version" : "1.0 2024-03-09",
     "contest_status" : "closed",
     "news_update" : "2024-03-10T17:01:11+00:00",
-    "status_update" : "2024-03-10T17:01:12+00:00"
+    "status_update" : "2024-03-10T20:55:10+00:00"
 }
@@ -159,6 +167,8 @@ Comments and suggestions on these preliminary items are welcome. See the scheduled opening date.

“open”

The IOCCC is open for submissions.

+

See the IOCCC news page for details on rules, +guidelines, tools and deadlines.

Be sure to review the official IOCCC rules, guidelines, and tools for any changes that may have been made while the IOCCC was “pending”.

diff --git a/status.json b/status.json index 1de9d86b9..be107a9c1 100644 --- a/status.json +++ b/status.json @@ -3,5 +3,5 @@ "IOCCC_status_version" : "1.0 2024-03-09", "contest_status" : "closed", "news_update" : "2024-03-10T17:01:11+00:00", - "status_update" : "2024-03-10T17:01:12+00:00" + "status_update" : "2024-03-10T20:55:10+00:00" } diff --git a/status.md b/status.md index 0a71e4f44..a8d0eb3c9 100644 --- a/status.md +++ b/status.md @@ -46,6 +46,8 @@ scheduled opening date. The IOCCC is open for submissions. +See the [IOCCC news](news.html) page for details on rules, guidelines, tools and deadlines. + Be sure to review the official IOCCC rules, guidelines, and tools for any changes that may have been made while the IOCCC was "**pending**".