aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/ao_header_extract.org
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2016-06-29 22:28:53 -0400
committerRalph Amissah <ralph@amissah.com>2019-04-04 14:48:18 -0400
commit1d30d4b2225be7f152de94b007d81a5d7b7a1c3a (patch)
tree36a5a30d607b4ace9d9be006700d98fcf1a16f34 /org/ao_header_extract.org
parentregisters, minor cleaning (diff)
associated array instead of json
Diffstat (limited to 'org/ao_header_extract.org')
-rw-r--r--org/ao_header_extract.org576
1 files changed, 435 insertions, 141 deletions
diff --git a/org/ao_header_extract.org b/org/ao_header_extract.org
index a0b87d4..04ebdb6 100644
--- a/org/ao_header_extract.org
+++ b/org/ao_header_extract.org
@@ -13,107 +13,417 @@
#+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n)
[[./sdp.org][sdp]] [[./][org/]]
-* conf make sdlang
+* 0. sdlang to AA
#+name: ao_header_extract_sdl
#+BEGIN_SRC d
-private auto documentMakeSDLangToJSONmake(Tag document_make_sdlang) {
+private auto configSettingsSDLangToAAmake(Tag conf_sdlang) {
+ /+ config settings +/
+ string hm;
+ string hs;
+ auto conf = conf_aa;
+ hm = "webserv";
+ if (!(conf_sdlang.maybe.tags[hm].empty)) {
+ hs = "url_root";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "path";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "images";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "cgi";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ }
+ hm = "webserv_cgi";
+ if (!(conf_sdlang.maybe.tags[hm].empty)) {
+ hs = "host";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "base_path";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "port";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "user";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "file_links";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ }
+ hm = "processing";
+ if (!(conf_sdlang.maybe.tags[hm].empty)) {
+ hs = "path";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "dir";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "concord_max";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ }
+ hm = "flag";
+ if (!(conf_sdlang.maybe.tags[hm].empty)) {
+ hs = "act0";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "act0";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "act1";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "act2";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "act3";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "act4";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "act5";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "act6";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "act7";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "act8";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "act9";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ }
+ hm = "default";
+ if (!(conf_sdlang.maybe.tags[hm].empty)) {
+ hs = "papersize";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "text_wrap";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "emphasis";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "language";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "digest";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ }
+ hm = "permission";
+ if (!(conf_sdlang.maybe.tags[hm].empty)) {
+ hs = "share_source";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ }
+ hm = "program_select";
+ if (!(conf_sdlang.maybe.tags[hm].empty)) {
+ hs = "editor";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "epub_viewer";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "html_viewer";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "odf_viewer";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "pdf_viewer";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "xml_viewer";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ }
+ hm = "search";
+ if (!(conf_sdlang.maybe.tags[hm].empty)) {
+ hs = "flag";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "action";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "db";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ hs = "title";
+ if (!(conf_sdlang.tags[hm][0].maybe.attributes[hs].empty)
+ && (conf_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
+ writeln(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ conf[hm][hs] =
+ to!string(conf_sdlang.tags[hm][0].attributes[hs][0].value);
+ }
+ }
+ return conf;
+}
+#+END_SRC
+
+* B. conf make sdlang
+
+#+name: ao_header_extract_sdl
+#+BEGIN_SRC d
+private auto documentMakeSDLangToAAmake(Tag document_make_sdlang) {
/+ dochead +/
string hm;
string hs;
/+ make +/
- auto dochead_make = parseJSON(make_jsonstr).object;
+ auto dochead_make = make_aa;
if (!(document_make_sdlang.maybe.tags["make"].empty)) {
hm = "make";
hs = "bold";
if (!(document_make_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (document_make_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(document_make_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_make[hm][hs].str =
+ dochead_make[hm][hs] =
to!string(document_make_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "breaks";
if (!(document_make_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (document_make_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(document_make_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_make[hm][hs].str =
+ dochead_make[hm][hs] =
to!string(document_make_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "cover_image";
if (!(document_make_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (document_make_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(document_make_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_make[hm][hs].str =
+ dochead_make[hm][hs] =
to!string(document_make_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "css";
if (!(document_make_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (document_make_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(document_make_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_make[hm][hs].str =
+ dochead_make[hm][hs] =
to!string(document_make_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "emphasis";
if (!(document_make_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (document_make_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(document_make_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_make[hm][hs].str =
+ dochead_make[hm][hs] =
to!string(document_make_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "footer";
if (!(document_make_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (document_make_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(document_make_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_make[hm][hs].str =
+ dochead_make[hm][hs] =
to!string(document_make_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "headings";
if (!(document_make_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (document_make_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(document_make_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_make[hm][hs].str =
+ dochead_make[hm][hs] =
to!string(document_make_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "home_button_image";
if (!(document_make_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (document_make_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(document_make_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_make[hm][hs].str =
+ dochead_make[hm][hs] =
to!string(document_make_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "home_button_text";
if (!(document_make_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (document_make_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(document_make_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_make[hm][hs].str =
+ dochead_make[hm][hs] =
to!string(document_make_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "italics";
if (!(document_make_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (document_make_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(document_make_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_make[hm][hs].str =
+ dochead_make[hm][hs] =
to!string(document_make_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "num_top";
if (!(document_make_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (document_make_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(document_make_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_make[hm][hs].str =
+ dochead_make[hm][hs] =
to!string(document_make_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "substitute";
if (!(document_make_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (document_make_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(document_make_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_make[hm][hs].str =
+ dochead_make[hm][hs] =
to!string(document_make_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "texpdf_font";
if (!(document_make_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (document_make_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(document_make_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_make[hm][hs].str =
+ dochead_make[hm][hs] =
to!string(document_make_sdlang.tags[hm][0].attributes[hs][0].value);
}
}
@@ -127,7 +437,7 @@ private auto documentMakeSDLangToJSONmake(Tag document_make_sdlang) {
// if (!(document_make_sdlang.tags[hm][0].maybe.attributes[hs].empty)
// && (document_make_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
// writeln(document_make_sdlang.tags[hm][0].attributes[hs][0].value);
- // dochead_meta[hm][hs].str =
+ // dochead_meta[hm][hs] =
// to!string(document_make_sdlang.tags[hm][0].attributes[hs][0].value);
// }
}
@@ -137,19 +447,19 @@ private auto documentMakeSDLangToJSONmake(Tag document_make_sdlang) {
}
#+END_SRC
-* header native :header:native:
+* C.a. header native :header:native:
// mixin SiSUheader;
-// auto set_header = HeaderDocMetadataAndMakeNativeToJson(); // reintroduce
+// auto set_header = HeaderDocMetadataAndMakeNativeToAA(); // reintroduce
-** native header document metadata in json :json:
+** native header document metadata in associative array :aa:
#+name: ao_markup_header_extract_native
#+BEGIN_SRC d
-auto header_metadata_and_make_jsonstr(
+auto header_metadata_and_make_aa(
string header,
- JSONValue[string] dochead_meta,
- JSONValue[string] dochead_make
+ string[string][string] dochead_meta,
+ string[string][string] dochead_make
)
in { }
body {
@@ -169,13 +479,13 @@ body {
if (auto m = match(line, rgx.native_header_main)) {
if (!empty(m.captures[2])) {
if (hm == "creator") {
- dochead_meta[hm]["author"].str =
+ dochead_meta[hm]["author"] =
to!string(m.captures[2]);
} else if (hm == "title") {
- dochead_meta[hm]["main"].str =
+ dochead_meta[hm]["main"] =
to!string(m.captures[2]);
} else if (hm == "publisher") {
- dochead_meta[hm]["name"].str =
+ dochead_meta[hm]["name"] =
to!string(m.captures[2]);
}
}
@@ -183,12 +493,12 @@ body {
if (!empty(s.captures[2])) {
auto hs = to!string(s.captures[1]);
if ((hm == "make" )
- && (dochead_make[hm].type() == JSON_TYPE.OBJECT)) {
+ && (dochead_make[hm])) {
switch (hm) {
case "make":
if (match(hs, rgx.native_subhead_make)) {
- if (dochead_make[hm][hs].type() == JSON_TYPE.STRING) {
- dochead_make[hm][hs].str = to!string(s.captures[2]);
+ if (dochead_make[hm][hs]) {
+ dochead_make[hm][hs] = to!string(s.captures[2]);
}
} else {
writeln("not a valid header type:", hm, ":", hs);
@@ -199,12 +509,12 @@ body {
default:
break;
}
- } else if (dochead_meta[hm].type() == JSON_TYPE.OBJECT) {
+ } else if (dochead_meta[hm]) {
switch (hm) {
case "creator":
if (match(hs, rgx.native_subhead_creator)) {
- if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) {
- dochead_meta[hm][hs].str =
+ if (dochead_meta[hm][hs]) {
+ dochead_meta[hm][hs] =
to!string(s.captures[2]);
}
} else {
@@ -216,11 +526,11 @@ body {
case "title":
if (match(hs, rgx.native_subhead_title)) {
if ((hs == "subtitle")
- && (dochead_meta[hm]["sub"].type() == JSON_TYPE.STRING)) {
- dochead_meta[hm]["sub"].str =
+ && (dochead_meta[hm]["sub"])) {
+ dochead_meta[hm]["sub"] =
to!string(s.captures[2]);
- } else if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) {
- dochead_meta[hm][hs].str =
+ } else if (dochead_meta[hm][hs]) {
+ dochead_meta[hm][hs] =
to!string(s.captures[2]);
}
} else {
@@ -231,8 +541,8 @@ body {
break;
case "rights":
if (match(hs, rgx.native_subhead_rights)) {
- if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) {
- dochead_meta[hm][hs].str =
+ if (dochead_meta[hm][hs]) {
+ dochead_meta[hm][hs] =
to!string(s.captures[2]);
}
} else {
@@ -243,8 +553,8 @@ body {
break;
case "date":
if (match(hs, rgx.native_subhead_date)) {
- if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) {
- dochead_meta[hm][hs].str =
+ if (dochead_meta[hm][hs]) {
+ dochead_meta[hm][hs] =
to!string(s.captures[2]);
}
} else {
@@ -255,8 +565,8 @@ body {
break;
case "original":
if (match(hs, rgx.native_subhead_original)) {
- if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) {
- dochead_meta[hm][hs].str =
+ if (dochead_meta[hm][hs]) {
+ dochead_meta[hm][hs] =
to!string(s.captures[2]);
}
} else {
@@ -267,8 +577,8 @@ body {
break;
case "classify":
if (match(hs, rgx.native_subhead_classify)) {
- if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) {
- dochead_meta[hm][hs].str =
+ if (dochead_meta[hm][hs]) {
+ dochead_meta[hm][hs] =
to!string(s.captures[2]);
}
} else {
@@ -279,8 +589,8 @@ body {
break;
case "identifier":
if (match(hs, rgx.native_subhead_identifier)) {
- if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) {
- dochead_meta[hm][hs].str =
+ if (dochead_meta[hm][hs]) {
+ dochead_meta[hm][hs] =
to!string(s.captures[2]);
}
} else {
@@ -291,8 +601,8 @@ body {
break;
case "notes":
if (match(hs, rgx.native_subhead_notes)) {
- if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) {
- dochead_meta[hm][hs].str =
+ if (dochead_meta[hm][hs]) {
+ dochead_meta[hm][hs] =
to!string(s.captures[2]);
}
} else {
@@ -303,8 +613,8 @@ body {
break;
case "publisher":
if (match(hs, rgx.native_subhead_publisher)) {
- if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) {
- dochead_meta[hm][hs].str =
+ if (dochead_meta[hm][hs]) {
+ dochead_meta[hm][hs] =
to!string(s.captures[2]);
}
} else {
@@ -317,8 +627,8 @@ body {
destroy(hm);
destroy(hs);
// if (match(hs, rgx.native_subhead_links)) {
- // if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) {
- // dochead_meta[hm][hs].str = to!string(s.captures[2]);
+ // if (dochead_meta[hm][hs]) {
+ // dochead_meta[hm][hs] = to!string(s.captures[2]);
// }
// } else {
// writeln("not a valid header type:", hm, ":", hs);
@@ -412,7 +722,7 @@ auto header_reset_states_common(
#+name: ao_markup_header_extract_native
#+BEGIN_SRC d
-private auto headerNativeToJSON(in char[] src_header) {
+private auto headerNativeToAA(in char[] src_header) {
auto type = flags_type_init;
type = [
"header" : State.off,
@@ -421,9 +731,9 @@ private auto headerNativeToJSON(in char[] src_header) {
];
string[string] an_object;
int[string] line_occur;
- auto dochead_make = parseJSON(make_jsonstr).object;
- auto dochead_meta = parseJSON(meta_jsonstr).object;
- auto set_header = HeaderDocMetadataAndMakeNativeToJson();
+ auto dochead_make = make_aa;
+ auto dochead_meta = meta_aa;
+ auto set_header = HeaderDocMetadataAndMakeNativeToAA();
char[][] source_header_arr =
split(cast(char[]) src_header, rgx.line_delimiter);
foreach(header_line; source_header_arr) {
@@ -443,7 +753,7 @@ private auto headerNativeToJSON(in char[] src_header) {
if (header_line.length == 0) {
/+ header_make instructions (current line empty) +/
auto dochead_metadata_and_make =
- set_header.header_metadata_and_make_jsonstr(strip(an_object["obj"]), dochead_meta, dochead_make);
+ set_header.header_metadata_and_make_aa(strip(an_object["obj"]), dochead_meta, dochead_make);
static assert(!isTypeTuple!(dochead_metadata_and_make));
dochead_meta = dochead_metadata_and_make[0];
dochead_make = dochead_metadata_and_make[1];
@@ -466,7 +776,7 @@ private auto headerNativeToJSON(in char[] src_header) {
}
#+END_SRC
-* header sdlang :header:sdl:
+* C.b. header sdlang :header:sdl:
** sdlang header parse and extract root Tag :sdlang:root:tag:
#+name: ao_header_extract_sdl
@@ -529,24 +839,11 @@ private auto headerSDLangGet(in char[] src_header) {
}
#+END_SRC
-** sdlang header to json make sdlTag in :sdlang:json:
+** sdlang header to associative array make sdlTag in :sdlang:aa:
#+name: ao_header_extract_sdl
#+BEGIN_SRC d
-private auto headerSDLangToJSONmake(Tag header_sdlang, JSONValue[string] dochead_make) {
- /+ TODO json next +/
- /+ TODO
- auto dochead_make = parseJSON(make_jsonstr).object;
- auto dochead_meta = parseJSON(meta_jsonstr).object;
- auto hm = to!string(t.captures[1]);
- auto hs = to!string(s.captures[1]);
- if (dochead_make[hm][hs].type() == JSON_TYPE.STRING) {
- dochead_make[hm][hs].str = to!string(s.captures[2]);
- }
- if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) {
- dochead_meta[hm][hs].str = to!string(s.captures[2]);
- }
- +/
+private auto headerSDLangToAAmake(Tag header_sdlang, string[string][string] dochead_make) {
/+ dochead +/
string hm;
string hs;
@@ -557,96 +854,96 @@ private auto headerSDLangToJSONmake(Tag header_sdlang, JSONValue[string] dochead
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_make[hm][hs].str =
+ dochead_make[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "breaks";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_make[hm][hs].str =
+ dochead_make[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "cover_image";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_make[hm][hs].str =
+ dochead_make[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "css";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_make[hm][hs].str =
+ dochead_make[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "emphasis";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_make[hm][hs].str =
+ dochead_make[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "footer";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_make[hm][hs].str =
+ dochead_make[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "headings";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_make[hm][hs].str =
+ dochead_make[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "home_button_image";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_make[hm][hs].str =
+ dochead_make[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "home_button_text";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_make[hm][hs].str =
+ dochead_make[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "italics";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_make[hm][hs].str =
+ dochead_make[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "num_top";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_make[hm][hs].str =
+ dochead_make[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "substitute";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_make[hm][hs].str =
+ dochead_make[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "texpdf_font";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_make[hm][hs].str =
+ dochead_make[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
}
/+ meta +/
- auto dochead_meta = parseJSON(meta_jsonstr).object;
+ auto dochead_meta = meta_aa;
hm = "title";
if (!(header_sdlang.maybe.tags[hm].empty)) {
/+ TODO Title REQUIRED +/
@@ -654,13 +951,13 @@ private auto headerSDLangToJSONmake(Tag header_sdlang, JSONValue[string] dochead
if (!(header_sdlang.tags[hm].empty)
&& (header_sdlang.tags[hm][0].values[0].length > 1)) {
writeln(header_sdlang.tags[hm][0].values[0]);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].values[0]);
// to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
} else if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
} else {
writeln("Required header metadata Title, missing");
@@ -669,12 +966,12 @@ private auto headerSDLangToJSONmake(Tag header_sdlang, JSONValue[string] dochead
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
} else if (!(header_sdlang.tags[hm][0].maybe.attributes["subtitle"].empty)
&& (header_sdlang.tags[hm][0].attributes["subtitle"][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes["subtitle"][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes["subtitle"][0].value);
}
// full title composite (main + sub)
@@ -684,26 +981,26 @@ private auto headerSDLangToJSONmake(Tag header_sdlang, JSONValue[string] dochead
if (!(header_sdlang.tags[hm][0].maybe.attributes["lang"].empty)
&& (header_sdlang.tags[hm][0].attributes["lang"][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes["lang"][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes["lang"][0].value);
} else if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "edition";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "note";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
}
@@ -719,28 +1016,28 @@ private auto headerSDLangToJSONmake(Tag header_sdlang, JSONValue[string] dochead
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "author_email";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "illustrator";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "translator";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
}
@@ -750,35 +1047,35 @@ private auto headerSDLangToJSONmake(Tag header_sdlang, JSONValue[string] dochead
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "keywords";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "loc";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "subject";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "topic_register";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
}
@@ -788,49 +1085,49 @@ private auto headerSDLangToJSONmake(Tag header_sdlang, JSONValue[string] dochead
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "available";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "created";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "issued";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "modified";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "published";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "valid";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
}
@@ -840,21 +1137,21 @@ private auto headerSDLangToJSONmake(Tag header_sdlang, JSONValue[string] dochead
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "oclc";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "pg";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
}
@@ -867,7 +1164,7 @@ private auto headerSDLangToJSONmake(Tag header_sdlang, JSONValue[string] dochead
// if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
// && (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
// writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- // dochead_meta[hm][hs].str =
+ // dochead_meta[hm][hs] =
// to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
// }
}
@@ -877,14 +1174,14 @@ private auto headerSDLangToJSONmake(Tag header_sdlang, JSONValue[string] dochead
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "description";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
}
@@ -894,21 +1191,21 @@ private auto headerSDLangToJSONmake(Tag header_sdlang, JSONValue[string] dochead
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "source";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "title";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
}
@@ -918,7 +1215,7 @@ private auto headerSDLangToJSONmake(Tag header_sdlang, JSONValue[string] dochead
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
}
@@ -928,47 +1225,45 @@ private auto headerSDLangToJSONmake(Tag header_sdlang, JSONValue[string] dochead
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "cover";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "illustrations";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
hs = "license";
if (!(header_sdlang.tags[hm][0].maybe.attributes[hs].empty)
&& (header_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) {
writeln(header_sdlang.tags[hm][0].attributes[hs][0].value);
- dochead_meta[hm][hs].str =
+ dochead_meta[hm][hs] =
to!string(header_sdlang.tags[hm][0].attributes[hs][0].value);
}
}
- // writeln(dochead_make);
- // writeln(dochead_meta);
auto t = tuple(dochead_make, dochead_meta);
static assert(!isTypeTuple!(t));
return t;
}
#+END_SRC
-** hub: get sdlang header and convert to json :hub:sdlang:json:
+** hub: get sdlang header and convert to associative array :hub:sdlang:aa:
#+name: ao_header_extract_sdl
#+BEGIN_SRC d
-private auto headerSDLangToJSON(char[] header_sdlang_src, JSONValue[string] conf_doc_make_json) {
+private auto headerSDLangToAA(char[] header_sdlang_src, string[string][string] conf_doc_make_aa) {
auto header_sdlang_tag = headerSDLangGet(header_sdlang_src); // sdlang.ast.Tag
- auto header_json_tuple = headerSDLangToJSONmake(header_sdlang_tag, conf_doc_make_json);
- return header_json_tuple;
+ auto header_aa_tuple = headerSDLangToAAmake(header_sdlang_tag, conf_doc_make_aa);
+ return header_aa_tuple;
}
#+END_SRC
@@ -980,11 +1275,11 @@ required first heading ^A~), determine whether is a native header or sdlang one
with a regex check if whether it contains the "native header" required tag/field
@title: then process accordingly as a "native header" or "sdlang header"
converting the metadata and make instructions to a common json format used by
-program internally.
+program internally. Moved to associative array.
#+BEGIN_SRC d :tangle ../src/sdp/ao_header_extract.d
/+
- extract native/orig header return json
+ extract native/orig header return associative array
+/
template SiSUheaderExtractHub() {
private import
@@ -995,13 +1290,13 @@ template SiSUheaderExtractHub() {
mixin SiSUheaderExtractNative;
mixin SiSUheaderExtractSDLang;
auto rgx = Rgx();
- private auto headerContentJSON(char[] header_src, JSONValue[string] conf_doc_make_json) {
- auto head_native = HeaderDocMetadataAndMakeNativeToJson();
+ private auto headerContentAA(char[] header_src, string[string][string] conf_doc_make_aa) {
+ auto head_native = HeaderDocMetadataAndMakeNativeToAA();
auto head_sdlang = HeaderExtractSDL();
writeln(__LINE__);
auto header_make_and_meta_tuple = (match(header_src, rgx.native_header_meta_title))
- ? (head_native.headerNativeToJSON(header_src))
- : (head_sdlang.headerSDLangToJSON(header_src, conf_doc_make_json));
+ ? (head_native.headerNativeToAA(header_src))
+ : (head_sdlang.headerSDLangToAA(header_src, conf_doc_make_aa));
writeln(__LINE__);
static assert(!isTypeTuple!(header_make_and_meta_tuple));
return header_make_and_meta_tuple;
@@ -1010,12 +1305,11 @@ template SiSUheaderExtractHub() {
}
#+END_SRC
-// Tuple!(JSONValue[string], JSONValue[string]) header_make_and_meta_tuple;
** 2a. Header Native :ao_markup_header_extract_native:
#+BEGIN_SRC d :tangle ../src/sdp/ao_header_extract_native.d
/+
- extract native/orig header return json
+ extract native/orig header return associative array
+/
template SiSUheaderExtractNative() {
private import
@@ -1025,7 +1319,7 @@ template SiSUheaderExtractNative() {
std.conv : to;
private import
ao_rgx;
- struct HeaderDocMetadataAndMakeNativeToJson {
+ struct HeaderDocMetadataAndMakeNativeToAA {
mixin SiSUregisters;
mixin SiSUrgxInitFlags;
mixin RgxInit;
@@ -1053,7 +1347,7 @@ template SiSUheaderExtractSDLang() {
mixin RgxInit;
auto rgx = Rgx();
<<ao_header_extract_sdl>>
- <<ao_header_extract_sdl_to_json>>
+ <<ao_header_extract_sdl_to_aa>>
}
}
#+END_SRC