change winner to entry

We change various uses of winner to entry, including
variable names and code comments.
This commit is contained in:
Landon Curt Noll committed 2024-02-11 21:39:22 -08:00
1 parent 23d3e5fbb5
commit 16cc268c2a
336 files changed
+965 -962

No files matched your search

+12 -12
View File
@@ -1,11 +1,11 @@
#!/usr/bin/env bash
#
# all-run.sh - run a command for all winners
# all-run.sh - run a command for all entries
#
# We cd to topdir, than then walk the winner directory tree.
# We obtain the set of winner years (YYYY) via the .top file.
# For each year (YYYY), we obtain the set of winner directories (dir).
# For all winner directories (YYYY/dir) we run the tool.
# We cd to topdir, than then walk the entry directory tree.
# We obtain the set of IOCCC years (YYYY) via the .top file.
# For each year (YYYY), we obtain the set of entry directories (dir).
# For all entry directories (YYYY/dir) we run the tool.
#
# The tool argument, if not an absolute path, must be relative to topdir.
# The tool argument is the first argument command line. Any additional
@@ -23,7 +23,7 @@
#
# all-run.sh -v 3 -t readme2html -U https://www.ioccc.org bin/quick-readme2html.sh -v 1
#
# will run the tool bin/quick-readme2html.sh for each winner YYYY/dir as follows:
# will run the tool bin/quick-readme2html.sh for each entry YYYY/dir as follows:
#
# bin/quick-readme2html.sh -t readme2html -U https://www.ioccc.org YYYY/dir -v 1
#
@@ -139,7 +139,7 @@ export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
-w site_url Base URL of the web site (def: $SITE_URL)
NOTE: The '-w site_url' is passed as leading options on tool command lines.
tool the tool to run over all winners
tool the tool to run over all entries
[more_options] additional tool command line options to use before the YYYY/dir argument
NOTE: Any '-t tagline', '-T md2html.sh', '-p tool', '-P pandoc_opts', '-u repo_url', '-U top_url'
@@ -462,7 +462,7 @@ for YYYY in $(< "$TOP_FILE"); do
continue
fi
# process each winner under YYYY
# process each entry directroy under YYYY
#
export YYYY_DIR
for YYYY_DIR in $(< "$YEAR_FILE"); do
@@ -494,15 +494,15 @@ for YYYY in $(< "$TOP_FILE"); do
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
continue
fi
export WINNER_DIR=${YYYY_DIR#*/}
if [[ -z $WINNER_DIR ]]; then
export ENTRY_DIR=${YYYY_DIR#*/}
if [[ -z $ENTRY_DIR ]]; then
echo "$0: ERROR: YYYY_DIR not in $YEAR_DIR/dir form: $YYYY_DIR" 1>&2
EXIT_CODE="7" # exit 7
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
continue
fi
if [[ $WINNER_DIR = */* ]]; then
echo "$0: ERROR: YYYY_DIR: $YYYY_DIR dir contains a /: $WINNER_DIR" 1>&2
if [[ $ENTRY_DIR = */* ]]; then
echo "$0: ERROR: YYYY_DIR: $YYYY_DIR dir contains a /: $ENTRY_DIR" 1>&2
EXIT_CODE="7" # exit 7
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
continue
+27 -27
View File
@@ -164,7 +164,7 @@ $NAME version: $VERSION"
# output_entry_ids
#
# Write the winner ids from an author/author_handle.json file to standard output (stdout)
# Write the entry ids from an author/author_handle.json file to standard output (stdout)
#
# XXX - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - XXX
# XXX - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - XXX
@@ -182,7 +182,7 @@ $NAME version: $VERSION"
function output_entry_ids
{
local AUTHOR_HANDLE_JSON_PATH; # the .entry.json path
local entry_id; # a found winner id
local entry_id; # a found entry id
# parse args
#
@@ -204,7 +204,7 @@ function output_entry_ids
return 4
fi
# extract winner ids from the author/author_handle.json file
# extract entry ids from the author/author_handle.json file
#
grep -F entry_id "$AUTHOR_HANDLE_JSON_PATH" | awk 'NF == 5 { print $4; }' | tr -d '"'
return 0
@@ -251,7 +251,7 @@ function output_author_handle
return 4
fi
# extract winner ids from the author/author_handle.json file
# extract entry ids from the author/author_handle.json file
#
grep -F author_handle "$AUTHOR_HANDLE_JSON_PATH" | sed -e 's/.*"author_handle" : "//' -e 's/",.*//'
return 0
@@ -657,26 +657,26 @@ if [[ -n $DO_NOT_PROCESS ]]; then
exit 0
fi
# create a temporary winners markdown file
# create a temporary entry markdown file
#
TMP_WINNERS_MD=".$NAME.$$.winners.md"
TMP_AUTHORS_MD=".$NAME.$$.entry.md"
if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: temporary winners markdown file: $TMP_WINNERS_MD" 1>&2
echo "$0: debug[3]: temporary entry markdown file: $TMP_AUTHORS_MD" 1>&2
fi
if [[ -z $NOOP ]]; then
trap 'rm -f $TMP_WINNERS_MD; exit' 0 1 2 3 15
rm -f "$TMP_WINNERS_MD"
if [[ -e $TMP_WINNERS_MD ]]; then
echo "$0: ERROR: cannot remove temporary winners markdown file: $TMP_WINNERS_MD" 1>&2
trap 'rm -f $TMP_AUTHORS_MD; exit' 0 1 2 3 15
rm -f "$TMP_AUTHORS_MD"
if [[ -e $TMP_AUTHORS_MD ]]; then
echo "$0: ERROR: cannot remove temporary entry markdown file: $TMP_AUTHORS_MD" 1>&2
exit 212
fi
:> "$TMP_WINNERS_MD"
if [[ ! -e $TMP_WINNERS_MD ]]; then
echo "$0: ERROR: cannot create temporary winners markdown file: $TMP_WINNERS_MD" 1>&2
:> "$TMP_AUTHORS_MD"
if [[ ! -e $TMP_AUTHORS_MD ]]; then
echo "$0: ERROR: cannot create temporary entry markdown file: $TMP_AUTHORS_MD" 1>&2
exit 213
fi
elif [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: because of -n, temporary winners markdown file is not used: $TMP_WINNERS_MD" 1>&2
echo "$0: debug[3]: because of -n, temporary entry markdown file is not used: $TMP_AUTHORS_MD" 1>&2
fi
# create a temporary sort word list file
@@ -686,7 +686,7 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: temporary sort word list file: $TMP_SORT_WORD" 1>&2
fi
if [[ -z $NOOP ]]; then
trap 'rm -f $TMP_WINNERS_MD $TMP_SORT_WORD; exit' 0 1 2 3 15
trap 'rm -f $TMP_AUTHORS_MD $TMP_SORT_WORD; exit' 0 1 2 3 15
rm -f "$TMP_SORT_WORD"
if [[ -e $TMP_SORT_WORD ]]; then
echo "$0: ERROR: cannot remove temporary sort word list file: $TMP_SORT_WORD" 1>&2
@@ -729,7 +729,7 @@ if [[ $status -ne 0 ]]; then
exit 216
fi
# generate the temporary winners markdown file
# generate the temporary entry markdown file
#
# XXX - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - XXX
# XXX - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - XXX
@@ -836,7 +836,7 @@ EOF
#
output_entry_ids "$filename" | while read -r ENTRY_ID; do
# verify the winner id
# verify the entry id
#
if [[ $ENTRY_ID =~ ^[^_][^_]*_[^_][^_]*$ ]]; then
if [[ $V_FLAG -ge 7 ]]; then
@@ -875,7 +875,7 @@ EOF
echo "$0: debug[7]: .entry.json: $ENTRY_JSON" 1>&2
fi
# collect the award for this winner id
# collect the award for this entry id
#
AWARD=$(output_award "$ENTRY_JSON")
if [[ -z $AWARD ]]; then
@@ -891,11 +891,11 @@ EOF
fi
done < "$TMP_SORT_WORD"
} | if [[ -z $NOOP ]]; then
cat >> "$TMP_WINNERS_MD"
cat >> "$TMP_AUTHORS_MD"
else
cat > /dev/null
if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: because of -n, temporary winners markdown file is NOT written into: $TMP_WINNERS_MD" 1>&2
echo "$0: debug[3]: because of -n, temporary entry markdown file is NOT written into: $TMP_AUTHORS_MD" 1>&2
fi
fi
@@ -903,12 +903,12 @@ fi
#
if [[ -z $NOOP ]]; then
if [[ $V_FLAG -ge 1 ]]; then
echo "$0: debug[1]: about to run: $MD2HTML_SH ${TOOL_OPTION[*]} -- winners.md $TMP_WINNERS_MD $AUTHORS_HTML" 1>&2
echo "$0: debug[1]: about to run: $MD2HTML_SH ${TOOL_OPTION[*]} -- authors.md $TMP_AUTHORS_MD $AUTHORS_HTML" 1>&2
fi
"$MD2HTML_SH" "${TOOL_OPTION[@]}" -- winners.md "$TMP_WINNERS_MD" "$AUTHORS_HTML"
"$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[*]} -- winners.md $TMP_WINNERS_MD $AUTHORS_HTML" \
echo "$0: Warning: 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
@@ -919,15 +919,15 @@ if [[ -z $NOOP ]]; then
# report disabled by -n
#
elif [[ $V_FLAG -ge 5 ]]; then
echo "$0: debug[5]: because of -n, did not run: $MD2HTML_SH ${TOOL_OPTION[*]} -- winners.md $TMP_WINNERS_MD $AUTHORS_HTML" 1>&2
echo "$0: debug[5]: because of -n, did not run: $MD2HTML_SH ${TOOL_OPTION[*]} -- authors.md $TMP_AUTHORS_MD $AUTHORS_HTML" 1>&2
fi
# file cleanup
#
if [[ -z $NOOP ]]; then
rm -f -- "$TMP_WINNERS_MD"
rm -f -- "$TMP_AUTHORS_MD"
elif [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: because of -n, disabled: rm -f -- $TMP_WINNERS_MD" 1>&2
echo "$0: debug[3]: because of -n, disabled: rm -f -- $TMP_AUTHORS_MD" 1>&2
fi
# All Done!!! -- Jessica Noll, Age 2
+6 -6
View File
@@ -645,7 +645,7 @@ for YYYY in $("$TAC_TOOL" "$TOP_FILE"); do
fi
fi
# process each winner under YYYY
# process each entry under YYYY
#
export YYYY_DIR
for YYYY_DIR in $(< "$YEAR_FILE"); do
@@ -677,15 +677,15 @@ for YYYY in $("$TAC_TOOL" "$TOP_FILE"); do
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
continue
fi
export WINNER_DIR=${YYYY_DIR#*/}
if [[ -z $WINNER_DIR ]]; then
export ENTRY_DIR=${YYYY_DIR#*/}
if [[ -z $ENTRY_DIR ]]; then
echo "$0: ERROR: YYYY_DIR not in $YEAR_DIR/dir form: $YYYY_DIR" 1>&2
EXIT_CODE="7" # exit 7
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
continue
fi
if [[ $WINNER_DIR = */* ]]; then
echo "$0: ERROR: YYYY_DIR: $YYYY_DIR dir contains a /: $WINNER_DIR" 1>&2
if [[ $ENTRY_DIR = */* ]]; then
echo "$0: ERROR: YYYY_DIR: $YYYY_DIR dir contains a /: $ENTRY_DIR" 1>&2
EXIT_CODE="7" # exit 7
echo "$0: Warning: EXIT_CODE set to: $EXIT_CODE" 1>&2
continue
@@ -766,7 +766,7 @@ for YYYY in $("$TAC_TOOL" "$TOP_FILE"); do
else
cat > /dev/null
if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: because of -n, $YYYY winner markdown data is NOT written into: $TMP_YEARS_MD" 1>&2
echo "$0: debug[3]: because of -n, $YYYY_DIR markdown data is NOT written into: $TMP_YEARS_MD" 1>&2
fi
fi
+1 -1
View File
@@ -1035,7 +1035,7 @@ fi
#
# We will use the dirname of match.md as our working directory. This is path from
# topdir, that is to be used to match an entry in the inc/md2html.cfg configuration file.
# In the case of a winner directory, this will be a YYYY/dir working directory.
# In the case of a entry directory, this will be a YYYY/dir working directory.
# In the case of a year level directory, this will be a YYYY working directory.
# In the case of a top level directory, this will be just a . working directory.
#
+34 -34
View File
@@ -6,7 +6,7 @@
#
# This tool is intended to be invoked by a tool such as "readme2index.sh".
# The final arg will be in YYYY/dir form, and will be called from
# the topdir directory under which the YYYY/dir winner directory must be found.
# the topdir directory under which the YYYY/dir entry directory must be found.
#
# Copyright (c) 2023,2024 by Landon Curt Noll. All Rights Reserved.
#
@@ -102,7 +102,7 @@ export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
-e string output string, followed by newline, to stderr (def: do not)
-E exitcode force exit with exitcode (def: exit based on success or failure of the action)
YYYY/dir path from topdir to winner directory: must contain the files: README.md, .path and .entry.json
YYYY/dir path from topdir to entry directory: must contain the files: README.md, .path and .entry.json
Exit codes:
0 all OK
@@ -110,7 +110,7 @@ Exit codes:
2 -h and help string printed or -V and version string printed
3 command line error
4 bash version is < 4.2
5 YYYY/dir is not a winner directory
5 YYYY/dir is not a entry directory
6 pandoc tool not found or not executable
>= 10 < 210 ((not used))
>= 210 internal tool error
@@ -124,7 +124,7 @@ export DO_NOT_PROCESS=
# output_author_handles
#
# Write the author handle(s) for the YYYY/dir winner to standard output (stdout)
# Write the author handle(s) for the YYYY/dir entry to standard output (stdout)
#
# XXX - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - XXX
# XXX - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - XXX
@@ -177,7 +177,7 @@ function output_author_handles
# output_entry_ids
#
# Write the winner ids from an author/author_handle.json file to standard output (stdout)
# Write the entry ids from an author/author_handle.json file to standard output (stdout)
#
# XXX - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - XXX
# XXX - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - XXX
@@ -195,7 +195,7 @@ function output_author_handles
function output_entry_ids
{
local AUTHOR_HANDLE_JSON_PATH; # the .entry.json path
local entry_id; # a found winner id
local entry_id; # a found entry id
# parse args
#
@@ -217,7 +217,7 @@ function output_entry_ids
return 4
fi
# extract winner ids from the author/author_handle.json file
# extract entry ids from the author/author_handle.json file
#
grep -F entry_id "$AUTHOR_HANDLE_JSON_PATH" |
awk 'NF == 5 { print $4; }' |
@@ -397,9 +397,9 @@ if [[ $# -ne 1 ]]; then
exit 3
fi
#
export WINNER_PATH="$1"
export ENTRY_PATH="$1"
if [[ $V_FLAG -ge 1 ]]; then
echo "$0: debug[1]: WINNER_PATH=$WINNER_PATH" 1>&2
echo "$0: debug[1]: ENTRY_PATH=$ENTRY_PATH" 1>&2
fi
# verify that we have a topdir directory
@@ -472,61 +472,61 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: now in directory: $(/bin/pwd)" 1>&2
fi
# verify that WINNER_PATH is a winner directory
# verify that ENTRY_PATH is a entry directory
#
# WINNER_PATH must be in YYYY/dir form
# ENTRY_PATH must be in YYYY/dir form
# YYYY must be a directory
# YYYY must be a writable directory
# YYYY/.year must be a non-empty file
# YYYY/dir must be a directory
# YYYY/dir/.path must be a non-empty file
# WINNER_PATH must match the contents of YYYY/dir/.path
# ENTRY_PATH must match the contents of YYYY/dir/.path
# YYYY/dir/.entry.json must be a non-empty file
#
if [[ ! -d $WINNER_PATH ]]; then
echo "$0: ERROR: arg is not a directory: $WINNER_PATH" 1>&2
if [[ ! -d $ENTRY_PATH ]]; then
echo "$0: ERROR: arg is not a directory: $ENTRY_PATH" 1>&2
exit 5
fi
if [[ ! -w $WINNER_PATH ]]; then
echo "$0: ERROR: arg is not a writable directory: $WINNER_PATH" 1>&2
if [[ ! -w $ENTRY_PATH ]]; then
echo "$0: ERROR: arg is not a writable directory: $ENTRY_PATH" 1>&2
exit 5
fi
export YEAR_DIR=${WINNER_PATH%%/*}
export YEAR_DIR=${ENTRY_PATH%%/*}
if [[ -z $YEAR_DIR ]]; then
echo "$0: ERROR: arg not in YYYY/dir form: $WINNER_PATH" 1>&2
echo "$0: ERROR: arg not in YYYY/dir form: $ENTRY_PATH" 1>&2
exit 5
fi
export WINNER_DIR=${WINNER_PATH#*/}
if [[ -z $WINNER_DIR ]]; then
echo "$0: ERROR: arg: $WINNER_PATH not in $YEAR_DIR/dir form: $WINNER_PATH" 1>&2
export ENTRY_DIR=${ENTRY_PATH#*/}
if [[ -z $ENTRY_DIR ]]; then
echo "$0: ERROR: arg: $ENTRY_PATH not in $YEAR_DIR/dir form: $ENTRY_PATH" 1>&2
exit 5
fi
if [[ $WINNER_DIR = */* ]]; then
echo "$0: ERROR: dir from arg: $WINNER_PATH contains a /: $WINNER_DIR" 1>&2
if [[ $ENTRY_DIR = */* ]]; then
echo "$0: ERROR: dir from arg: $ENTRY_PATH contains a /: $ENTRY_DIR" 1>&2
exit 5
fi
if [[ ! -d $YEAR_DIR ]]; then
echo "$0: ERROR: YYYY from arg: $WINNER_PATH is not a directory: $YEAR_DIR" 1>&2
echo "$0: ERROR: YYYY from arg: $ENTRY_PATH is not a directory: $YEAR_DIR" 1>&2
exit 5
fi
export ENTRY_ID="${YEAR_DIR}_${WINNER_DIR}"
export ENTRY_ID="${YEAR_DIR}_${ENTRY_DIR}"
export DOT_YEAR="$YEAR_DIR/.year"
if [[ ! -s $DOT_YEAR ]]; then
echo "$0: ERROR: not a non-empty file: $DOT_YEAR" 1>&2
exit 5
fi
# Now that we have moved to topdir, form and verify YYYY_DIR is a writable directory
export YYYY_DIR="$YEAR_DIR/$WINNER_DIR"
export YYYY_DIR="$YEAR_DIR/$ENTRY_DIR"
if [[ ! -e $YYYY_DIR ]]; then
echo "$0: ERROR: YYYY/dir from arg: $WINNER_PATH does not exist: $YYYY_DIR" 1>&2
echo "$0: ERROR: YYYY/dir from arg: $ENTRY_PATH does not exist: $YYYY_DIR" 1>&2
exit 5
fi
if [[ ! -d $YYYY_DIR ]]; then
echo "$0: ERROR: YYYY/dir from arg: $WINNER_PATH is not a directory: $YYYY_DIR" 1>&2
echo "$0: ERROR: YYYY/dir from arg: $ENTRY_PATH is not a directory: $YYYY_DIR" 1>&2
exit 5
fi
if [[ ! -w $YYYY_DIR ]]; then
echo "$0: ERROR: YYYY/dir from arg: $WINNER_PATH is not a writable directory: $YYYY_DIR" 1>&2
echo "$0: ERROR: YYYY/dir from arg: $ENTRY_PATH is not a writable directory: $YYYY_DIR" 1>&2
exit 5
fi
export DOT_PATH="$YYYY_DIR/.path"
@@ -535,8 +535,8 @@ if [[ ! -s $DOT_PATH ]]; then
exit 5
fi
DOT_PATH_CONTENT=$(< "$DOT_PATH")
if [[ $WINNER_PATH != "$DOT_PATH_CONTENT" ]]; then
echo "$0: ERROR: arg: $WINNER_PATH does not match $DOT_PATH contents: $DOT_PATH_CONTENT" 1>&2
if [[ $ENTRY_PATH != "$DOT_PATH_CONTENT" ]]; then
echo "$0: ERROR: arg: $ENTRY_PATH does not match $DOT_PATH contents: $DOT_PATH_CONTENT" 1>&2
exit 5
fi
export ENTRY_JSON="$YYYY_DIR/.entry.json"
@@ -570,7 +570,7 @@ fi
if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: NAME=$NAME" 1>&2
echo "$0: debug[3]: YEAR_DIR=$YEAR_DIR" 1>&2
echo "$0: debug[3]: WINNER_DIR=$WINNER_DIR" 1>&2
echo "$0: debug[3]: ENTRY_DIR=$ENTRY_DIR" 1>&2
echo "$0: debug[3]: ENTRY_ID=$ENTRY_ID" 1>&2
echo "$0: debug[3]: DOT_YEAR=$DOT_YEAR" 1>&2
echo "$0: debug[3]: DOT_PATH=$DOT_PATH" 1>&2
@@ -638,11 +638,11 @@ for author_handle in $AUTHOR_HANDLE_SET; do
ENTRY_ID_FOUND=$(output_entry_ids "$AUTHOR_HANDLE_JSON" | grep -F -- "$ENTRY_ID")
status="$?"
if [[ $status -ne 0 || -z $ENTRY_ID_FOUND ]]; then
echo "$0: ERROR: winner id: $ENTRY_ID not found in author JSON file: $AUTHOR_HANDLE_JSON, status: $status" 1>&2
echo "$0: ERROR: entry id: $ENTRY_ID not found in author JSON file: $AUTHOR_HANDLE_JSON, status: $status" 1>&2
exit 224
fi
if [[ $V_FLAG -ge 7 ]]; then
echo "$0: debug[7]: readable author JSON file: $AUTHOR_HANDLE_JSON mentions winner id: $ENTRY_ID" 1>&2
echo "$0: debug[7]: readable author JSON file: $AUTHOR_HANDLE_JSON mentions entry id: $ENTRY_ID" 1>&2
fi
# verify that we have a Full Name in the /author/author_handle.json file
+31 -31
View File
@@ -6,7 +6,7 @@
#
# This tool is intended to be invoked by a tool such as "readme2index.sh".
# The final arg will be in YYYY/dir form, and will be called from
# the topdir directory under which the YYYY/dir winner directory must be found.
# the topdir directory under which the YYYY/dir entry directory must be found.
#
# Copyright (c) 2024 by Landon Curt Noll. All Rights Reserved.
#
@@ -197,9 +197,9 @@ if [[ $# -ne 1 ]]; then
exit 3
fi
#
export WINNER_PATH="$1"
export ENTRY_PATH="$1"
if [[ $V_FLAG -ge 1 ]]; then
echo "$0: debug[1]: WINNER_PATH=$WINNER_PATH" 1>&2
echo "$0: debug[1]: ENTRY_PATH=$ENTRY_PATH" 1>&2
fi
# verify that we have a topdir directory
@@ -272,65 +272,65 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: now in directory: $(/bin/pwd)" 1>&2
fi
# verify that WINNER_PATH is a winner directory
# verify that ENTRY_PATH is a entry directory
#
# WINNER_PATH must be in YYYY/dir form
# ENTRY_PATH must be in YYYY/dir form
# YYYY must be a directory
# YYYY must be a writable directory
# YYYY/.year must be a non-empty file
# YYYY/dir must be a directory
# YYYY/dir/.path must be a non-empty file
# WINNER_PATH must match the contents of YYYY/dir/.path
# ENTRY_PATH must match the contents of YYYY/dir/.path
# YYYY/dir/.entry.json must be a non-empty file
#
if [[ ! -d $WINNER_PATH ]]; then
echo "$0: ERROR: arg is not a directory: $WINNER_PATH" 1>&2
if [[ ! -d $ENTRY_PATH ]]; then
echo "$0: ERROR: arg is not a directory: $ENTRY_PATH" 1>&2
exit 5
fi
if [[ ! -w $WINNER_PATH ]]; then
echo "$0: ERROR: arg is not a writable directory: $WINNER_PATH" 1>&2
if [[ ! -w $ENTRY_PATH ]]; then
echo "$0: ERROR: arg is not a writable directory: $ENTRY_PATH" 1>&2
exit 5
fi
export YEAR_DIR=${WINNER_PATH%%/*}
export YEAR_DIR=${ENTRY_PATH%%/*}
if [[ -z $YEAR_DIR ]]; then
echo "$0: ERROR: arg not in YYYY/dir form: $WINNER_PATH" 1>&2
echo "$0: ERROR: arg not in YYYY/dir form: $ENTRY_PATH" 1>&2
exit 5
fi
export WINNER_DIR=${WINNER_PATH#*/}
if [[ -z $WINNER_DIR ]]; then
echo "$0: ERROR: arg: $WINNER_PATH not in $YEAR_DIR/dir form: $WINNER_PATH" 1>&2
export ENTRY_DIR=${ENTRY_PATH#*/}
if [[ -z $ENTRY_DIR ]]; then
echo "$0: ERROR: arg: $ENTRY_PATH not in $YEAR_DIR/dir form: $ENTRY_PATH" 1>&2
exit 5
fi
if [[ $WINNER_DIR = */* ]]; then
echo "$0: ERROR: dir from arg: $WINNER_PATH contains a /: $WINNER_DIR" 1>&2
if [[ $ENTRY_DIR = */* ]]; then
echo "$0: ERROR: dir from arg: $ENTRY_PATH contains a /: $ENTRY_DIR" 1>&2
exit 5
fi
if [[ ! -d $YEAR_DIR ]]; then
echo "$0: ERROR: YYYY from arg: $WINNER_PATH is not a directory: $YEAR_DIR" 1>&2
echo "$0: ERROR: YYYY from arg: $ENTRY_PATH is not a directory: $YEAR_DIR" 1>&2
exit 5
fi
export WINNER_ID="${YEAR_DIR}_${WINNER_DIR}"
export ENTRY_ID="${YEAR_DIR}_${ENTRY_DIR}"
export DOT_YEAR="$YEAR_DIR/.year"
if [[ ! -s $DOT_YEAR ]]; then
echo "$0: ERROR: not a non-empty file: $DOT_YEAR" 1>&2
exit 5
fi
# Now that we have moved to topdir, form and verify YYYY_DIR is a writable directory
export YYYY_DIR="$YEAR_DIR/$WINNER_DIR"
export YYYY_DIR="$YEAR_DIR/$ENTRY_DIR"
if [[ ! -e $YYYY_DIR ]]; then
echo "$0: ERROR: YYYY/dir from arg: $WINNER_PATH does not exist: $YYYY_DIR" 1>&2
echo "$0: ERROR: YYYY/dir from arg: $ENTRY_PATH does not exist: $YYYY_DIR" 1>&2
exit 5
fi
if [[ ! -d $YYYY_DIR ]]; then
echo "$0: ERROR: YYYY/dir from arg: $WINNER_PATH is not a directory: $YYYY_DIR" 1>&2
echo "$0: ERROR: YYYY/dir from arg: $ENTRY_PATH is not a directory: $YYYY_DIR" 1>&2
exit 5
fi
if [[ ! -w $YYYY_DIR ]]; then
echo "$0: ERROR: YYYY/dir from arg: $WINNER_PATH is not a writable directory: $YYYY_DIR" 1>&2
echo "$0: ERROR: YYYY/dir from arg: $ENTRY_PATH is not a writable directory: $YYYY_DIR" 1>&2
exit 5
fi
if [[ ! -d $YYYY_DIR ]]; then
echo "$0: ERROR: YYYY/dir from arg: $WINNER_PATH is not a directory: $YYYY_DIR" 1>&2
echo "$0: ERROR: YYYY/dir from arg: $ENTRY_PATH is not a directory: $YYYY_DIR" 1>&2
exit 5
fi
export DOT_PATH="$YYYY_DIR/.path"
@@ -339,8 +339,8 @@ if [[ ! -s $DOT_PATH ]]; then
exit 5
fi
DOT_PATH_CONTENT=$(< "$DOT_PATH")
if [[ $WINNER_PATH != "$DOT_PATH_CONTENT" ]]; then
echo "$0: ERROR: arg: $WINNER_PATH does not match $DOT_PATH contents: $DOT_PATH_CONTENT" 1>&2
if [[ $ENTRY_PATH != "$DOT_PATH_CONTENT" ]]; then
echo "$0: ERROR: arg: $ENTRY_PATH does not match $DOT_PATH contents: $DOT_PATH_CONTENT" 1>&2
exit 5
fi
export ENTRY_JSON="$YYYY_DIR/.entry.json"
@@ -390,8 +390,8 @@ fi
if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: NAME=$NAME" 1>&2
echo "$0: debug[3]: YEAR_DIR=$YEAR_DIR" 1>&2
echo "$0: debug[3]: WINNER_DIR=$WINNER_DIR" 1>&2
echo "$0: debug[3]: WINNER_ID=$WINNER_ID" 1>&2
echo "$0: debug[3]: ENTRY_DIR=$ENTRY_DIR" 1>&2
echo "$0: debug[3]: ENTRY_ID=$ENTRY_ID" 1>&2
echo "$0: debug[3]: DOT_YEAR=$DOT_YEAR" 1>&2
echo "$0: debug[3]: DOT_PATH=$DOT_PATH" 1>&2
echo "$0: debug[3]: ENTRY_JSON=$ENTRY_JSON" 1>&2
@@ -475,10 +475,10 @@ if [[ -z $NOOP ]]; then
exit 224
fi
{
# load numerically sorted winners_rank lines into the temporary markdown file
# load numerically sorted inventory_order lines into the temporary markdown file
#
# Any winners_rank that is 1 to 9 decimal digits is considered a primary file.
# Any winners_rank that is 10 or more decimal digits is considered a secondary file.
# Any inventory_order that is 1 to 9 decimal digits is considered a primary file.
# Any inventory_order that is 10 or more decimal digits is considered a secondary file.
#
echo '# <a name="inventory"></a>Inventory for' "$YYYY_DIR"
echo
+1 -1
View File
@@ -7,7 +7,7 @@
# This tool is intended to be invoked by a tool such as 'readme2index.sh"
# and as such, the leading options will include "-p pandoc_wrapper" and -P "optstr",
# the final arg will be in YYYY/dir form, and will be called from
# the topdir directory under which the YYYY/dir winner directory must be found.
# the topdir directory under which the YYYY/dir entry directory must be found.
#
# Copyright (c) 2023,2024 by Landon Curt Noll. All Rights Reserved.
#
+45 -45
View File
@@ -127,7 +127,7 @@ export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
-w site_url Base URL of the web site (def: $SITE_URL)
NOTE: The '-w site_url' is passed as leading options on tool command lines.
tool the tool to run over all winners
tool the tool to run over all entries
[more_options] additional tool command line options to use before the YYYY/dir argument
NOTE: Any '-t tagline', '-T md2html.sh', '-p tool', '-P pandoc_opts', '-u repo_url', '-U top_url'
@@ -249,9 +249,9 @@ if [[ $# -ne 1 ]]; then
exit 3
fi
#
export WINNER_PATH="$1"
export ENTRY_PATH="$1"
if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: WINNER_PATH=$WINNER_PATH" 1>&2
echo "$0: debug[3]: ENTRY_PATH=$ENTRY_PATH" 1>&2
fi
# always add the '-v level' option, unless level is empty, to the set of options passed to the md2html.sh tool
@@ -268,40 +268,40 @@ if [[ -n $TAGLINE ]]; then
TOOL_OPTION+=("$TAGLINE")
fi
# parse the WINNER_PATH arg
# parse the ENTRY_PATH arg
#
# verify that WINNER_PATH is in proper form
# verify that ENTRY_PATH is in proper form
#
# Also obtain the YEAR_DIR and WINNER_DIR from WINNER_PATH.
# Also obtain the YEAR_DIR and ENTRY_DIR from ENTRY_PATH.
#
if [[ -z $WINNER_PATH ]]; then
if [[ -z $ENTRY_PATH ]]; then
echo "$0: ERROR: arg is an empty string" 1>&2
exit 3
fi
if [[ ! -d $WINNER_PATH ]]; then
echo "$0: ERROR: arg is not a directory: $WINNER_PATH" 1>&2
if [[ ! -d $ENTRY_PATH ]]; then
echo "$0: ERROR: arg is not a directory: $ENTRY_PATH" 1>&2
exit 3
fi
if [[ ! -w $WINNER_PATH ]]; then
echo "$0: ERROR: arg is not a writable directory: $WINNER_PATH" 1>&2
if [[ ! -w $ENTRY_PATH ]]; then
echo "$0: ERROR: arg is not a writable directory: $ENTRY_PATH" 1>&2
exit 3
fi
export YEAR_DIR=${WINNER_PATH%%/*}
export YEAR_DIR=${ENTRY_PATH%%/*}
if [[ -z $YEAR_DIR ]]; then
echo "$0: ERROR: arg not in YYYY/dir form: $WINNER_PATH" 1>&2
echo "$0: ERROR: arg not in YYYY/dir form: $ENTRY_PATH" 1>&2
exit 3
fi
if [[ ! -d $YEAR_DIR ]]; then
echo "$0: ERROR: YYYY from arg: $WINNER_PATH is not a directory: $YEAR_DIR" 1>&2
echo "$0: ERROR: YYYY from arg: $ENTRY_PATH is not a directory: $YEAR_DIR" 1>&2
exit 3
fi
export WINNER_DIR=${WINNER_PATH#*/}
if [[ -z $WINNER_DIR ]]; then
echo "$0: ERROR: arg: $WINNER_PATH not in $YEAR_DIR/dir form: $WINNER_PATH" 1>&2
export ENTRY_DIR=${ENTRY_PATH#*/}
if [[ -z $ENTRY_DIR ]]; then
echo "$0: ERROR: arg: $ENTRY_PATH not in $YEAR_DIR/dir form: $ENTRY_PATH" 1>&2
exit 3
fi
if [[ $WINNER_DIR = */* ]]; then
echo "$0: ERROR: dir from arg: $WINNER_PATH contains a /: $WINNER_DIR" 1>&2
if [[ $ENTRY_DIR = */* ]]; then
echo "$0: ERROR: dir from arg: $ENTRY_PATH contains a /: $ENTRY_DIR" 1>&2
exit 3
fi
@@ -363,59 +363,59 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: now in directory: $(/bin/pwd)" 1>&2
fi
# perform tests on YYYY_DIR (YYYY/dir) as a winner directory
# perform tests on YYYY_DIR (YYYY/dir) as a entry directory
#
export DOT_YEAR="$YEAR_DIR/.year"
if [[ ! -e $DOT_YEAR ]]; then
echo "$0: ERROR: in $WINNER_PATH .year does not exist: $DOT_YEAR" 1>&2
echo "$0: ERROR: in $ENTRY_PATH .year does not exist: $DOT_YEAR" 1>&2
exit 7
fi
if [[ ! -f $DOT_YEAR ]]; then
echo "$0: ERROR: in $WINNER_PATH .year is not a file: $DOT_YEAR" 1>&2
echo "$0: ERROR: in $ENTRY_PATH .year is not a file: $DOT_YEAR" 1>&2
exit 7
fi
if [[ ! -r $DOT_YEAR ]]; then
echo "$0: ERROR: in $WINNER_PATH .year is not a readable file: $DOT_YEAR" 1>&2
echo "$0: ERROR: in $ENTRY_PATH .year is not a readable file: $DOT_YEAR" 1>&2
exit 7
fi
if [[ ! -s $DOT_YEAR ]]; then
echo "$0: ERROR: in $WINNER_PATH .year is not a non-empty readable file: $DOT_YEAR" 1>&2
echo "$0: ERROR: in $ENTRY_PATH .year is not a non-empty readable file: $DOT_YEAR" 1>&2
exit 7
fi
# Now that we have moved to topdir, form and verify YYYY_DIR is a writable directory
export YYYY_DIR="$YEAR_DIR/$WINNER_DIR"
export YYYY_DIR="$YEAR_DIR/$ENTRY_DIR"
if [[ ! -e $YYYY_DIR ]]; then
echo "$0: ERROR: YYYY/dir from arg: $WINNER_PATH does not exist: $YYYY_DIR" 1>&2
echo "$0: ERROR: YYYY/dir from arg: $ENTRY_PATH does not exist: $YYYY_DIR" 1>&2
exit 7
fi
if [[ ! -d $YYYY_DIR ]]; then
echo "$0: ERROR: YYYY/dir from arg: $WINNER_PATH is not a directory: $YYYY_DIR" 1>&2
echo "$0: ERROR: YYYY/dir from arg: $ENTRY_PATH is not a directory: $YYYY_DIR" 1>&2
exit 7
fi
if [[ ! -w $YYYY_DIR ]]; then
echo "$0: ERROR: YYYY/dir from arg: $WINNER_PATH is not a writable directory: $YYYY_DIR" 1>&2
echo "$0: ERROR: YYYY/dir from arg: $ENTRY_PATH is not a writable directory: $YYYY_DIR" 1>&2
exit 7
fi
export DOT_PATH="$YYYY_DIR/.path"
if [[ ! -e $DOT_PATH ]]; then
echo "$0: ERROR: in $WINNER_PATH .path does not exist: $DOT_PATH" 1>&2
echo "$0: ERROR: in $ENTRY_PATH .path does not exist: $DOT_PATH" 1>&2
exit 8
fi
if [[ ! -f $DOT_PATH ]]; then
echo "$0: ERROR: in $WINNER_PATH .path is not a file: $DOT_PATH" 1>&2
echo "$0: ERROR: in $ENTRY_PATH .path is not a file: $DOT_PATH" 1>&2
exit 8
fi
if [[ ! -r $DOT_PATH ]]; then
echo "$0: ERROR: in $WINNER_PATH .path is not a readable file: $DOT_PATH" 1>&2
echo "$0: ERROR: in $ENTRY_PATH .path is not a readable file: $DOT_PATH" 1>&2
exit 8
fi
if [[ ! -s $DOT_PATH ]]; then
echo "$0: ERROR: in $WINNER_PATH .path is not a non-empty readable file: $DOT_PATH" 1>&2
echo "$0: ERROR: in $ENTRY_PATH .path is not a non-empty readable file: $DOT_PATH" 1>&2
exit 8
fi
DOT_PATH_CONTENT=$(< "$DOT_PATH")
if [[ $WINNER_PATH != "$DOT_PATH_CONTENT" ]]; then
echo "$0: ERROR: in $WINNER_PATH .path: $DOT_PATH contents: $DOT_PATH_CONTENT" 1>&2
if [[ $ENTRY_PATH != "$DOT_PATH_CONTENT" ]]; then
echo "$0: ERROR: in $ENTRY_PATH .path: $DOT_PATH contents: $DOT_PATH_CONTENT" 1>&2
exit 8
fi
@@ -424,19 +424,19 @@ fi
export README_PATH="$YYYY_DIR/README.md"
export INDEX_PATH="$YYYY_DIR/index.html"
if [[ ! -e $README_PATH ]]; then
echo "$0: ERROR: in $WINNER_PATH README.md does not exist: $README_PATH" 1>&2
echo "$0: ERROR: in $ENTRY_PATH README.md does not exist: $README_PATH" 1>&2
exit 8
fi
if [[ ! -f $README_PATH ]]; then
echo "$0: ERROR: in $WINNER_PATH README.md is not a file: $README_PATH" 1>&2
echo "$0: ERROR: in $ENTRY_PATH README.md is not a file: $README_PATH" 1>&2
exit 8
fi
if [[ ! -r $README_PATH ]]; then
echo "$0: ERROR: in $WINNER_PATH README.md is not a readable file: $README_PATH" 1>&2
echo "$0: ERROR: in $ENTRY_PATH README.md is not a readable file: $README_PATH" 1>&2
exit 8
fi
if [[ ! -s $README_PATH ]]; then
echo "$0: ERROR: in $WINNER_PATH README.md is not a non-empty readable file: $README_PATH" 1>&2
echo "$0: ERROR: in $ENTRY_PATH README.md is not a non-empty readable file: $README_PATH" 1>&2
exit 8
fi
@@ -444,23 +444,23 @@ fi
#
export ENTRY_JSON="$YYYY_DIR/.entry.json"
if [[ ! -e $ENTRY_JSON ]]; then
echo "$0: ERROR: in $WINNER_PATH .entry.json does not exist: $ENTRY_JSON" 1>&2
echo "$0: ERROR: in $ENTRY_PATH .entry.json does not exist: $ENTRY_JSON" 1>&2
exit 8
fi
if [[ ! -f $ENTRY_JSON ]]; then
echo "$0: ERROR: in $WINNER_PATH .entry.json is not a file: $ENTRY_JSON" 1>&2
echo "$0: ERROR: in $ENTRY_PATH .entry.json is not a file: $ENTRY_JSON" 1>&2
exit 8
fi
if [[ ! -r $ENTRY_JSON ]]; then
echo "$0: ERROR: in $WINNER_PATH .entry.json is not a readable file: $ENTRY_JSON" 1>&2
echo "$0: ERROR: in $ENTRY_PATH .entry.json is not a readable file: $ENTRY_JSON" 1>&2
exit 8
fi
if [[ ! -s $ENTRY_JSON ]]; then
echo "$0: ERROR: in $WINNER_PATH .entry.json is not a non-empty readable file: $ENTRY_JSON" 1>&2
echo "$0: ERROR: in $ENTRY_PATH .entry.json is not a non-empty readable file: $ENTRY_JSON" 1>&2
exit 8
fi
# always add the '-U URL' for the winner index.html file
# always add the '-U URL' for the entry's index.html file
#
TOOL_OPTION+=("-U")
TOOL_OPTION+=("$SITE_URL/$YYYY_DIR/index.html")
@@ -484,9 +484,9 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: NOOP=$NOOP" 1>&2
echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2
echo "$0: debug[3]: EXIT_CODE=$EXIT_CODE" 1>&2
echo "$0: debug[3]: WINNER_PATH=$WINNER_PATH" 1>&2
echo "$0: debug[3]: ENTRY_PATH=$ENTRY_PATH" 1>&2
echo "$0: debug[3]: YEAR_DIR=$YEAR_DIR" 1>&2
echo "$0: debug[3]: WINNER_DIR=$WINNER_DIR" 1>&2
echo "$0: debug[3]: ENTRY_DIR=$ENTRY_DIR" 1>&2
for index in "${!TOOL_OPTION[@]}"; do
echo "$0: debug[3]: TOOL_OPTION[$index]=${TOOL_OPTION[$index]}" 1>&2
done
+43 -43
View File
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
#
# readme2index - convert a winner README.md into the winner index.html
# readme2index - convert a entry's README.md into the entry's index.html
#
# We will convert a winner README.md markdown file into winner index.html file
# We will convert a entry's README.md markdown file into an entry's index.html file
# using the bin/md2html.sh tool.
#
# Copyright (c) 2023,2024 by Landon Curt Noll. All Rights Reserved.
@@ -117,7 +117,7 @@ export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-D docroot/] [-n] [-N]
-w site_url Base URL of the web site (def: $SITE_URL)
NOTE: The '-w site_url' is passed as leading options on tool command lines.
YYYY/dir path from topdir to winner directory: must contain the files: README.md, .path and .entry.json
YYYY/dir path from topdir to entry directory: must contain the files: README.md, .path and .entry.json
NOTE: The '-v level' is passed as initial command line options to the 'markdown to html tool' (md2html.sh).
The 'tagline' is passed as '-t tagline' to the 'markdown to html tool' (md2html.sh), after the '-v level'.
@@ -242,9 +242,9 @@ if [[ $# -ne 1 ]]; then
exit 3
fi
#
export WINNER_PATH="$1"
export ENTRY_PATH="$1"
if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: WINNER_PATH=$WINNER_PATH" 1>&2
echo "$0: debug[3]: ENTRY_PATH=$ENTRY_PATH" 1>&2
fi
# always add the '-v level' option, unless level is empty, to the set of options passed to the md2html.sh tool
@@ -261,40 +261,40 @@ if [[ -n $TAGLINE ]]; then
TOOL_OPTION+=("$TAGLINE")
fi
# parse the WINNER_PATH arg
# parse the ENTRY_PATH arg
#
# verify that WINNER_PATH is in proper form
# verify that ENTRY_PATH is in proper form
#
# Also obtain the YEAR_DIR and WINNER_DIR from WINNER_PATH.
# Also obtain the YEAR_DIR and ENTRY_DIR from ENTRY_PATH.
#
if [[ -z $WINNER_PATH ]]; then
if [[ -z $ENTRY_PATH ]]; then
echo "$0: ERROR: arg is an empty string" 1>&2
exit 3
fi
if [[ ! -d $WINNER_PATH ]]; then
echo "$0: ERROR: arg is not a directory: $WINNER_PATH" 1>&2
if [[ ! -d $ENTRY_PATH ]]; then
echo "$0: ERROR: arg is not a directory: $ENTRY_PATH" 1>&2
exit 3
fi
if [[ ! -w $WINNER_PATH ]]; then
echo "$0: ERROR: arg is not a writable directory: $WINNER_PATH" 1>&2
if [[ ! -w $ENTRY_PATH ]]; then
echo "$0: ERROR: arg is not a writable directory: $ENTRY_PATH" 1>&2
exit 3
fi
export YEAR_DIR=${WINNER_PATH%%/*}
export YEAR_DIR=${ENTRY_PATH%%/*}
if [[ -z $YEAR_DIR ]]; then
echo "$0: ERROR: arg not in YYYY/dir form: $WINNER_PATH" 1>&2
echo "$0: ERROR: arg not in YYYY/dir form: $ENTRY_PATH" 1>&2
exit 3
fi
if [[ ! -d $YEAR_DIR ]]; then
echo "$0: ERROR: YYYY from arg: $WINNER_PATH is not a directory: $YEAR_DIR" 1>&2
echo "$0: ERROR: YYYY from arg: $ENTRY_PATH is not a directory: $YEAR_DIR" 1>&2
exit 3
fi
export WINNER_DIR=${WINNER_PATH#*/}
if [[ -z $WINNER_DIR ]]; then
echo "$0: ERROR: arg: $WINNER_PATH not in $YEAR_DIR/dir form: $WINNER_PATH" 1>&2
export ENTRY_DIR=${ENTRY_PATH#*/}
if [[ -z $ENTRY_DIR ]]; then
echo "$0: ERROR: arg: $ENTRY_PATH not in $YEAR_DIR/dir form: $ENTRY_PATH" 1>&2
exit 3
fi
if [[ $WINNER_DIR = */* ]]; then
echo "$0: ERROR: dir from arg: $WINNER_PATH contains a /: $WINNER_DIR" 1>&2
if [[ $ENTRY_DIR = */* ]]; then
echo "$0: ERROR: dir from arg: $ENTRY_PATH contains a /: $ENTRY_DIR" 1>&2
exit 3
fi
@@ -356,59 +356,59 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: now in directory: $(/bin/pwd)" 1>&2
fi
# perform tests on YYYY_DIR (YYYY/dir) as a winner directory
# perform tests on YYYY_DIR (YYYY/dir) as a entry directory
#
export DOT_YEAR="$YEAR_DIR/.year"
if [[ ! -e $DOT_YEAR ]]; then
echo "$0: ERROR: in $WINNER_PATH .year does not exist: $DOT_YEAR" 1>&2
echo "$0: ERROR: in $ENTRY_PATH .year does not exist: $DOT_YEAR" 1>&2
exit 7
fi
if [[ ! -f $DOT_YEAR ]]; then
echo "$0: ERROR: in $WINNER_PATH .year is not a file: $DOT_YEAR" 1>&2
echo "$0: ERROR: in $ENTRY_PATH .year is not a file: $DOT_YEAR" 1>&2
exit 7
fi
if [[ ! -r $DOT_YEAR ]]; then
echo "$0: ERROR: in $WINNER_PATH .year is not a readable file: $DOT_YEAR" 1>&2
echo "$0: ERROR: in $ENTRY_PATH .year is not a readable file: $DOT_YEAR" 1>&2
exit 7
fi
if [[ ! -s $DOT_YEAR ]]; then
echo "$0: ERROR: in $WINNER_PATH .year is not a non-empty readable file: $DOT_YEAR" 1>&2
echo "$0: ERROR: in $ENTRY_PATH .year is not a non-empty readable file: $DOT_YEAR" 1>&2
exit 7
fi
# Now that we have moved to topdir, form and verify YYYY_DIR is a writable directory
export YYYY_DIR="$YEAR_DIR/$WINNER_DIR"
export YYYY_DIR="$YEAR_DIR/$ENTRY_DIR"
if [[ ! -e $YYYY_DIR ]]; then
echo "$0: ERROR: YYYY/dir from arg: $WINNER_PATH does not exist: $YYYY_DIR" 1>&2
echo "$0: ERROR: YYYY/dir from arg: $ENTRY_PATH does not exist: $YYYY_DIR" 1>&2
exit 7
fi
if [[ ! -d $YYYY_DIR ]]; then
echo "$0: ERROR: YYYY/dir from arg: $WINNER_PATH is not a directory: $YYYY_DIR" 1>&2
echo "$0: ERROR: YYYY/dir from arg: $ENTRY_PATH is not a directory: $YYYY_DIR" 1>&2
exit 7
fi
if [[ ! -w $YYYY_DIR ]]; then
echo "$0: ERROR: YYYY/dir from arg: $WINNER_PATH is not a writable directory: $YYYY_DIR" 1>&2
echo "$0: ERROR: YYYY/dir from arg: $ENTRY_PATH is not a writable directory: $YYYY_DIR" 1>&2
exit 7
fi
export DOT_PATH="$YYYY_DIR/.path"
if [[ ! -e $DOT_PATH ]]; then
echo "$0: ERROR: in $WINNER_PATH .path does not exist: $DOT_PATH" 1>&2
echo "$0: ERROR: in $ENTRY_PATH .path does not exist: $DOT_PATH" 1>&2
exit 8
fi
if [[ ! -f $DOT_PATH ]]; then
echo "$0: ERROR: in $WINNER_PATH .path is not a file: $DOT_PATH" 1>&2
echo "$0: ERROR: in $ENTRY_PATH .path is not a file: $DOT_PATH" 1>&2
exit 8
fi
if [[ ! -r $DOT_PATH ]]; then
echo "$0: ERROR: in $WINNER_PATH .path is not a readable file: $DOT_PATH" 1>&2
echo "$0: ERROR: in $ENTRY_PATH .path is not a readable file: $DOT_PATH" 1>&2
exit 8
fi
if [[ ! -s $DOT_PATH ]]; then
echo "$0: ERROR: in $WINNER_PATH .path is not a non-empty readable file: $DOT_PATH" 1>&2
echo "$0: ERROR: in $ENTRY_PATH .path is not a non-empty readable file: $DOT_PATH" 1>&2
exit 8
fi
DOT_PATH_CONTENT=$(< "$DOT_PATH")
if [[ $WINNER_PATH != "$DOT_PATH_CONTENT" ]]; then
echo "$0: ERROR: in $WINNER_PATH .path: $DOT_PATH contents: $DOT_PATH_CONTENT" 1>&2
if [[ $ENTRY_PATH != "$DOT_PATH_CONTENT" ]]; then
echo "$0: ERROR: in $ENTRY_PATH .path: $DOT_PATH contents: $DOT_PATH_CONTENT" 1>&2
exit 8
fi
@@ -417,23 +417,23 @@ fi
export README_PATH="$YYYY_DIR/README.md"
export INDEX_PATH="$YYYY_DIR/index.html"
if [[ ! -e $README_PATH ]]; then
echo "$0: ERROR: in $WINNER_PATH README.md does not exist: $README_PATH" 1>&2
echo "$0: ERROR: in $ENTRY_PATH README.md does not exist: $README_PATH" 1>&2
exit 8
fi
if [[ ! -f $README_PATH ]]; then
echo "$0: ERROR: in $WINNER_PATH README.md is not a file: $README_PATH" 1>&2
echo "$0: ERROR: in $ENTRY_PATH README.md is not a file: $README_PATH" 1>&2
exit 8
fi
if [[ ! -r $README_PATH ]]; then
echo "$0: ERROR: in $WINNER_PATH README.md is not a readable file: $README_PATH" 1>&2
echo "$0: ERROR: in $ENTRY_PATH README.md is not a readable file: $README_PATH" 1>&2
exit 8
fi
if [[ ! -s $README_PATH ]]; then
echo "$0: ERROR: in $WINNER_PATH README.md is not a non-empty readable file: $README_PATH" 1>&2
echo "$0: ERROR: in $ENTRY_PATH README.md is not a non-empty readable file: $README_PATH" 1>&2
exit 8
fi
# always add the '-U URL' for the winner index.html file
# always add the '-U URL' for the entry's index.html file
#
TOOL_OPTION+=("-U")
TOOL_OPTION+=("$SITE_URL/$YYYY_DIR/index.html")
@@ -457,9 +457,9 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: NOOP=$NOOP" 1>&2
echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2
echo "$0: debug[3]: EXIT_CODE=$EXIT_CODE" 1>&2
echo "$0: debug[3]: WINNER_PATH=$WINNER_PATH" 1>&2
echo "$0: debug[3]: ENTRY_PATH=$ENTRY_PATH" 1>&2
echo "$0: debug[3]: YEAR_DIR=$YEAR_DIR" 1>&2
echo "$0: debug[3]: WINNER_DIR=$WINNER_DIR" 1>&2
echo "$0: debug[3]: ENTRY_DIR=$ENTRY_DIR" 1>&2
for index in "${!TOOL_OPTION[@]}"; do
echo "$0: debug[3]: TOOL_OPTION[$index]=${TOOL_OPTION[$index]}" 1>&2
done
+30 -30
View File
@@ -97,7 +97,7 @@ export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-n] [-N]
-n go thru the actions, but do not update any files (def: do the action)
-N do not process file, just parse arguments and ignore the file (def: process the file)
YYYY/dir path from topdir to winner directory: must contain the files: README.md, .path and .entry.json
YYYY/dir path from topdir to entry directory: must contain the files: README.md, .path and .entry.json
Exit codes:
0 all OK
@@ -105,7 +105,7 @@ Exit codes:
2 -h and help string printed or -V and version string printed
3 command line error
4 bash version is < 4.2
5 YYYY/dir is not a winner directory
5 YYYY/dir is not a entry directory
6 sgi.sh tool not found or not executable
>= 10 internal error
@@ -168,9 +168,9 @@ if [[ $# -ne 1 ]]; then
exit 3
fi
#
export WINNER_PATH="$1"
export ENTRY_PATH="$1"
if [[ $V_FLAG -ge 1 ]]; then
echo "$0: debug[1]: WINNER_PATH=$WINNER_PATH" 1>&2
echo "$0: debug[1]: ENTRY_PATH=$ENTRY_PATH" 1>&2
fi
# verify that we have a topdir directory
@@ -235,64 +235,64 @@ if [[ ! -x $SGI_TOOL ]]; then
exit 6
fi
# verify that WINNER_PATH is a winner directory
# verify that ENTRY_PATH is a entry directory
#
# WINNER_PATH must be in YYYY/dir form
# ENTRY_PATH must be in YYYY/dir form
# YYYY must be a directory
# YYYY must be a writable directory
# YYYY/.year must be a non-empty file
# YYYY/dir must be a directory
# YYYY/dir/.path must be a non-empty file
# WINNER_PATH must match the contents of YYYY/dir/.path
# ENTRY_PATH must match the contents of YYYY/dir/.path
# YYYY/dir/.gitignore.json must be a writable file
#
if [[ ! -d $WINNER_PATH ]]; then
echo "$0: ERROR: arg is not a directory: $WINNER_PATH" 1>&2
if [[ ! -d $ENTRY_PATH ]]; then
echo "$0: ERROR: arg is not a directory: $ENTRY_PATH" 1>&2
exit 5
fi
if [[ ! -w $WINNER_PATH ]]; then
echo "$0: ERROR: arg is not a writable directory: $WINNER_PATH" 1>&2
if [[ ! -w $ENTRY_PATH ]]; then
echo "$0: ERROR: arg is not a writable directory: $ENTRY_PATH" 1>&2
exit 5
fi
export YEAR_DIR=${WINNER_PATH%%/*}
export YEAR_DIR=${ENTRY_PATH%%/*}
if [[ -z $YEAR_DIR ]]; then
echo "$0: ERROR: arg not in YYYY/dir form: $WINNER_PATH" 1>&2
echo "$0: ERROR: arg not in YYYY/dir form: $ENTRY_PATH" 1>&2
exit 5
fi
export WINNER_DIR=${WINNER_PATH#*/}
if [[ -z $WINNER_DIR ]]; then
echo "$0: ERROR: arg: $WINNER_PATH not in $YEAR_DIR/dir form: $WINNER_PATH" 1>&2
export ENTRY_DIR=${ENTRY_PATH#*/}
if [[ -z $ENTRY_DIR ]]; then
echo "$0: ERROR: arg: $ENTRY_PATH not in $YEAR_DIR/dir form: $ENTRY_PATH" 1>&2
exit 5
fi
if [[ $WINNER_DIR = */* ]]; then
echo "$0: ERROR: dir from arg: $WINNER_PATH contains a /: $WINNER_DIR" 1>&2
if [[ $ENTRY_DIR = */* ]]; then
echo "$0: ERROR: dir from arg: $ENTRY_PATH contains a /: $ENTRY_DIR" 1>&2
exit 5
fi
if [[ ! -d $YEAR_DIR ]]; then
echo "$0: ERROR: YYYY from arg: $WINNER_PATH is not a directory: $YEAR_DIR" 1>&2
echo "$0: ERROR: YYYY from arg: $ENTRY_PATH is not a directory: $YEAR_DIR" 1>&2
exit 5
fi
export WINNER_ID="${YEAR_DIR}_${WINNER_DIR}"
export ENTRY_ID="${YEAR_DIR}_${ENTRY_DIR}"
export DOT_YEAR="$YEAR_DIR/.year"
if [[ ! -s $DOT_YEAR ]]; then
echo "$0: ERROR: not a non-empty file: $DOT_YEAR" 1>&2
exit 5
fi
if [[ ! -d $YEAR_DIR/$WINNER_DIR ]]; then
echo "$0: ERROR: YYYY/dir from arg: $WINNER_PATH is not a directory: $YEAR_DIR/$WINNER_DIR" 1>&2
if [[ ! -d $YEAR_DIR/$ENTRY_DIR ]]; then
echo "$0: ERROR: YYYY/dir from arg: $ENTRY_PATH is not a directory: $YEAR_DIR/$ENTRY_DIR" 1>&2
exit 5
fi
export DOT_PATH="$YEAR_DIR/$WINNER_DIR/.path"
export DOT_PATH="$YEAR_DIR/$ENTRY_DIR/.path"
if [[ ! -s $DOT_PATH ]]; then
echo "$0: ERROR: not a non-empty file: $DOT_PATH" 1>&2
exit 5
fi
DOT_PATH_CONTENT=$(< "$DOT_PATH")
if [[ $WINNER_PATH != "$DOT_PATH_CONTENT" ]]; then
echo "$0: ERROR: arg: $WINNER_PATH does not match $DOT_PATH contents: $DOT_PATH_CONTENT" 1>&2
if [[ $ENTRY_PATH != "$DOT_PATH_CONTENT" ]]; then
echo "$0: ERROR: arg: $ENTRY_PATH does not match $DOT_PATH contents: $DOT_PATH_CONTENT" 1>&2
exit 5
fi
export GITIGNORE="$YEAR_DIR/$WINNER_DIR/.gitignore"
export GITIGNORE="$YEAR_DIR/$ENTRY_DIR/.gitignore"
if [[ ! -e $GITIGNORE ]]; then
echo "$0: ERROR: .entry.json does not exist: $GITIGNORE" 1>&2
exit 5
@@ -316,13 +316,13 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: SGI_TOOL=$SGI_TOOL" 1>&2
echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2
echo "$0: debug[3]: NOOP=$NOOP" 1>&2
echo "$0: debug[3]: WINNER_PATH=$WINNER_PATH" 1>&2
echo "$0: debug[3]: ENTRY_PATH=$ENTRY_PATH" 1>&2
echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2
echo "$0: debug[3]: BIN_PATH=$BIN_PATH" 1>&2
echo "$0: debug[3]: BIN_DIR=$BIN_DIR" 1>&2
echo "$0: debug[3]: YEAR_DIR=$YEAR_DIR" 1>&2
echo "$0: debug[3]: WINNER_DIR=$WINNER_DIR" 1>&2
echo "$0: debug[3]: WINNER_ID=$WINNER_ID" 1>&2
echo "$0: debug[3]: ENTRY_DIR=$ENTRY_DIR" 1>&2
echo "$0: debug[3]: ENTRY_ID=$ENTRY_ID" 1>&2
echo "$0: debug[3]: DOT_YEAR=$DOT_YEAR" 1>&2
echo "$0: debug[3]: DOT_PATH=$DOT_PATH" 1>&2
echo "$0: debug[3]: GITIGNORE=$GITIGNORE" 1>&2
@@ -339,7 +339,7 @@ fi
# create a temporary markdown for pandoc to process
#
TMP_FILE="$WINNER_PATH/.$NAME.$$.sgi.sh"
TMP_FILE="$ENTRY_PATH/.$NAME.$$.sgi.sh"
if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: temporary markdown file: $TMP_FILE" 1>&2
fi
+41 -41
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#
# subst.entry-index.sh - print substitutions for a winner index.html
# subst.entry-index.sh - print substitutions for a entry's index.html
#
# This tool is used in conjunction with the inc/md2html.cfg configuration
# file, and the tools that use that use that configuration file such as "bin/md2html.sh".
@@ -101,7 +101,7 @@ export USAGE="usage: $0 [-h] [-v level] [-V] [-d topdir] [-n] [-N]
-e string output string, followed by newline, to stderr (def: do not)
-E exitcode force exit with exitcode (def: exit based on success or failure of the action)
YYYY/dir path from topdir to winner directory: must contain the files: README.md, .path and .entry.json
YYYY/dir path from topdir to entry directory: must contain the files: README.md, .path and .entry.json
Exit codes:
0 all OK
@@ -109,7 +109,7 @@ Exit codes:
2 -h and help string printed or -V and version string printed
3 command line error
4 bash version is < 4.2
5 YYYY/dir is not a winner directory
5 YYYY/dir is not a entry directory
6 subst.entry-navbar.awk tool not found
7 cannot find important information about the author or winning entry
>= 10 < 210 ((not used))
@@ -121,7 +121,7 @@ $NAME version: $VERSION"
#
# XXX - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - XXX
# XXX - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - XXX
# XXX - until we have the jnamval command, we must FAKE PARSE the .entry.json file - XXX
# XXX - until we have the jnamval command, we must FAKE PARSE the .entry.json file - XXX
# XXX - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - GROSS HACK - XXX
# XXX - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - XXX
#
@@ -245,9 +245,9 @@ if [[ $# -ne 1 ]]; then
exit 3
fi
#
export WINNER_PATH="$1"
export ENTRY_PATH="$1"
if [[ $V_FLAG -ge 1 ]]; then
echo "$0: debug[1]: WINNER_PATH=$WINNER_PATH" 1>&2
echo "$0: debug[1]: ENTRY_PATH=$ENTRY_PATH" 1>&2
fi
# verify that we have a topdir directory
@@ -320,61 +320,61 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: now in directory: $(/bin/pwd)" 1>&2
fi
# verify that WINNER_PATH is a winner directory
# verify that ENTRY_PATH is a entry directory
#
# WINNER_PATH must be in YYYY/dir form
# ENTRY_PATH must be in YYYY/dir form
# YYYY must be a directory
# YYYY must be a writable directory
# YYYY/.year must be a non-empty file
# YYYY/dir must be a directory
# YYYY/dir/.path must be a non-empty file
# WINNER_PATH must match the contents of YYYY/dir/.path
# ENTRY_PATH must match the contents of YYYY/dir/.path
# YYYY/dir/.entry.json must be a non-empty file
#
if [[ ! -d $WINNER_PATH ]]; then
echo "$0: ERROR: arg is not a directory: $WINNER_PATH" 1>&2
if [[ ! -d $ENTRY_PATH ]]; then
echo "$0: ERROR: arg is not a directory: $ENTRY_PATH" 1>&2
exit 5
fi
if [[ ! -w $WINNER_PATH ]]; then
echo "$0: ERROR: arg is not a writable directory: $WINNER_PATH" 1>&2
if [[ ! -w $ENTRY_PATH ]]; then
echo "$0: ERROR: arg is not a writable directory: $ENTRY_PATH" 1>&2
exit 5
fi
export YEAR_DIR=${WINNER_PATH%%/*}
export YEAR_DIR=${ENTRY_PATH%%/*}
if [[ -z $YEAR_DIR ]]; then
echo "$0: ERROR: arg not in YYYY/dir form: $WINNER_PATH" 1>&2
echo "$0: ERROR: arg not in YYYY/dir form: $ENTRY_PATH" 1>&2
exit 5
fi
export WINNER_DIR=${WINNER_PATH#*/}
if [[ -z $WINNER_DIR ]]; then
echo "$0: ERROR: arg: $WINNER_PATH not in $YEAR_DIR/dir form: $WINNER_PATH" 1>&2
export ENTRY_DIR=${ENTRY_PATH#*/}
if [[ -z $ENTRY_DIR ]]; then
echo "$0: ERROR: arg: $ENTRY_PATH not in $YEAR_DIR/dir form: $ENTRY_PATH" 1>&2
exit 5
fi
if [[ $WINNER_DIR = */* ]]; then
echo "$0: ERROR: dir from arg: $WINNER_PATH contains a /: $WINNER_DIR" 1>&2
if [[ $ENTRY_DIR = */* ]]; then
echo "$0: ERROR: dir from arg: $ENTRY_PATH contains a /: $ENTRY_DIR" 1>&2
exit 5
fi
if [[ ! -d $YEAR_DIR ]]; then
echo "$0: ERROR: YYYY from arg: $WINNER_PATH is not a directory: $YEAR_DIR" 1>&2
echo "$0: ERROR: YYYY from arg: $ENTRY_PATH is not a directory: $YEAR_DIR" 1>&2
exit 5
fi
export WINNER_ID="${YEAR_DIR}_${WINNER_DIR}"
export ENTRY_ID="${YEAR_DIR}_${ENTRY_DIR}"
export DOT_YEAR="$YEAR_DIR/.year"
if [[ ! -s $DOT_YEAR ]]; then
echo "$0: ERROR: not a non-empty file: $DOT_YEAR" 1>&2
exit 5
fi
# Now that we have moved to topdir, form and verify YYYY_DIR is a writable directory
export YYYY_DIR="$YEAR_DIR/$WINNER_DIR"
export YYYY_DIR="$YEAR_DIR/$ENTRY_DIR"
if [[ ! -e $YYYY_DIR ]]; then
echo "$0: ERROR: YYYY/dir from arg: $WINNER_PATH does not exist: $YYYY_DIR" 1>&2
echo "$0: ERROR: YYYY/dir from arg: $ENTRY_PATH does not exist: $YYYY_DIR" 1>&2
exit 5
fi
if [[ ! -d $YYYY_DIR ]]; then
echo "$0: ERROR: YYYY/dir from arg: $WINNER_PATH is not a directory: $YYYY_DIR" 1>&2
echo "$0: ERROR: YYYY/dir from arg: $ENTRY_PATH is not a directory: $YYYY_DIR" 1>&2
exit 5
fi
if [[ ! -w $YYYY_DIR ]]; then
echo "$0: ERROR: YYYY/dir from arg: $WINNER_PATH is not a writable directory: $YYYY_DIR" 1>&2
echo "$0: ERROR: YYYY/dir from arg: $ENTRY_PATH is not a writable directory: $YYYY_DIR" 1>&2
exit 5
fi
export DOT_PATH="$YYYY_DIR/.path"
@@ -383,8 +383,8 @@ if [[ ! -s $DOT_PATH ]]; then
exit 5
fi
DOT_PATH_CONTENT=$(< "$DOT_PATH")
if [[ $WINNER_PATH != "$DOT_PATH_CONTENT" ]]; then
echo "$0: ERROR: arg: $WINNER_PATH does not match $DOT_PATH contents: $DOT_PATH_CONTENT" 1>&2
if [[ $ENTRY_PATH != "$DOT_PATH_CONTENT" ]]; then
echo "$0: ERROR: arg: $ENTRY_PATH does not match $DOT_PATH contents: $DOT_PATH_CONTENT" 1>&2
exit 5
fi
export ENTRY_JSON="$YYYY_DIR/.entry.json"
@@ -403,17 +403,17 @@ fi
# verify we have our awk script
#
export WINNER_NAVBAR_AWK="$BIN_DIR/subst.entry-navbar.awk"
if [[ ! -e $WINNER_NAVBAR_AWK ]]; then
echo "$0: ERROR: bin/subst.entry-navbar.awk does not exist: $WINNER_NAVBAR_AWK" 1>&2
export ENTRY_NAVBAR_AWK="$BIN_DIR/subst.entry-navbar.awk"
if [[ ! -e $ENTRY_NAVBAR_AWK ]]; then
echo "$0: ERROR: bin/subst.entry-navbar.awk does not exist: $ENTRY_NAVBAR_AWK" 1>&2
exit 6
fi
if [[ ! -f $WINNER_NAVBAR_AWK ]]; then
echo "$0: ERROR: bin/subst.entry-navbar.awk is not a file: $WINNER_NAVBAR_AWK" 1>&2
if [[ ! -f $ENTRY_NAVBAR_AWK ]]; then
echo "$0: ERROR: bin/subst.entry-navbar.awk is not a file: $ENTRY_NAVBAR_AWK" 1>&2
exit 6
fi
if [[ ! -r $WINNER_NAVBAR_AWK ]]; then
echo "$0: ERROR: bin/subst.entry-navbar.awk is not a readable file: $WINNER_NAVBAR_AWK" 1>&2
if [[ ! -r $ENTRY_NAVBAR_AWK ]]; then
echo "$0: ERROR: bin/subst.entry-navbar.awk is not a readable file: $ENTRY_NAVBAR_AWK" 1>&2
exit 6
fi
@@ -431,8 +431,8 @@ export AWARD
if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: NAME=$NAME" 1>&2
echo "$0: debug[3]: YEAR_DIR=$YEAR_DIR" 1>&2
echo "$0: debug[3]: WINNER_DIR=$WINNER_DIR" 1>&2
echo "$0: debug[3]: WINNER_ID=$WINNER_ID" 1>&2
echo "$0: debug[3]: ENTRY_DIR=$ENTRY_DIR" 1>&2
echo "$0: debug[3]: ENTRY_ID=$ENTRY_ID" 1>&2
echo "$0: debug[3]: DOT_YEAR=$DOT_YEAR" 1>&2
echo "$0: debug[3]: DOT_PATH=$DOT_PATH" 1>&2
echo "$0: debug[3]: ENTRY_JSON=$ENTRY_JSON" 1>&2
@@ -448,7 +448,7 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: INC_DIR=$INC_DIR" 1>&2
echo "$0: debug[3]: BIN_PATH=$BIN_PATH" 1>&2
echo "$0: debug[3]: BIN_DIR=$BIN_DIR" 1>&2
echo "$0: debug[3]: WINNER_NAVBAR_AWK=$WINNER_NAVBAR_AWK" 1>&2
echo "$0: debug[3]: ENTRY_NAVBAR_AWK=$ENTRY_NAVBAR_AWK" 1>&2
echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2
echo "$0: debug[3]: NOOP=$NOOP" 1>&2
fi
@@ -470,12 +470,12 @@ echo "TITIE=$YYYY_DIR - $AWARD"
# output DESCRIPTION substitution
#
echo "-s"
echo "DESCRIPTION=$YEAR_DIR IOCCC winner $WINNER_DIR - $AWARD"
echo "DESCRIPTION=$YEAR_DIR IOCCC entry $ENTRY_DIR - $AWARD"
# output KEYWORDS substitution
#
echo "-s"
echo "KEYWORDS=IOCCC, $YEAR_DIR, IOCCC $YEAR_DIR, IOCCC winner, $WINNER_DIR, $AWARD"
echo "KEYWORDS=IOCCC, $YEAR_DIR, IOCCC $YEAR_DIR, IOCCC entry, $ENTRY_DIR, $AWARD"
# output HEADER_2 substitution
#
@@ -484,7 +484,7 @@ echo "HEADER_2=$YYYY_DIR - $AWARD"
# output topnav links
#
awk -v winner_path="$YYYY_DIR" -f "$WINNER_NAVBAR_AWK" "$DOT_YEAR"
awk -v entry_path="$YYYY_DIR" -f "$ENTRY_NAVBAR_AWK" "$DOT_YEAR"
status="$?"
if [[ $status -ne 0 ]]; then
echo "$0: ERROR: subst.entry-navbar.awk failed, error: $status" 1>&2
+21 -21
View File
@@ -11,7 +11,7 @@
#
# usage:
#
# awk -v winner_path=YYYY/dir -f bin/subst.winner-navbar.awk YYYY/.year
# awk -v entry_path=YYYY/dir -f bin/subst.winner-navbar.awk YYYY/.year
#
# where:
#
@@ -23,15 +23,15 @@ BEGIN {
# setup
#
VERSION="1.1 2024-01-29"
process_next_line = 0; # 1 ==> we found our winner_path, now process the next line
found_winner_path = 0; # 1 ==> we found our winner_path
process_next_line = 0; # 1 ==> we found our entry_path, now process the next line
found_entry_path = 0; # 1 ==> we found our entry_path
prev_line = ""; # the previous YYYY/dir line
topnav_phase = "mid"; # topnav name to use (-H topnav=topnav_phase)
# error if github is not set via -v github=REPO_URL
#
if (length(winner_path) == 0) {
exit 210; # use 210 to match length(winner_path) == 0 error in the END section
if (length(entry_path) == 0) {
exit 210; # use 210 to match length(entry_path) == 0 error in the END section
}
}
@@ -53,11 +53,11 @@ $0 ~ /[^\/]+\/[^\/]+/ {
year = file[1];
dir = file[2];
# if we need the line after we found our winner_path
# if we need the line after we found our entry_path
#
if (process_next_line) {
# process the line after we found our winner_path
# process the line after we found our entry_path
#
# report the previous entry for this year
print "-s";
@@ -66,14 +66,14 @@ $0 ~ /[^\/]+\/[^\/]+/ {
print "RIGHT_TEXT=" dir;
process_next_line = 0;
# if we found our winner_path
# if we found our entry_path
#
} else if (winner_path == $0) {
} else if (entry_path == $0) {
# in case our our winner_path is the 1st line
# in case our our entry_path is the 1st line
#
if (NR == 1) {
# no previous line winner_path is the 1st line
# no previous line entry_path is the 1st line
topnav_phase = "first";
}
@@ -109,7 +109,7 @@ $0 ~ /[^\/]+\/[^\/]+/ {
print "LEFT_TEXT=" prev_dir;
}
# process our found winner_path
# process our found entry_path
#
# report up link top year index.html
print "-s";
@@ -117,7 +117,7 @@ $0 ~ /[^\/]+\/[^\/]+/ {
print "-s";
print "UP_TEXT=" year;
process_next_line = 1;
found_winner_path = 1;
found_entry_path = 1;
}
# save the line as the next previous line
@@ -141,12 +141,12 @@ END {
# error if github is not set via -v github=REPO_URL
#
if (length(winner_path) == 0) {
if (length(entry_path) == 0) {
print "-e";
print "'ERROR: github variable not set, call with -v github=REPO_URL'";
print "-E";
print "210"; # use 210 to match length(winner_path) == 0 error in the BEGIN section
exit 210; # use 210 to match length(winner_path) == 0 error in the BEGIN section
print "210"; # use 210 to match length(entry_path) == 0 error in the BEGIN section
exit 210; # use 210 to match length(entry_path) == 0 error in the BEGIN section
}
# output inventory link information
@@ -156,18 +156,18 @@ END {
print "-s";
print "INVENTORY_TEXT=Inventory";
# case: we did not find our winner_path
# case: we did not find our entry_path
#
if (!found_winner_path) {
# ERROR: winner_path was not found
if (!found_entry_path) {
# ERROR: entry_path was not found
print "-e";
print "'we did not find:", winner_path "'";
print "'we did not find:", entry_path "'";
print "-E";
print "215";
exit
} else if (process_next_line) {
# no next line winner_path is the last line
# no next line entry_path is the last line
topnav_phase = "last";
}