chore(prvt):Update submodule
[BK-2020-03.git] / user / mw_wc2sp.sh
index 4973f243a7f50a5a3d153498f10176a732773c47..ab412b36c4e49f0f2aa4f3a9374ecdbb2c8b1fb4 100755 (executable)
@@ -4,15 +4,15 @@
 # Input:  arg1  path  input wikicode file
 # Output: files       wikicode file tree
 # Depends: Bash 5.1.16, GNU Coreutils 8.32
 # Input:  arg1  path  input wikicode file
 # Output: files       wikicode file tree
 # Depends: Bash 5.1.16, GNU Coreutils 8.32
-# Version: 0.1.0
+# Version: 0.2.0
 
 re_sp='^(<!-- @subpage:)(.*)([ ]*-->)$'; # subpage marker pattern
 d_out=./wikicode/; # default output dir
 f_spl="subpage_list.txt"; # subpage title list
 
 re_sp='^(<!-- @subpage:)(.*)([ ]*-->)$'; # subpage marker pattern
 d_out=./wikicode/; # default output dir
 f_spl="subpage_list.txt"; # subpage title list
-p_spl="${d_out}/${f_spl}";
+p_spl="${d_out}/subpages/${f_spl}";
 f_splv="subpage_list_validated.txt"; # subpage title list (validated)
 f_splv="subpage_list_validated.txt"; # subpage title list (validated)
-p_splv="${d_out}/${f_splv}";
-f_splwc="subpage_list.wc"; # subpage list wikicode
+p_splv="${d_out}/subpages/${f_splv}";
+f_splwc="subpages.wc"; # subpage list wikicode
 p_splwc="${d_out}/${f_splwc}";
 
 yell() { echo "$0: $*" >&2; } # print script path and all args to stderr
 p_splwc="${d_out}/${f_splwc}";
 
 yell() { echo "$0: $*" >&2; } # print script path and all args to stderr
@@ -189,7 +189,7 @@ assemble_subpage_ftree() {
 
     yell "STATUS:Running assemble_subpage_ftree()."; # debug
 
 
     yell "STATUS:Running assemble_subpage_ftree()."; # debug
 
-    spc_path="${d_out}/presubpage.content"; # default destination for content before subpage detected
+    spc_path="${d_out}/subpages/presubpage.content"; # default destination for content before subpage detected
     
     ## Process input line-by-line
     while read -r line; do
     
     ## Process input line-by-line
     while read -r line; do
@@ -200,7 +200,7 @@ assemble_subpage_ftree() {
             sp_path="$(echo "$line" | sed -E -e "s/${re_sp}/\2/" -e 's/[ ]*$//'; )";
             # declare -p sp_path; # debug
             #### Update subpage content file path
             sp_path="$(echo "$line" | sed -E -e "s/${re_sp}/\2/" -e 's/[ ]*$//'; )";
             # declare -p sp_path; # debug
             #### Update subpage content file path
-            spc_path="${d_out}/${sp_path}.content";
+            spc_path="${d_out}/subpages/${sp_path}.content";
             spc_dir="$(dirname "$spc_path"; )";
             #declare -p spc_path spc_dir; # debug
             #### Prepare file destination
             spc_dir="$(dirname "$spc_path"; )";
             #declare -p spc_path spc_dir; # debug
             #### Prepare file destination
@@ -283,7 +283,7 @@ create_output_wikicode() {
         
         # Check subpage content files
         f_spc="${lines_spl[i-1]}.content"; 
         
         # Check subpage content files
         f_spc="${lines_spl[i-1]}.content"; 
-        p_spc="${d_out}/${f_spc}";
+        p_spc="${d_out}/subpages/${f_spc}";
         declare -p f_spc p_spc;
         ## Exit if subpage content file missing
         if [[ "$i" -gt 0 ]] && [[ ! -f "$p_spc" ]]; then
         declare -p f_spc p_spc;
         ## Exit if subpage content file missing
         if [[ "$i" -gt 0 ]] && [[ ! -f "$p_spc" ]]; then
@@ -291,7 +291,7 @@ create_output_wikicode() {
 
         # Prepare output subpage wikicode files
         f_spwc="${lines_splv[i-1]}.wc";
 
         # Prepare output subpage wikicode files
         f_spwc="${lines_splv[i-1]}.wc";
-        p_spwc="${d_out}/${f_spwc}"; # use validated subpage name
+        p_spwc="${d_out}/subpages/${f_spwc}"; # use validated subpage name
         declare -p f_spwc p_spwc; # debug
         if [[ "$i" -gt 0 ]]; then
             must touch "$p_spwc";
         declare -p f_spwc p_spwc; # debug
         if [[ "$i" -gt 0 ]]; then
             must touch "$p_spwc";