From: Steven Baltakatei Sandoval Date: Mon, 29 Jul 2024 20:36:12 +0000 (+0000) Subject: fix(user/mw_create_subpage_navlinks.sh):Process final line correctly X-Git-Url: https://zdv2.bktei.com/gitweb/BK-2020-03.git/commitdiff_plain/8bc49658c267d4380450b167b21253d127d4977f?ds=inline fix(user/mw_create_subpage_navlinks.sh):Process final line correctly --- 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;