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.org304
1 files changed, 191 insertions, 113 deletions
diff --git a/org/ao_conf_make_meta.org b/org/ao_conf_make_meta.org
index 8cd73d9..25bcd4d 100644
--- a/org/ao_conf_make_meta.org
+++ b/org/ao_conf_make_meta.org
@@ -15,7 +15,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. Header Hub :module:sdp:ao_conf_make_meta:
+* 0. header extract (native & sdlang) to AA :module:sdp:ao_conf_make_meta:
** module template
#+BEGIN_SRC d :tangle ../src/sdp/ao/conf_make_meta.d
@@ -30,7 +30,7 @@
program internally. Moved to associative array.
+/
module sdp.ao.conf_make_meta;
-template SiSUheaderExtractHub() {
+template docHeaderMakeAndMetaTupExtractAndConvertToAA() {
import
std.exception,
std.regex,
@@ -46,21 +46,23 @@ template SiSUheaderExtractHub() {
sdp.ao.rgx;
mixin SiSUrgxInit;
mixin SiSUheaderExtractNative;
- mixin SiSUheaderExtractSDLang;
+ mixin SiSUextractSDLang;
auto rgx = Rgx();
- auto SiSUheaderExtractHub(Src, DocMake)(
+ auto docHeaderMakeAndMetaTupExtractAndConvertToAA(DocMake, Src)(
+ DocMake conf_doc_make_aa,
Src header_src,
- DocMake conf_doc_make_aa
) {
debug(asserts){
static assert(is(typeof(header_src) == char[]));
static assert(is(typeof(conf_doc_make_aa) == string[string][string]));
}
auto head_native = HeaderDocMetadataAndMakeNativeToAA();
- auto head_sdlang = HeaderExtractSDL();
+ auto header_sdlang_tag = (!(header_src.match(rgx.native_header_meta_title)))
+ ? extractSDL().docHeaderSDLtagGet(header_src) // sdlang.ast.Tag
+ : null;
auto header_make_and_meta_tuple = (header_src.match(rgx.native_header_meta_title))
? (head_native.headerNativeToAA(header_src))
- : (head_sdlang.headerSDLangToAA(header_src, conf_doc_make_aa));
+ : (extractSDL().docHeaderSDLtoAA(conf_doc_make_aa, header_sdlang_tag));
static assert(!isTypeTuple!(header_make_and_meta_tuple));
static assert(header_make_and_meta_tuple.length==2);
return header_make_and_meta_tuple;
@@ -68,8 +70,8 @@ template SiSUheaderExtractHub() {
}
#+END_SRC
-* A. header sdlang (extract) :module:sdp:ao_conf_make_meta_sdlang:
-** module template
+* A. module sdlang :module:sdp:ao_conf_make_meta_sdlang:
+** 0. module template
#+BEGIN_SRC d :tangle ../src/sdp/ao/conf_make_meta_sdlang.d
/++
@@ -77,7 +79,7 @@ template SiSUheaderExtractHub() {
extract sdlang header return sdlang
+/
module sdp.ao.conf_make_meta_sdlang;
-template SiSUheaderExtractSDLang() {
+template SiSUextractSDLang() {
import
std.exception,
std.regex,
@@ -90,7 +92,7 @@ template SiSUheaderExtractSDLang() {
import
sdp.ao.defaults,
sdp.ao.rgx;
- struct HeaderExtractSDL {
+ struct extractSDL {
mixin SiSUregisters;
mixin SiSUrgxInit;
auto rgx = Rgx();
@@ -99,92 +101,37 @@ template SiSUheaderExtractSDLang() {
}
#+END_SRC
-** entry points
-*** _sdlang to associative array_
+** 1. sdlang header _extract root Tag_ :sdlang:root:tag:
#+name: ao_conf_make_meta_sdl
#+BEGIN_SRC d
-private auto sdlangToAAheaderMakeMeta(C,Tag)(C conf, Tag conf_sdlang) {
+private auto docHeaderSDLtagGet(Hs)(Hs src_header) {
debug(asserts){
- static assert(is(typeof(conf) == string[string][string]));
+ static assert(is(typeof(src_header) == char[]));
}
- foreach (maintag, subtags; conf) {
- foreach (subtag, content; subtags) {
- 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(__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] =
- (conf_sdlang.tags[maintag][0].attributes[subtag][0].value).to!string;
- }
- }
+ char[][] source_header_arr =
+ (cast(char[]) src_header).split(rgx.newline_eol_delimiter);
+ char[] _src_header;
+ foreach(header_line; source_header_arr) {
+ if (!match(header_line, rgx.comments)) {
+ _src_header ~= header_line ~ "\n";
}
}
- return conf;
-}
-#+END_SRC
-
-*** _conf settings_ sdlang
-
-#+name: ao_conf_make_meta_sdl
-#+BEGIN_SRC d
-private auto configSettingsSDLangToAAmake(Tag)(Tag conf_sdlang) {
- auto conf = sdlangToAAheaderMakeMeta(conf_aa_empty, conf_sdlang);
- return conf;
-}
-#+END_SRC
-
-*** _conf make_ sdlang
-
-#+name: ao_conf_make_meta_sdl
-#+BEGIN_SRC d
-private auto documentMakeSDLangToAAmake(Tag)(Tag 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:
-
-#+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",
+ "%s\n%s\n%s:%s failed here:\n _src_header: %s",
__MODULE__, __FUNCTION__,
__FILE__, __LINE__,
- src_header,
+ _src_header,
);
}
Tag sdl_root_header;
try {
- sdl_root_header = parseSource(src_header);
+ sdl_root_header = parseSource(_src_header.to!string);
}
catch(ParseException e) {
stderr.writeln("SDLang problem with this document header:");
- stderr.writeln(src_header);
+ stderr.writeln(_src_header);
// Error messages of the form:
// myFile.sdl(5:28): Error: Invalid integer suffix.
stderr.writeln(e.msg);
@@ -205,42 +152,62 @@ final private auto headerMakeSDLang(Hs)(Hs src_header) {
}
}
}
- return sdl_root_header;
+ return sdl_root_header; // sdlang.ast.Tag
}
#+END_SRC
-*** sdlang header _src text get_ :sdlang:get:src:
+** 2a. _sdlang to associative array_
#+name: ao_conf_make_meta_sdl
#+BEGIN_SRC d
-private auto headerSDLangGet(Hs)(Hs src_header) {
+private auto sdlangToAA(C,Tag)(C conf, Tag conf_sdlang) {
debug(asserts){
- static assert(is(typeof(src_header) == char[]));
+ static assert(is(typeof(conf) == string[string][string]));
}
- char[][] source_header_arr =
- (cast(char[]) src_header).split(rgx.newline_eol_delimiter);
- char[] header_clean;
- foreach(header_line; source_header_arr) {
- if (!match(header_line, rgx.comments)) {
- header_clean ~= header_line ~ "\n";
+ foreach (maintag, subtags; conf) {
+ /+ writeln(__LINE__, ": ", maintag, ":- ", subtags); +/
+ foreach (subtag, content; subtags) {
+ 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(__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] =
+ (conf_sdlang.tags[maintag][0].attributes[subtag][0].value).to!string;
+ }
+ }
}
}
- /+ get sdlang tags +/
- auto header_sdlang=headerMakeSDLang(to!string(header_clean));
- return header_sdlang; // sdlang.ast.Tag
+ return conf;
}
#+END_SRC
-*** sdlang header to _associative array_ make sdlTag in :sdlang:aa:
+** 2b. 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) {
+private auto docHeaderSDLtoAA(Ma, Tag)(Ma dochead_make, Tag header_sdlang) {
debug(asserts){
static assert(is(typeof(dochead_make) == string[string][string]));
}
- dochead_make = sdlangToAAheaderMakeMeta(dochead_make, header_sdlang);
- auto dochead_meta = sdlangToAAheaderMakeMeta(meta_aa_empty, header_sdlang);
+ dochead_make = sdlangToAA(dochead_make, header_sdlang);
+ auto dochead_meta = sdlangToAA(meta_aa_empty, header_sdlang);
if (dochead_meta["title"]["main"].empty) {
{
Tag _maintag = header_sdlang.getTag("title");
@@ -283,23 +250,8 @@ private auto headerSDLangToAAmake(Tag,Ma)(Tag header_sdlang, Ma dochead_make) {
}
#+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);
- auto header_aa_tuple = headerSDLangToAAmake(header_sdlang_tag, conf_doc_make_aa);
- return header_aa_tuple;
-}
-#+END_SRC
-
-* B. header native :module:sdp:ao_conf_make_meta_native:
-** Header Native :header:native:markup_header_extract_native:
+* B. module native document header :module:sdp:ao_conf_make_meta_native:
+** module template
#+BEGIN_SRC d :tangle ../src/sdp/ao/conf_make_meta_native.d
/++
@@ -658,3 +610,129 @@ private auto headerNativeToAA(Hn)(Hn src_header) {
return t;
}
#+END_SRC
+
+* 0. composite make :module:sdp:ao_composite_make:
+** TODO 0. template
+*** composite make
+
+#+BEGIN_SRC d :tangle ../src/sdp/ao/composite_make.d
+/++
+ output hub<BR>
+ check & generate output types requested
++/
+module sdp.ao.composite_make;
+template compositeMkCnf() {
+ <<imports>>
+ mixin SiSUrgxInit;
+ string[] _substitutions;
+ string[string][] _sub;
+ string _bold;
+ string _italics;
+ string _emphasis;
+ auto compositeMkCnf(Mks...)(Mks makes) {
+ foreach (make; makes) {
+ auto rgx = Rgx();
+ if (auto z = "make" in make) {
+ if (auto x = "substitute" in *z) {
+ foreach (m; (*x).matchAll(rgx.make_simple_substitutions_d)) {
+ _sub ~= ["match": (m["match"]), "replace": (m["replace"])];
+ _substitutions ~= format("`%s`,\"%s\"",
+ m["match"],
+ m["replace"],
+ );
+ }
+ foreach (m; (*x).matchAll(rgx.make_simple_substitutions_rb)) {
+ _sub ~= ["match": (m["match"]), "replace": (m["replace"])];
+ _substitutions ~= format("`%s`,\"%s\"",
+ m["match"],
+ m["replace"],
+ );
+ }
+ }
+ if (auto x = "bold" in *z) {
+ _bold = (*x).to!string;
+ }
+ if (auto x = "italics" in *z) {
+ _italics = (*x).to!string;
+ }
+ if (auto x = "emphasis" in *z) {
+ _emphasis = (*x).to!string;
+ }
+ }
+ }
+ struct _composite_make {
+ auto substitutions() {
+ auto _k = _sub;
+ return _k;
+ }
+ auto substitute() {
+ auto _k = _substitutions;
+ return _k;
+ }
+ auto italics() {
+ auto _k = _italics;
+ return _k;
+ }
+ auto bold() {
+ auto _k = _bold;
+ return _k;
+ }
+ auto emphasis() {
+ auto _k = _emphasis;
+ return _k;
+ }
+ }
+ return _composite_make();
+ }
+}
+#+END_SRC
+
+*** composite make aa
+#+BEGIN_SRC d :tangle ../src/sdp/ao/composite_make.d
+/++
+ output hub<BR>
+ check & generate output types requested
++/
+template compositeMkCnfAA() {
+ <<imports>>
+ mixin SiSUrgxInit;
+ string[] _substitutions;
+ string[string][] _sub;
+ auto rgx = Rgx();
+ auto compositeMkCnfAA(Mks...)(Mks makes) {
+ /+
+ - skip.first_make which is the "composite make output"
+ - pass config files as associative arrays,
+ - skip.last_make which is getopt, treat separately
+ +/
+ auto _composite_make = makes[0];
+ auto _opts = makes[$-1];
+ foreach (make; makes[1..$-1]) {
+ if (auto z = "make" in make) { // document head: make (part of individual document)
+ if (auto x = "substitute" in *z) {
+ _composite_make["make"]["substitute"] = *x;
+ }
+ if (auto x = "italics" in *z) {
+ _composite_make["make"]["italics"] = *x;
+ }
+ if (auto x = "bold" in *z) {
+ _composite_make["make"]["bold"] = *x;
+ }
+ if (auto x = "emphasis" in *z) {
+ _composite_make["make"]["emphasis"] = *x;
+ }
+ }
+ }
+ /+ logic for adding _opts make instructions to _composite make +/
+ return _composite_make;
+ }
+}
+#+END_SRC
+
+** initialize / imports
+
+#+name: imports
+#+BEGIN_SRC d
+import sdp.ao;
+import std.array;
+#+END_SRC