X-Git-Url: https://zdv2.bktei.com/gitweb/BK-2020-03.git/blobdiff_plain/4f51959a8c300e9436864e8bd1bc50b53a942c81..37cfd97f7b07184f10dd6139d40f1541af2dadd4:/user/mw_create_subpage_navlinks.sh 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;