From 8bc49658c267d4380450b167b21253d127d4977f Mon Sep 17 00:00:00 2001 From: Steven Baltakatei Sandoval Date: Mon, 29 Jul 2024 20:36:12 +0000 Subject: [PATCH 1/1] fix(user/mw_create_subpage_navlinks.sh):Process final line correctly --- user/mw_create_subpage_navlinks.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/user/mw_create_subpage_navlinks.sh b/user/mw_create_subpage_navlinks.sh index 5cdf74a..c4aee6f 100755 --- a/user/mw_create_subpage_navlinks.sh +++ b/user/mw_create_subpage_navlinks.sh @@ -3,7 +3,7 @@ # Input: file text file with list of chapters # stdin text with list of chapters # Output: [[../Chapter 4|Next]], [[../Chapter 2|Previous]], [[../|Up]] -# Version: 0.1.0 +# Version: 0.1.1 # Attrib: Steven Baltakatei Sandoval. (2024-07-17). reboil.com # License: GPLv3+ @@ -270,7 +270,7 @@ generate_wikicode() { # Print navigation link wikicode if [[ -z "$lprev" ]]; then printf "[[%s|Next]], [[../|Up]]\n" "$link_next"; - elif [[ -n "$lprev" ]]; then + elif [[ -n "$lnext" ]]; then printf "[[%s|Next]], [[%s|Previous]], [[../|Up]]\n" "$link_next" "$link_prev"; elif [[ -z "$lnext" ]]; then printf "[[%s|Previous]], [[../|Up]]\n" "$link_prev"; @@ -278,11 +278,12 @@ generate_wikicode() { echo "FATAL:Here be dragons." 1>&2; fi; - #declare -p n lprev lcurr lnext lprev_hier lcurr_hier lnext_hier; # debug + #declare -p n line lprev lcurr lnext lprev_hier lcurr_hier lnext_hier; # debug #declare -p fork_level_next fork_level_prev relups_next relups_prev; # debug #declare -p link_next link_prev; # debug + #printf "====================\n" # debug ((n++)); - done < <(read_stdin); # read stdin plus one more blank line + done < <(read_stdin; printf "\n"; ); # read stdin plus one more blank line }; # Generate wikicode from validated subpage lines main() { read_input "$@" | validate_subpage_list | generate_wikicode; -- 2.30.2