aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sdp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sdp')
-rw-r--r--src/sdp/ao_abstract_doc_source.d328
-rw-r--r--src/sdp/ao_defaults.d45
-rw-r--r--src/sdp/ao_object_setter.d5
3 files changed, 270 insertions, 108 deletions
diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d
index 7dbc573..c2cf32b 100644
--- a/src/sdp/ao_abstract_doc_source.d
+++ b/src/sdp/ao_abstract_doc_source.d
@@ -70,11 +70,14 @@ template SiSUdocAbstraction() {
string book_idx_tmp;
string[][string][string] bookindex_unordered_hashes;
auto bookindex_extract_hash = BookIndexNuggetHash();
- string[][string][string] bkidx_hash(string bookindex_section, int obj_cite_number) {
+ string[][string][string] bkidx_hash(
+ string bookindex_section,
+ int obj_cite_number
+ ) {
return bookindex_extract_hash.bookindex_nugget_hash(bookindex_section, obj_cite_number);
}
/+ node +/
- string _node;
+ string[string][string] _node;
auto node_construct = NodeStructureMetadata();
/+ ↓ abstract marked up document +/
auto abstract_doc_source(
@@ -97,6 +100,7 @@ template SiSUdocAbstraction() {
destroy(processing);
destroy(biblio_arr_json);
}
+ auto node_ = node_metadata;
line_occur = [
"heading" : 0,
"para" : 0,
@@ -104,13 +108,6 @@ template SiSUdocAbstraction() {
"blurb" : 0,
];
auto type = flags_type_init;
- void tell_lo(int obj_cite_number, in char[] line) {
- writefln(
- "* %s %s",
- to!string(obj_cite_number),
- to!string(line)
- );
- }
string[string] obj_cite_number_poem = [
"start" : "",
"end" : ""
@@ -161,6 +158,11 @@ template SiSUdocAbstraction() {
string toc_txt_;
an_object["glossary_nugget"] = "";
an_object["blurb_nugget"] = "";
+ node_["object"]["is"] = "heading";
+ node_["object"]["obj_cite_number"] = "0";
+ node_["object"]["segment_anchor_tag"] = "toc";
+ node_["object"]["parent_obj_cite_number"] = "1";
+ node_["object"]["parent_lev_markup_number"] = "0";
auto toc_head =
set_abstract_object.contents_heading(
"Table of Contents", // nugget/object
@@ -170,6 +172,7 @@ template SiSUdocAbstraction() {
"1", // lev
4, // lev_int_markup
2, // lev_int_collapsed
+ node_,
);
the_table_of_contents_section = [
"seg": [toc_head],
@@ -258,6 +261,11 @@ template SiSUdocAbstraction() {
line_occur["para"] = State.off;
an_object_key="glossary_nugget"; //
if (matchFirst(line, rgx.heading_glossary)) {
+ node_["object"]["is"] = "heading";
+ node_["object"]["obj_cite_number"] = "0";
+ node_["object"]["segment_anchor_tag"] = "glossary";
+ node_["object"]["parent_obj_cite_number"] = "1";
+ node_["object"]["parent_lev_markup_number"] = "0";
the_glossary_section ~=
set_abstract_object.contents_heading(
"Glossary", // nugget/object
@@ -267,7 +275,13 @@ template SiSUdocAbstraction() {
"B", // lev
1, // lev_int_markup
1, // lev_int_collapsed
+ node_,
);
+ node_["object"]["is"] = "heading";
+ node_["object"]["obj_cite_number"] = "0";
+ node_["object"]["segment_anchor_tag"] = "glossary";
+ node_["object"]["parent_obj_cite_number"] = "1";
+ node_["object"]["parent_lev_markup_number"] = "0";
the_glossary_section ~=
set_abstract_object.contents_heading(
"Glossary", // nugget/object
@@ -277,6 +291,7 @@ template SiSUdocAbstraction() {
"1", // lev
4, // lev_int_markup
2, // lev_int_collapsed
+ node_,
);
// } else if (matchFirst(line, rgx.heading)) {
// _heading_matched_(line, line_occur, an_object, an_object_key, lv, collapsed_lev, type, dochead_meta_aa); // levels?
@@ -319,6 +334,11 @@ template SiSUdocAbstraction() {
line_occur["para"] = State.off;
an_object_key="blurb_nugget";
if (matchFirst(line, rgx.heading_blurb)) {
+ node_["object"]["is"] = "heading";
+ node_["object"]["obj_cite_number"] = "0";
+ node_["object"]["segment_anchor_tag"] = "blurb";
+ node_["object"]["parent_obj_cite_number"] = "1";
+ node_["object"]["parent_lev_markup_number"] = "0";
the_blurb_section ~=
set_abstract_object.contents_heading(
"Blurb", // nugget/object
@@ -328,7 +348,13 @@ template SiSUdocAbstraction() {
"B", // lev
1, // lev_int_markup
1, // lev_int_collapsed
+ node_,
);
+ node_["object"]["is"] = "heading";
+ node_["object"]["obj_cite_number"] = "0";
+ node_["object"]["segment_anchor_tag"] = "blurb";
+ node_["object"]["parent_obj_cite_number"] = "1";
+ node_["object"]["parent_lev_markup_number"] = "0";
the_blurb_section ~=
set_abstract_object.contents_heading(
"Blurb", // nugget/object
@@ -338,10 +364,16 @@ template SiSUdocAbstraction() {
"1", // lev
4, // lev_int_markup
2, // lev_int_collapsed
+ node_,
);
} else if ((matchFirst(line, rgx.heading))
- && (opt_action_bool["backmatter"] && opt_action_bool["section_blurb"])) {
+ && (opt_action_bool["backmatter"] && opt_action_bool["section_blurb"])) {
_heading_matched_(line, line_occur, an_object, an_object_key, lv, collapsed_lev, type, dochead_meta_aa); // levels?
+ node_["object"]["is"] = "heading";
+ node_["object"]["obj_cite_number"] = "0";
+ node_["object"]["segment_anchor_tag"] = "blurb";
+ node_["object"]["parent_obj_cite_number"] = "1";
+ node_["object"]["parent_lev_markup_number"] = "0";
the_blurb_section ~=
set_abstract_object.contents_heading(
to!string(line), // an_object["substantive"],
@@ -351,6 +383,7 @@ template SiSUdocAbstraction() {
to!string(an_object["lev"]),
to!int(an_object["lev_markup_number"]),
to!int(an_object["lev_collapsed_number"]),
+ node_,
);
} else {
_para_match_(line, an_object, an_object_key, indent, bullet, type, line_occur);
@@ -581,6 +614,7 @@ template SiSUdocAbstraction() {
to!string(an_object["lev"]),
to!int(an_object["lev_markup_number"]),
to!int(an_object["lev_collapsed_number"]),
+ _node,
);
// track previous heading and make assertions
debug(objectrelated1) { // check
@@ -700,6 +734,11 @@ template SiSUdocAbstraction() {
}
if (an_object["glossary_nugget"].length == 0) {
writeln("no gloss");
+ node_["object"]["is"] = "heading";
+ node_["object"]["obj_cite_number"] = "0";
+ node_["object"]["segment_anchor_tag"] = "glossary";
+ node_["object"]["parent_obj_cite_number"] = "1";
+ node_["object"]["parent_lev_markup_number"] = "0";
the_glossary_section ~=
set_abstract_object.contents_heading(
"(skip) there is no Glossary section", // nugget/object
@@ -709,6 +748,7 @@ template SiSUdocAbstraction() {
"B", // lev
1, // lev_int_markup
1, // lev_int_collapsed
+ node_,
);
} else {
writeln("gloss");
@@ -724,6 +764,11 @@ template SiSUdocAbstraction() {
auto biblio_ordered =
biblio._bibliography_(biblio_unsorted_incomplete, bib_arr_json);
if (biblio_ordered.length > 0) {
+ node_["object"]["is"] = "heading";
+ node_["object"]["obj_cite_number"] = "0";
+ node_["object"]["segment_anchor_tag"] = "bibliography";
+ node_["object"]["parent_obj_cite_number"] = "1";
+ node_["object"]["parent_lev_markup_number"] = "0";
the_bibliography_section ~=
set_abstract_object.contents_heading(
"Bibliography", // nugget/object
@@ -733,7 +778,13 @@ template SiSUdocAbstraction() {
"B", // lev
1, // lev_int_markup
1, // lev_int_collapsed
+ node_,
);
+ node_["object"]["is"] = "heading";
+ node_["object"]["obj_cite_number"] = "0";
+ node_["object"]["segment_anchor_tag"] = "bibliography";
+ node_["object"]["parent_obj_cite_number"] = "1";
+ node_["object"]["parent_lev_markup_number"] = "0";
the_bibliography_section ~=
set_abstract_object.contents_heading(
"Bibliography", // nugget/object
@@ -743,8 +794,14 @@ template SiSUdocAbstraction() {
"1", // lev
4, // lev_int_markup
2, // lev_int_collapsed
+ node_,
);
} else {
+ node_["object"]["is"] = "heading";
+ node_["object"]["obj_cite_number"] = "0";
+ node_["object"]["segment_anchor_tag"] = "bibliography";
+ node_["object"]["parent_obj_cite_number"] = "1";
+ node_["object"]["parent_lev_markup_number"] = "0";
the_bibliography_section ~=
set_abstract_object.contents_heading(
"(skip) there is no Bibliography", // nugget/object
@@ -754,6 +811,7 @@ template SiSUdocAbstraction() {
"B", // lev
1, // lev_int_markup
1, // lev_int_collapsed
+ node_,
);
}
string out_;
@@ -805,6 +863,11 @@ template SiSUdocAbstraction() {
}
if (an_object["blurb_nugget"].length == 0) {
writeln("no blurb");
+ node_["object"]["is"] = "heading";
+ node_["object"]["obj_cite_number"] = "0";
+ node_["object"]["segment_anchor_tag"] = "blurb";
+ node_["object"]["parent_obj_cite_number"] = "1";
+ node_["object"]["parent_lev_markup_number"] = "0";
the_blurb_section ~=
set_abstract_object.contents_heading(
"(skip) there is no Blurb section", // nugget/object
@@ -814,6 +877,7 @@ template SiSUdocAbstraction() {
"B", // lev
1, // lev_int_markup
1, // lev_int_collapsed
+ node_,
);
} else {
writeln("blurb");
@@ -1747,7 +1811,7 @@ template SiSUdocAbstraction() {
ref ObjComposite[] the_document_body_section,
ref string[][string][string] bookindex_unordered_hashes,
ref int obj_cite_number,
- ref string _node,
+ ref string[string][string] _node,
ref long cntr,
ref int[string] type,
string[string] obj_cite_number_poem,
@@ -2817,7 +2881,12 @@ 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) {
+ 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;
@@ -2996,7 +3065,11 @@ template SiSUdocAbstraction() {
}
struct ObjAttributes {
string[string] _obj_attrib;
- string obj_attributes(string obj_is_, string obj_raw, string _node)
+ string obj_attributes(
+ string obj_is_,
+ string obj_raw,
+ string[string][string] _node
+ )
in { }
body {
scope(exit) {
@@ -3175,24 +3248,26 @@ template SiSUdocAbstraction() {
}
invariant() {
}
- string _set_additional_values_parse_as_json(string _obj_attrib, string obj_is_, string _node) {
+ string _set_additional_values_parse_as_json(
+ string _obj_attrib,
+ string obj_is_,
+ string[string][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)
+ (oa_j.type == JSON_TYPE.OBJECT)
);
if (obj_is_ == "heading") {
- oa_j.object["obj_cite_number"] = node_j["obj_cite_number"];
- oa_j.object["lev_markup_number"] = node_j["lev_markup_number"];
- oa_j.object["lev_collapsed_number"] = node_j["lev_collapsed_number"];
+ oa_j.object["obj_cite_number"] = _node["object"]["obj_cite_number"];
+ oa_j.object["lev_markup_number"] = _node["heading"]["lev_markup_number"];
+ oa_j.object["lev_collapsed_number"] = _node["heading"]["lev_collapsed_number"];
oa_j.object["heading_ptr"] =
- node_j["heading_ptr"]; // check
+ _node["object"]["heading_ptr"]; // check
oa_j.object["doc_object_ptr"] =
- node_j["doc_object_ptr"]; // check
+ _node["object"]["doc_object_ptr"]; // check
}
- 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"];
+ oa_j.object["parent_obj_cite_number"] = _node["object"]["parent_obj_cite_number"];
+ oa_j.object["parent_lev_markup_number"] = _node["object"]["parent_lev_markup_number"];
_obj_attrib = oa_j.toString();
return _obj_attrib;
}
@@ -3204,7 +3279,10 @@ template SiSUdocAbstraction() {
string[][string][string] bi;
string[][string][string] hash_nugget;
string[] bi_main_terms_split_arr;
- string[][string][string] bookindex_nugget_hash(string bookindex_section, int obj_cite_number)
+ string[][string][string] bookindex_nugget_hash(
+ string bookindex_section,
+ int obj_cite_number
+ )
in {
debug(bookindexraw) {
if (!bookindex_section.empty) {
@@ -3329,6 +3407,7 @@ template SiSUdocAbstraction() {
string segment_anchor_tag_that_object_belongs_to,
bool[string] opt_action_bool,
) {
+ mixin SiSUnode;
string type;
string lev;
int lev_int_markup, lev_int_collapsed;
@@ -3338,6 +3417,7 @@ template SiSUdocAbstraction() {
auto mainkeys =
bookindex_unordered_hashes.byKey.array.sort().release;
ObjComposite[][string] bookindex_section;
+ auto node_ = node_metadata;
if ((mainkeys.length > 0)
&& (opt_action_bool["backmatter"] && opt_action_bool["section_bookindex"])) {
string bi_tmp_seg, bi_tmp_scroll;
@@ -3345,6 +3425,11 @@ template SiSUdocAbstraction() {
lev="B";
lev_int_markup=1;
lev_int_collapsed=1;
+ node_["object"]["is"] = "heading";
+ node_["object"]["obj_cite_number"] = "0";
+ node_["object"]["segment_anchor_tag"] = "bookindex";
+ node_["object"]["parent_obj_cite_number"] = "1";
+ node_["object"]["parent_lev_markup_number"] = "0";
bookindex_section["scroll"] ~=
set_abstract_object.contents_heading(
"Book Index",
@@ -3353,7 +3438,8 @@ template SiSUdocAbstraction() {
[],
to!string(lev),
lev_int_markup,
- lev_int_collapsed
+ lev_int_collapsed,
+ node_,
);
bookindex_section["seg"] ~=
set_abstract_object.contents_heading(
@@ -3363,7 +3449,8 @@ template SiSUdocAbstraction() {
[],
to!string(lev),
lev_int_markup,
- lev_int_collapsed
+ lev_int_collapsed,
+ node_,
);
++obj_cite_number;
++mkn;
@@ -3372,6 +3459,11 @@ template SiSUdocAbstraction() {
lev="1";
lev_int_markup=4;
lev_int_collapsed=2;
+ node_["object"]["is"] = "heading";
+ node_["object"]["obj_cite_number"] = "0";
+ node_["object"]["segment_anchor_tag"] = "bookindex";
+ node_["object"]["parent_obj_cite_number"] = "1";
+ node_["object"]["parent_lev_markup_number"] = "0";
bookindex_section["scroll"] ~=
set_abstract_object.contents_heading(
"Index",
@@ -3380,7 +3472,8 @@ template SiSUdocAbstraction() {
["book_index"],
to!string(lev),
lev_int_markup,
- lev_int_collapsed
+ lev_int_collapsed,
+ node_,
);
bookindex_section["seg"] ~=
set_abstract_object.contents_heading(
@@ -3390,7 +3483,8 @@ template SiSUdocAbstraction() {
["book_index"],
to!string(lev),
lev_int_markup,
- lev_int_collapsed
+ lev_int_collapsed,
+ node_,
);
++obj_cite_number;
++mkn;
@@ -3453,6 +3547,11 @@ template SiSUdocAbstraction() {
++mkn;
}
} else { // no book index, (figure out what to do here)
+ node_["object"]["is"] = "heading";
+ node_["object"]["obj_cite_number"] = "0";
+ node_["object"]["segment_anchor_tag"] = "bookindex";
+ node_["object"]["parent_obj_cite_number"] = "1";
+ node_["object"]["parent_lev_markup_number"] = "0";
bookindex_section["scroll"] ~=
set_abstract_object.contents_heading(
"(skip) there is no Book Index",
@@ -3461,7 +3560,8 @@ template SiSUdocAbstraction() {
[""],
"B",
1,
- 1
+ 1,
+ node_,
);
bookindex_section["seg"] ~=
set_abstract_object.contents_heading(
@@ -3471,7 +3571,8 @@ template SiSUdocAbstraction() {
[""],
"B",
1,
- 1
+ 1,
+ node_,
);
}
auto t = tuple(bookindex_section, obj_cite_number);
@@ -3558,6 +3659,7 @@ template SiSUdocAbstraction() {
in {
}
body {
+ mixin SiSUnode;
auto set_abstract_object = ObjectAbstractSet();
ObjComposite[][string] the_endnotes_section;
auto endnotes_ = gathered_notes();
@@ -3565,12 +3667,18 @@ template SiSUdocAbstraction() {
string lev, lev_markup_number, lev_collapsed_number;
string attrib;
int[string] indent;
+ auto node_ = node_metadata;
if ((endnotes_["seg"].length > 0)
&& (opt_action_bool["backmatter"] && opt_action_bool["section_endnotes"])) {
attrib="";
lev="B";
lev_markup_number="1";
lev_collapsed_number="1";
+ node_["object"]["is"] = "heading";
+ node_["object"]["obj_cite_number"] = "0";
+ node_["object"]["segment_anchor_tag"] = "endnotes";
+ node_["object"]["parent_obj_cite_number"] = "1";
+ node_["object"]["parent_lev_markup_number"] = "0";
the_endnotes_section["seg"] ~=
set_abstract_object.contents_heading(
"Endnotes",
@@ -3579,7 +3687,8 @@ template SiSUdocAbstraction() {
[],
to!string(lev),
to!int(lev_markup_number),
- to!int(lev_collapsed_number)
+ to!int(lev_collapsed_number),
+ node_,
);
the_endnotes_section["scroll"] ~=
set_abstract_object.contents_heading(
@@ -3589,7 +3698,8 @@ template SiSUdocAbstraction() {
[],
to!string(lev),
to!int(lev_markup_number),
- to!int(lev_collapsed_number)
+ to!int(lev_collapsed_number),
+ node_,
);
++obj_cite_number;
++mkn;
@@ -3597,6 +3707,11 @@ template SiSUdocAbstraction() {
lev="1";
lev_markup_number="4";
lev_collapsed_number="2";
+ node_["object"]["is"] = "heading";
+ node_["object"]["obj_cite_number"] = "0";
+ node_["object"]["segment_anchor_tag"] = "endnotes";
+ node_["object"]["parent_obj_cite_number"] = "1";
+ node_["object"]["parent_lev_markup_number"] = "0";
the_endnotes_section["seg"] ~=
set_abstract_object.contents_heading(
"Endnotes",
@@ -3605,7 +3720,8 @@ template SiSUdocAbstraction() {
["endnotes"],
to!string(lev),
to!int(lev_markup_number),
- to!int(lev_collapsed_number)
+ to!int(lev_collapsed_number),
+ node_,
);
the_endnotes_section["scroll"] ~=
set_abstract_object.contents_heading(
@@ -3615,11 +3731,17 @@ template SiSUdocAbstraction() {
["endnotes"],
to!string(lev),
to!int(lev_markup_number),
- to!int(lev_collapsed_number)
+ to!int(lev_collapsed_number),
+ node_,
);
++obj_cite_number;
++mkn;
} else {
+ node_["object"]["is"] = "heading";
+ node_["object"]["obj_cite_number"] = "0";
+ node_["object"]["segment_anchor_tag"] = "endnotes";
+ node_["object"]["parent_obj_cite_number"] = "1";
+ node_["object"]["parent_lev_markup_number"] = "0";
the_endnotes_section["seg"] ~=
set_abstract_object.contents_heading(
"(skip) there are no Endnotes",
@@ -3628,7 +3750,8 @@ template SiSUdocAbstraction() {
[""],
"B",
1,
- 1
+ 1,
+ node_,
);
the_endnotes_section["scroll"] ~=
set_abstract_object.contents_heading(
@@ -3638,7 +3761,8 @@ template SiSUdocAbstraction() {
[""],
"B",
1,
- 1
+ 1,
+ node_,
);
}
if (opt_action_bool["backmatter"] && opt_action_bool["section_endnotes"]) {
@@ -3741,8 +3865,8 @@ template SiSUdocAbstraction() {
int lv, lv0, lv1, lv2, lv3, lv4, lv5, lv6, lv7;
int obj_cite_number;
int[string] p_; // p_ parent_
- string _node;
- string node_emitter(
+ string[string][string] _node;
+ string[string][string] node_emitter(
string lev_markup_number,
string segment_anchor_tag,
int obj_cite_number_,
@@ -3772,16 +3896,24 @@ template SiSUdocAbstraction() {
p_["lev_markup_number"] = DocStructMarkupHeading.h_text_1;
p_["obj_cite_number"] = lv4;
}
- _node=("{ " ~
- "\"is\": \"" ~ is_ ~ "\"" ~
- ", \"heading_ptr\": " ~ to!string(ptr_) ~
- ", \"doc_object_ptr\": " ~ to!string(cntr_) ~
- ", \"obj_cite_number\": " ~ to!string(obj_cite_number_) ~
- ", \"segment_anchor_tag\": \"" ~ segment_anchor_tag ~ "\"" ~
- ", \"parent_obj_cite_number\": " ~ to!string(p_["obj_cite_number"]) ~
- ", \"parent_lev_markup_number\": " ~ to!string(p_["lev_markup_number"]) ~
- " }"
- );
+ auto _node = [
+ "object" : [
+ "is" : is_,
+ "heading_ptr" : to!string(ptr_),
+ "doc_object_ptr" : to!string(cntr_),
+ "obj_cite_number" : to!string(obj_cite_number_),
+ "segment_anchor_tag" : to!string(segment_anchor_tag),
+ "parent_obj_cite_number" : to!string(p_["obj_cite_number"]),
+ "parent_lev_markup_number" : to!string(p_["lev_markup_number"]),
+ ],
+ "heading" : [
+ "html_segnames_ptr" : "",
+ "lev_markup_number" : "",
+ "lev_collapsed_number" : "",
+ // "ancestors" : "",
+ // "open_headings_to_close" : "",
+ ]
+ ];
debug(node) {
if (match(lev_markup_number, rgx.levels_numbered_headings)) {
writeln("x ", to!string(_node));
@@ -3789,15 +3921,14 @@ template SiSUdocAbstraction() {
writeln("- ", to!string(_node));
}
}
- JSONValue j = parseJSON(_node);
- assert(j["parent_lev_markup_number"].integer >= 4);
- assert(j["parent_lev_markup_number"].integer <= 7);
- assert(j["parent_obj_cite_number"].integer >= 0);
+ assert(to!int(_node["object"]["parent_lev_markup_number"]) >= 4);
+ assert(to!int(_node["object"]["parent_lev_markup_number"]) <= 7);
+ assert(to!int(_node["object"]["parent_obj_cite_number"]) >= 0); // hmm, perhaps
return _node;
}
invariant() {
}
- string node_emitter_heading(
+ string[string][string] node_emitter_heading(
string lev_markup_number,
string lev_collapsed_number,
string segment_anchor_tag,
@@ -3904,20 +4035,25 @@ template SiSUdocAbstraction() {
default:
break;
}
- _node=("{ " ~
- "\"is\": \"" ~ is_ ~ "\"" ~
- ", \"heading_ptr\": " ~ to!string(ptr_) ~
- ", \"doc_object_ptr\": " ~ to!string(cntr_) ~
- ", \"html_segnames_ptr\": \"" ~ ((lev_markup_number == "4") ? (to!string(html_segnames_ptr)) : "") ~ "\"" ~
- ", \"obj_cite_number\": " ~ to!string(obj_cite_number_) ~
- ", \"lev_markup_number\": " ~ to!string(lev_markup_number) ~
- ", \"lev_collapsed_number\": " ~ to!string(lev_collapsed_number) ~
- ", \"segment_anchor_tag\": \"" ~ segment_anchor_tag ~ "\"" ~
- ", \"parent_obj_cite_number\": " ~ to!string(p_["obj_cite_number"]) ~
- ", \"parent_lev_markup_number\": " ~ to!string(p_["lev_markup_number"]) ~
- " }"
- );
- debug(heading) {
+ auto _node = [
+ "object" : [
+ "is" : is_,
+ "heading_ptr" : to!string(ptr_),
+ "doc_object_ptr" : to!string(cntr_),
+ "obj_cite_number" : to!string(obj_cite_number_),
+ "segment_anchor_tag" : to!string(segment_anchor_tag),
+ "parent_obj_cite_number" : to!string(p_["obj_cite_number"]),
+ "parent_lev_markup_number" : to!string(p_["lev_markup_number"]),
+ ],
+ "heading" : [
+ "html_segnames_ptr" : ((lev_markup_number == "4") ? (to!string(html_segnames_ptr)) : ""),
+ "lev_markup_number" : to!string(lev_markup_number),
+ "lev_collapsed_number" : to!string(lev_collapsed_number),
+ // "ancestors" : to!string(ancestors),
+ // "open_headings_to_close" : to!string(open_headings_to_close),
+ ]
+ ];
+ debug(node) {
if (match(lev_markup_number, rgx.levels_numbered_headings)) {
writeln("* ", to!string(_node));
}
@@ -3927,35 +4063,34 @@ template SiSUdocAbstraction() {
writeln("* ", to!string(_node));
}
}
- JSONValue j = parseJSON(_node);
- assert(j["parent_lev_markup_number"].integer <= 7);
- assert(j["parent_obj_cite_number"].integer >= 0);
+ assert(to!int(_node["object"]["parent_lev_markup_number"]) <= 7);
+ assert(to!int(_node["object"]["parent_obj_cite_number"]) >= 0);
if (match(lev_markup_number, rgx.levels_numbered_headings)) {
- assert(j["lev_markup_number"].integer <= 7);
- assert(j["obj_cite_number"].integer >= 0);
- if (j["parent_lev_markup_number"].integer > 0) {
- assert(j["parent_lev_markup_number"].integer < j["lev_markup_number"].integer);
- if (j["obj_cite_number"].integer != 0) {
- assert(j["parent_obj_cite_number"].integer < j["obj_cite_number"].integer);
+ assert(to!int(_node["heading"]["lev_markup_number"]) <= 7);
+ assert(to!int(_node["object"]["obj_cite_number"]) >= 0);
+ if (to!int(_node["object"]["parent_lev_markup_number"]) > 0) {
+ assert(to!int(_node["object"]["parent_lev_markup_number"]) < to!int(_node["heading"]["lev_markup_number"]));
+ if (to!int(_node["object"]["obj_cite_number"]) != 0) {
+ assert(to!int(_node["object"]["parent_obj_cite_number"]) < to!int(_node["object"]["obj_cite_number"]));
}
}
- if (j["lev_markup_number"].integer == 0) {
- assert(j["parent_lev_markup_number"].integer == DocStructMarkupHeading.h_sect_A);
- } else if (j["lev_markup_number"].integer == DocStructMarkupHeading.h_sect_B) {
- assert(j["parent_lev_markup_number"].integer == DocStructMarkupHeading.h_sect_A);
- } else if (j["lev_markup_number"].integer == DocStructMarkupHeading.h_sect_C) {
- assert(j["parent_lev_markup_number"].integer == DocStructMarkupHeading.h_sect_B);
- } else if (j["lev_markup_number"].integer == DocStructMarkupHeading.h_sect_D) {
- assert(j["parent_lev_markup_number"].integer == DocStructMarkupHeading.h_sect_C);
- } else if (j["lev_markup_number"].integer == DocStructMarkupHeading.h_text_1) {
- assert(j["parent_lev_markup_number"].integer <= DocStructMarkupHeading.h_sect_D);
- } else if (j["lev_markup_number"].integer == DocStructMarkupHeading.h_text_2) {
- assert(j["parent_lev_markup_number"].integer == DocStructMarkupHeading.h_text_1);
- } else if (j["lev_markup_number"].integer == DocStructMarkupHeading.h_text_3) {
- assert(j["parent_lev_markup_number"].integer == DocStructMarkupHeading.h_text_2);
- } else if (j["lev_markup_number"].integer == DocStructMarkupHeading.h_text_4) {
- assert(j["parent_lev_markup_number"].integer == DocStructMarkupHeading.h_text_3);
- } else if (j["lev_markup_number"].integer == DocStructMarkupHeading.h_text_5) {
+ if (to!int(_node["heading"]["lev_markup_number"]) == 0) {
+ assert(to!int(_node["object"]["parent_lev_markup_number"]) == DocStructMarkupHeading.h_sect_A);
+ } else if (to!int(_node["heading"]["lev_markup_number"]) == DocStructMarkupHeading.h_sect_B) {
+ assert(to!int(_node["object"]["parent_lev_markup_number"]) == DocStructMarkupHeading.h_sect_A);
+ } else if (to!int(_node["heading"]["lev_markup_number"]) == DocStructMarkupHeading.h_sect_C) {
+ assert(to!int(_node["object"]["parent_lev_markup_number"]) == DocStructMarkupHeading.h_sect_B);
+ } else if (to!int(_node["heading"]["lev_markup_number"]) == DocStructMarkupHeading.h_sect_D) {
+ assert(to!int(_node["object"]["parent_lev_markup_number"]) == DocStructMarkupHeading.h_sect_C);
+ } else if (to!int(_node["heading"]["lev_markup_number"]) == DocStructMarkupHeading.h_text_1) {
+ assert(to!int(_node["object"]["parent_lev_markup_number"]) <= DocStructMarkupHeading.h_sect_D);
+ } else if (to!int(_node["heading"]["lev_markup_number"]) == DocStructMarkupHeading.h_text_2) {
+ assert(to!int(_node["object"]["parent_lev_markup_number"]) == DocStructMarkupHeading.h_text_1);
+ } else if (to!int(_node["heading"]["lev_markup_number"]) == DocStructMarkupHeading.h_text_3) {
+ assert(to!int(_node["object"]["parent_lev_markup_number"]) == DocStructMarkupHeading.h_text_2);
+ } else if (to!int(_node["heading"]["lev_markup_number"]) == DocStructMarkupHeading.h_text_4) {
+ assert(to!int(_node["object"]["parent_lev_markup_number"]) == DocStructMarkupHeading.h_text_3);
+ } else if (to!int(_node["heading"]["lev_markup_number"]) == DocStructMarkupHeading.h_text_5) {
}
}
return _node;
@@ -3965,7 +4100,10 @@ template SiSUdocAbstraction() {
}
/+ abstraction functions emitters ↑ +/
/+ ↓ abstraction functions assertions +/
- auto assertions_doc_structure(string[string] an_object, int[string] lv) {
+ auto assertions_doc_structure(
+ string[string] an_object,
+ int[string] lv
+ ) {
if (lv["h3"] > State.off) {
assert(lv["h0"] > State.off);
assert(lv["h1"] > State.off);
diff --git a/src/sdp/ao_defaults.d b/src/sdp/ao_defaults.d
index 9a84e80..4408cc8 100644
--- a/src/sdp/ao_defaults.d
+++ b/src/sdp/ao_defaults.d
@@ -144,7 +144,7 @@ template SiSUregisters() {
];
return meta_;
}
- auto pointer_head_main =
+ auto ptr_head_main =
[
"classify",
"creator",
@@ -157,7 +157,7 @@ template SiSUregisters() {
"rights",
"title"
];
- auto pointer_head_sub_classify =
+ auto ptr_head_sub_classify =
[
"dewey",
"keywords",
@@ -165,7 +165,7 @@ template SiSUregisters() {
"subject",
"topic_register"
];
- auto pointer_head_sub_creator =
+ auto ptr_head_sub_creator =
[
"author",
"author_email",
@@ -173,7 +173,7 @@ template SiSUregisters() {
"illustrator",
"translator"
];
- auto pointer_head_sub_date =
+ auto ptr_head_sub_date =
[
"added_to_site",
"available",
@@ -183,14 +183,14 @@ template SiSUregisters() {
"published",
"valid"
];
- auto pointer_head_sub_identifier =
+ auto ptr_head_sub_identifier =
[
"isbn",
"oclc",
"pg"
];
/+ make +/
- auto pointer_head_sub_make =
+ auto ptr_head_sub_make =
[
"cover_image",
"home_button_image",
@@ -205,27 +205,27 @@ template SiSUregisters() {
"texpdf_font",
"css"
];
- auto pointer_head_sub_notes =
+ auto ptr_head_sub_notes =
[
"abstract",
"description"
];
- auto pointer_head_sub_original =
+ auto ptr_head_sub_original =
[
"language",
"source",
"title"
];
- auto pointer_head_sub_publisher =
+ auto ptr_head_sub_publisher =
[ "name" ];
- auto pointer_head_sub_rights =
+ auto ptr_head_sub_rights =
[
"copyright",
"cover",
"illustrations",
"license"
];
- auto pointer_head_sub_title =
+ auto ptr_head_sub_title =
[
"edition",
"full",
@@ -350,6 +350,29 @@ template SiSUrgxInitFlags() {
return flags_type_init;
}
}
+template SiSUnode() {
+ string[string][string] node_metadata() {
+ auto node_ = [
+ "object" : [
+ "is" : "",
+ "heading_ptr" : "",
+ "doc_object_ptr" : "",
+ "obj_cite_number" : "",
+ "segment_anchor_tag" : "",
+ "parent_obj_cite_number" : "",
+ "parent_lev_markup_number" : "",
+ ],
+ "heading" : [
+ "html_segnames_ptr" : "",
+ "lev_markup_number" : "",
+ "lev_collapsed_number" : "",
+ // "ancestors" : "",
+ // "open_headings_to_close" : "",
+ ],
+ ];
+ return node_;
+ }
+}
template SiSUbiblio() {
// required: deemed_author (author || editor); year; fulltitle;
auto biblio_entry_tags_jsonstr = `{
diff --git a/src/sdp/ao_object_setter.d b/src/sdp/ao_object_setter.d
index 35ca768..c293eb0 100644
--- a/src/sdp/ao_object_setter.d
+++ b/src/sdp/ao_object_setter.d
@@ -42,7 +42,7 @@ template ObjectSetter() {
// heading segments, 1~ lev4:
int heading_array_ptr_segments = 0; // TODO
// node info json string:
- string node = "";
+ string[string][string] node;
}
struct ObjComposite {
string use = "";
@@ -78,6 +78,7 @@ template ObjectSetter() {
in string lev,
in int lev_int_markup,
in int lev_int_collapsed,
+ in string[string][string] _node,
) {
ObjComposite object_set;
object_set.use = "content";
@@ -184,7 +185,7 @@ template ObjectSetter() {
in string type,
in string object,
in string obj_cite_number,
- in string _node
+ in string[string][string] _node
) {
ObjComposite object_set;
object_set.use = "content";