aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/ao_abstract_doc_source.org
diff options
context:
space:
mode:
Diffstat (limited to 'org/ao_abstract_doc_source.org')
-rw-r--r--org/ao_abstract_doc_source.org219
1 files changed, 119 insertions, 100 deletions
diff --git a/org/ao_abstract_doc_source.org b/org/ao_abstract_doc_source.org
index cf0efd2..cc4fd47 100644
--- a/org/ao_abstract_doc_source.org
+++ b/org/ao_abstract_doc_source.org
@@ -49,7 +49,8 @@ mixin InternalMarkup;
/+ initialize +/
auto rgx = Rgx();
-string[string][] contents_the_objects;
+ObjComposite[] contents_the_objects;
+
string[string] an_object, processing;
auto set_abstract_object = ObjectAbstractSet();
auto set_header = HeaderDocMetadataMakeJson();
@@ -235,7 +236,8 @@ scope(exit) {
}
scope(failure) {
stderr.writefln(
- "%s:%s failed here:\n line: %s",
+ "%s\n%s\n%s:%s failed here:\n line: %s",
+ __MODULE__, __FUNCTION__,
__FILE__, __LINE__,
line,
);
@@ -638,12 +640,11 @@ if ((type["header_make"] == State.on)
++heading_pointer;
contents_the_objects ~=
set_abstract_object.contents_heading(
- type["obj_cite_number_status"],
an_object["substantive"],
an_object["attrib"],
- obj_cite_number, an_object["lev"],
- an_object["lev_markup_number"],
- an_object["lev_collapsed_number"]
+ obj_cite_number,
+ to!int(an_object["lev_markup_number"]),
+ to!int(an_object["lev_collapsed_number"])
);
// track previous heading and make assertions
debug(objectrelated1) { // check
@@ -732,10 +733,10 @@ if ((type["header_make"] == State.on)
#+name: abs_in_loop_body_01
#+BEGIN_SRC d
-if (((contents_the_objects[$-1]["is"] == "para")
-|| (contents_the_objects[$-1]["is"] == "heading"))
+if (((contents_the_objects[$-1].is_a == "para")
+|| (contents_the_objects[$-1].is_a == "heading"))
&& (counter-1 > previous_count)) {
- if (match(contents_the_objects[$-1]["obj"],
+ if (match(contents_the_objects[$-1].object,
rgx.inline_notes_delimiter_al_regular_number_note)) {
// endnotes/ footnotes for
// doc objects other than paragraphs & headings
@@ -1805,7 +1806,7 @@ auto table_block(char[] line, ref string[string] an_object, ref int[string] type
auto block_flag_line_empty(
char[] line,
ref string[string] an_object,
- ref string[string][] contents_the_objects,
+ ref ObjComposite[] contents_the_objects,
ref string[][string][string] bookindex_unordered_hashes,
ref int obj_cite_number,
ref string node,
@@ -3449,7 +3450,6 @@ struct BookIndexReportIndent {
#+name: ao_emitters
#+BEGIN_SRC d
struct BookIndexReportSection {
- mixin ObjectSetter;
int mkn, skn;
auto rgx = Rgx();
auto bookindex_write_section(
@@ -3483,7 +3483,6 @@ struct BookIndexReportSection {
int obj_cite_number
) {
string type;
- int type_heading;
string lev, lev_markup_number, lev_collapsed_number;
string attrib;
string[string] indent;
@@ -3491,43 +3490,35 @@ struct BookIndexReportSection {
auto mainkeys =
bookindex_unordered_hashes.byKey.array.sort().release;
string bi_tmp;
- string[string][] bookindex_section;
+ ObjComposite[] bookindex_section;
// writeln(mainkeys.length);
// B~ Book Index
- type_heading=1;
- bi_tmp = "Book Index";
attrib="";
lev="B";
lev_markup_number="1";
lev_collapsed_number="1";
bookindex_section ~=
set_abstract_object.contents_heading(
- type_heading,
- bi_tmp,
+ "Book Index",
attrib,
obj_cite_number,
- lev,
- lev_markup_number,
- lev_collapsed_number
+ to!int(lev_markup_number),
+ to!int(lev_collapsed_number)
);
++obj_cite_number;
++mkn;
// 1~ Index
- type_heading=1;
- bi_tmp = "Index";
attrib="";
lev="1";
lev_markup_number="4";
lev_collapsed_number="2";
bookindex_section ~=
set_abstract_object.contents_heading(
- type_heading,
- bi_tmp,
+ "Index",
attrib,
obj_cite_number,
- lev,
- lev_markup_number,
- lev_collapsed_number
+ to!int(lev_markup_number),
+ to!int(lev_collapsed_number)
);
++obj_cite_number;
++mkn;
@@ -3622,31 +3613,30 @@ struct BookIndexReportSection {
#+name: ao_emitters
#+BEGIN_SRC d
struct NotesSection {
- mixin ObjectSetter;
string object_notes;
long previous_count;
int mkn;
auto rgx = Rgx();
private auto gather_notes_for_endnote_section(
- string[string][] contents_am,
- long counter
+ ObjComposite[] contents_am,
+ ulong counter
)
in {
// endnotes/ footnotes for
// doc objects other than paragraphs & headings
// various forms of grouped text
- assert((contents_am[counter]["is"] == "para")
- || (contents_am[counter]["is"] == "heading"));
+ assert((contents_am[counter].is_a == "para")
+ || (contents_am[counter].is_a == "heading"));
assert(counter > previous_count);
previous_count=counter;
assert(
- match(contents_am[counter]["obj"],
+ match(contents_am[counter].object,
rgx.inline_notes_delimiter_al_regular_number_note)
);
}
body {
foreach(m;
- matchAll(contents_am[counter]["obj"],
+ matchAll(contents_am[counter].object,
rgx.inline_notes_delimiter_al_regular_number_note)) {
debug(endnotes_build) {
writeln(
@@ -3675,47 +3665,40 @@ struct NotesSection {
}
body {
auto set_abstract_object = ObjectAbstractSet();
- string[string][] endnotes_section;
+ ObjComposite[] endnotes_section;
auto endnotes_ = gathered_notes();
// auto endnotes_ = (split(object_notes, rgx.break_string))[0..$-1];
string type;
- int type_heading;
string lev, lev_markup_number, lev_collapsed_number;
string attrib;
string[string] indent;
// B~ Endnotes
- type_heading=1;
attrib="";
lev="B";
lev_markup_number="1";
lev_collapsed_number="1";
endnotes_section ~=
set_abstract_object.contents_heading(
- type_heading,
"Endnotes",
attrib,
obj_cite_number,
- lev,
- lev_markup_number,
- lev_collapsed_number
+ to!int(lev_markup_number),
+ to!int(lev_collapsed_number)
);
++obj_cite_number;
++mkn;
// 1~ Endnotes
- type_heading=1;
attrib="";
lev="1";
lev_markup_number="4";
lev_collapsed_number="2";
endnotes_section ~=
set_abstract_object.contents_heading(
- type_heading,
"Endnotes",
attrib,
obj_cite_number,
- lev,
- lev_markup_number,
- lev_collapsed_number
+ to!int(lev_markup_number),
+ to!int(lev_collapsed_number)
);
++obj_cite_number;
++mkn;
@@ -4293,19 +4276,59 @@ auto assertions_flag_types_block_status_none_or_closed(int[string] type) {
* object setter :abstract:object:
set abstracted objects for downstream processing
+** structs :struct:
+#+name: ao_structs
+#+BEGIN_SRC d
+struct HeadingAttrib {
+ int lev = 9; // use of enum should make this redundant, remove
+ int lev_markup_number = 9;
+ int lev_collapsed_number = 9;
+}
+struct ParaAttrib {
+ int indent_first = 0;
+ int indent_second = 0;
+ bool bullet = false;
+}
+struct BlockAttrib {
+}
+struct Comment {
+ // no .attrib and no .obj_cite_number
+}
+struct Node {
+ int ocn = 0;
+ int parent_lev = 0;
+ int parent_ocn = 0;
+ string node = "";
+}
+struct ObjComposite {
+ // size_t id;
+ string use = "";
+ string of = "";
+ string is_a = "";
+ string object = "";
+ string obj_cite_number = ""; // not used for calculations? output only? else int
+ HeadingAttrib heading_attrib;
+ ParaAttrib para_attrib;
+ BlockAttrib block_attrib;
+ Node node_structure;
+}
+struct ObjCompositeArr {
+ ObjComposite[] oca;
+}
+#+END_SRC
+
** object setter :set:
*** comment :comment:
#+name: ao_object_setter
#+BEGIN_SRC d
-string[string] contents_comment(in string object) {
- string[string] object_set;
- object_set["use"] = "comment";
- object_set["of"] = "comment";
- object_set["is"] = "comment";
- object_set["obj"] = object;
- // object_set["attrib"] = attrib;
+auto contents_comment(in string object) {
+ ObjComposite object_set;
+ object_set.use = "comment";
+ object_set.of = "comment";
+ object_set.is_a = "comment";
+ object_set.object = object;
return object_set;
}
#+END_SRC
@@ -4314,28 +4337,22 @@ string[string] contents_comment(in string object) {
#+name: ao_object_setter
#+BEGIN_SRC d
-string[string] contents_heading(
- in int type,
+auto contents_heading(
in string object,
in string attrib,
in int obj_cite_number,
- in string lev,
- in string lev_markup_number,
- in string lev_collapsed_number,
+ in int lev_markup_number,
+ in int lev_collapsed_number,
) {
- string[string] object_set;
- object_set["use"] = "content";
- object_set["of"] = "para";
- object_set["is"] = "heading";
- object_set["type"] = to!string(type);
- // object_set["is"] = type; // "heading" "heading_dummy"
- object_set["obj"] = object;
- object_set["obj_cite_number"] = (obj_cite_number==0) ? "" : to!string(obj_cite_number);
- object_set["lev"] = to!string(lev);
- object_set["lev_markup_number"] = to!string(lev_markup_number);
- object_set["lev_collapsed_number"] = to!string(lev_collapsed_number);
- object_set["attrib"] = attrib;
- // object_set["children"] = children;
+ ObjComposite object_set;
+ object_set.use = "content";
+ object_set.of = "para";
+ object_set.is_a = "heading";
+ object_set.object = object;
+ object_set.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number);
+ object_set.heading_attrib.lev_markup_number = lev_markup_number;
+ object_set.heading_attrib.lev_collapsed_number = lev_collapsed_number;
+ // object_set.node_structure.node = node;
return object_set;
}
#+END_SRC
@@ -4344,7 +4361,7 @@ string[string] contents_heading(
#+name: ao_object_setter
#+BEGIN_SRC d
-string[string] contents_para(
+auto contents_para(
in string is_a,
in string object,
in string attrib,
@@ -4352,17 +4369,16 @@ string[string] contents_para(
in string[string] indent,
in bool bullet
) {
- string[string] object_set;
- object_set["use"] = "content";
- object_set["of"] = "para";
- object_set["is"] = is_a;
- // object_set["status"] = status;
- object_set["obj"] = object;
- object_set["obj_cite_number"] = (obj_cite_number==0) ? "" : to!string(obj_cite_number);
- object_set["indent_first"] = indent["first"];
- object_set["indent_second"] = indent["second"];
- object_set["bullet"] = to!string(bullet);
- object_set["attrib"] = attrib;
+ ObjComposite object_set;
+ object_set.use = "content";
+ object_set.of = "para";
+ object_set.is_a = "para";
+ object_set.object = object;
+ object_set.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number);
+ object_set.para_attrib.indent_first = 0; // indent["first"];
+ object_set.para_attrib.indent_second = 0; // indent["second"];
+ object_set.para_attrib.bullet = false;
+ // object_set.node_structure.node = node;
return object_set;
}
#+END_SRC
@@ -4371,19 +4387,19 @@ string[string] contents_para(
#+name: ao_object_setter
#+BEGIN_SRC d
-string[string] contents_block(
+auto contents_block(
in string type,
in string object,
in string attrib,
in int obj_cite_number
) {
- string[string] object_set;
- object_set["use"] = "content";
- object_set["of"] = "block";
- object_set["is"] = type;
- object_set["obj"] = object;
- object_set["obj_cite_number"] = (obj_cite_number==0) ? "" : to!string(obj_cite_number);
- object_set["attrib"] = attrib;
+ ObjComposite object_set;
+ object_set.use = "content";
+ object_set.of = "block";
+ object_set.is_a = type;
+ object_set.object = object;
+ object_set.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number);
+ // object_set.node_structure.node = node;
return object_set;
}
#+END_SRC
@@ -4392,20 +4408,19 @@ string[string] contents_block(
#+name: ao_object_setter
#+BEGIN_SRC d
-string[string] contents_block_obj_cite_number_string(
+auto contents_block_obj_cite_number_string(
in string type,
in string object,
in string obj_cite_number,
in string node
) {
- string[string] object_set;
- object_set["use"] = "content";
- object_set["of"] = "block";
- object_set["is"] = type;
- object_set["obj"] = object;
- object_set["obj_cite_number"] = obj_cite_number;
- object_set["node"] = node;
- // object_set["attrib"] = "";
+ ObjComposite object_set;
+ object_set.use = "content";
+ object_set.of = "block";
+ object_set.is_a = type;
+ object_set.object = object;
+ object_set.obj_cite_number = obj_cite_number;
+ object_set.node_structure.node = node;
return object_set;
}
#+END_SRC
@@ -4482,6 +4497,10 @@ template SiSUdocAbstraction() {
ao_object_setter.d
+/
template ObjectSetter() {
+ /+ structs +/
+ <<ao_structs>>
+
+ /+ structs setter +/
struct ObjectAbstractSet {
import std.conv : to;
<<ao_object_setter>>