aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sdp/ao_abstract_doc_source.d
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2016-10-07 12:53:03 -0400
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:13 -0400
commit2471669e0954080b2a13b4f87cf61a36b1bf86dd (patch)
tree7da1f8bbaaa5e3508d9e46d503d694f921d2720f /src/sdp/ao_abstract_doc_source.d
parentsegment auto naming (where no name provided) placed in function (diff)
introduce a couple of unittests some re-organizing of obt
Diffstat (limited to 'src/sdp/ao_abstract_doc_source.d')
-rw-r--r--src/sdp/ao_abstract_doc_source.d660
1 files changed, 341 insertions, 319 deletions
diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d
index 595241a..5423513 100644
--- a/src/sdp/ao_abstract_doc_source.d
+++ b/src/sdp/ao_abstract_doc_source.d
@@ -54,7 +54,7 @@ template SiSUdocAbstraction() {
bool bullet = true;
string content_non_header = "8";
auto obj_im = ObjInlineMarkup();
- auto obj_att = ObjAttrib();
+ auto obj_att = ObjAttributes();
/+ ocn +/
int obj_cite_number, obj_cite_number_;
auto object_citation_number = OCNemitter();
@@ -1877,160 +1877,6 @@ template SiSUdocAbstraction() {
invariant() {
}
}
- struct ObjAttributes {
- string[string] obj_txt;
- string para_and_blocks(string obj_txt_in)
- in { }
- body {
- auto rgx = Rgx();
- obj_txt["munge"]=obj_txt_in;
- if (matchFirst(obj_txt_in, rgx.para_bullet)) {
- obj_txt["attrib"] =" \"bullet\": \"true\","
- ~ " \"indent_start\": 0,"
- ~ " \"indent_rest\": 0,";
- } else if (auto m = matchFirst(obj_txt_in, rgx.para_bullet_indent)) {
- obj_txt["attrib"] =" \"bullet\": \"true\","
- ~ " \"indent_start\": " ~ to!string(m.captures[1]) ~ ","
- ~ " \"indent_rest\": " ~ to!string(m.captures[1]) ~ ",";
- } else if (auto m = matchFirst(obj_txt_in, rgx.para_indent_hang)) {
- obj_txt["attrib"] =" \"bullet\": \"false\","
- ~ " \"indent_start\": " ~ to!string(m.captures[1]) ~ ","
- ~ " \"indent_rest\": " ~ to!string(m.captures[2]) ~ ",";
- } else if (auto m = matchFirst(obj_txt_in, rgx.para_indent)) {
- obj_txt["attrib"] =" \"bullet\": \"false\","
- ~ " \"indent_start\": " ~ to!string(m.captures[1]) ~ ","
- ~ " \"indent_rest\": " ~ to!string(m.captures[1]) ~ ",";
- } else {
- obj_txt["attrib"] =" \"bullet\": \"false\","
- ~ " \"indent_start\": 0,"
- ~ " \"indent_rest\": 0,";
- }
- return obj_txt["attrib"];
- }
- string para(string obj_txt_in)
- in { }
- body {
- obj_txt["munge"]=obj_txt_in;
- obj_txt["attrib"] = " \"use\": \"content\","
- ~ " \"of\": \"para\","
- ~ " \"is\": \"para\"";
- return obj_txt["attrib"];
- }
- invariant() {
- }
- string heading(string obj_txt_in)
- in { }
- body {
- obj_txt["munge"]=obj_txt_in;
- obj_txt["attrib"] = " \"use\": \"content\","
- ~ " \"of\": \"para\","
- ~ " \"is\": \"heading\"";
- // obj_txt["struct"]=;
- return obj_txt["attrib"];
- }
- invariant() {
- }
- /+ revist +/
- // string header_make(string obj_txt_in)
- // in { }
- // body {
- // obj_txt["munge"]=obj_txt_in;
- // obj_txt["attrib"] = " \"use\": \"head\","
- // ~ " \"of\": \"header\","
- // ~ " \"is\": \"header_make\"";
- // return obj_txt["attrib"];
- // }
- // invariant() {
- // }
- // string header_meta(string obj_txt_in)
- // in { }
- // body {
- // obj_txt["munge"]=obj_txt_in;
- // obj_txt["attrib"] = " \"use\": \"head\","
- // ~ " \"of\": \"header\","
- // ~ " \"is\": \"header_metadata\"";
- // return obj_txt["attrib"];
- // }
- // invariant() {
- // }
- string code(string obj_txt_in)
- in { }
- body {
- obj_txt["munge"]=obj_txt_in;
- obj_txt["attrib"] = " \"use\": \"content\","
- ~ " \"of\": \"block\","
- ~ " \"is\": \"code\"";
- return obj_txt["attrib"];
- }
- invariant() {
- }
- string group(string obj_txt_in)
- in { }
- body {
- obj_txt["munge"]=obj_txt_in;
- obj_txt["attrib"] = " \"use\": \"content\","
- ~ " \"of\": \"block\","
- ~ " \"is\": \"group\"";
- return obj_txt["attrib"];
- }
- invariant() {
- }
- string block(string obj_txt_in)
- in { }
- body {
- obj_txt["munge"]=obj_txt_in;
- obj_txt["attrib"] = " \"use\": \"content\","
- ~ " \"of\": \"block\","
- ~ " \"is\": \"block\"";
- return obj_txt["attrib"];
- }
- invariant() {
- }
- string verse(string obj_txt_in)
- in { }
- body {
- obj_txt["munge"]=obj_txt_in;
- obj_txt["attrib"] = " \"use\": \"content\","
- ~ " \"of\": \"block\","
- ~ " \"is\": \"verse\"";
- return obj_txt["attrib"];
- }
- invariant() {
- }
- string quote(string obj_txt_in)
- in { }
- body {
- obj_txt["munge"]=obj_txt_in;
- obj_txt["attrib"] = " \"use\": \"content\","
- ~ " \"of\": \"block\","
- ~ " \"is\": \"quote\"";
- return obj_txt["attrib"];
- }
- invariant() {
- }
- string table(string obj_txt_in)
- in { }
- body {
- obj_txt["munge"]=obj_txt_in;
- obj_txt["attrib"] = " \"use\": \"content\","
- ~ " \"of\": \"block\","
- ~ " \"is\": \"table\"";
- return obj_txt["attrib"];
- }
- invariant() {
- }
- string comment(string obj_txt_in)
- in { }
- body {
- obj_txt["munge"]=obj_txt_in;
- obj_txt["attrib"] = " \"use\": \"comment\","
- ~ " \"of\": \"comment\","
- ~ " \"is\": \"comment\"";
- return obj_txt["attrib"];
- }
- invariant() {
- }
- }
struct ObjInlineMarkupMunge {
// struct ObjInlineMarkupMunge : AssertObjInlineMarkup {
string[string] obj_txt;
@@ -2221,25 +2067,6 @@ template SiSUdocAbstraction() {
// struct ObjInlineMarkup : AssertObjInlineMarkup {
auto munge = ObjInlineMarkupMunge();
string[string] obj_txt;
- string make_segment_anchor_tags_if_none_provided(string munge_, string lev_) {
- if (!(match(munge_, rgx.heading_anchor_tag))) { // if (anchor_tags_.length == 0) {
- if (match(munge_, rgx.heading_identify_anchor_tag)) {
- if (auto m = match(munge_, rgx.heading_extract_named_anchor_tag)) {
- munge_=replaceFirst(munge_, rgx.heading_marker_missing_tag,
- "$1~" ~ toLower(m.captures[1]) ~ "_" ~ m.captures[2] ~ " ");
- } else if (auto m = match(munge_, rgx.heading_extract_unnamed_anchor_tag)) {
- munge_=replaceFirst(munge_, rgx.heading_marker_missing_tag,
- "$1~" ~ "s" ~ m.captures[1] ~ " ");
- }
- } else if (lev_ == "1") { // (if not successful) manufacture a unique anchor tag for lev=="1"
- static __gshared uint heading_num_lev1 = 0;
- heading_num_lev1 ++;
- munge_=replaceFirst(munge_, rgx.heading_marker_missing_tag,
- "$1~" ~ "x" ~ to!string(heading_num_lev1) ~ " ");
- }
- }
- return munge_;
- }
auto obj_inline_markup_and_anchor_tags(string[string] obj_, string[string][string] dochead_make_aa)
in { }
body {
@@ -2251,117 +2078,9 @@ template SiSUdocAbstraction() {
switch (obj_["is"]) {
case "heading":
static __gshared string anchor_tag = "";
- if (dochead_make_aa["make"]["num_top"].length > 0) {
- if (!(match(obj_txt["munge"], rgx.heading_anchor_tag))) {
- static __gshared uint heading_num_top_level=9;
- static __gshared uint heading_num_depth=2;
- static __gshared uint heading_num_0 = 0;
- static __gshared uint heading_num_1 = 0;
- static __gshared uint heading_num_2 = 0;
- static __gshared uint heading_num_3 = 0;
- static __gshared string heading_number_auto_composite = "";
- if (heading_num_top_level==9) {
- if (dochead_make_aa["make"]["num_depth"].length > 0) {
- heading_num_depth = to!uint(dochead_make_aa["make"]["num_depth"]);
- }
- switch (dochead_make_aa["make"]["num_top"]) {
- case "A":
- break;
- case "B":
- heading_num_top_level=1;
- break;
- case "C":
- heading_num_top_level=2;
- break;
- case "D":
- heading_num_top_level=3;
- break;
- case "1":
- heading_num_top_level=4;
- break;
- case "2":
- heading_num_top_level=5;
- break;
- case "3":
- heading_num_top_level=6;
- break;
- case "4":
- heading_num_top_level=7;
- break;
- default:
- break;
- }
- }
- /+ num_depth minimum 0 (1.) default 2 (1.1.1) max 3 (1.1.1.1) implement +/
- if (heading_num_top_level > to!uint(obj_["lev_markup_number"])) {
- heading_num_0 = 0;
- heading_num_1 = 0;
- heading_num_2 = 0;
- heading_num_3 = 0;
- } else if (heading_num_top_level == to!uint(obj_["lev_markup_number"])) {
- heading_num_0 ++;
- heading_num_1 = 0;
- heading_num_2 = 0;
- heading_num_3 = 0;
- } else if (heading_num_top_level == (to!uint(obj_["lev_markup_number"]) - 1)) {
- heading_num_1 ++;
- heading_num_2 = 0;
- heading_num_3 = 0;
- } else if (heading_num_top_level == (to!uint(obj_["lev_markup_number"]) - 2)) {
- heading_num_2 ++;
- heading_num_3 = 0;
- } else if (heading_num_top_level == (to!uint(obj_["lev_markup_number"]) - 3)) {
- heading_num_3 ++;
- } else {
- }
- if (heading_num_3 > 0) {
- heading_number_auto_composite =
- (heading_num_depth == 3)
- ? ( to!string(heading_num_0) ~ "." ~
- to!string(heading_num_1) ~ "." ~
- to!string(heading_num_2) ~ "." ~
- to!string(heading_num_3)
- )
- : "";
- } else if (heading_num_2 > 0) {
- heading_number_auto_composite =
- ((heading_num_depth >= 2)
- && (heading_num_depth <= 3))
- ? ( to!string(heading_num_0) ~ "." ~
- to!string(heading_num_1) ~ "." ~
- to!string(heading_num_2)
- )
- : "";
- } else if (heading_num_1 > 0) {
- heading_number_auto_composite =
- ((heading_num_depth >= 1)
- && (heading_num_depth <= 3))
- ? ( to!string(heading_num_0) ~ "." ~
- to!string(heading_num_1)
- )
- : "";
- } else if (heading_num_0 > 0) {
- heading_number_auto_composite =
- ((heading_num_depth >= 0)
- && (heading_num_depth <= 3))
- ? (to!string(heading_num_0))
- : "";
- } else {
- heading_number_auto_composite = "";
- }
- debug(heading_number_auto) {
- writeln(heading_number_auto_composite);
- }
- if (!empty(heading_number_auto_composite)) {
- obj_txt["munge"]=replaceFirst(obj_txt["munge"], rgx.heading,
- "$1~$2 " ~ heading_number_auto_composite ~ ". ");
- obj_txt["munge"]=replaceFirst(obj_txt["munge"], rgx.heading_marker_missing_tag,
- "$1~" ~ heading_number_auto_composite ~ " ");
- }
- }
- }
// WORK ON, you still need to ensure that level 1 anchor_tags are unique
- obj_txt["munge"]=make_segment_anchor_tags_if_none_provided(obj_txt["munge"], obj_["lev"]);
+ obj_txt["munge"]=_configured_auto_heading_numbering_and_segment_anchor_tags(obj_txt["munge"], obj_, dochead_make_aa);
+ obj_txt["munge"]=_make_segment_anchor_tags_if_none_provided(obj_txt["munge"], obj_["lev"]);
if (auto m = match(obj_txt["munge"], rgx.heading_anchor_tag)) {
anchor_tag = m.captures[1];
anchor_tags_ ~=anchor_tag;
@@ -2409,10 +2128,189 @@ template SiSUdocAbstraction() {
}
invariant() {
}
+ private:
+ static string _configured_auto_heading_numbering_and_segment_anchor_tags(string munge_, string[string] obj_, string[string][string] dochead_make_aa) {
+ if (dochead_make_aa["make"]["num_top"].length > 0) {
+ if (!(match(munge_, rgx.heading_anchor_tag))) {
+ static __gshared uint heading_num_top_level=9;
+ static __gshared uint heading_num_depth=2;
+ static __gshared uint heading_num_0 = 0;
+ static __gshared uint heading_num_1 = 0;
+ static __gshared uint heading_num_2 = 0;
+ static __gshared uint heading_num_3 = 0;
+ static __gshared string heading_number_auto_composite = "";
+ if (heading_num_top_level==9) {
+ if (dochead_make_aa["make"]["num_depth"].length > 0) {
+ heading_num_depth = to!uint(dochead_make_aa["make"]["num_depth"]);
+ }
+ switch (dochead_make_aa["make"]["num_top"]) {
+ case "A":
+ break;
+ case "B":
+ heading_num_top_level=1;
+ break;
+ case "C":
+ heading_num_top_level=2;
+ break;
+ case "D":
+ heading_num_top_level=3;
+ break;
+ case "1":
+ heading_num_top_level=4;
+ break;
+ case "2":
+ heading_num_top_level=5;
+ break;
+ case "3":
+ heading_num_top_level=6;
+ break;
+ case "4":
+ heading_num_top_level=7;
+ break;
+ default:
+ break;
+ }
+ }
+ /+ num_depth minimum 0 (1.) default 2 (1.1.1) max 3 (1.1.1.1) implement +/
+ if (heading_num_top_level > to!uint(obj_["lev_markup_number"])) {
+ heading_num_0 = 0;
+ heading_num_1 = 0;
+ heading_num_2 = 0;
+ heading_num_3 = 0;
+ } else if (heading_num_top_level == to!uint(obj_["lev_markup_number"])) {
+ heading_num_0 ++;
+ heading_num_1 = 0;
+ heading_num_2 = 0;
+ heading_num_3 = 0;
+ } else if (heading_num_top_level == (to!uint(obj_["lev_markup_number"]) - 1)) {
+ heading_num_1 ++;
+ heading_num_2 = 0;
+ heading_num_3 = 0;
+ } else if (heading_num_top_level == (to!uint(obj_["lev_markup_number"]) - 2)) {
+ heading_num_2 ++;
+ heading_num_3 = 0;
+ } else if (heading_num_top_level == (to!uint(obj_["lev_markup_number"]) - 3)) {
+ heading_num_3 ++;
+ } else {
+ //
+ }
+ if (heading_num_3 > 0) {
+ heading_number_auto_composite =
+ (heading_num_depth == 3)
+ ? ( to!string(heading_num_0) ~ "." ~
+ to!string(heading_num_1) ~ "." ~
+ to!string(heading_num_2) ~ "." ~
+ to!string(heading_num_3)
+ )
+ : "";
+ } else if (heading_num_2 > 0) {
+ heading_number_auto_composite =
+ ((heading_num_depth >= 2)
+ && (heading_num_depth <= 3))
+ ? ( to!string(heading_num_0) ~ "." ~
+ to!string(heading_num_1) ~ "." ~
+ to!string(heading_num_2)
+ )
+ : "";
+ } else if (heading_num_1 > 0) {
+ heading_number_auto_composite =
+ ((heading_num_depth >= 1)
+ && (heading_num_depth <= 3))
+ ? ( to!string(heading_num_0) ~ "." ~
+ to!string(heading_num_1)
+ )
+ : "";
+ } else if (heading_num_0 > 0) {
+ heading_number_auto_composite =
+ ((heading_num_depth >= 0)
+ && (heading_num_depth <= 3))
+ ? (to!string(heading_num_0))
+ : "";
+ } else {
+ heading_number_auto_composite = "";
+ }
+ debug(heading_number_auto) {
+ writeln(heading_number_auto_composite);
+ }
+ if (!empty(heading_number_auto_composite)) {
+ munge_=replaceFirst(munge_, rgx.heading,
+ "$1~$2 " ~ heading_number_auto_composite ~ ". ");
+ munge_=replaceFirst(munge_, rgx.heading_marker_missing_tag,
+ "$1~" ~ heading_number_auto_composite ~ " ");
+ }
+ }
+ }
+ return munge_;
+ }
+
+
+ static string _make_segment_anchor_tags_if_none_provided(string munge_, string lev_) {
+ if (!(match(munge_, rgx.heading_anchor_tag))) { // if (anchor_tags_.length == 0) {
+ if (match(munge_, rgx.heading_identify_anchor_tag)) {
+ if (auto m = match(munge_, rgx.heading_extract_named_anchor_tag)) {
+ munge_=replaceFirst(munge_, rgx.heading_marker_missing_tag,
+ "$1~" ~ toLower(m.captures[1]) ~ "_" ~ m.captures[2] ~ " ");
+ } else if (auto m = match(munge_, rgx.heading_extract_unnamed_anchor_tag)) {
+ munge_=replaceFirst(munge_, rgx.heading_marker_missing_tag,
+ "$1~" ~ "s" ~ m.captures[1] ~ " ");
+ }
+ } else if (lev_ == "1") { // (if not successful) manufacture a unique anchor tag for lev=="1"
+ static __gshared uint heading_num_lev1 = 0;
+ heading_num_lev1 ++;
+ munge_=replaceFirst(munge_, rgx.heading_marker_missing_tag,
+ "$1~" ~ "x" ~ to!string(heading_num_lev1) ~ " ");
+ }
+ }
+ return munge_;
+ }
+ unittest {
+ string txt_lev="1";
+ string txt_in, txt_out;
+
+ txt_in = "1~copyright Copyright";
+ txt_out ="1~copyright Copyright";
+ assert(_make_segment_anchor_tags_if_none_provided(txt_in, txt_lev) == txt_out);
+ // assert(ObjInlineMarkup._make_segment_anchor_tags_if_none_provided(txt_in, txt_lev) == txt_out);
+
+ txt_in = "1~ 6. Writing Copyright Licenses";
+ txt_out ="1~s6 6. Writing Copyright Licenses";
+ assert(_make_segment_anchor_tags_if_none_provided(txt_in, txt_lev) == txt_out);
+
+ txt_in= "1~ 1. Reinforcing trends";
+ txt_out= "1~s1 1. Reinforcing trends";
+ assert(_make_segment_anchor_tags_if_none_provided(txt_in, txt_lev) == txt_out);
+
+ txt_in= "1~ 11 SCIENCE AS A COMMONS";
+ txt_out= "1~s11 11 SCIENCE AS A COMMONS";
+ assert(_make_segment_anchor_tags_if_none_provided(txt_in, txt_lev) == txt_out);
+
+ txt_in= "1~ Chapter 1";
+ txt_out="1~chapter_1 Chapter 1";
+ assert(_make_segment_anchor_tags_if_none_provided(txt_in, txt_lev) == txt_out);
+
+ txt_in= "1~ Chapter 1.";
+ txt_out="1~chapter_1 Chapter 1.";
+ assert(_make_segment_anchor_tags_if_none_provided(txt_in, txt_lev) == txt_out);
+
+ txt_in= "1~ Chapter 1: Done";
+ txt_out="1~chapter_1 Chapter 1: Done";
+ assert(_make_segment_anchor_tags_if_none_provided(txt_in, txt_lev) == txt_out);
+
+ txt_in= "1~ Chapter 11 - The Battle Over the Institutional Ecology of the Digital Environment";
+ txt_out= "1~chapter_11 Chapter 11 - The Battle Over the Institutional Ecology of the Digital Environment";
+ assert(_make_segment_anchor_tags_if_none_provided(txt_in, txt_lev) == txt_out);
+
+ txt_in= "1~ CHAPTER I.";
+ txt_out="1~x1 CHAPTER I.";
+ assert(_make_segment_anchor_tags_if_none_provided(txt_in, txt_lev) == txt_out);
+
+ txt_in= "1~ CHAPTER II.";
+ txt_out="1~x2 CHAPTER II.";
+ assert(_make_segment_anchor_tags_if_none_provided(txt_in, txt_lev) == txt_out);
+ }
}
- struct ObjAttrib {
- auto attrib = ObjAttributes();
- string[string] obj_attrib;
+ struct ObjAttributes {
+ string[string] _obj_attrib;
string obj_attributes(string obj_is_, string obj_raw, string node)
in { }
body {
@@ -2421,46 +2319,182 @@ template SiSUdocAbstraction() {
destroy(obj_raw);
destroy(node);
}
- JSONValue node_j = parseJSON(node);
- obj_attrib.remove("json");
- obj_attrib["json"] ="{";
+ _obj_attrib.remove("json");
+ _obj_attrib["json"] ="{";
switch (obj_is_) {
case "heading":
- obj_attrib["json"] ~= attrib.heading(obj_raw); //
+ _obj_attrib["json"] ~= _heading(obj_raw); //
break;
case "para":
- obj_attrib["json"] ~= attrib.para_and_blocks(obj_raw)
- ~ attrib.para(obj_raw);
+ _obj_attrib["json"] ~= _para_and_blocks(obj_raw)
+ ~ _para(obj_raw);
break;
case "code":
- obj_attrib["json"] ~= attrib.code(obj_raw);
+ _obj_attrib["json"] ~= _code(obj_raw);
break;
case "group":
- obj_attrib["json"] ~= attrib.para_and_blocks(obj_raw)
- ~ attrib.group(obj_raw);
+ _obj_attrib["json"] ~= _para_and_blocks(obj_raw)
+ ~ _group(obj_raw);
break;
case "block":
- obj_attrib["json"] ~= attrib.para_and_blocks(obj_raw)
- ~ attrib.block(obj_raw);
+ _obj_attrib["json"] ~= _para_and_blocks(obj_raw)
+ ~ _block(obj_raw);
break;
case "verse":
- obj_attrib["json"] ~= attrib.verse(obj_raw);
+ _obj_attrib["json"] ~= _verse(obj_raw);
break;
case "quote":
- obj_attrib["json"] ~= attrib.quote(obj_raw);
+ _obj_attrib["json"] ~= _quote(obj_raw);
break;
case "table":
- obj_attrib["json"] ~= attrib.table(obj_raw);
+ _obj_attrib["json"] ~= _table(obj_raw);
break;
case "comment":
- obj_attrib["json"] ~= attrib.comment(obj_raw);
+ _obj_attrib["json"] ~= _comment(obj_raw);
break;
default:
- obj_attrib["json"] ~= attrib.para(obj_raw);
+ _obj_attrib["json"] ~= _para(obj_raw);
break;
}
- obj_attrib["json"] ~=" }";
- JSONValue oa_j = parseJSON(obj_attrib["json"]);
+ _obj_attrib["json"] ~=" }";
+ _obj_attrib["json"]=_set_additional_values_parse_as_json(_obj_attrib["json"], obj_is_, node);
+ debug(structattrib) {
+ if (oa_j["is"].str() == "heading") {
+ // writeln(__LINE__);
+ writeln(_obj_attrib["json"]);
+ // writeln(node);
+ writeln(
+ "is: ", oa_j["is"].str(),
+ "; obj_cite_number: ", oa_j["obj_cite_number"].integer()
+ );
+ }
+ }
+ return _obj_attrib["json"];
+ }
+ invariant() {
+ }
+ private:
+ string _obj_attributes;
+ string _para_and_blocks(string obj_txt_in)
+ in { }
+ body {
+ auto rgx = Rgx();
+ if (matchFirst(obj_txt_in, rgx.para_bullet)) {
+ _obj_attributes =" \"bullet\": \"true\","
+ ~ " \"indent_start\": 0,"
+ ~ " \"indent_rest\": 0,";
+ } else if (auto m = matchFirst(obj_txt_in, rgx.para_bullet_indent)) {
+ _obj_attributes =" \"bullet\": \"true\","
+ ~ " \"indent_start\": " ~ to!string(m.captures[1]) ~ ","
+ ~ " \"indent_rest\": " ~ to!string(m.captures[1]) ~ ",";
+ } else if (auto m = matchFirst(obj_txt_in, rgx.para_indent_hang)) {
+ _obj_attributes =" \"bullet\": \"false\","
+ ~ " \"indent_start\": " ~ to!string(m.captures[1]) ~ ","
+ ~ " \"indent_rest\": " ~ to!string(m.captures[2]) ~ ",";
+ } else if (auto m = matchFirst(obj_txt_in, rgx.para_indent)) {
+ _obj_attributes =" \"bullet\": \"false\","
+ ~ " \"indent_start\": " ~ to!string(m.captures[1]) ~ ","
+ ~ " \"indent_rest\": " ~ to!string(m.captures[1]) ~ ",";
+ } else {
+ _obj_attributes =" \"bullet\": \"false\","
+ ~ " \"indent_start\": 0,"
+ ~ " \"indent_rest\": 0,";
+ }
+ return _obj_attributes;
+ }
+ string _para(string obj_txt_in)
+ in { }
+ body {
+ _obj_attributes = " \"use\": \"content\","
+ ~ " \"of\": \"para\","
+ ~ " \"is\": \"para\"";
+ return _obj_attributes;
+ }
+ invariant() {
+ }
+ string _heading(string obj_txt_in)
+ in { }
+ body {
+ _obj_attributes = " \"use\": \"content\","
+ ~ " \"of\": \"para\","
+ ~ " \"is\": \"heading\"";
+ return _obj_attributes;
+ }
+ invariant() {
+ }
+ string _code(string obj_txt_in)
+ in { }
+ body {
+ _obj_attributes = " \"use\": \"content\","
+ ~ " \"of\": \"block\","
+ ~ " \"is\": \"code\"";
+ return _obj_attributes;
+ }
+ invariant() {
+ }
+ string _group(string obj_txt_in)
+ in { }
+ body {
+ _obj_attributes = " \"use\": \"content\","
+ ~ " \"of\": \"block\","
+ ~ " \"is\": \"group\"";
+ return _obj_attributes;
+ }
+ invariant() {
+ }
+ string _block(string obj_txt_in)
+ in { }
+ body {
+ _obj_attributes = " \"use\": \"content\","
+ ~ " \"of\": \"block\","
+ ~ " \"is\": \"block\"";
+ return _obj_attributes;
+ }
+ invariant() {
+ }
+ string _verse(string obj_txt_in)
+ in { }
+ body {
+ _obj_attributes = " \"use\": \"content\","
+ ~ " \"of\": \"block\","
+ ~ " \"is\": \"verse\"";
+ return _obj_attributes;
+ }
+ invariant() {
+ }
+ string _quote(string obj_txt_in)
+ in { }
+ body {
+ _obj_attributes = " \"use\": \"content\","
+ ~ " \"of\": \"block\","
+ ~ " \"is\": \"quote\"";
+ return _obj_attributes;
+ }
+ invariant() {
+ }
+ string _table(string obj_txt_in)
+ in { }
+ body {
+ _obj_attributes = " \"use\": \"content\","
+ ~ " \"of\": \"block\","
+ ~ " \"is\": \"table\"";
+ return _obj_attributes;
+ }
+ invariant() {
+ }
+ string _comment(string obj_txt_in)
+ in { }
+ body {
+ _obj_attributes = " \"use\": \"comment\","
+ ~ " \"of\": \"comment\","
+ ~ " \"is\": \"comment\"";
+ return _obj_attributes;
+ }
+ invariant() {
+ }
+ string _set_additional_values_parse_as_json(string _obj_attrib, string obj_is_, string node) {
+ JSONValue oa_j = parseJSON(_obj_attrib);
+ JSONValue node_j = parseJSON(node);
assert(
(oa_j.type == JSON_TYPE.OBJECT) &&
(node_j.type == JSON_TYPE.OBJECT)
@@ -2476,20 +2510,8 @@ template SiSUdocAbstraction() {
}
oa_j.object["parent_obj_cite_number"] = node_j["parent_obj_cite_number"];
oa_j.object["parent_lev_markup_number"] = node_j["parent_lev_markup_number"];
- obj_attrib["json"] = oa_j.toString();
- debug(structattrib) {
- if (oa_j["is"].str() == "heading") {
- writeln(obj_attrib["json"]);
- writeln(
- "is: ", oa_j["is"].str(),
- "; obj_cite_number: ", oa_j["obj_cite_number"].integer()
- );
- }
- }
- // obj_attrib["json"]="{}";
- return obj_attrib["json"];
- }
- invariant() {
+ _obj_attrib = oa_j.toString();
+ return _obj_attrib;
}
}
struct BookIndexNuggetHash {