From c8f3ea1fe9389f720546534ca57b050f16e34a8c Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph@amissah.com>
Date: Mon, 20 Nov 2017 13:44:08 -0500
Subject: process pod dir with sisudoc.txt (or file)

- process multiple files named in sisudoc.txt
- works with multilingual doc with inserts
- regex fixes were needed
---
 src/sdp/meta/metadoc.d           |  2 ++
 src/sdp/meta/metadoc_summary.d   |  2 +-
 src/sdp/meta/read_source_files.d | 11 +++++++----
 src/sdp/meta/rgx.d               |  6 +++---
 4 files changed, 13 insertions(+), 8 deletions(-)

(limited to 'src/sdp/meta')

diff --git a/src/sdp/meta/metadoc.d b/src/sdp/meta/metadoc.d
index b2f6270..eca4df7 100644
--- a/src/sdp/meta/metadoc.d
+++ b/src/sdp/meta/metadoc.d
@@ -2,6 +2,8 @@ module sdp.meta.metadoc;
 template SiSUabstraction() {
   import
     std.getopt,
+    std.file,
+    std.path,
     std.process;
   import
     sdp.meta,
diff --git a/src/sdp/meta/metadoc_summary.d b/src/sdp/meta/metadoc_summary.d
index 526c492..45fd319 100644
--- a/src/sdp/meta/metadoc_summary.d
+++ b/src/sdp/meta/metadoc_summary.d
@@ -10,8 +10,8 @@ template SiSUabstractionSummary() {
     import
       std.array,
       std.exception,
-      std.stdio,
       std.regex,
+      std.stdio,
       std.string,
       std.traits,
       std.typecons,
diff --git a/src/sdp/meta/read_source_files.d b/src/sdp/meta/read_source_files.d
index 9700cb6..0443ded 100644
--- a/src/sdp/meta/read_source_files.d
+++ b/src/sdp/meta/read_source_files.d
@@ -55,7 +55,8 @@ static template SiSUrawMarkupContent() {
     final private string readInMarkupSource(in char[] fn_src) {
       enforce(
         exists(fn_src)!=0,
-        "file not found"
+        "file not found: «" ~
+        fn_src ~ "»"
       );
       string source_txt_str;
       try {
@@ -96,7 +97,8 @@ static template SiSUrawMarkupContent() {
       static auto rgx = Rgx();
       enforce(
         fn_src.match(rgx.src_pth),
-        "not a sisu markup filename"
+        "not a sisu markup filename: «" ~
+        fn_src ~ "»"
       );
       auto source_txt_str = readInMarkupSource(fn_src);
       return source_txt_str;
@@ -115,12 +117,13 @@ static template SiSUrawMarkupContent() {
       return t;
     }
     final char[][] getInsertMarkupSourceContentRawLineArray(
-      in char[] fn_src_insert,
+      in char[]    fn_src_insert,
       Regex!(char) rgx_file
     ) {
       enforce(
         fn_src_insert.match(rgx_file),
-        "not a sisu markup filename"
+        "not a sisu markup filename: «" ~
+        fn_src_insert  ~ "»"
       );
       auto source_txt_str = readInMarkupSource(fn_src_insert);
       auto source_line_arr = markupSourceLineArray(source_txt_str);
diff --git a/src/sdp/meta/rgx.d b/src/sdp/meta/rgx.d
index 13b9e9f..bf1b175 100644
--- a/src/sdp/meta/rgx.d
+++ b/src/sdp/meta/rgx.d
@@ -196,9 +196,9 @@ static template SiSUrgxInit() {
     static nbsp_chars_line_start                          = ctRegex!(`^░+`, "mg");
     static nbsp_and_space                                 = ctRegex!(`&nbsp;[ ]`, "mg");
     static nbsp_char_and_space                            = ctRegex!(`░[ ]`, "mg");
-    static src_pth                                        = ctRegex!(`^(?P<path>[a-zA-Z0-9._-]+/)*(?P<filename>[a-zA-Z0-9._-]+[.]ss[tm])$`);
-    static src_pth_contents                               = ctRegex!(`^(?P<path>[a-zA-Z0-9._-]+/)*(?P<filename>[a-zA-Z0-9._-]+)/sisudoc[.]txt$`);
-    static src_pth_zip                                    = ctRegex!(`^(?P<path>[a-zA-Z0-9._-]+/)*(?P<filename>[a-zA-Z0-9._-]+[.]zip)$`);
+    static src_pth                                        = ctRegex!(`^(?P<path>(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]ss[tm])$`);
+    static src_pth_contents                               = ctRegex!(`^(?P<path>(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+)/sisudoc[.]txt$`);
+    static src_pth_zip                                    = ctRegex!(`^(?P<path>(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]zip)$`);
     static src_pth_unzip_pod                              = ctRegex!(`^(?P<path>media/text/[a-z]{2}/)*(?P<filename>[a-zA-Z0-9._-]+[.]ss[im])$`);
     static src_pth_types                                  = ctRegex!(`^(?P<path>[a-zA-Z0-9._-]+/)*(?P<gotfile>(?P<filename>[a-zA-Z0-9._-]+[.]ss[tm])|(?P<filelist>[a-zA-Z0-9._-]+/sisudoc[.]txt)|(?P<filezip>[a-zA-Z0-9._-]+[.]zip))$`);
     static src_fn                                         =
-- 
cgit v1.2.3