aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sdp/ao_abstract_doc_source.d
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2016-06-16 01:49:06 -0400
committerRalph Amissah <ralph@amissah.com>2019-04-04 14:48:18 -0400
commit8ab7e935913c102fb039110e20b71f698a68c6ee (patch)
tree3472debd16ce656a57150399ce666e248565f011 /src/sdp/ao_abstract_doc_source.d
parentstep4.1 as step4 but extract header meta & make on first reading in document (diff)
step5 sdlang used for config files and doc headers
Diffstat (limited to 'src/sdp/ao_abstract_doc_source.d')
-rw-r--r--src/sdp/ao_abstract_doc_source.d125
1 files changed, 17 insertions, 108 deletions
diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d
index ca435ff..c814c15 100644
--- a/src/sdp/ao_abstract_doc_source.d
+++ b/src/sdp/ao_abstract_doc_source.d
@@ -120,11 +120,8 @@ template SiSUdocAbstraction() {
// mixin SiSUdocAbstractionFunctions;
/+ ↓ abstract marked up document +/
- auto abstract_doc_source(
- char[][] markup_sourcefile_content,
- JSONValue[string] dochead_make_json,
- JSONValue[string] dochead_meta_json
- ) {
+ auto abstract_doc_source(char[][] markup_sourcefile_content) {
+
/+ ↓ abstraction init +/
scope(success) {
}
@@ -341,24 +338,24 @@ template SiSUdocAbstraction() {
&& ((type["para"] == State.off)
&& (type["heading"] == State.off))) {
/+ heading or para but neither flag nor line exists +/
- if ((to!string(dochead_make_json["make"]["headings"]).length > 2)
- && (type["make_headings"] == State.off)) {
- /+ heading found +/
- auto dochead_make_headings =
- to!string(dochead_make_json["make"]["headings"]);
- heading_found(line, dochead_make_headings, heading_match_str, heading_match_rgx, type);
- }
+ // if ((to!string(dochead_make["make"]["headings"]).length > 2)
+ // && (type["make_headings"] == State.off)) {
+ // /+ heading found +/
+ // auto dochead_make_headings =
+ // to!string(dochead_make["make"]["headings"]);
+ // heading_found(line, dochead_make_headings, heading_match_str, heading_match_rgx, type);
+ // }
if ((type["make_headings"] == State.on)
&& ((line_occur["para"] == State.off)
&& (line_occur["heading"] == State.off))
&& ((type["para"] == State.off)
&& (type["heading"] == State.off))) {
/+ heading make set +/
- heading_make_set(line, line_occur, heading_match_rgx, type);
+ // heading_make_set(line, line_occur, heading_match_rgx, type);
}
if (matchFirst(line, rgx.heading)) {
/+ heading match +/
- heading_matched(line, line_occur, an_object, lv, collapsed_lev, type, dochead_meta_json);
+ heading_matched(line, line_occur, an_object, lv, collapsed_lev, type);
} else if (line_occur["para"] == State.off) {
/+ para match +/
para_match(line, an_object, indent, bullet, type, line_occur);
@@ -1617,94 +1614,6 @@ template SiSUdocAbstraction() {
}
}
}
- auto heading_found(
- char[] line,
- string dochead_make_headings,
- ref string[string] heading_match_str,
- ref Regex!(char)[string] heading_match_rgx,
- ref int[string] type
- ) {
- if ((to!string(dochead_make_headings).length > 2)
- && (type["make_headings"] == State.off)) {
- /+ headings found +/
- debug(headingsfound) {
- writeln(dochead_make_headings);
- }
- auto make_headings_txt =
- match(
- to!string(dochead_make_headings),
- rgx.within_quotes);
- char[][] make_headings_spl =
- split(
- cast(char[]) make_headings_txt.captures[1],
- rgx.make_heading_delimiter);
- debug(headingsfound) {
- writeln(make_headings_spl.length);
- writeln(make_headings_spl);
- }
- switch (make_headings_spl.length) {
- case 7 :
- if (!empty(make_headings_spl[6])) {
- heading_match_str["h_4"] =
- "^(" ~ to!string(make_headings_spl[6]) ~ ")";
- heading_match_rgx["h_4"] =
- regex(heading_match_str["h_4"]);
- }
- goto case;
- case 6 :
- if (!empty(make_headings_spl[5])) {
- heading_match_str["h_3"] =
- "^(" ~ to!string(make_headings_spl[5]) ~ ")";
- heading_match_rgx["h_3"] =
- regex(heading_match_str["h_3"]);
- }
- goto case;
- case 5 :
- if (!empty(make_headings_spl[4])) {
- heading_match_str["h_2"] =
- "^(" ~ to!string(make_headings_spl[4]) ~ ")";
- heading_match_rgx["h_2"] =
- regex(heading_match_str["h_2"]);
- }
- goto case;
- case 4 :
- if (!empty(make_headings_spl[3])) {
- heading_match_str["h_1"] =
- "^(" ~ to!string(make_headings_spl[3]) ~ ")";
- heading_match_rgx["h_1"] =
- regex(heading_match_str["h_1"]);
- }
- goto case;
- case 3 :
- if (!empty(make_headings_spl[2])) {
- heading_match_str["h_D"] =
- "^(" ~ to!string(make_headings_spl[2]) ~ ")";
- heading_match_rgx["h_D"] =
- regex(heading_match_str["h_D"]);
- }
- goto case;
- case 2 :
- if (!empty(make_headings_spl[1])) {
- heading_match_str["h_C"] =
- "^(" ~ to!string(make_headings_spl[1]) ~ ")";
- heading_match_rgx["h_C"] =
- regex(heading_match_str["h_C"]);
- }
- goto case;
- case 1 :
- if (!empty(make_headings_spl[0])) {
- heading_match_str["h_B"] =
- "^(" ~ to!string(make_headings_spl[0]) ~ ")";
- heading_match_rgx["h_B"] =
- regex(heading_match_str["h_B"]);
- }
- break;
- default:
- break;
- }
- type["make_headings"] = State.on;
- }
- }
auto heading_make_set(
ref char[] line,
ref int[string] line_occur,
@@ -1767,8 +1676,8 @@ template SiSUdocAbstraction() {
ref string[string] an_object,
ref int[string] lv,
ref int[string] collapsed_lev,
- ref int[string] type,
- ref JSONValue[string] dochead_meta_json
+ ref int[string] type
+ // ref JSONValue[string] dochead_meta_json
) {
if (auto m = match(line, rgx.heading)) {
/+ heading match +/
@@ -1782,10 +1691,10 @@ template SiSUdocAbstraction() {
assertions_doc_structure(an_object, lv); // includes most of the logic for collapsed levels
switch (an_object["lev"]) {
case "A":
- an_object["obj"]=replaceFirst(an_object["obj"], rgx.head_value_title, to!string(dochead_meta_json["title"]["main"]));
- an_object["obj"]=replaceFirst(an_object["obj"], rgx.head_value_author, to!string(dochead_meta_json["creator"]["author"]));
- // an_object["obj"]=replaceFirst(an_object["obj"], rgx.head_value_title, to!string(parseJSON(dochead_meta_json["title"]["main"])));
- // an_object["obj"]=replaceFirst(an_object["obj"], rgx.head_value_author, to!string(parseJSON(dochead_meta_json["creator"]["author"])));
+ // an_object["obj"]=replaceFirst(an_object["obj"], rgx.head_value_title, to!string(dochead_metadata["title"]["main"]));
+ // an_object["obj"]=replaceFirst(an_object["obj"], rgx.head_value_author, to!string(dochead_metadata["creator"]["author"]));
+ // // an_object["obj"]=replaceFirst(an_object["obj"], rgx.head_value_title, to!string(parseJSON(dochead_metadata["title"]["main"])));
+ // // an_object["obj"]=replaceFirst(an_object["obj"], rgx.head_value_author, to!string(parseJSON(dochead_metadata["creator"]["author"])));
collapsed_lev["h0"] = 1;
an_object["lev_collapsed_number"] =
to!string(collapsed_lev["h0"]);