aboutsummaryrefslogtreecommitdiffhomepage
path: root/org
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2017-06-06 17:58:10 -0400
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:14 -0400
commite280a374991a3a6db3c40fd1fa03a2d9c6fa66eb (patch)
tree730441b0371f6f65794a5e598000e89c06127bed /org
parentgetopt, fixes, & naming command line options related (diff)
naming mostly
Diffstat (limited to 'org')
-rw-r--r--org/ao_conf_make_meta.org91
-rw-r--r--org/ao_debugs.org4
-rw-r--r--org/ao_read_source_files.org29
-rw-r--r--org/default_misc.org21
-rw-r--r--org/default_paths.org10
-rw-r--r--org/output_hub.org15
-rw-r--r--org/sdp.org39
7 files changed, 115 insertions, 94 deletions
diff --git a/org/ao_conf_make_meta.org b/org/ao_conf_make_meta.org
index 6527269..8cd73d9 100644
--- a/org/ao_conf_make_meta.org
+++ b/org/ao_conf_make_meta.org
@@ -70,7 +70,6 @@ template SiSUheaderExtractHub() {
* A. header sdlang (extract) :module:sdp:ao_conf_make_meta_sdlang:
** module template
-** extract sdlang header
#+BEGIN_SRC d :tangle ../src/sdp/ao/conf_make_meta_sdlang.d
/++
@@ -100,24 +99,40 @@ template SiSUheaderExtractSDLang() {
}
#+END_SRC
-** sdlang to associative array
+** entry points
+*** _sdlang to associative array_
#+name: ao_conf_make_meta_sdl
#+BEGIN_SRC d
-private auto sdlangToAAmake(C,Tag)(C conf, Tag conf_sdlang) {
+private auto sdlangToAAheaderMakeMeta(C,Tag)(C conf, Tag conf_sdlang) {
debug(asserts){
static assert(is(typeof(conf) == string[string][string]));
}
foreach (maintag, subtags; conf) {
foreach (subtag, content; subtags) {
- if (!(conf_sdlang.maybe.tags[maintag].empty)) {
- if (!(conf_sdlang.tags[maintag][0].maybe.attributes[subtag].empty)
- && (conf_sdlang.tags[maintag][0].attributes[subtag][0].value.length > 0)) {
+ if (maintag in conf_sdlang.maybe.tags) {
+ Tag _maintag = conf_sdlang.getTag(maintag);
+ if ((subtag in _maintag.maybe.tags)
+ && (_maintag.getTagValues(subtag).length > 0)) {
debug(headersdlang) {
- writeln(conf_sdlang.tags[maintag][0].attributes[subtag][0].value);
+ writeln(__LINE__, ": ", maintag, ":", subtag, ": ", _maintag.getTagValues(subtag)[0]);
+ }
+ if (_maintag.getTagValues(subtag).length == 1) {
+ conf[maintag][subtag] =
+ (_maintag.getTagValues(subtag)[0]).to!string;
+ } else if (_maintag.getTagValues(subtag).length > 1) {
+ foreach (st; _maintag.getTagValues(subtag)) {
+ conf[maintag][subtag] ~=
+ st.to!string ~ ";";
+ }
+ }
+ } else if ((subtag in _maintag.maybe.attributes)
+ && (_maintag.maybe.attributes[subtag][0].value.length > 0)) {
+ debug(headersdlang) {
+ writeln(__LINE__, ": ", maintag, ":", subtag, ": ", conf_sdlang.tags[maintag][0].attributes[subtag][0].value);
}
conf[maintag][subtag] =
- to!string(conf_sdlang.tags[maintag][0].attributes[subtag][0].value);
+ (conf_sdlang.tags[maintag][0].attributes[subtag][0].value).to!string;
}
}
}
@@ -126,28 +141,28 @@ private auto sdlangToAAmake(C,Tag)(C conf, Tag conf_sdlang) {
}
#+END_SRC
-** conf settings sdlang
+*** _conf settings_ sdlang
#+name: ao_conf_make_meta_sdl
#+BEGIN_SRC d
private auto configSettingsSDLangToAAmake(Tag)(Tag conf_sdlang) {
- auto conf = sdlangToAAmake(conf_aa, conf_sdlang);
+ auto conf = sdlangToAAheaderMakeMeta(conf_aa_empty, conf_sdlang);
return conf;
}
#+END_SRC
-** conf make sdlang
+*** _conf make_ sdlang
#+name: ao_conf_make_meta_sdl
#+BEGIN_SRC d
private auto documentMakeSDLangToAAmake(Tag)(Tag document_make_sdlang) {
- auto dochead_make = sdlangToAAmake(make_aa, document_make_sdlang);
+ auto dochead_make = sdlangToAAheaderMakeMeta(conf_aa_empty, document_make_sdlang);
return dochead_make;
}
#+END_SRC
** header :header:sdl:
-*** sdlang header parse and extract root Tag :sdlang:root:tag:
+*** sdlang header parse and _extract root Tag_ :sdlang:root:tag:
#+name: ao_conf_make_meta_sdl
#+BEGIN_SRC d
@@ -176,13 +191,25 @@ final private auto headerMakeSDLang(Hs)(Hs src_header) {
}
debug(sdlang) {
writeln("header SDL:");
- writeln(sdl_root_header.toSDLDocument());
+ writeln(__LINE__, ": ", sdl_root_header.toSDLDocument());
+ writeln(__LINE__, ": ", sdl_root_header.maybe.namespaces);
+ writeln("header make sdlang: ", sdl_root_header.toSDLDocument());
+ writeln(__LINE__, ": ", sdl_root_header.getTagValues("title"));
+ writeln(__LINE__, ": ", sdl_root_header.getTagValues("creator"));
+ Tag creator = sdl_root_header.getTag("creator");
+ if (creator !is null) {
+ if ("author" in creator.maybe.tags) {
+ writeln(__LINE__, ": ", creator.getTagValues("author"));
+ } else if ("author" in creator.maybe.attributes) {
+ writeln(__LINE__, ": ", creator.maybe.attributes["author"][0].value);
+ }
+ }
}
return sdl_root_header;
}
#+END_SRC
-*** sdlang header get :sdlang:get:src:
+*** sdlang header _src text get_ :sdlang:get:src:
#+name: ao_conf_make_meta_sdl
#+BEGIN_SRC d
@@ -200,20 +227,11 @@ private auto headerSDLangGet(Hs)(Hs src_header) {
}
/+ get sdlang tags +/
auto header_sdlang=headerMakeSDLang(to!string(header_clean));
- debug(sdlang) {
- writeln("--------------");
- stdout.rawWrite( header_sdlang.toSDLDocument() );
- writeln("--------------");
- Value test = header_sdlang.tags["title"][0].values[0];
- assert(test == typeid(string));
- // writeln(header_sdlang.maybe.tags["title"]);
- // writeln(header_sdlang.maybe.tags["title"][0].maybe.attributes["subtitle"]);
- }
return header_sdlang; // sdlang.ast.Tag
}
#+END_SRC
-*** sdlang header to associative array make sdlTag in :sdlang:aa:
+*** sdlang header to _associative array_ make sdlTag in :sdlang:aa:
#+name: ao_conf_make_meta_sdl
#+BEGIN_SRC d
@@ -221,11 +239,22 @@ private auto headerSDLangToAAmake(Tag,Ma)(Tag header_sdlang, Ma dochead_make) {
debug(asserts){
static assert(is(typeof(dochead_make) == string[string][string]));
}
- dochead_make = sdlangToAAmake(dochead_make, header_sdlang);
- auto dochead_meta = sdlangToAAmake(meta_aa, header_sdlang);
+ dochead_make = sdlangToAAheaderMakeMeta(dochead_make, header_sdlang);
+ auto dochead_meta = sdlangToAAheaderMakeMeta(meta_aa_empty, header_sdlang);
if (dochead_meta["title"]["main"].empty) {
- dochead_meta["title"]["main"] =
- to!string(header_sdlang.maybe.tags["title"][0].values[0]);
+ {
+ Tag _maintag = header_sdlang.getTag("title");
+ if (_maintag !is null) {
+ if ("main" in _maintag.maybe.tags) {
+ dochead_meta["title"]["main"] =
+ to!string(_maintag.getTagValues("main"));
+ } else if ("main" !in _maintag.maybe.attributes) {
+ writeln(__LINE__, ": ", _maintag.values[0]);
+ dochead_meta["title"]["main"] =
+ (_maintag.values[0]).to!string; // test that this exists
+ }
+ }
+ }
}
if (!(dochead_meta["title"]["subtitle"].empty)
&& (dochead_meta["title"]["sub"].empty)) {
@@ -588,8 +617,8 @@ private auto headerNativeToAA(Hn)(Hn src_header) {
];
string[string] an_object;
int[string] line_occur;
- auto dochead_make = make_aa;
- auto dochead_meta = meta_aa;
+ auto dochead_make = conf_aa_empty;
+ auto dochead_meta = meta_aa_empty;
auto set_header = HeaderDocMetadataAndMakeNativeToAA();
char[][] source_header_arr =
(cast(char[]) src_header).split(rgx.newline_eol_delimiter);
diff --git a/org/ao_debugs.org b/org/ao_debugs.org
index be525c3..1111d55 100644
--- a/org/ao_debugs.org
+++ b/org/ao_debugs.org
@@ -116,7 +116,7 @@ debug(dumpdoc) {
__FILE__,
__LINE__,
);
- foreach (obj; contents) {
+ foreach (obj; contents[key]) {
if (obj.use != "empty") {
writefln(
"[%s][%s]\n%s",
@@ -481,7 +481,7 @@ debug(objects) {
__FILE__,
__LINE__,
);
- foreach (obj; contents) {
+ foreach (obj; contents[key]) {
if (obj.use != "empty") {
writefln(
"* [%s][%s] %s",
diff --git a/org/ao_read_source_files.org b/org/ao_read_source_files.org
index 930d3f8..7bbaca9 100644
--- a/org/ao_read_source_files.org
+++ b/org/ao_read_source_files.org
@@ -25,7 +25,7 @@ import
std.path;
#+END_SRC
-* 1. get config file (read in) :module:sdp:ao_read_config_files:
+* 1. get _config file_ (read in) :module:sdp:ao_read_config_files:
** 0. module template
#+BEGIN_SRC d :tangle ../src/sdp/ao/read_config_files.d
@@ -44,9 +44,9 @@ module sdp.ao.read_config_files;
#+name: ao_config_file_in
#+BEGIN_SRC d
-template ConfigIn() {
+template configIn() {
<<imports_std>>
- final string ConfigIn(C,E)(C conf_sdl, E env) {
+ final string configIn(C,E)(C conf_sdl, E env) {
string dot_pwd = chainPath(to!string(env["pwd"]), ".sisu").array;
string underscore_pwd = chainPath(to!string(env["pwd"]), "_sisu").array;
string dot_home = chainPath(to!string(env["home"]), ".sisu").array;
@@ -109,13 +109,6 @@ auto ConfigSDLang(string configuration, string conf_sdl_filename) {
stderr.writeln("SDLang problem with content for ", conf_sdl_filename);
stderr.writeln(e.msg);
}
- debug(sdlang) {
- Value output_dir_structure_by = sdl_root_conf.tags["output_dir_structure_by"][0].values[0];
- assert(output_dir_structure_by.type == typeid(string));
- writeln(output_dir_structure_by);
- writeln("conf SDL:");
- writeln(sdl_root_conf.toSDLDocument());
- }
return sdl_root_conf;
}
#+END_SRC
@@ -127,7 +120,7 @@ auto ConfigSDLang(string configuration, string conf_sdl_filename) {
#+BEGIN_SRC d
/+
+/
-template ConfigHub() {
+template configRead() {
<<imports_std>>
<<ao_config_file_import_sdlang>>
<<ao_config_file_sdlang_hub>>
@@ -142,16 +135,18 @@ import sdlang;
*** config hub function
+Read in sdl config file name given, and return sdl root
+
#+name: ao_config_file_sdlang_hub
#+BEGIN_SRC d
-final auto ConfigHub(C,E)(C conf_sdl, E env) {
- auto configuration = ConfigIn!()(conf_sdl, env);
+final auto configRead(C,E)(C conf_sdl, E env) {
+ auto configuration = configIn!()(conf_sdl, env);
auto sdl_root = ConfigSDLang!()(configuration, conf_sdl);
return sdl_root;
}
#+END_SRC
-* 2. get markup source, read file :module:sdp:ao_read_source_files:
+* 2. get _markup source_, read file :module:sdp:ao_read_source_files:
** 0. module template
#+BEGIN_SRC d :tangle ../src/sdp/ao/read_source_files.d
@@ -352,14 +347,14 @@ auto markupSourceHeaderContentRawLineTupleArray(in string source_txt_str) {
#+name: ao_markup_source_raw_get_insert_source_line_array
#+BEGIN_SRC d
final char[][] getInsertMarkupSourceContentRawLineArray(
- in char[] fn_src,
+ in char[] fn_src_insert,
Regex!(char) rgx_file
) {
enforce(
- fn_src.match(rgx_file),
+ fn_src_insert.match(rgx_file),
"not a sisu markup filename"
);
- auto source_txt_str = readInMarkupSource(fn_src);
+ auto source_txt_str = readInMarkupSource(fn_src_insert);
auto source_line_arr = markupSourceLineArray(source_txt_str);
return source_line_arr;
}
diff --git a/org/default_misc.org b/org/default_misc.org
index b87a1f3..4fe8a7b 100644
--- a/org/default_misc.org
+++ b/org/default_misc.org
@@ -65,7 +65,7 @@ import
#+name: ao_defaults_template_registers
#+BEGIN_SRC d
-string[string][string] conf_aa() {
+string[string][string] conf_aa_empty() {
auto conf_ = [
"webserv": [
"url_root" : "",
@@ -120,18 +120,7 @@ string[string][string] conf_aa() {
"action" : "",
"db" : "",
"title" : ""
- ]
- ];
- return conf_;
-}
-#+END_SRC
-
-**** make associative array
-
-#+name: ao_defaults_template_registers
-#+BEGIN_SRC d
-string[string][string] make_aa() {
- auto make_ = [
+ ],
"make": [
"bold" : "",
"breaks" : "",
@@ -147,9 +136,9 @@ string[string][string] make_aa() {
"num_depth" : "",
"substitute" : "",
"texpdf_font" : ""
- ]
+ ],
];
- return make_;
+ return conf_;
}
#+END_SRC
@@ -157,7 +146,7 @@ string[string][string] make_aa() {
#+name: ao_defaults_template_registers
#+BEGIN_SRC d
-string[string][string] meta_aa() {
+string[string][string] meta_aa_empty() {
auto meta_ = [
"classify": [
"dewey" : "",
diff --git a/org/default_paths.org b/org/default_paths.org
index e3026b7..3a250a0 100644
--- a/org/default_paths.org
+++ b/org/default_paths.org
@@ -35,7 +35,7 @@ template SiSUpathsSRC() {
auto rgx = Rgx();
auto SiSUpathsSRC(D,Fn)(
D _pwd,
- Fn _fn_src,
+ Fn _fn_src_and_relative_path,
) {
struct SisuSrcPaths {
auto pwd() {
@@ -44,10 +44,10 @@ template SiSUpathsSRC() {
auto language() {
// use command line info as well?
string _k;
- if (auto m = _fn_src.match(rgx.language_code_and_filename)) {
+ if (auto m = _fn_src_and_relative_path.match(rgx.language_code_and_filename)) {
_k = m.captures[1];
} else {
- _k = "en";
+ _k = "xx"; // original default was "en" but is not known
}
return _k;
}
@@ -70,10 +70,10 @@ template SiSUpathsSRC() {
return text_root.chainPath(language).array;
}
auto doc_src_with_relative_path() {
- return pwd.chainPath(_fn_src).array;
+ return pwd.chainPath(_fn_src_and_relative_path).array;
}
auto doc_src_fn() {
- return _fn_src.baseName.array;
+ return _fn_src_and_relative_path.baseName.array;
}
}
return SisuSrcPaths();
diff --git a/org/output_hub.org b/org/output_hub.org
index 5855810..a859d59 100644
--- a/org/output_hub.org
+++ b/org/output_hub.org
@@ -72,9 +72,11 @@ if ((doc_matters.opt_action["source"])
{ writeln("sisupod source processing... "); }
SiSUpod!()(doc_matters);
if ((doc_matters.opt_action["verbose"])
+ && (doc_matters.opt_action["debug"])
&& (doc_matters.opt_action["source"]))
{ writeln("sisu source done"); }
if ((doc_matters.opt_action["verbose"])
+ && (doc_matters.opt_action["debug"])
&& (doc_matters.opt_action["sisupod"]))
{ writeln("sisupod done"); }
}
@@ -99,18 +101,21 @@ if (doc_matters.opt_action["text"]) {
if (doc_matters.opt_action["html"]) {
if ((doc_matters.opt_action["verbose"])) { writeln("html scroll processing... "); }
outputHTML!().scroll(doc_abstraction, doc_matters);
- if ((doc_matters.opt_action["verbose"])) { writeln("html scroll done"); }
+ if ((doc_matters.opt_action["verbose"]) && (doc_matters.opt_action["debug"])) { writeln("html scroll done"); }
if ((doc_matters.opt_action["verbose"])) { writeln("html seg processing... "); }
outputHTML!().seg(doc_abstraction, doc_matters);
- if ((doc_matters.opt_action["verbose"])) { writeln("html seg done"); }
+ if ((doc_matters.opt_action["verbose"]) && (doc_matters.opt_action["debug"])) { writeln("html seg done"); }
+ outputHTML!().css(doc_matters);
} else if (doc_matters.opt_action["html-seg"]) {
if ((doc_matters.opt_action["verbose"])) { writeln("html seg processing... "); }
outputHTML!().seg(doc_abstraction, doc_matters);
- if ((doc_matters.opt_action["verbose"])) { writeln("html seg done"); }
+ if ((doc_matters.opt_action["verbose"]) && (doc_matters.opt_action["debug"])) { writeln("html seg done"); }
+ outputHTML!().css(doc_matters);
} else if (doc_matters.opt_action["html-scroll"]) {
if ((doc_matters.opt_action["verbose"])) { writeln("html scroll processing... "); }
outputHTML!().scroll(doc_abstraction, doc_matters);
- if ((doc_matters.opt_action["verbose"])) { writeln("html scroll done"); }
+ if ((doc_matters.opt_action["verbose"]) && (doc_matters.opt_action["debug"])) { writeln("html scroll done"); }
+ outputHTML!().css(doc_matters);
}
#+END_SRC
@@ -123,7 +128,7 @@ if (doc_matters.opt_action["epub"]) {
if ((doc_matters.opt_action["verbose"])) { writeln("epub3 processing... "); }
outputEPub3!()(doc_abstraction, doc_matters);
// epub.css_write;
- if ((doc_matters.opt_action["verbose"])) { writeln("epub3 done"); }
+ if ((doc_matters.opt_action["verbose"]) && (doc_matters.opt_action["debug"])) { writeln("epub3 done"); }
}
#+END_SRC
diff --git a/org/sdp.org b/org/sdp.org
index 4a7e848..2f58357 100644
--- a/org/sdp.org
+++ b/org/sdp.org
@@ -60,15 +60,18 @@ void main(string[] args) {
<<sdp_args>>
<<sdp_env>>
<<sdp_conf_files>>
- foreach(fn_src; fns_src) {
- if (!empty(fn_src)) {
- <<sdp_each_file_do_scope>>
- <<sdp_abstraction>>
- <<sdp_each_file_do_debugs_checkdoc>>
- <<sdp_each_file_do_selected_output>>
- <<sdp_each_file_do_scope_exit>>
- } else {
- <<sdp_no_filename_provided>>
+ <<sdp_do_selected>>
+ if (fns_src.length > 0) {
+ foreach(fn_src; fns_src) {
+ if (!empty(fn_src)) {
+ <<sdp_each_file_do_scope>>
+ <<sdp_abstraction>>
+ <<sdp_each_file_do_debugs_checkdoc>>
+ <<sdp_each_file_do_selected_output>>
+ <<sdp_each_file_do_scope_exit>>
+ } else {
+ <<sdp_no_filename_provided>>
+ }
}
}
}
@@ -308,8 +311,8 @@ auto env = [
#+NAME: sdp_conf_files
#+BEGIN_SRC d
-auto sdl_root_configuration = ConfigHub!()("conf.sdl", env);
-auto sdl_root_doc_make = ConfigHub!()("sisu_document_make", env);
+auto sdl_root_configuration = configRead!()("conf.sdl", env);
+auto sdl_root_doc_make = configRead!()("sisu_document_make", env);
auto confsdl = HeaderExtractSDL();
auto conf_settings_aa = confsdl.configSettingsSDLangToAAmake(sdl_root_configuration);
auto conf_doc_make_aa = confsdl.documentMakeSDLangToAAmake(sdl_root_doc_make);
@@ -486,10 +489,10 @@ debug(header_and_body) {
#+NAME: sdp_each_file_do_split_sisu_markup_file_header_into_make_and_meta
#+BEGIN_SRC d
/+ ↓ split header into make and meta +/
-auto _make_and_meta =
+auto _make_and_meta_tup =
SiSUheaderExtractHub!()(_header_body_inserts[headBody.header], conf_doc_make_aa);
-static assert(!isTypeTuple!(_make_and_meta));
-static assert(_make_and_meta.length==2);
+static assert(!isTypeTuple!(_make_and_meta_tup));
+static assert(_make_and_meta_tup.length==2);
#+END_SRC
** 3. _document abstraction, tuple_ (pre-output-processing) :processing:
@@ -511,8 +514,8 @@ static assert(_make_and_meta.length==2);
/+ ↓ document abstraction: process document, return abstraction as tuple +/
auto da = SiSUdocAbstraction!()(
_header_body_inserts[headBody.body_content],
- _make_and_meta[makeMeta.make],
- _make_and_meta[makeMeta.meta],
+ _make_and_meta_tup[makeMeta.make],
+ _make_and_meta_tup[makeMeta.meta],
opts
);
static assert(!isTypeTuple!(da));
@@ -546,11 +549,11 @@ struct DocumentMatters {
return _k;
}
auto dochead_make() {
- string[string][string] _k = _make_and_meta[makeMeta.make];
+ string[string][string] _k = _make_and_meta_tup[makeMeta.make];
return _k;
}
auto dochead_meta() {
- string[string][string] _k = _make_and_meta[makeMeta.meta];
+ string[string][string] _k = _make_and_meta_tup[makeMeta.meta];
return _k;
}
auto src_path_info() {