aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--org/ao_defaults.org6
-rw-r--r--org/ao_header_extract.org170
-rw-r--r--org/sdp.org7
-rwxr-xr-xsrc/sdp.d7
-rw-r--r--src/sdp/ao_defaults.d6
-rw-r--r--src/sdp/ao_header_extract.d4
-rw-r--r--src/sdp/ao_header_extract_native.d6
-rw-r--r--src/sdp/ao_header_extract_sdlang.d152
8 files changed, 283 insertions, 75 deletions
diff --git a/org/ao_defaults.org b/org/ao_defaults.org
index 00fe102..ec007b0 100644
--- a/org/ao_defaults.org
+++ b/org/ao_defaults.org
@@ -19,8 +19,8 @@
** template: header :header:
#+name: ao_defaults_templates
#+BEGIN_SRC d
-template SiSUheaderRegister() {
- auto header_make_jsonstr = `{
+template SiSUregisters() {
+ string make_jsonstr = `{
"make": {
"bold" : "",
"breaks" : "",
@@ -37,7 +37,7 @@ template SiSUheaderRegister() {
"texpdf_font" : ""
}
}`;
- auto header_meta_jsonstr = `{
+ auto meta_jsonstr = `{
"classify": {
"dewey" : "",
"keywords" : "",
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
diff --git a/org/sdp.org b/org/sdp.org
index 89cd588..014cb0c 100644
--- a/org/sdp.org
+++ b/org/sdp.org
@@ -173,8 +173,9 @@ mixin(import("version.txt"));
#+NAME: sdp_args
#+BEGIN_SRC d
-mixin SiSUheaderRegister;
+mixin SiSUregisters;
mixin SiSUheaderExtractHub;
+mixin SiSUheaderExtractSDLang;
mixin SiSUbiblio;
mixin SiSUrgxInitFlags;
mixin SiSUconfigSDLangHub;
@@ -312,6 +313,8 @@ foreach(arg; args) {
auto conf = ConfigHub();
auto sdl_root_configuration = conf.configSDLang("conf.sdl");
auto sdl_root_document_make = conf.configSDLang("sisu_document_make");
+auto confsdl = HeaderExtractSDL();
+auto conf_doc_make_json = confsdl.documentMakeSDLangToJSONmake(sdl_root_document_make);
#+END_SRC
** each file (loop) [+2] :loop:files:
@@ -362,7 +365,7 @@ debug(header_and_content) {
**** [#A] read doc header: metadata & make :doc:header:metadata:make:
#+NAME: sdp_each_file_do
#+BEGIN_SRC d
-auto header_make_and_meta_tuple = head.headerContentJSON(header);
+auto header_make_and_meta_tuple = head.headerContentJSON(header, conf_doc_make_json);
static assert(!isTypeTuple!(header_make_and_meta_tuple));
JSONValue[string] dochead_make_json = header_make_and_meta_tuple[0];
JSONValue[string] dochead_meta_json = header_make_and_meta_tuple[1];
diff --git a/src/sdp.d b/src/sdp.d
index 127a8ad..c032607 100755
--- a/src/sdp.d
+++ b/src/sdp.d
@@ -97,8 +97,9 @@ mixin CompileTimeInfo;
mixin RgxInit;
void main(string[] args) {
- mixin SiSUheaderRegister;
+ mixin SiSUregisters;
mixin SiSUheaderExtractHub;
+ mixin SiSUheaderExtractSDLang;
mixin SiSUbiblio;
mixin SiSUrgxInitFlags;
mixin SiSUconfigSDLangHub;
@@ -208,6 +209,8 @@ void main(string[] args) {
auto conf = ConfigHub();
auto sdl_root_configuration = conf.configSDLang("conf.sdl");
auto sdl_root_document_make = conf.configSDLang("sisu_document_make");
+ auto confsdl = HeaderExtractSDL();
+ auto conf_doc_make_json = confsdl.documentMakeSDLangToJSONmake(sdl_root_document_make);
foreach(fn_src; fns_src) {
// foreach(fn_src; fns_src) {
if (!empty(fn_src)) {
@@ -242,7 +245,7 @@ void main(string[] args) {
writeln(header_and_content_tuple.length);
writeln(sourcefile_content[0]);
}
- auto header_make_and_meta_tuple = head.headerContentJSON(header);
+ auto header_make_and_meta_tuple = head.headerContentJSON(header, conf_doc_make_json);
static assert(!isTypeTuple!(header_make_and_meta_tuple));
JSONValue[string] dochead_make_json = header_make_and_meta_tuple[0];
JSONValue[string] dochead_meta_json = header_make_and_meta_tuple[1];
diff --git a/src/sdp/ao_defaults.d b/src/sdp/ao_defaults.d
index 48f61c9..dda08f7 100644
--- a/src/sdp/ao_defaults.d
+++ b/src/sdp/ao_defaults.d
@@ -2,8 +2,8 @@
defaults
ao_defaults.d
+/
-template SiSUheaderRegister() {
- auto header_make_jsonstr = `{
+template SiSUregisters() {
+ string make_jsonstr = `{
"make": {
"bold" : "",
"breaks" : "",
@@ -20,7 +20,7 @@ template SiSUheaderRegister() {
"texpdf_font" : ""
}
}`;
- auto header_meta_jsonstr = `{
+ auto meta_jsonstr = `{
"classify": {
"dewey" : "",
"keywords" : "",
diff --git a/src/sdp/ao_header_extract.d b/src/sdp/ao_header_extract.d
index 76c5a7d..cf6dca1 100644
--- a/src/sdp/ao_header_extract.d
+++ b/src/sdp/ao_header_extract.d
@@ -10,13 +10,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;
diff --git a/src/sdp/ao_header_extract_native.d b/src/sdp/ao_header_extract_native.d
index 49555ef..2f86d89 100644
--- a/src/sdp/ao_header_extract_native.d
+++ b/src/sdp/ao_header_extract_native.d
@@ -10,7 +10,7 @@ template SiSUheaderExtractNative() {
private import
ao_rgx;
struct HeaderDocMetadataAndMakeNativeToJson {
- mixin SiSUheaderRegister;
+ mixin SiSUregisters;
mixin SiSUrgxInitFlags;
mixin RgxInit;
auto rgx = Rgx();
@@ -273,8 +273,8 @@ template SiSUheaderExtractNative() {
];
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);
diff --git a/src/sdp/ao_header_extract_sdlang.d b/src/sdp/ao_header_extract_sdlang.d
index a175b4f..886a2c8 100644
--- a/src/sdp/ao_header_extract_sdlang.d
+++ b/src/sdp/ao_header_extract_sdlang.d
@@ -7,9 +7,127 @@ template SiSUheaderExtractSDLang() {
private import
ao_rgx;
struct HeaderExtractSDL {
- mixin SiSUheaderRegister;
+ mixin SiSUregisters;
mixin RgxInit;
auto rgx = Rgx();
+ 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;
+ }
final private auto headerMakeSDLang(in string src_header) {
scope(failure) {
stderr.writefln(
@@ -60,11 +178,11 @@ template SiSUheaderExtractSDLang() {
}
return header_sdlang; // sdlang.ast.Tag
}
- 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) {
@@ -78,7 +196,6 @@ template SiSUheaderExtractSDLang() {
string hm;
string hs;
/+ make +/
- auto dochead_make = parseJSON(header_make_jsonstr).object;
if (!(header_sdlang.maybe.tags["make"].empty)) {
hm = "make";
hs = "bold";
@@ -174,7 +291,7 @@ template SiSUheaderExtractSDLang() {
}
}
/+ 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 +/
@@ -487,30 +604,11 @@ template SiSUheaderExtractSDLang() {
static assert(!isTypeTuple!(t));
return t;
}
- 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;
}
}
- 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;
- }
- }
}