aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sdp/ao_abstract_doc_source.d
diff options
context:
space:
mode:
Diffstat (limited to 'src/sdp/ao_abstract_doc_source.d')
-rw-r--r--src/sdp/ao_abstract_doc_source.d316
1 files changed, 172 insertions, 144 deletions
diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d
index 51089cd..cc39ea1 100644
--- a/src/sdp/ao_abstract_doc_source.d
+++ b/src/sdp/ao_abstract_doc_source.d
@@ -75,9 +75,10 @@ template SiSUdocAbstraction() {
auto node_construct = NodeStructureMetadata();
/+ ↓ abstract marked up document +/
auto abstract_doc_source(
- char[][] markup_sourcefile_content,
+ char[][] markup_sourcefile_content,
string[string][string] dochead_make_aa,
- string[string][string] dochead_meta_aa
+ string[string][string] dochead_meta_aa,
+ bool[string] opt_action_bool,
) {
/+ ↓ abstraction init +/
scope(success) {
@@ -214,21 +215,25 @@ template SiSUdocAbstraction() {
/+ object other than "code block" object
(includes regular text paragraph, headings & blocks other than code) +/
if ((matchFirst(line, rgx.heading_biblio)
- || (type["biblio_section"] == State.on))
+ || (type["biblio_section"] == State.on
+ && (!matchFirst(line, rgx.heading_blurb_glossary))))
&& (!matchFirst(line, rgx.heading))
&& (!matchFirst(line, rgx.comment))) {
/+ within section (block object): biblio +/
- _biblio_block_(line, type, bib_entry, biblio_entry_str_json, biblio_arr_json);
type["glossary_section"] = State.off;
type["biblio_section"] = State.on;
type["blurb_section"] = State.off;
- debug(bibliobuild) {
- writeln("- ", biblio_entry_str_json);
- writeln("-> ", biblio_arr_json.length);
+ if (opt_action_bool["backmatter"] && opt_action_bool["section_biblio"]) {
+ _biblio_block_(line, type, bib_entry, biblio_entry_str_json, biblio_arr_json); //
+ debug(bibliobuild) {
+ writeln("- ", biblio_entry_str_json);
+ writeln("-> ", biblio_arr_json.length);
+ }
}
continue;
} else if ((matchFirst(line, rgx.heading_glossary)
- || (type["glossary_section"] == State.on))
+ || (type["glossary_section"] == State.on
+ && (!matchFirst(line, rgx.heading_biblio_blurb))))
&& (!matchFirst(line, rgx.heading))
&& (!matchFirst(line, rgx.comment))) {
/+ within section (block object): glossary +/
@@ -240,53 +245,56 @@ template SiSUdocAbstraction() {
type["glossary_section"] = State.on;
type["biblio_section"] = State.off;
type["blurb_section"] = State.off;
- indent=[
- "hang_position" : 0,
- "base_position" : 0,
- ];
- bullet = false;
- type["para"] = State.on;
- line_occur["para"] = State.off;
- an_object_key="glossary_nugget"; //
- if (matchFirst(line, rgx.heading_glossary)) {
- the_glossary_section ~=
- set_abstract_object.contents_heading(
- "Glossary", // nugget/object
- "", // attrib
- 0, // obj_cite_number
- [""], // anchor tag
- "B", // lev
- 1, // lev_markup_number
- 1, // lev_collapsed_number
- );
- the_glossary_section ~=
- set_abstract_object.contents_heading(
- "Glossary", // nugget/object
- "", // attrib
- 0, // obj_cite_number
- ["glossary"], // anchor tag
- "1", // lev
- 4, // lev_markup_number
- 2, // lev_collapsed_number
- );
- // } else if (matchFirst(line, rgx.heading)) {
- // _heading_matched_(line, line_occur, an_object, an_object_key, lv, collapsed_lev, type, dochead_meta_aa); // levels?
- } else {
- _para_match_(line, an_object, an_object_key, indent, bullet, type, line_occur);
- the_glossary_section ~=
- set_abstract_object.contents_para(
- "para", // an_object["is"],
- to!string(line), // an_object["substantive"],
- "", // attrib
- 0, // obj_cite_number,
- indent,
- bullet
- );
+ if (opt_action_bool["backmatter"] && opt_action_bool["section_glossary"]) {
+ indent=[
+ "hang_position" : 0,
+ "base_position" : 0,
+ ];
+ bullet = false;
+ type["para"] = State.on;
+ line_occur["para"] = State.off;
+ an_object_key="glossary_nugget"; //
+ if (matchFirst(line, rgx.heading_glossary)) {
+ the_glossary_section ~=
+ set_abstract_object.contents_heading(
+ "Glossary", // nugget/object
+ "", // attrib
+ 0, // obj_cite_number
+ [""], // anchor tag
+ "B", // lev
+ 1, // lev_markup_number
+ 1, // lev_collapsed_number
+ );
+ the_glossary_section ~=
+ set_abstract_object.contents_heading(
+ "Glossary", // nugget/object
+ "", // attrib
+ 0, // obj_cite_number
+ ["glossary"], // anchor tag
+ "1", // lev
+ 4, // lev_markup_number
+ 2, // lev_collapsed_number
+ );
+ // } else if (matchFirst(line, rgx.heading)) {
+ // _heading_matched_(line, line_occur, an_object, an_object_key, lv, collapsed_lev, type, dochead_meta_aa); // levels?
+ } else {
+ _para_match_(line, an_object, an_object_key, indent, bullet, type, line_occur);
+ the_glossary_section ~=
+ set_abstract_object.contents_para(
+ "para", // an_object["is"],
+ to!string(line), // an_object["substantive"],
+ "", // attrib
+ 0, // obj_cite_number,
+ indent,
+ bullet
+ );
+ }
+ type["obj_cite_number_status"] = TriState.off;
}
- type["obj_cite_number_status"] = TriState.off;
continue;
} else if ((matchFirst(line, rgx.heading_blurb)
- || (type["blurb_section"] == State.on))
+ || (type["blurb_section"] == State.on
+ && (!matchFirst(line, rgx.heading_biblio_glossary))))
&& (!matchFirst(line, rgx.heading))
&& (!matchFirst(line, rgx.comment))) {
/+ within section (block object): blurb +/
@@ -298,60 +306,63 @@ template SiSUdocAbstraction() {
type["glossary_section"] = State.off;
type["biblio_section"] = State.off;
type["blurb_section"] = State.on;
- indent=[
- "hang_position" : 0,
- "base_position" : 0,
- ];
- bullet = false;
- type["para"] = State.on;
- line_occur["para"] = State.off;
- an_object_key="blurb_nugget";
- if (matchFirst(line, rgx.heading_blurb)) {
- the_blurb_section ~=
- set_abstract_object.contents_heading(
- "Blurb", // nugget/object
- "", // attrib
- 0, // obj_cite_number
- [""], // anchor tag
- "B", // lev
- 1, // lev_markup_number
- 1, // lev_collapsed_number
- );
- the_blurb_section ~=
- set_abstract_object.contents_heading(
- "Blurb", // nugget/object
- "", // attrib
- 0, // obj_cite_number
- ["blurb"], // anchor tag
- "1", // lev
- 4, // lev_markup_number
- 2, // lev_collapsed_number
- );
- } else if (matchFirst(line, rgx.heading)) {
- _heading_matched_(line, line_occur, an_object, an_object_key, lv, collapsed_lev, type, dochead_meta_aa);
- the_blurb_section ~=
- set_abstract_object.contents_heading(
- to!string(line), // an_object["substantive"],
- "", // attrib
- 0, // obj_cite_number
- [""], // anchor tag
- to!string(an_object["lev"]),
- to!int(an_object["lev_markup_number"]),
- to!int(an_object["lev_collapsed_number"]),
- );
- } else {
- _para_match_(line, an_object, an_object_key, indent, bullet, type, line_occur);
- the_blurb_section ~=
- set_abstract_object.contents_para(
- "para", // an_object["is"],
- to!string(line), // an_object["substantive"],
- "", // attrib
- obj_cite_number,
- indent,
- bullet
- );
+ if (opt_action_bool["backmatter"] && opt_action_bool["section_blurb"]) {
+ indent=[
+ "hang_position" : 0,
+ "base_position" : 0,
+ ];
+ bullet = false;
+ type["para"] = State.on;
+ line_occur["para"] = State.off;
+ an_object_key="blurb_nugget";
+ if (matchFirst(line, rgx.heading_blurb)) {
+ the_blurb_section ~=
+ set_abstract_object.contents_heading(
+ "Blurb", // nugget/object
+ "", // attrib
+ 0, // obj_cite_number
+ [""], // anchor tag
+ "B", // lev
+ 1, // lev_markup_number
+ 1, // lev_collapsed_number
+ );
+ the_blurb_section ~=
+ set_abstract_object.contents_heading(
+ "Blurb", // nugget/object
+ "", // attrib
+ 0, // obj_cite_number
+ ["blurb"], // anchor tag
+ "1", // lev
+ 4, // lev_markup_number
+ 2, // lev_collapsed_number
+ );
+ } else if ((matchFirst(line, rgx.heading))
+ && (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?
+ the_blurb_section ~=
+ set_abstract_object.contents_heading(
+ to!string(line), // an_object["substantive"],
+ "", // attrib
+ 0, // obj_cite_number
+ [""], // anchor tag
+ to!string(an_object["lev"]),
+ to!int(an_object["lev_markup_number"]),
+ to!int(an_object["lev_collapsed_number"]),
+ );
+ } else {
+ _para_match_(line, an_object, an_object_key, indent, bullet, type, line_occur);
+ the_blurb_section ~=
+ set_abstract_object.contents_para(
+ "para", // an_object["is"],
+ to!string(line), // an_object["substantive"],
+ "", // attrib
+ obj_cite_number,
+ indent,
+ bullet
+ );
+ }
+ type["obj_cite_number_status"] = TriState.off;
}
- type["obj_cite_number_status"] = TriState.off;
continue;
} else if (type["poem"] == TriState.on) {
/+ within block object: poem +/
@@ -419,7 +430,7 @@ template SiSUdocAbstraction() {
|| (matchFirst(line, rgx.book_index_open))
|| (type["book_index"] == State.on )) {
/+ book_index +/
- _book_index_(line, book_idx_tmp, an_object, type);
+ _book_index_(line, book_idx_tmp, an_object, type, opt_action_bool);
} else {
/+ not book_index +/
an_object_key="body_nugget";
@@ -655,15 +666,16 @@ template SiSUdocAbstraction() {
}
/+
Backmatter:
- * endnotes
- * glossary
- * references / bibliography
- * book index
+ - endnotes
+ - glossary
+ - bibliography / references
+ - book index
+ - blurb
+/
// TODO FIGURE OUT, you need this possibility
// obj_im.obj_inline_markup_and_anchor_tags("doc_end_reset", an_object_key, "", dochead_make_aa);
auto en_tuple =
- note_section.endnote_objects(obj_cite_number);
+ note_section.endnote_objects(obj_cite_number, opt_action_bool);
static assert(!isTypeTuple!(en_tuple));
auto the_endnotes_section = en_tuple[0];
obj_cite_number = en_tuple[1];
@@ -771,7 +783,8 @@ template SiSUdocAbstraction() {
bi.bookindex_build_section(
bookindex_unordered_hashes,
obj_cite_number,
- segment_object_belongs_to
+ segment_object_belongs_to,
+ opt_action_bool,
);
static assert(!isTypeTuple!(bi_tuple));
auto the_bookindex_section = bi_tuple[0];
@@ -1945,10 +1958,11 @@ template SiSUdocAbstraction() {
}
}
auto _book_index_(
- char[] line,
- ref string book_idx_tmp,
+ char[] line,
+ ref string book_idx_tmp,
ref string[string] an_object,
- ref int[string] type
+ ref int[string] type,
+ bool[string] opt_action_bool,
) {
if (auto m = match(line, rgx.book_index)) {
/+ match book_index +/
@@ -1962,27 +1976,33 @@ template SiSUdocAbstraction() {
} else if (auto m = match(line, rgx.book_index_open)) {
/+ match open book_index +/
type["book_index"] = State.on;
- book_idx_tmp = to!string(m.captures[1]);
- debug(bookindexmatch) { // book index
- writefln(
- "* [bookindex] %s\n",
- book_idx_tmp,
- );
+ if (opt_action_bool["backmatter"] && opt_action_bool["section_bookindex"]) {
+ book_idx_tmp = to!string(m.captures[1]);
+ debug(bookindexmatch) { // book index
+ writefln(
+ "* [bookindex] %s\n",
+ book_idx_tmp,
+ );
+ }
}
} else if (type["book_index"] == State.on ) {
/+ book_index flag set +/
if (auto m = match(line, rgx.book_index_close)) {
type["book_index"] = State.off;
- an_object["bookindex_nugget"] = book_idx_tmp ~ to!string(m.captures[1]);
- debug(bookindexmatch) { // book index
- writefln(
- "* [bookindex] %s\n",
- book_idx_tmp,
- );
+ if (opt_action_bool["backmatter"] && opt_action_bool["section_bookindex"]) {
+ an_object["bookindex_nugget"] = book_idx_tmp ~ to!string(m.captures[1]);
+ debug(bookindexmatch) { // book index
+ writefln(
+ "* [bookindex] %s\n",
+ book_idx_tmp,
+ );
+ }
}
book_idx_tmp = "";
} else {
- book_idx_tmp ~= line;
+ if (opt_action_bool["backmatter"] && opt_action_bool["section_bookindex"]) {
+ book_idx_tmp ~= line;
+ }
}
}
}
@@ -3297,8 +3317,9 @@ template SiSUdocAbstraction() {
}
auto bookindex_build_section(
string[][string][string] bookindex_unordered_hashes,
- int obj_cite_number,
- string segment_object_belongs_to,
+ int obj_cite_number,
+ string segment_object_belongs_to,
+ bool[string] opt_action_bool,
) {
string type;
string lev;
@@ -3309,7 +3330,8 @@ template SiSUdocAbstraction() {
auto mainkeys =
bookindex_unordered_hashes.byKey.array.sort().release;
ObjComposite[][string] bookindex_section;
- if (mainkeys.length > 0) {
+ if ((mainkeys.length > 0)
+ && (opt_action_bool["backmatter"] && opt_action_bool["section_bookindex"])) {
string bi_tmp_seg, bi_tmp_scroll;
attrib="";
lev="B";
@@ -3455,8 +3477,8 @@ template SiSUdocAbstraction() {
auto rgx = Rgx();
private auto gather_notes_for_endnote_section(
ObjComposite[] contents_am,
- string segment_object_belongs_to,
- ulong counter
+ string segment_object_belongs_to,
+ ulong counter,
)
in {
// endnotes/ footnotes for
@@ -3521,7 +3543,10 @@ template SiSUdocAbstraction() {
}
return endnotes_;
}
- private auto endnote_objects(int obj_cite_number)
+ private auto endnote_objects(
+ int obj_cite_number,
+ bool[string] opt_action_bool,
+ )
in {
}
body {
@@ -3532,7 +3557,8 @@ template SiSUdocAbstraction() {
string lev, lev_markup_number, lev_collapsed_number;
string attrib;
int[string] indent;
- if (endnotes_["seg"].length > 0) {
+ if ((endnotes_["seg"].length > 0)
+ && (opt_action_bool["backmatter"] && opt_action_bool["section_endnotes"])) {
attrib="";
lev="B";
lev_markup_number="1";
@@ -3607,15 +3633,17 @@ template SiSUdocAbstraction() {
1
);
}
- foreach (i, endnote; endnotes_["seg"]) {
- attrib="";
- the_endnotes_section["seg"] ~=
- set_abstract_object.contents_endnote(endnote, endnotes_["anchor"][i]);
- }
- foreach (i, endnote; endnotes_["scroll"]) {
- attrib="";
- the_endnotes_section["scroll"] ~=
- set_abstract_object.contents_endnote(endnote, endnotes_["anchor"][i]);
+ if (opt_action_bool["backmatter"] && opt_action_bool["section_endnotes"]) {
+ foreach (i, endnote; endnotes_["seg"]) {
+ attrib="";
+ the_endnotes_section["seg"] ~=
+ set_abstract_object.contents_endnote(endnote, endnotes_["anchor"][i]);
+ }
+ foreach (i, endnote; endnotes_["scroll"]) {
+ attrib="";
+ the_endnotes_section["scroll"] ~=
+ set_abstract_object.contents_endnote(endnote, endnotes_["anchor"][i]);
+ }
}
auto t = tuple(the_endnotes_section, obj_cite_number);
return t;