]> zdv2.bktei.com Git - BK-2020-03.git/blobdiff - user/mw_wc2sp.sh
fix(unitproc/bkt-sum_float):Simplify
[BK-2020-03.git] / user / mw_wc2sp.sh
index 4ffdd884672f91677d34245f94c2ed46dd3a6d8a..f0981a2bf5024ba2673aec44f34b7e1c1c888a98 100755 (executable)
@@ -4,7 +4,7 @@
 # Input:  arg1  path  input wikicode file
 # Output: files       wikicode file tree
 # Depends: Bash 5.1.16, GNU Coreutils 8.32
-# Version: 0.2.0
+# Version: 0.5.0
 
 re_sp='^(<!-- @subpage:)(.*)([ ]*-->)$'; # subpage marker pattern
 d_out=./wikicode/; # default output dir
@@ -234,8 +234,28 @@ print_wc_footer() {
     printf -- "\n==References==\n<references />\n"
     printf -- "\n==Footnotes==\n<references group=fn />\n";
     printf -- "\n==Comments==\n<references group=cmt />\n";
+    printf -- "\n<!-- End of Page -->\n";
     printf -- "\n";
 }; # print wikicode footer
+print_wc_nav() {
+    # Desc: Print navigation wikilinks
+    # Input:  var  lprev
+    #         var  lnext
+    #         var  link_prev
+    #         var  link_next
+    # Output  stdout
+
+    # Print navigation link wikicode
+    if [[ -z "$lprev" ]]; then
+        printf "\n[[%s|Next]], [[../|Up]]\n" "$link_next";
+    elif [[ -n "$lnext" ]]; then
+        printf "\n[[%s|Next]], [[%s|Previous]], [[../|Up]]\n" "$link_next" "$link_prev";
+    elif [[ -z "$lnext" ]]; then
+        printf "\n[[%s|Previous]], [[../|Up]]\n" "$link_prev";
+    else
+        yell "FATAL:Here be dragons.";
+    fi;
+}; # print wikicode navigation links
 create_output_wikicode() {
     # Desc: Use subpage list and subpage content files to create
     #   output subpage wikicode.
@@ -271,7 +291,7 @@ create_output_wikicode() {
 
     # Initialize subpage list wikicode file
     must touch "$p_splwc";
-    printf "==Stats==\n\n==Subpages==\n" >> "$p_splwc";
+    printf "==Stats==\n* Author:\n* Publication date:\n* [[/Combined]]\n\n==Subpages==\n" >> "$p_splwc";
     
     # Read content files according to subpage list file    
     #   Note: $i corresponds to “next” line ($lnext). Therefore, use
@@ -335,19 +355,10 @@ create_output_wikicode() {
         link_next+="$(prune_path_rootside "$lnext" "$fork_level_next")";
         link_prev+="$(prune_path_rootside "$lprev" "$fork_level_prev")";
 
-        # Print navigation link wikicode
-        if [[ -z "$lprev" ]]; then
-            printf "[[%s|Next]], [[../|Up]]\n" "$link_next" >> "$p_spwc";
-        elif [[ -n "$lnext" ]]; then
-            printf "[[%s|Next]], [[%s|Previous]], [[../|Up]]\n" "$link_next" "$link_prev" >> "$p_spwc";
-        elif [[ -z "$lnext" ]]; then
-            printf "[[%s|Previous]], [[../|Up]]\n" "$link_prev" >> "$p_spwc";
-        else
-            yell "FATAL:Here be dragons.";
-        fi;
-
         # Print subpage content
+        print_wc_nav >> "$p_spwc";
         print_wc_content >> "$p_spwc";
+        print_wc_nav >> "$p_spwc";
         print_wc_footer >> "$p_spwc";
 
         declare -p i lprev lcurr lnext lprev_hier lcurr_hier lnext_hier; # debug