aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/ao_conf_make_meta.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/ao_conf_make_meta.org
parentgetopt, fixes, & naming command line options related (diff)
naming mostly
Diffstat (limited to 'org/ao_conf_make_meta.org')
-rw-r--r--org/ao_conf_make_meta.org91
1 files changed, 60 insertions, 31 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);