From ad90b883170f1b78a39102dc80c62802d9d5550d Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Mon, 4 Nov 2024 06:59:31 -0800 Subject: [PATCH 1/2] Add html.sed to translate certain characters The script, for now, translates the following characters to their html entity: &, <, > An important note that is in a comment is that the & MUST come first as otherwise the & in the others will be corrupted. One script uses this but in order to make sure it is okay make www will have to be run first. Another script, the one that needs it even more, has a problem that has to be discussed, before it can be used. Nonetheless the html.sed file is at least added for the scripts once things are tested okay. --- bin/html.sed | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 bin/html.sed diff --git a/bin/html.sed b/bin/html.sed new file mode 100644 index 000000000..b81a37064 --- /dev/null +++ b/bin/html.sed @@ -0,0 +1,32 @@ +#!/usr/bin/env sed +# +# bin/html.sed - translate certain characters to HTML & entities +# +# This script was written in 2024 November by: +# +# @xexyl +# https://xexyl.net Cody Boone Ferguson +# https://ioccc.xexyl.net +# +# "Because sometimes even the IOCCC Judges need some help." :-) +# +# This script will take certain characters, for instance '<', and convert them +# to their respective html entity, for instance '<', so that html lints do +# not complain. +# +# usage: +# +# cmd | sed -f bin/html.sed +# +# sed -f bin/html.sed file > output +# +# sed -i -f bin/html.sed file +# +# VERSION="1.0 2024-11-04" + +# IMPORTANT NOTE: the '&' substitution MUST come first! This is because the +# other substitutions have '&'s in them and if the '&' came after it would +# corrupt the '&'s in the string. +s/&/\&/g +s//\>/g From 7b05c2cc14d4f754a560aff24d29f32be5e8015d Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Mon, 4 Nov 2024 08:40:53 -0800 Subject: [PATCH 2/2] Update output-index-inventory.sh to use html.sed After running make www everything seems to be okay with this script being updated. --- bin/output-index-inventory.sh | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/bin/output-index-inventory.sh b/bin/output-index-inventory.sh index 7d522467b..d313c3fc6 100755 --- a/bin/output-index-inventory.sh +++ b/bin/output-index-inventory.sh @@ -20,6 +20,18 @@ # # make entry_index # +# This script was written in 2024 by: +# +# chongo (Landon Curt Noll, http://www.isthe.com/chongo/index.html) /\oo/\ +# +# with improvements and fixes by: +# +# @xexyl +# https://xexyl.net Cody Boone Ferguson +# https://ioccc.xexyl.net +# +# "Because sometimes even the IOCCC Judges need some help." :-) +# # Copyright (c) 2024 by Landon Curt Noll. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and @@ -104,7 +116,7 @@ shopt -s globstar # enable '**' to match all files and zero or more directories # set variables referenced in the usage message # -export VERSION="1.4.3 2024-08-05" +export VERSION="1.4.4 2024-11-04" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -320,6 +332,7 @@ if [[ ! -d $BIN_PATH ]]; then exit 6 fi export BIN_DIR="bin" +export HTML_SED="$BIN_DIR/html.sed" # verify that the bin/pandoc-wrapper.sh tool is executable @@ -472,6 +485,7 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: BIN_DIR=$BIN_DIR" 1>&2 echo "$0: debug[3]: PANDOC_WRAPPER=$PANDOC_WRAPPER" 1>&2 echo "$0: debug[3]: MANIFEST_ENTRY_JSON_AWK=$MANIFEST_ENTRY_JSON_AWK" 1>&2 + echo "$0: debug[3]: HTML_SED=$HTML_SED" 1>&2 echo "$0: debug[3]: YEAR_DIR=$YEAR_DIR" 1>&2 echo "$0: debug[3]: ENTRY_DIR=$ENTRY_DIR" 1>&2 echo "$0: debug[3]: ENTRY_ID=$ENTRY_ID" 1>&2 @@ -538,6 +552,21 @@ elif [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: because of -n, temporary manifest file is not used: $TMP_MANIFEST" 1>&2 fi +# verify we have our sed script +# +if [[ ! -e $HTML_SED ]]; then + echo "$0: ERROR: bin/html.sed does not exist: $HTML_SED" 1>&2 + exit 6 +fi +if [[ ! -f $HTML_SED ]]; then + echo "$0: ERROR: bin/html.sed is not a regular file: $HTML_SED" 1>&2 + exit 6 +fi +if [[ ! -r $HTML_SED ]]; then + echo "$0: ERROR: bin/html.sed is not a readable file: $HTML_SED" 1>&2 + exit 6 +fi + # generate the temporary manifest file # @@ -560,11 +589,11 @@ if [[ -z $NOOP ]]; then echo echo '## Primary files' echo - grep -E '^[0-9][0-9]{0,8} ' "$TMP_MANIFEST" | LC_ALL=C sort -k 1n -k 3.2d | sed -e 's/^[0-9][0-9]* //' + grep -E '^[0-9][0-9]{0,8} ' "$TMP_MANIFEST" | LC_ALL=C sort -k 1n -k 3.2d | sed -f "$HTML_SED" -e 's/^[0-9][0-9]* //' echo echo '## Secondary files' echo - grep -E '^[1-9][0-9]{9,} ' "$TMP_MANIFEST" | LC_ALL=C sort -k 1n -k 3.2d | sed -e 's/^[0-9][0-9]* //' + grep -E '^[1-9][0-9]{9,} ' "$TMP_MANIFEST" | LC_ALL=C sort -k 1n -k 3.2d | sed -f "$HTML_SED" -e 's/^[0-9][0-9]* //' echo echo '
' echo '

Jump to: top

'