aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/sdp.org
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2017-11-20 13:44:08 -0500
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:14 -0400
commitc8f3ea1fe9389f720546534ca57b050f16e34a8c (patch)
treea3759fde79fe71ca3d02257b69912f9bac6770ad /org/sdp.org
parentprocess filesystem/unzipped sisupod.zip (diff)
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
Diffstat (limited to 'org/sdp.org')
-rw-r--r--org/sdp.org31
1 files changed, 20 insertions, 11 deletions
diff --git a/org/sdp.org b/org/sdp.org
index 9cd57bc..d0d7eaf 100644
--- a/org/sdp.org
+++ b/org/sdp.org
@@ -112,6 +112,8 @@ unittest {
#+BEGIN_SRC d
import
std.getopt,
+ std.file,
+ std.path,
std.process;
import
sdp.meta,
@@ -316,13 +318,20 @@ foreach(arg; args[1..$]) {
flag_action ~= " " ~ arg; // flags not taken by getopt
} else if (arg.match(rgx.src_pth)) {
fns_src ~= arg; // gather input markup source file names for processing
- } else if (arg.match(rgx.src_pth_contents)) {
- import std.file,
- std.path;
+ } else if (arg.match(rgx.src_pth_contents)
+ || ((arg.isDir) && ((arg.chainPath("sisudoc.txt").array).isFile))
+ ) {
string contents_location_;
+ string sisudoc_txt_;
+ if ((arg.chainPath("sisudoc.txt").array).isFile) {
+ sisudoc_txt_ = arg.chainPath("sisudoc.txt").array;
+ } else if (arg.match(rgx.src_pth_contents)) {
+ sisudoc_txt_ = arg;
+ } else {
+ }
try {
- if (exists(arg)) {
- contents_location_ = arg.readText;
+ if (exists(sisudoc_txt_)) {
+ contents_location_ = sisudoc_txt_.readText;
}
}
catch (ErrnoException ex) {
@@ -332,11 +341,11 @@ foreach(arg; args[1..$]) {
}
auto contents_locations_arr =
(cast(char[]) contents_location_).split;
- auto tmp_dir_ = (arg).dirName.array;
+ auto tmp_dir_ = (sisudoc_txt_).dirName.array;
foreach (contents_location; contents_locations_arr) {
assert(contents_location.match(rgx.src_pth),
- "not a recognised file: " ~
- contents_location
+ "not a recognised file: «" ~
+ contents_location ~ "»"
);
auto contents_location_pth_ = (contents_location).to!string;
fns_src ~= (((tmp_dir_).chainPath(contents_location_pth_)).array).to!(char[]);
@@ -401,8 +410,8 @@ scope(failure) {
}
enforce(
fn_src.match(rgx.src_pth_types),
- "not a sisu markup filename: <<" ~
- fn_src ~ ">>"
+ "not a sisu markup filename: «" ~
+ fn_src ~ "»"
);
#+END_SRC
@@ -705,8 +714,8 @@ import
import
std.array,
std.exception,
- std.stdio,
std.regex,
+ std.stdio,
std.string,
std.traits,
std.typecons,