improve entry index.html navbar links
We improve entry `index.html` navbar links by allowing the next and previous to link across years. The `make genpath` now forms `.allyear`, which is a sorted contamination of all YYY level `.year` files. Updated `make help` to reflect the `make genpath` functionality. Updated FAQ 6.8 to talk about the `.allyear` file. Fixed links to `.top` and `.allyear' to refer to GitHub. Changed `bin/subst.entry-navbar.awk` VERSION from "1.2 2024-03-02" to "1.3 2024-08-02". Changed `bin/subst.entry-index.sh` VERSION from "1.3.5 2024-08-05" to "1.4 2024-08-09". Performed `make www` to accomplish the above and to test under macOS.
This commit is contained in:
1 parent
8683845014
commit
a956c3d1e5
327 files changed
+1143
-777
No files matched your search
@@ -103,7 +103,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.5 2024-08-05"
|
||||
export VERSION="1.4 2024-08-09"
|
||||
NAME=$(basename "$0")
|
||||
export NAME
|
||||
export V_FLAG=0
|
||||
@@ -391,9 +391,9 @@ if [[ ! -d $YEAR_DIR ]]; then
|
||||
exit 3
|
||||
fi
|
||||
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
|
||||
export DOT_ALLYEAR=".allyear"
|
||||
if [[ ! -s $DOT_ALLYEAR ]]; then
|
||||
echo "$0: ERROR: not a non-empty file: $DOT_ALLYEAR" 1>&2
|
||||
exit 6
|
||||
fi
|
||||
# Now that we have moved to topdir, form and verify YYYY_DIR is a writable directory
|
||||
@@ -486,7 +486,7 @@ if [[ $V_FLAG -ge 3 ]]; then
|
||||
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
|
||||
echo "$0: debug[3]: DOT_YEAR=$DOT_YEAR" 1>&2
|
||||
echo "$0: debug[3]: DOT_ALLYEAR=$DOT_ALLYEAR" 1>&2
|
||||
echo "$0: debug[3]: YYYY_DIR=$YYYY_DIR" 1>&2
|
||||
echo "$0: debug[3]: DOT_PATH=$DOT_PATH" 1>&2
|
||||
echo "$0: debug[3]: DOT_PATH_CONTENT=$DOT_PATH_CONTENT" 1>&2
|
||||
@@ -526,7 +526,7 @@ echo "HEADER_2=$YYYY_DIR - $AWARD"
|
||||
|
||||
# output navbar left hand side links
|
||||
#
|
||||
awk -v entry_path="$YYYY_DIR" -f "$ENTRY_NAVBAR_AWK" "$DOT_YEAR"
|
||||
awk -v entry_path="$YYYY_DIR" -f "$ENTRY_NAVBAR_AWK" "$DOT_ALLYEAR"
|
||||
status="$?"
|
||||
if [[ $status -ne 0 ]]; then
|
||||
echo "$0: ERROR: subst.entry-navbar.awk failed, error: $status" 1>&2
|
||||
|
||||
+45
-17
@@ -13,6 +13,10 @@
|
||||
#
|
||||
# awk -v entry_path=YYYY/dir -f bin/subst.entry-navbar.awk YYYY/.year
|
||||
#
|
||||
# usage:
|
||||
#
|
||||
# awk -v entry_path=YYYY/dir -f bin/subst.entry-navbar.awk .allyear
|
||||
#
|
||||
# where:
|
||||
#
|
||||
# YYYY IOCCC year or mock
|
||||
@@ -22,7 +26,7 @@ BEGIN {
|
||||
|
||||
# setup
|
||||
#
|
||||
VERSION="1.2 2024-03-02"
|
||||
VERSION="1.3 2024-08-02"
|
||||
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
|
||||
@@ -33,6 +37,15 @@ BEGIN {
|
||||
if (length(entry_path) == 0) {
|
||||
exit 210; # use 210 to match length(entry_path) == 0 error in the END section
|
||||
}
|
||||
|
||||
# determine entry_path_year and entry_path_dir
|
||||
#
|
||||
len = split(entry_path, file, "/");
|
||||
if (len != 2) {
|
||||
exit 211; # use 211 to match len != 2 error in the END section
|
||||
}
|
||||
entry_path_year = file[1];
|
||||
entry_path_dir = file[2];
|
||||
}
|
||||
|
||||
# process YYYY/dir lines
|
||||
@@ -47,7 +60,7 @@ $0 ~ /[^\/]+\/[^\/]+/ {
|
||||
print "-e";
|
||||
print "'invalid split of:", $0, "expected 2 part, found:", len "'";
|
||||
print "-E";
|
||||
print "211";
|
||||
print "212";
|
||||
exit
|
||||
}
|
||||
year = file[1];
|
||||
@@ -60,10 +73,15 @@ $0 ~ /[^\/]+\/[^\/]+/ {
|
||||
# process the line after we found our entry_path
|
||||
#
|
||||
# report the previous entry for this year
|
||||
if (year == entry_path_year) {
|
||||
print "-s";
|
||||
print "RIGHT_LINK=../" dir "/index.html";
|
||||
} else {
|
||||
print "-s";
|
||||
print "RIGHT_LINK=../../" year "/" dir "/index.html";
|
||||
}
|
||||
print "-s";
|
||||
print "RIGHT_LINK=../" dir "/index.html";
|
||||
print "-s";
|
||||
print "RIGHT_TEXT=" dir;
|
||||
print "RIGHT_TEXT=" year "/" dir;
|
||||
process_next_line = 0;
|
||||
|
||||
# if we found our entry_path
|
||||
@@ -89,24 +107,22 @@ $0 ~ /[^\/]+\/[^\/]+/ {
|
||||
print "-e";
|
||||
print "'invalid split of:", prev_line "expected 2 part, found:", prev_len "'";
|
||||
print "-E";
|
||||
print "212";
|
||||
print "213";
|
||||
exit
|
||||
}
|
||||
prev_year = file[1];
|
||||
prev_dir = file[2];
|
||||
if (year != prev_year) {
|
||||
# ERROR: previous YYYY/dir YYYY does not match current line
|
||||
print "-e";
|
||||
print "'previous line:", prev_line "year:", prev_year, "!= current line year:", year "'";
|
||||
print "-E";
|
||||
print "213";
|
||||
}
|
||||
|
||||
# report the next entry for this year
|
||||
if (prev_year == entry_path_year) {
|
||||
print "-s";
|
||||
print "LEFT_LINK=../" prev_dir "/index.html";
|
||||
} else {
|
||||
print "-s";
|
||||
print "LEFT_LINK=../../" prev_year "/" prev_dir "/index.html";
|
||||
}
|
||||
print "-s";
|
||||
print "LEFT_LINK=../" prev_dir "/index.html";
|
||||
print "-s";
|
||||
print "LEFT_TEXT=" prev_dir;
|
||||
print "LEFT_TEXT=" prev_year "/" prev_dir;
|
||||
}
|
||||
|
||||
# process our found entry_path
|
||||
@@ -139,7 +155,7 @@ $0 !~ /[^\/]+\/[^\/]+/ {
|
||||
|
||||
END {
|
||||
|
||||
# error if github is not set via -v github=REPO_URL
|
||||
# error if entry_path is not set via -v entry_path=YYYY/dir
|
||||
#
|
||||
if (length(entry_path) == 0) {
|
||||
print "-e";
|
||||
@@ -149,6 +165,18 @@ END {
|
||||
exit 210; # use 210 to match length(entry_path) == 0 error in the BEGIN section
|
||||
}
|
||||
|
||||
# error if entry_path_year and entry_path_dir
|
||||
#
|
||||
len = split(entry_path, file, "/");
|
||||
if (len != 2) {
|
||||
# ERROR: invalid split of a YYYY/dir line
|
||||
print "-e";
|
||||
print "'invalid split of entry_path:", entry_path, "expected 2 part, found:", len "'";
|
||||
print "-E";
|
||||
print "211";
|
||||
exit 211;
|
||||
}
|
||||
|
||||
# case: we did not find our entry_path
|
||||
#
|
||||
if (!found_entry_path) {
|
||||
|
||||
Reference in new issue
Block a user