aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/sdp.org
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2018-07-16 22:39:09 -0400
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:15 -0400
commitfc2471c91966186fc7bc0a5ac2217496c9e43eea (patch)
treedd288cff39e82017e7c41bf8e2f084ad29c62bca /org/sdp.org
parent0.26.4 file renames, cleaning, reorganisation (diff)
0.26.5 sqlite output, focus
Diffstat (limited to 'org/sdp.org')
-rw-r--r--org/sdp.org100
1 files changed, 73 insertions, 27 deletions
diff --git a/org/sdp.org b/org/sdp.org
index b26f317..e85d040 100644
--- a/org/sdp.org
+++ b/org/sdp.org
@@ -26,7 +26,7 @@ struct Version {
int minor;
int patch;
}
-enum ver = Version(0, 26, 4);
+enum ver = Version(0, 26, 5);
#+END_SRC
** compilation restrictions (supported compilers)
@@ -217,14 +217,13 @@ scope(failure) {
}
#+END_SRC
-*** config files and command line arguements
-**** getopt args for loop :args:getopt:
+*** getopt args for loop :args:getopt:
look into using getopt
[[http://dlang.org/phobos/std_getopt.html][getopt]]
[[http://dlang.org/library/std/getopt.html][getopt]]
-***** getopt
+**** getopt
#+NAME: sdp_args
#+BEGIN_SRC d
@@ -248,9 +247,12 @@ bool[string] opts = [
"sisupod" : false,
"source" : false,
"sqlite-discrete" : false,
+ "sqlite-db-create" : false,
+ "sqlite-db-drop" : false,
+ "sqlite-db-recreate" : false,
+ "sqlite-delete" : false,
+ "sqlite-insert" : false,
"sqlite-update" : false,
- "sqlite-create" : false,
- "sqlite-drop" : false,
"text" : false,
"verbose" : false,
"xhtml" : false,
@@ -270,6 +272,7 @@ string[string] settings = [
"output-dir" : "",
"site-config-dir" : "",
"lang" : "all",
+ "sqlite-filename" : "documents",
];
auto helpInfo = getopt(args,
std.getopt.config.passThrough,
@@ -294,8 +297,11 @@ auto helpInfo = getopt(args,
"sisupod", "--sisupod sisupod source content bundled", &opts["sisupod"],
"source", "--source markup source text content", &opts["source"],
"sqlite-discrete", "--sqlite process discrete sqlite output", &opts["sqlite-discrete"],
- "sqlite-create", "--sqlite-create create db, create tables", &opts["sqlite-create"],
- "sqlite-drop", "--sqlite-drop drop tables & db", &opts["sqlite-drop"],
+ "sqlite-db-create", "--sqlite-db-create create db, create tables", &opts["sqlite-db-create"],
+ "sqlite-db-drop", "--sqlite-db-drop drop tables & db", &opts["sqlite-db-drop"],
+ "sqlite-db-recreate", "--sqlite-db-recreate create db, create tables", &opts["sqlite-db-recreate"],
+ "sqlite-delete", "--sqlite process sqlite output", &opts["sqlite-delete"],
+ "sqlite-insert", "--sqlite process sqlite output", &opts["sqlite-insert"],
"sqlite-update", "--sqlite process sqlite output", &opts["sqlite-update"],
"text", "--text process text output", &opts["text"],
"txt", "--txt process text output", &opts["text"],
@@ -314,6 +320,7 @@ auto helpInfo = getopt(args,
"skip-output", "--skip-output", &opts["skip-output"],
"output-dir", "--output-dir=[dir path]", &settings["output-dir"],
"site-config-dir", "--site-config-dir=[dir path]", &settings["site-config-dir"],
+ "sqlite-filename", "--sqlite-filename=[filename].sqlite", &settings["sqlite-filename"],
"lang", "--lang=[lang code e.g. =en or =en,es]", &settings["lang"],
);
if (helpInfo.helpWanted) {
@@ -321,7 +328,7 @@ if (helpInfo.helpWanted) {
}
#+END_SRC
-***** getopt hash to struct
+**** getopt hash to struct
#+NAME: sdp_args
#+BEGIN_SRC d
@@ -402,14 +409,34 @@ struct OptActions {
auto sqlite_discrete() {
return opts["sqlite-discrete"];
}
- auto sqlite_update() {
- return opts["sqlite-update"];
+ auto sqlite_db_drop() {
+ bool _is;
+ if (
+ opts["sqlite-db-recreate"]
+ || opts["sqlite-db-drop"]
+ ) {
+ _is = true;
+ } else { _is = false; }
+ return _is;
+ }
+ auto sqlite_db_create() {
+ bool _is;
+ if (
+ opts["sqlite-db-recreate"]
+ || opts["sqlite-db-create"]
+ ) {
+ _is = true;
+ } else { _is = false; }
+ return _is;
}
- auto sqlite_create() {
- return opts["sqlite-create"];
+ auto sqlite_insert() {
+ return opts["sqlite-insert"];
}
- auto sqlite_drop() {
- return opts["sqlite-drop"];
+ auto sqlite_delete() {
+ return opts["sqlite-delete"];
+ }
+ auto sqlite_update() {
+ return opts["sqlite-update"];
}
auto text() {
return opts["text"];
@@ -459,6 +486,9 @@ struct OptActions {
auto output_dir_set() {
return settings["output-dir"];
}
+ auto sqlite_filename() {
+ return settings["sqlite-filename"];
+ }
auto abstraction() {
bool _is;
if (
@@ -475,6 +505,8 @@ struct OptActions {
|| sisupod
|| source
|| sqlite_discrete
+ || sqlite_delete
+ || sqlite_insert
|| sqlite_update
|| text
|| xhtml
@@ -487,7 +519,7 @@ struct OptActions {
auto _opt_action = OptActions();
#+END_SRC
-***** getopt processing path, _manifest[] >>
+**** env
#+NAME: sdp_args
#+BEGIN_SRC d
@@ -495,6 +527,12 @@ auto _env = [
"pwd" : environment["PWD"],
"home" : environment["HOME"],
];
+#+END_SRC
+
+*** opt actions on processing files & file paths (pods, src etc.)
+
+#+NAME: sdp_args
+#+BEGIN_SRC d
auto _manifest_start = PodManifest!()("");
auto _manifest_matter = PathMatters!()(_opt_action, _env, "");
auto _manifests = [ _manifest_matter ];
@@ -520,10 +558,8 @@ foreach(arg; args[1..$]) {
if (exists(sisudoc_txt_)) {
contents_location_raw_ = sisudoc_txt_.readText;
}
- }
- catch (ErrnoException ex) {
- }
- catch (FileException ex) {
+ } catch (ErrnoException ex) {
+ } catch (FileException ex) {
// Handle errors
}
if (contents_location_raw_.match(rgx.pod_content_location)) { // (file name followed by language codes \n)+
@@ -553,14 +589,15 @@ foreach(arg; args[1..$]) {
) {
auto _fns = (((tmp_dir_).chainPath(contents_location_pth_)).array).to!string;
_manifest_matter = PathMatters!()(_opt_action, _env, arg, _fns, contents_locations_arr);
- _manifests ~= _manifest_matter; // TODO how to capture?
+ _manifests ~= _manifest_matter;
}
}
} else if (arg.match(rgx.src_pth_sst_or_ssm)) {
if (exists(arg)==0) {
writeln("ERROR >> Processing Skipped! File not found: ", arg);
} else {
- _manifests ~= PathMatters!()(_opt_action, _env, arg, arg); // gather input markup source file names for processing
+ _manifest_matter = PathMatters!()(_opt_action, _env, arg, arg);
+ _manifests ~= _manifest_matter;
}
} else if (arg.match(rgx.src_pth_zip)) {
// fns_src ~= arg; // gather input markup source file names for processing
@@ -570,7 +607,7 @@ foreach(arg; args[1..$]) {
}
#+END_SRC
-**** config files load & read
+*** config files load & read
#+NAME: sdp_conf_files
#+BEGIN_SRC d
@@ -581,7 +618,8 @@ _make_and_meta_struct = configParseTOMLreturnSiSUstruct!()(_make_and_meta_struct
_make_and_meta_struct = configParseTOMLreturnSiSUstruct!()(_make_and_meta_struct, _config_local_site_struct);
#+END_SRC
-** 2a. actions independent of processing files
+*** opt actions independent of processing files (no files no processing loop)
+
#+NAME: sdp_do_selected
#+BEGIN_SRC d
if (!(_opt_action.skip_output)) {
@@ -595,7 +633,7 @@ if (!(_opt_action.skip_output)) {
}
#+END_SRC
-** _2b. processing: (loop each file)_ [+2] :loop:files:
+** _2. processing: (loop each file)_ [+2] :loop:files:
*** scope (loop) :scope:
#+NAME: sdp_each_file_do_scope
@@ -911,6 +949,14 @@ struct DocumentMatters {
auto pod() {
return _manifest.pod;
}
+ auto sqlite() {
+ struct SQLite_ {
+ string filename() {
+ return _opt_action.sqlite_filename;
+ }
+ }
+ return SQLite_();
+ }
auto xml() {
struct XML_ {
auto keys_seq() {
@@ -1392,8 +1438,8 @@ provide the result as a single set of make instructions for each document parsed
| | | | | sisupod |
| | | | | source |
| | | | | sqlite |
-| | | | | sqlite-create |
-| | | | | sqlite-drop |
+| | | | | sqlite-db-create |
+| | | | | sqlite-db-drop |
| | | | | text |
| | | | | verbose |
| | | | | xhtml |