From 1d30d4b2225be7f152de94b007d81a5d7b7a1c3a Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 29 Jun 2016 22:28:53 -0400 Subject: associated array instead of json --- src/sdp/ao_abstract_doc_source.d | 6 +- src/sdp/ao_defaults.d | 229 +++++++++++------- src/sdp/ao_header_extract.d | 10 +- src/sdp/ao_header_extract_native.d | 78 +++---- src/sdp/ao_header_extract_sdlang.d | 463 ++++++++++++++++++++++++++++++------- 5 files changed, 570 insertions(+), 216 deletions(-) (limited to 'src/sdp') diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d index 8c19bf3..27a78b7 100644 --- a/src/sdp/ao_abstract_doc_source.d +++ b/src/sdp/ao_abstract_doc_source.d @@ -122,8 +122,8 @@ template SiSUdocAbstraction() { /+ ↓ abstract marked up document +/ auto abstract_doc_source( char[][] markup_sourcefile_content, - JSONValue[string] dochead_make_json, - JSONValue[string] dochead_meta_json + string[string][string] dochead_make_json, + string[string][string] dochead_meta_json ) { /+ ↓ abstraction init +/ scope(success) { @@ -1768,7 +1768,7 @@ template SiSUdocAbstraction() { ref int[string] lv, ref int[string] collapsed_lev, ref int[string] type, - ref JSONValue[string] dochead_meta_json + ref string[string][string] dochead_meta_json ) { if (auto m = match(line, rgx.heading)) { /+ heading match +/ diff --git a/src/sdp/ao_defaults.d b/src/sdp/ao_defaults.d index dda08f7..f344fe7 100644 --- a/src/sdp/ao_defaults.d +++ b/src/sdp/ao_defaults.d @@ -3,89 +3,146 @@ ao_defaults.d +/ template SiSUregisters() { - string make_jsonstr = `{ - "make": { - "bold" : "", - "breaks" : "", - "cover_image" : "", - "css" : "", - "emphasis" : "", - "footer" : "", - "headings" : "", - "home_button_image" : "", - "home_button_text" : "", - "italics" : "", - "num_top" : "", - "substitute" : "", - "texpdf_font" : "" - } - }`; - auto meta_jsonstr = `{ - "classify": { - "dewey" : "", - "keywords" : "", - "loc" : "", - "subject" : "", - "topic_register" : "" - }, - "creator": { - "author" : "", - "author_email" : "", - "illustrator" : "", - "translator" : "" - }, - "date": { - "added_to_site" : "", - "available" : "", - "created" : "", - "issued" : "", - "modified" : "", - "published" : "", - "valid" : "" - }, - "identifier": { - "isbn" : "", - "oclc" : "", - "pg" : "" - }, - "links": { - "link" : "" - }, - "notes": { - "abstract" : "", - "description" : "" - }, - "original": { - "language" : "", - "source" : "", - "title" : "" - }, - "publisher": { - "name" : "" - }, - "rights": { - "copyright" : "", - "cover" : "", - "illustrations" : "", - "license" : "" - }, - "title": { - "edition" : "", - "full" : "", - "language" : "", - "main" : "", - "note" : "", - "sub" : "" - } - }`; // links - auto pointer_head_sub_classify = - [ - "dewey", - "keywords", // - "loc", - "subject", - "topic_register" + string[string][string] conf_aa() { + auto conf_ = [ + "webserv": [ + "url_root" : "", + "path" : "~/sdp_www" , + "images" : "" , + "cgi" : "/usr/local/lib/sdp-cgi" + ], + "webserv_cgi": [ + "host" : "localhost", + "base_path" : "", + "port" : "8081", + "user" : "", + "file_links" : "www.sisudoc.org" + ], + "processing": [ + "path" : "~", + "dir" : "_sisu_processing", + "concord_max" : "400000" + ], + "flag": [ + "act0" : "--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --sqlite --manifest --verbose", + "act1" : "--digest --text --html --manifest", + "act2" : "--digest --text --html --epub --pdf --manifest", + "act3" : "--digest --qrcode --text --html --epub --concordance --pdf --manifest", + "act4" : "--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --manifest", + "act5" : "--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --sqlite --manifest", + "act6" : "--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --sqlite --manifest", + "act7" : "--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --sqlite --source --sisupod --manifest", + "act8" : "--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --pg --update --manifest", + "act9" : "--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --pg --update --source --sisupod --manifest" + ], + "default": [ + "papersize" : "a4,letter", + "text_wrap" : "78", + "emphasis" : "bold", + "language" : "en", + "digest" : "sha256" + ], + "permission": [ + "share_source" : "" + ], + "program_select": [ + "editor" : "vim", + "epub_viewer" : "ebook-viewer", + "html_viewer" : "xombrero", + "odf_viewer" : "lowriter", + "pdf_viewer" : "evince", + "xml_viewer" : "xml-viewer" + ], + "search": [ + "flag" : "", + "action" : "", + "db" : "", + "title" : "" + ] ]; + return conf_; + } + string[string][string] make_aa() { + auto make_ = [ + "make": [ + "bold" : "", + "breaks" : "", + "cover_image" : "", + "css" : "", + "emphasis" : "", + "footer" : "", + "headings" : "", + "home_button_image" : "", + "home_button_text" : "", + "italics" : "", + "num_top" : "", + "substitute" : "", + "texpdf_font" : "" + ] + ]; + return make_; + } + string[string][string] meta_aa() { + auto meta_ = [ + "classify": [ + "dewey" : "", + "keywords" : "", + "loc" : "", + "subject" : "", + "topic_register" : "" + ], + "creator": [ + "author" : "", + "author_email" : "", + "illustrator" : "", + "translator" : "" + ], + "date": [ + "added_to_site" : "", + "available" : "", + "created" : "", + "issued" : "", + "modified" : "", + "published" : "", + "valid" : "" + ], + "identifier": [ + "isbn" : "", + "oclc" : "", + "pg" : "" + ], + "links": [ + "link" : "" + ], + "notes": [ + "abstract" : "", + "description" : "" + ], + "original": [ + "language" : "", + "source" : "", + "title" : "" + ], + "publisher": [ + "name" : "" + ], + "rights": [ + "copyright" : "", + "cover" : "", + "illustrations" : "", + "license" : "" + ], + "title": [ + "edition" : "", + "full" : "", + "language" : "", + "main" : "", + "note" : "", + "sub" : "" + ] + ]; + return meta_; + } auto pointer_head_main = [ "classify", @@ -99,6 +156,14 @@ template SiSUregisters() { "rights", "title" ]; + auto pointer_head_sub_classify = + [ + "dewey", + "keywords", + "loc", + "subject", + "topic_register" + ]; auto pointer_head_sub_creator = [ "author", diff --git a/src/sdp/ao_header_extract.d b/src/sdp/ao_header_extract.d index cf6dca1..f78d7c4 100644 --- a/src/sdp/ao_header_extract.d +++ b/src/sdp/ao_header_extract.d @@ -1,5 +1,5 @@ /+ - extract native/orig header return json + extract native/orig header return associative array +/ template SiSUheaderExtractHub() { private import @@ -10,13 +10,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; diff --git a/src/sdp/ao_header_extract_native.d b/src/sdp/ao_header_extract_native.d index 2f86d89..7bcf965 100644 --- a/src/sdp/ao_header_extract_native.d +++ b/src/sdp/ao_header_extract_native.d @@ -1,5 +1,5 @@ /+ - extract native/orig header return json + extract native/orig header return associative array +/ template SiSUheaderExtractNative() { private import @@ -9,17 +9,17 @@ template SiSUheaderExtractNative() { std.conv : to; private import ao_rgx; - struct HeaderDocMetadataAndMakeNativeToJson { + struct HeaderDocMetadataAndMakeNativeToAA { mixin SiSUregisters; mixin SiSUrgxInitFlags; mixin RgxInit; auto rgx = Rgx(); enum State { off, on } string hm, hs; - 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 { @@ -39,13 +39,13 @@ template SiSUheaderExtractNative() { 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]); } } @@ -53,12 +53,12 @@ template SiSUheaderExtractNative() { 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); @@ -69,12 +69,12 @@ template SiSUheaderExtractNative() { 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 { @@ -86,11 +86,11 @@ template SiSUheaderExtractNative() { 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 { @@ -101,8 +101,8 @@ template SiSUheaderExtractNative() { 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 { @@ -113,8 +113,8 @@ template SiSUheaderExtractNative() { 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 { @@ -125,8 +125,8 @@ template SiSUheaderExtractNative() { 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 { @@ -137,8 +137,8 @@ template SiSUheaderExtractNative() { 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 { @@ -149,8 +149,8 @@ template SiSUheaderExtractNative() { 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 { @@ -161,8 +161,8 @@ template SiSUheaderExtractNative() { 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 { @@ -173,8 +173,8 @@ template SiSUheaderExtractNative() { 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 { @@ -187,8 +187,8 @@ template SiSUheaderExtractNative() { 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); @@ -264,7 +264,7 @@ template SiSUheaderExtractNative() { an_object.remove("is"); an_object.remove("attrib"); } - private auto headerNativeToJSON(in char[] src_header) { + private auto headerNativeToAA(in char[] src_header) { auto type = flags_type_init; type = [ "header" : State.off, @@ -273,9 +273,9 @@ template SiSUheaderExtractNative() { ]; 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) { @@ -295,7 +295,7 @@ template SiSUheaderExtractNative() { 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]; diff --git a/src/sdp/ao_header_extract_sdlang.d b/src/sdp/ao_header_extract_sdlang.d index 886a2c8..d4e9e36 100644 --- a/src/sdp/ao_header_extract_sdlang.d +++ b/src/sdp/ao_header_extract_sdlang.d @@ -10,103 +10,407 @@ template SiSUheaderExtractSDLang() { mixin SiSUregisters; mixin RgxInit; auto rgx = Rgx(); - 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; + } + 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); } } @@ -120,7 +424,7 @@ template SiSUheaderExtractSDLang() { // 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); // } } @@ -178,20 +482,7 @@ template SiSUheaderExtractSDLang() { } return header_sdlang; // sdlang.ast.Tag } - 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; @@ -202,96 +493,96 @@ template SiSUheaderExtractSDLang() { 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 +/ @@ -299,13 +590,13 @@ template SiSUheaderExtractSDLang() { 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"); @@ -314,12 +605,12 @@ template SiSUheaderExtractSDLang() { 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) @@ -329,26 +620,26 @@ template SiSUheaderExtractSDLang() { 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); } } @@ -364,28 +655,28 @@ template SiSUheaderExtractSDLang() { 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); } } @@ -395,35 +686,35 @@ template SiSUheaderExtractSDLang() { 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); } } @@ -433,49 +724,49 @@ template SiSUheaderExtractSDLang() { 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); } } @@ -485,21 +776,21 @@ template SiSUheaderExtractSDLang() { 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); } } @@ -512,7 +803,7 @@ template SiSUheaderExtractSDLang() { // 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); // } } @@ -522,14 +813,14 @@ template SiSUheaderExtractSDLang() { 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); } } @@ -539,21 +830,21 @@ template SiSUheaderExtractSDLang() { 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); } } @@ -563,7 +854,7 @@ template SiSUheaderExtractSDLang() { 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); } } @@ -573,41 +864,39 @@ template SiSUheaderExtractSDLang() { 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; } - 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; } } -- cgit v1.2.3