diff options
Diffstat (limited to 'org/ao_header_extract.org')
-rw-r--r-- | org/ao_header_extract.org | 170 |
1 files changed, 137 insertions, 33 deletions
diff --git a/org/ao_header_extract.org b/org/ao_header_extract.org index 586a0ff..a0b87d4 100644 --- a/org/ao_header_extract.org +++ b/org/ao_header_extract.org @@ -13,6 +13,130 @@ #+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 + +#+name: ao_header_extract_sdl +#+BEGIN_SRC d +private auto documentMakeSDLangToJSONmake(Tag document_make_sdlang) { + /+ dochead +/ + string hm; + string hs; + /+ make +/ + auto dochead_make = parseJSON(make_jsonstr).object; + 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 = + 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 = + 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 = + 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 = + 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 = + 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 = + 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 = + 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 = + 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 = + 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 = + 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 = + 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 = + 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 = + to!string(document_make_sdlang.tags[hm][0].attributes[hs][0].value); + } + } + /+ + hm = "links"; + if (!(document_make_sdlang.maybe.tags[hm].empty)) { + /+ TODO + stuff to fix + +/ + // hs = "link"; + // 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 = + // to!string(document_make_sdlang.tags[hm][0].attributes[hs][0].value); + // } + } + +/ + // writeln(dochead_make); + return dochead_make; +} +#+END_SRC + * header native :header:native: // mixin SiSUheader; @@ -297,8 +421,8 @@ private auto headerNativeToJSON(in char[] src_header) { ]; string[string] an_object; int[string] line_occur; - auto dochead_make = parseJSON(header_make_jsonstr).object; - auto dochead_meta = parseJSON(header_meta_jsonstr).object; + auto dochead_make = parseJSON(make_jsonstr).object; + auto dochead_meta = parseJSON(meta_jsonstr).object; auto set_header = HeaderDocMetadataAndMakeNativeToJson(); char[][] source_header_arr = split(cast(char[]) src_header, rgx.line_delimiter); @@ -405,15 +529,15 @@ private auto headerSDLangGet(in char[] src_header) { } #+END_SRC -** sdlang header to json make :sdlang:json: +** sdlang header to json make sdlTag in :sdlang:json: #+name: ao_header_extract_sdl #+BEGIN_SRC d -private auto headerSDLangToJSONmake(Tag header_sdlang) { +private auto headerSDLangToJSONmake(Tag header_sdlang, JSONValue[string] dochead_make) { /+ TODO json next +/ /+ TODO - auto dochead_make = parseJSON(header_make_jsonstr).object; - auto dochead_meta = parseJSON(header_meta_jsonstr).object; + 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) { @@ -427,7 +551,6 @@ private auto headerSDLangToJSONmake(Tag header_sdlang) { string hm; string hs; /+ make +/ - auto dochead_make = parseJSON(header_make_jsonstr).object; if (!(header_sdlang.maybe.tags["make"].empty)) { hm = "make"; hs = "bold"; @@ -523,7 +646,7 @@ private auto headerSDLangToJSONmake(Tag header_sdlang) { } } /+ meta +/ - auto dochead_meta = parseJSON(header_meta_jsonstr).object; + auto dochead_meta = parseJSON(meta_jsonstr).object; hm = "title"; if (!(header_sdlang.maybe.tags[hm].empty)) { /+ TODO Title REQUIRED +/ @@ -842,9 +965,9 @@ private auto headerSDLangToJSONmake(Tag header_sdlang) { #+name: ao_header_extract_sdl #+BEGIN_SRC d -private auto headerSDLangToJSON(char[] header_sdlang_src) { +private auto headerSDLangToJSON(char[] header_sdlang_src, JSONValue[string] conf_doc_make_json) { auto header_sdlang_tag = headerSDLangGet(header_sdlang_src); // sdlang.ast.Tag - auto header_json_tuple = headerSDLangToJSONmake(header_sdlang_tag); + auto header_json_tuple = headerSDLangToJSONmake(header_sdlang_tag, conf_doc_make_json); return header_json_tuple; } #+END_SRC @@ -872,13 +995,13 @@ template SiSUheaderExtractHub() { mixin SiSUheaderExtractNative; mixin SiSUheaderExtractSDLang; auto rgx = Rgx(); - private auto headerContentJSON(char[] header_src) { + private auto headerContentJSON(char[] header_src, JSONValue[string] conf_doc_make_json) { auto head_native = HeaderDocMetadataAndMakeNativeToJson(); 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)); + : (head_sdlang.headerSDLangToJSON(header_src, conf_doc_make_json)); writeln(__LINE__); static assert(!isTypeTuple!(header_make_and_meta_tuple)); return header_make_and_meta_tuple; @@ -903,7 +1026,7 @@ template SiSUheaderExtractNative() { private import ao_rgx; struct HeaderDocMetadataAndMakeNativeToJson { - mixin SiSUheaderRegister; + mixin SiSUregisters; mixin SiSUrgxInitFlags; mixin RgxInit; auto rgx = Rgx(); @@ -926,30 +1049,11 @@ template SiSUheaderExtractSDLang() { private import ao_rgx; struct HeaderExtractSDL { - mixin SiSUheaderRegister; + mixin SiSUregisters; mixin RgxInit; auto rgx = Rgx(); <<ao_header_extract_sdl>> <<ao_header_extract_sdl_to_json>> } - struct HeaderUseSDL { - mixin RgxInit; - auto rgx = Rgx(); - // Tag = sdl_header; - auto headerUseSDLang(T)(auto T sdl_root_header) { - // T sdl_root_header; - // auto headerUseSDLang(Tag sdl_root_header) { - // private auto headerUseSDLang(Tag sdl_root_header) { - // private auto headerUseSDLang(in Tag sdl_root_header) { - // auto sdl_root_header = T; - - // Value is a std.variant.Algebraic - Value test = sdl_root_header.tags["title"][0].values[0]; - // assert(test == typeid(string)); - writeln(test); - - return sdl_root_header; - } - } } #+END_SRC |