aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/ao_conf_make_meta.org
diff options
context:
space:
mode:
Diffstat (limited to 'org/ao_conf_make_meta.org')
-rw-r--r--org/ao_conf_make_meta.org334
1 files changed, 166 insertions, 168 deletions
diff --git a/org/ao_conf_make_meta.org b/org/ao_conf_make_meta.org
index 12dfbbe..dc45daf 100644
--- a/org/ao_conf_make_meta.org
+++ b/org/ao_conf_make_meta.org
@@ -13,8 +13,7 @@
#+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n)
[[./sdp.org][sdp]] [[./][org/]]
-* 0. Code Skeleton / Outline / Structure (tangles) :tangle:
-** 1. Header Hub :ao_markup_header_extract:
+* 0. Header Hub :ao_markup_header_extract:
#+BEGIN_SRC d :tangle ../src/sdp/ao_conf_make_meta.d
/++
@@ -65,39 +64,8 @@ template SiSUheaderExtractHub() {
}
#+END_SRC
-** 2a. Header Native :ao_markup_header_extract_native:
-
-#+BEGIN_SRC d :tangle ../src/sdp/ao_conf_make_meta_native.d
-/++
- native headers using<br>@title:<BR>:subtitle:<BR>type tags<BR>
- extract native/orig header return associative array
-+/
-template SiSUheaderExtractNative() {
- private import
- std.exception,
- std.regex,
- std.stdio,
- std.string,
- std.traits,
- std.typecons,
- std.utf,
- std.conv : to;
- private import
- ao_rgx,
- ao_defaults;
- struct HeaderDocMetadataAndMakeNativeToAA {
- mixin SiSUregisters;
- mixin SiSUrgxInitFlags;
- mixin SiSUrgxInit;
- auto rgx = Rgx();
- enum State { off, on }
- string hm, hs;
- <<ao_markup_header_extract_native>>
- }
-}
-#+END_SRC
-
-** 2b. Header SDLang :ao_markup_header_extract_sdlang:
+* A. header sdlang
+** extract sdlang header
#+BEGIN_SRC d :tangle ../src/sdp/ao_conf_make_meta_sdlang.d
/++
@@ -126,7 +94,7 @@ template SiSUheaderExtractSDLang() {
}
#+END_SRC
-* A. sdlang to AA
+** sdlang to associative array
#+name: ao_conf_make_meta_sdl
#+BEGIN_SRC d
@@ -152,7 +120,7 @@ private auto sdlangToAAmake(C,Tag)(C conf, Tag conf_sdlang) {
}
#+END_SRC
-* B. conf settings sdlang
+** conf settings sdlang
#+name: ao_conf_make_meta_sdl
#+BEGIN_SRC d
@@ -162,7 +130,7 @@ private auto configSettingsSDLangToAAmake(Tag)(Tag conf_sdlang) {
}
#+END_SRC
-* C. conf make sdlang
+** conf make sdlang
#+name: ao_conf_make_meta_sdl
#+BEGIN_SRC d
@@ -307,10 +275,164 @@ private auto documentMakeSDLangToAAmake(Tag)(Tag document_make_sdlang) {
}
#+END_SRC
-* D. header :header:
-** a. header native :header:native:
+** header :header:sdl:
+*** sdlang header parse and extract root Tag :sdlang:root:tag:
-*** native header document metadata in associative array :aa:
+#+name: ao_conf_make_meta_sdl
+#+BEGIN_SRC d
+final private auto headerMakeSDLang(Hs)(Hs src_header) {
+ debug(asserts){
+ static assert(is(typeof(src_header) == string));
+ }
+ scope(failure) {
+ stderr.writefln(
+ "%s\n%s\n%s:%s failed here:\n src_header: %s",
+ __MODULE__, __FUNCTION__,
+ __FILE__, __LINE__,
+ src_header,
+ );
+ }
+ Tag sdl_root_header;
+ try {
+ sdl_root_header = parseSource(src_header);
+ }
+ catch(ParseException e) {
+ stderr.writeln("SDLang problem with this document header:");
+ stderr.writeln(src_header);
+ // Error messages of the form:
+ // myFile.sdl(5:28): Error: Invalid integer suffix.
+ stderr.writeln(e.msg);
+ }
+ debug(sdlang) {
+ writeln("header SDL:");
+ writeln(sdl_root_header.toSDLDocument());
+ }
+ return sdl_root_header;
+}
+#+END_SRC
+
+*** sdlang header get :sdlang:get:src:
+
+#+name: ao_conf_make_meta_sdl
+#+BEGIN_SRC d
+private auto headerSDLangGet(Hs)(Hs src_header) {
+ debug(asserts){
+ static assert(is(typeof(src_header) == char[]));
+ }
+ char[][] source_header_arr =
+ split(cast(char[]) src_header, rgx.newline_eol_delimiter);
+ char[] header_clean;
+ // TODO
+ foreach(header_line; source_header_arr) {
+ if (!match(header_line, rgx.comments)) {
+ header_clean ~= header_line ~ "\n";
+ }
+ }
+ /+ 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:
+
+#+name: ao_conf_make_meta_sdl
+#+BEGIN_SRC d
+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);
+ if (dochead_meta["title"]["main"].empty) {
+ dochead_meta["title"]["main"] =
+ to!string(header_sdlang.maybe.tags["title"][0].values[0]); // test that this exists
+ }
+ if (!(dochead_meta["title"]["subtitle"].empty)
+ && (dochead_meta["title"]["sub"].empty)) {
+ dochead_meta["title"]["sub"] ~= dochead_meta["title"]["subtitle"];
+ }
+ dochead_meta["title"].remove("subtitle");
+ if (dochead_meta["title"]["sub"].empty) {
+ dochead_meta["title"]["full"] ~= dochead_meta["title"]["main"];
+ } else {
+ dochead_meta["title"]["full"] ~= format(
+ "%s - %s",
+ dochead_meta["title"]["main"],
+ dochead_meta["title"]["sub"],
+ );
+ }
+ dochead_meta["creator"]["author_raw"] = dochead_meta["creator"]["author"];
+ string[] authors_arr;
+ auto authors_raw_arr = split(dochead_meta["creator"]["author"], rgx.arr_delimiter);
+ foreach (author_raw; authors_raw_arr) {
+ authors_arr ~= replace(author_raw, rgx.raw_author_munge, "$2 $1");
+ }
+ dochead_meta["creator"]["author"] = join(authors_arr, ", ").chomp.chomp;
+ auto t = tuple(dochead_make, dochead_meta);
+ static assert(t.length==2);
+ return t;
+}
+#+END_SRC
+
+*** hub: get sdlang header and convert to associative array :hub:sdlang:aa:
+
+#+name: ao_conf_make_meta_sdl
+#+BEGIN_SRC d
+private auto headerSDLangToAA(Hs,Ma)(Hs header_sdlang_src, Ma conf_doc_make_aa) {
+ debug(asserts){
+ static assert(is(typeof(header_sdlang_src) == char[]));
+ static assert(is(typeof(conf_doc_make_aa) == string[string][string]));
+ }
+ auto header_sdlang_tag = headerSDLangGet(header_sdlang_src); // sdlang.ast.Tag
+ auto header_aa_tuple = headerSDLangToAAmake(header_sdlang_tag, conf_doc_make_aa);
+ return header_aa_tuple;
+}
+#+END_SRC
+
+* B. header native :header:native:
+** Header Native :ao_markup_header_extract_native:
+
+#+BEGIN_SRC d :tangle ../src/sdp/ao_conf_make_meta_native.d
+/++
+ native headers using<br>@title:<BR>:subtitle:<BR>type tags<BR>
+ extract native/orig header return associative array
++/
+template SiSUheaderExtractNative() {
+ private import
+ std.exception,
+ std.regex,
+ std.stdio,
+ std.string,
+ std.traits,
+ std.typecons,
+ std.utf,
+ std.conv : to;
+ private import
+ ao_rgx,
+ ao_defaults;
+ struct HeaderDocMetadataAndMakeNativeToAA {
+ mixin SiSUregisters;
+ mixin SiSUrgxInitFlags;
+ mixin SiSUrgxInit;
+ auto rgx = Rgx();
+ enum State { off, on }
+ string hm, hs;
+ <<ao_markup_header_extract_native>>
+ }
+}
+#+END_SRC
+
+** native header document metadata in associative array :aa:
#+name: ao_markup_header_extract_native
#+BEGIN_SRC d
@@ -508,7 +630,7 @@ body {
}
#+END_SRC
-*** native header extract to string object :string:
+** native header extract to string object :string:
#+name: ao_markup_header_extract_native
#+BEGIN_SRC d
@@ -558,7 +680,7 @@ private auto native_header_extract(L,Lo,O,T)(
}
#+END_SRC
-*** native header reset states :reset:
+** native header reset states :reset:
#+name: ao_markup_header_extract_native
#+BEGIN_SRC d
@@ -581,7 +703,7 @@ auto header_reset_states_common(Lo,O,T)(
}
#+END_SRC
-*** hub: native header start :hub:
+** hub: native header start :hub:
#+name: ao_markup_header_extract_native
#+BEGIN_SRC d
@@ -638,127 +760,3 @@ private auto headerNativeToAA(Hn)(Hn src_header) {
return t;
}
#+END_SRC
-
-** b. header sdlang :header:sdl:
-*** sdlang header parse and extract root Tag :sdlang:root:tag:
-
-#+name: ao_conf_make_meta_sdl
-#+BEGIN_SRC d
-final private auto headerMakeSDLang(Hs)(Hs src_header) {
- debug(asserts){
- static assert(is(typeof(src_header) == string));
- }
- scope(failure) {
- stderr.writefln(
- "%s\n%s\n%s:%s failed here:\n src_header: %s",
- __MODULE__, __FUNCTION__,
- __FILE__, __LINE__,
- src_header,
- );
- }
- Tag sdl_root_header;
- try {
- sdl_root_header = parseSource(src_header);
- }
- catch(ParseException e) {
- stderr.writeln("SDLang problem with this document header:");
- stderr.writeln(src_header);
- // Error messages of the form:
- // myFile.sdl(5:28): Error: Invalid integer suffix.
- stderr.writeln(e.msg);
- }
- debug(sdlang) {
- writeln("header SDL:");
- writeln(sdl_root_header.toSDLDocument());
- }
- return sdl_root_header;
-}
-#+END_SRC
-
-*** sdlang header get :sdlang:get:src:
-
-#+name: ao_conf_make_meta_sdl
-#+BEGIN_SRC d
-private auto headerSDLangGet(Hs)(Hs src_header) {
- debug(asserts){
- static assert(is(typeof(src_header) == char[]));
- }
- char[][] source_header_arr =
- split(cast(char[]) src_header, rgx.newline_eol_delimiter);
- char[] header_clean;
- // TODO
- foreach(header_line; source_header_arr) {
- if (!match(header_line, rgx.comments)) {
- header_clean ~= header_line ~ "\n";
- }
- }
- /+ 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:
-
-#+name: ao_conf_make_meta_sdl
-#+BEGIN_SRC d
-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);
- if (dochead_meta["title"]["main"].empty) {
- dochead_meta["title"]["main"] =
- to!string(header_sdlang.maybe.tags["title"][0].values[0]); // test that this exists
- }
- if (!(dochead_meta["title"]["subtitle"].empty)
- && (dochead_meta["title"]["sub"].empty)) {
- dochead_meta["title"]["sub"] ~= dochead_meta["title"]["subtitle"];
- }
- dochead_meta["title"].remove("subtitle");
- if (dochead_meta["title"]["sub"].empty) {
- dochead_meta["title"]["full"] ~= dochead_meta["title"]["main"];
- } else {
- dochead_meta["title"]["full"] ~= format(
- "%s - %s",
- dochead_meta["title"]["main"],
- dochead_meta["title"]["sub"],
- );
- }
- dochead_meta["creator"]["author_raw"] = dochead_meta["creator"]["author"];
- string[] authors_arr;
- auto authors_raw_arr = split(dochead_meta["creator"]["author"], rgx.arr_delimiter);
- foreach (author_raw; authors_raw_arr) {
- authors_arr ~= replace(author_raw, rgx.raw_author_munge, "$2 $1");
- }
- dochead_meta["creator"]["author"] = join(authors_arr, ", ").chomp.chomp;
- auto t = tuple(dochead_make, dochead_meta);
- static assert(t.length==2);
- return t;
-}
-#+END_SRC
-
-*** hub: get sdlang header and convert to associative array :hub:sdlang:aa:
-
-#+name: ao_conf_make_meta_sdl
-#+BEGIN_SRC d
-private auto headerSDLangToAA(Hs,Ma)(Hs header_sdlang_src, Ma conf_doc_make_aa) {
- debug(asserts){
- static assert(is(typeof(header_sdlang_src) == char[]));
- static assert(is(typeof(conf_doc_make_aa) == string[string][string]));
- }
- auto header_sdlang_tag = headerSDLangGet(header_sdlang_src); // sdlang.ast.Tag
- auto header_aa_tuple = headerSDLangToAAmake(header_sdlang_tag, conf_doc_make_aa);
- return header_aa_tuple;
-}
-#+END_SRC