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

+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