# 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+
# 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";
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;