aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc_reform/meta
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2023-11-15 22:16:26 -0500
committerRalph Amissah <ralph.amissah@gmail.com>2023-11-15 22:26:07 -0500
commitd2a94f93c3fe24d673eb812e1457829701c1ddfe (patch)
tree2bda2dae74b593c8d24e2d233f16a61186feb305 /src/doc_reform/meta
parent0.13.0 (diff)
ocda, single out, use more structs
Diffstat (limited to 'src/doc_reform/meta')
-rw-r--r--src/doc_reform/meta/metadoc.d5
-rw-r--r--src/doc_reform/meta/metadoc_from_src.d2460
2 files changed, 1465 insertions, 1000 deletions
diff --git a/src/doc_reform/meta/metadoc.d b/src/doc_reform/meta/metadoc.d
index cefee5b..a577530 100644
--- a/src/doc_reform/meta/metadoc.d
+++ b/src/doc_reform/meta/metadoc.d
@@ -132,9 +132,8 @@ template spineAbstraction() {
_manifest,
true,
);
- static assert(da.length==2);
- auto doc_abstraction = da[docAbst.doc_abstract_obj]; /+ head ~ toc ~ body ~ endnotes_seg ~ glossary ~ bibliography ~ bookindex ~ blurb; +/
- auto _doc_has_struct = da[docAbst.doc_has];
+ auto doc_abstraction = da.document_the;
+ auto _doc_has_struct = da.doc_has;
if ((_opt_action.debug_do)
|| (_opt_action.debug_do_stages)
) {
diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d
index 59cbc0b..620f884 100644
--- a/src/doc_reform/meta/metadoc_from_src.d
+++ b/src/doc_reform/meta/metadoc_from_src.d
@@ -126,7 +126,17 @@ template docAbstraction() {
}
/+ initialize +/
ObjGenericComposite[] the_document_toc_section, the_document_head_section, the_document_body_section, the_document_bibliography_section, the_document_glossary_section, the_document_blurb_section, the_document_xml_dom_tail_section;
- string[string] an_object, processing;
+ struct _theDoc {
+ ObjGenericComposite[] toc;
+ ObjGenericComposite[] head;
+ ObjGenericComposite[] body;
+ ObjGenericComposite[] bibliography;
+ ObjGenericComposite[] glossary;
+ ObjGenericComposite[] bookindex;
+ ObjGenericComposite[] blurb;
+ ObjGenericComposite[] endnotes;
+ }
+ string[string] an_object, processing, object_notes;
string an_object_key;
string[] anchor_tags;
string anchor_tag;
@@ -605,708 +615,872 @@ template docAbstraction() {
writeln("substitution to make: ", conf_make_meta.make.italics[Substitute.markup]);
}
}
- /+ ↓ ↻ loop markup document/text line by line +/
- srcDocLoop:
- foreach (line; markup_sourcefile_content) { /+ ↓ markup document/text line by line +/
- // "line" variable can be empty but should never be null
- /+ scope +/
- scope(exit) { }
- scope(failure) {
- stderr.writefln(
- "\n%s\n%s\n\n%s:%s\nFAILED while processing the file: ❮❮ %s ❯❯ on line with text:\n%s\n",
- __MODULE__, __FUNCTION__,
- __FILE__, __LINE__,
- manifested.src.filename, line,
- );
- }
- debug(source) {
- writeln(line);
- }
- debug(srclines) {
- if (!line.empty) {
- writefln("* %s", line);
+ auto loopMarkupSrcByLine(
+ char[][] markup_sourcefile_content,
+ string[string] an_object,
+ uint[string] pith,
+ ) {
+ struct _loopMarkupSrcByLineStruct {
+ ObjGenericComposite[] toc;
+ ObjGenericComposite[] body;
+ ObjGenericComposite[] glossary;
+ ObjGenericComposite[] blurb;
+ string[string] object_notes;
+ string[][string] segnames;
+ }
+ _loopMarkupSrcByLineStruct ret;
+ srcDocLoopLineByLine_:
+ foreach (line; markup_sourcefile_content) { /+ ↓ markup document/text line by line +/
+ // "line" variable can be empty but should never be null
+ /+ scope +/
+ scope(exit) { }
+ scope(failure) {
+ stderr.writefln(
+ "\n%s\n%s\n\n%s:%s\nFAILED while processing the file: ❮❮ %s ❯❯ on line with text:\n%s\n",
+ __MODULE__, __FUNCTION__,
+ __FILE__, __LINE__,
+ manifested.src.filename, line,
+ );
}
- }
- if (!line.empty) {
- pith = line._check_ocn_status_(pith);
- }
- if ( pith["block_is"] == eN.blk_is.code
- && pith["block_state"] == eN.blk_state.on
- ) {
- /+ block object: code +/
- line.flow_txt_block_code(an_object, pith);
- continue;
- } else if (!matchFirst(line, rgx.skip_from_regular_parse)) { /+ object other than "code block" object +/
- /+ (includes regular text paragraph, headings & blocks other than code) +/
- /+ heading, glossary, blurb, poem, group, block, quote, table +/
- line = line.inline_markup_faces; // by text line (rather than by text object), linebreaks in para problematic
- if (line.matchFirst(rgx.heading_biblio)
- || (pith["section"] == eN.sect.bibliography
- && ((!(line.matchFirst(rgx.heading_glossary)))
- && (!(line.matchFirst(rgx.heading_blurb)))
- && (!(line.matchFirst(rgx.heading)))
- && (!(line.matchFirst(rgx.comment)))))
+ debug(source) {
+ writeln(line);
+ }
+ debug(srclines) {
+ if (!line.empty) { writefln("* %s", line); }
+ }
+ if (!line.empty) { pith = line._check_ocn_status_(pith); }
+ if ( pith["block_is"] == eN.blk_is.code
+ && pith["block_state"] == eN.blk_state.on
) {
- pith["section"] = eN.sect.bibliography;
- if (opt_action.backmatter && opt_action.section_biblio) {
- line.flow_txt_block_biblio(pith, bib_entry, biblio_entry_str_json, biblio_arr_json);
- debug(bibliobuild) {
- writeln("- ", biblio_entry_str_json);
- writeln("-> ", biblio_arr_json.length);
- }
+ /+ block object: code +/
+ {
+ auto _get = line.txt_by_line_block_code(an_object, pith);
+ an_object = _get.this_object;
+ pith = _get.pith;
}
continue;
- } else if (line.matchFirst(rgx.heading_glossary)
- || (pith["section"] == eN.sect.glossary
- && ((!(line.matchFirst(rgx.heading_biblio)))
- && (!(line.matchFirst(rgx.heading_blurb)))
- && (!(line.matchFirst(rgx.heading)))
- && (!(line.matchFirst(rgx.comment)))))
- ) {
- /+ within section (block object): glossary +/
- debug(glossary) {
- writeln(__LINE__);
- writeln(line);
- }
- pith["section"] = eN.sect.glossary;
- if (opt_action.backmatter && opt_action.section_glossary) {
- indent = [
- "hang_position" : 0,
- "base_position" : 0,
- ];
- bullet = false;
- pith["txt_is"] = eN.txt_is.para;
- line_occur["para"] = eN.bi.off;
- an_object_key = "glossary_nugget";
- if (line.matchFirst(rgx.heading_glossary)) {
+ } else if (!matchFirst(line, rgx.skip_from_regular_parse)) { /+ object other than "code block" object +/
+ /+ (includes regular text paragraph, headings & blocks other than code) +/
+ /+ heading, glossary, blurb, poem, group, block, quote, table +/
+ line = line.inline_markup_faces; // by text line (rather than by text object), linebreaks in para problematic
+ if (line.matchFirst(rgx.heading_biblio)
+ || (pith["section"] == eN.sect.bibliography
+ && ((!(line.matchFirst(rgx.heading_glossary)))
+ && (!(line.matchFirst(rgx.heading_blurb)))
+ && (!(line.matchFirst(rgx.heading)))
+ && (!(line.matchFirst(rgx.comment)))))
+ ) {
+ pith["section"] = eN.sect.bibliography;
+ if (opt_action.backmatter && opt_action.section_biblio) {
{
- comp_obj_heading_ = comp_obj_heading_.init;
- comp_obj_heading_.metainfo.is_of_part = "backmatter";
- comp_obj_heading_.metainfo.is_of_section = "glossary";
- comp_obj_heading_.metainfo.is_of_type = "para";
- comp_obj_heading_.metainfo.is_a = "heading";
- comp_obj_heading_.text = "Glossary";
- comp_obj_heading_.metainfo.ocn = 0;
- comp_obj_heading_.metainfo.identifier = "";
- comp_obj_heading_.metainfo.dummy_heading = false;
- comp_obj_heading_.metainfo.object_number_off = false;
- comp_obj_heading_.metainfo.object_number_type = 0;
- comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_glossary";
- comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub;
- comp_obj_heading_.tags.in_segment_html = "glossary";
- comp_obj_heading_.tags.anchor_tags = ["section_glossary"];
- comp_obj_heading_.metainfo.heading_lev_markup = 1;
- comp_obj_heading_.metainfo.heading_lev_collapsed = 1;
- comp_obj_heading_.metainfo.parent_ocn = 1;
- comp_obj_heading_.metainfo.parent_lev_markup = 0;
- comp_obj_heading_.metainfo.dom_structure_markedup_tags_status = [ 1, 1, 0, 0, 0, 0, 0, 0];
- comp_obj_heading_.metainfo.dom_structure_collapsed_tags_status = [ 1, 1, 0, 0, 0, 0, 0, 0];
- the_document_glossary_section ~= comp_obj_heading_;
- tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html;
- tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1to4"] = comp_obj_heading_.tags.segment_anchor_tag_epub;
+ auto _get = line.txt_by_line_block_biblio(pith, bib_entry, biblio_entry_str_json, biblio_arr_json);
+ {
+ pith = _get.pith;
+ bib_entry = _get.bib_entry;
+ biblio_entry_str_json = _get.biblio_entry_str_json;
+ biblio_arr_json = _get.biblio_arr_json;
+ }
}
- {
- comp_obj_heading_ = comp_obj_heading_.init;
- comp_obj_heading_.metainfo.is_of_part = "backmatter";
- comp_obj_heading_.metainfo.is_of_section = "glossary";
- comp_obj_heading_.metainfo.is_of_type = "para";
- comp_obj_heading_.metainfo.is_a = "heading";
- comp_obj_heading_.text = "Glossary";
- comp_obj_heading_.metainfo.ocn = 0;
- comp_obj_heading_.metainfo.identifier = "";
- comp_obj_heading_.metainfo.dummy_heading = true;
- comp_obj_heading_.metainfo.object_number_off = true;
- comp_obj_heading_.metainfo.object_number_type = 0;
- comp_obj_heading_.tags.segment_anchor_tag_epub = "glossary";
- comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub;
- comp_obj_heading_.tags.in_segment_html = comp_obj_heading_.tags.anchor_tag_html;
- comp_obj_heading_.metainfo.heading_lev_markup = 4;
- comp_obj_heading_.metainfo.heading_lev_collapsed = 2;
- comp_obj_heading_.metainfo.parent_ocn = 1;
- comp_obj_heading_.metainfo.parent_lev_markup = 0;
- comp_obj_heading_.metainfo.dom_structure_markedup_tags_status = [ 1, 1, 0, 0, 1, 0, 0, 0];
- comp_obj_heading_.metainfo.dom_structure_collapsed_tags_status = [ 1, 1, 1, 0, 0, 0, 0, 0];
- comp_obj_heading_.tags.anchor_tags = ["glossary"];
- the_document_glossary_section ~= comp_obj_heading_;
- tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html;
- tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1to4"] = comp_obj_heading_.tags.segment_anchor_tag_epub;
+ debug(bibliobuild) {
+ writeln("- ", biblio_entry_str_json);
+ writeln("-> ", biblio_arr_json.length);
}
- } else {
- an_object = line.flow_para_match_(an_object, an_object_key, indent, bullet, pith, line_occur);
- comp_obj_para = comp_obj_para.init;
- comp_obj_para.metainfo.is_of_part = "backmatter";
- comp_obj_para.metainfo.is_of_section = "glossary";
- comp_obj_para.metainfo.is_of_type = "para";
- comp_obj_para.metainfo.is_a = "glossary";
- comp_obj_para.text = links_and_images(line.to!string.strip).replaceFirst(rgx.para_attribs, "");
- comp_obj_para.metainfo.ocn = 0;
- comp_obj_para.metainfo.identifier = "";
- comp_obj_para.metainfo.object_number_off = true;
- comp_obj_para.metainfo.object_number_type = 0;
- comp_obj_para.attrib.indent_hang = indent["hang_position"];
- comp_obj_para.attrib.indent_base = indent["base_position"];
- comp_obj_para.attrib.bullet = bullet;
- the_document_glossary_section ~= comp_obj_para;
}
- pith["ocn"] = eN.ocn.on;
- }
- continue;
- } else if (line.matchFirst(rgx.heading_blurb)
- || (pith["section"] == eN.sect.blurb
- && ((!(line.matchFirst(rgx.heading_glossary)))
- && (!(line.matchFirst(rgx.heading_biblio)))
- && (!(line.matchFirst(rgx.heading)))
- && (!(line.matchFirst(rgx.comment)))))
- ) {
- pith["section"] = eN.sect.blurb;
- debug(blurb) {
- writeln(__LINE__);
- writeln(line);
- }
- if (opt_action.backmatter && opt_action.section_blurb) {
- indent = [
- "hang_position" : 0,
- "base_position" : 0,
- ];
- bullet = false;
- if (auto m = line.matchFirst(rgx.para_indent)) {
- debug(paraindent) {
- writeln(line);
- }
- indent["hang_position"] = (m["indent"]).to!int;
- indent["base_position"] = (m["indent"]).to!int;
- } else if (line.matchFirst(rgx.para_bullet)) {
- debug(parabullet) {
- writeln(line);
- }
- bullet = true;
- } else if (auto m = line.matchFirst(rgx.para_indent_hang)) {
- debug(paraindenthang) {
- writeln(line);
- }
+ continue;
+ } else if (line.matchFirst(rgx.heading_glossary)
+ || (pith["section"] == eN.sect.glossary
+ && ((!(line.matchFirst(rgx.heading_biblio)))
+ && (!(line.matchFirst(rgx.heading_blurb)))
+ && (!(line.matchFirst(rgx.heading)))
+ && (!(line.matchFirst(rgx.comment)))))
+ ) {
+ /+ within section (block object): glossary +/
+ debug(glossary) {
+ writeln(__LINE__);
+ writeln(line);
+ }
+ pith["section"] = eN.sect.glossary;
+ if (opt_action.backmatter && opt_action.section_glossary) {
indent = [
- "hang_position" : (m["hang"]).to!int,
- "base_position" : (m["indent"]).to!int,
+ "hang_position" : 0,
+ "base_position" : 0,
];
- } else if (auto m = line.matchFirst(rgx.para_bullet_indent)) {
- debug(parabulletindent) {
- writeln(line);
+ bullet = false;
+ pith["txt_is"] = eN.txt_is.para;
+ line_occur["para"] = eN.bi.off;
+ an_object_key = "glossary_nugget";
+ if (line.matchFirst(rgx.heading_glossary)) {
+ {
+ comp_obj_heading_ = comp_obj_heading_.init;
+ comp_obj_heading_.metainfo.is_of_part = "backmatter";
+ comp_obj_heading_.metainfo.is_of_section = "glossary";
+ comp_obj_heading_.metainfo.is_of_type = "para";
+ comp_obj_heading_.metainfo.is_a = "heading";
+ comp_obj_heading_.text = "Glossary";
+ comp_obj_heading_.metainfo.ocn = 0;
+ comp_obj_heading_.metainfo.identifier = "";
+ comp_obj_heading_.metainfo.dummy_heading = false;
+ comp_obj_heading_.metainfo.object_number_off = false;
+ comp_obj_heading_.metainfo.object_number_type = 0;
+ comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_glossary";
+ comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub;
+ comp_obj_heading_.tags.in_segment_html = "glossary";
+ comp_obj_heading_.tags.anchor_tags = ["section_glossary"];
+ comp_obj_heading_.metainfo.heading_lev_markup = 1;
+ comp_obj_heading_.metainfo.heading_lev_collapsed = 1;
+ comp_obj_heading_.metainfo.parent_ocn = 1;
+ comp_obj_heading_.metainfo.parent_lev_markup = 0;
+ comp_obj_heading_.metainfo.dom_structure_markedup_tags_status = [ 1, 1, 0, 0, 0, 0, 0, 0];
+ comp_obj_heading_.metainfo.dom_structure_collapsed_tags_status = [ 1, 1, 0, 0, 0, 0, 0, 0];
+ the_document_glossary_section ~= comp_obj_heading_;
+ tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html;
+ tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1to4"] = comp_obj_heading_.tags.segment_anchor_tag_epub;
+ }
+ {
+ comp_obj_heading_ = comp_obj_heading_.init;
+ comp_obj_heading_.metainfo.is_of_part = "backmatter";
+ comp_obj_heading_.metainfo.is_of_section = "glossary";
+ comp_obj_heading_.metainfo.is_of_type = "para";
+ comp_obj_heading_.metainfo.is_a = "heading";
+ comp_obj_heading_.text = "Glossary";
+ comp_obj_heading_.metainfo.ocn = 0;
+ comp_obj_heading_.metainfo.identifier = "";
+ comp_obj_heading_.metainfo.dummy_heading = true;
+ comp_obj_heading_.metainfo.object_number_off = true;
+ comp_obj_heading_.metainfo.object_number_type = 0;
+ comp_obj_heading_.tags.segment_anchor_tag_epub = "glossary";
+ comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub;
+ comp_obj_heading_.tags.in_segment_html = comp_obj_heading_.tags.anchor_tag_html;
+ comp_obj_heading_.metainfo.heading_lev_markup = 4;
+ comp_obj_heading_.metainfo.heading_lev_collapsed = 2;
+ comp_obj_heading_.metainfo.parent_ocn = 1;
+ comp_obj_heading_.metainfo.parent_lev_markup = 0;
+ comp_obj_heading_.metainfo.dom_structure_markedup_tags_status = [ 1, 1, 0, 0, 1, 0, 0, 0];
+ comp_obj_heading_.metainfo.dom_structure_collapsed_tags_status = [ 1, 1, 1, 0, 0, 0, 0, 0];
+ comp_obj_heading_.tags.anchor_tags = ["glossary"];
+ the_document_glossary_section ~= comp_obj_heading_;
+ tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html;
+ tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1to4"] = comp_obj_heading_.tags.segment_anchor_tag_epub;
+ }
+ } else {
+ {
+ auto _get = line.flow_para_match_(an_object, an_object_key, indent, bullet, pith, line_occur);
+ {
+ an_object = _get.this_object;
+ an_object_key = _get.this_object_key;
+ pith = _get.pith;
+ indent = _get.indent;
+ bullet = _get.bullet;
+ line_occur = _get.line_occur;
+ }
+ }
+ comp_obj_para = comp_obj_para.init;
+ comp_obj_para.metainfo.is_of_part = "backmatter";
+ comp_obj_para.metainfo.is_of_section = "glossary";
+ comp_obj_para.metainfo.is_of_type = "para";
+ comp_obj_para.metainfo.is_a = "glossary";
+ comp_obj_para.text = links_and_images(line.to!string.strip).replaceFirst(rgx.para_attribs, "");
+ comp_obj_para.metainfo.ocn = 0;
+ comp_obj_para.metainfo.identifier = "";
+ comp_obj_para.metainfo.object_number_off = true;
+ comp_obj_para.metainfo.object_number_type = 0;
+ comp_obj_para.attrib.indent_hang = indent["hang_position"];
+ comp_obj_para.attrib.indent_base = indent["base_position"];
+ comp_obj_para.attrib.bullet = bullet;
+ the_document_glossary_section ~= comp_obj_para;
}
+ pith["ocn"] = eN.ocn.on;
+ }
+ continue;
+ } else if (line.matchFirst(rgx.heading_blurb)
+ || (pith["section"] == eN.sect.blurb
+ && ((!(line.matchFirst(rgx.heading_glossary)))
+ && (!(line.matchFirst(rgx.heading_biblio)))
+ && (!(line.matchFirst(rgx.heading)))
+ && (!(line.matchFirst(rgx.comment)))))
+ ) {
+ pith["section"] = eN.sect.blurb;
+ debug(blurb) {
+ writeln(__LINE__);
+ writeln(line);
+ }
+ if (opt_action.backmatter && opt_action.section_blurb) {
indent = [
- "hang_position" : (m["indent"]).to!int,
- "base_position" : (m["indent"]).to!int,
+ "hang_position" : 0,
+ "base_position" : 0,
];
- bullet = true;
- }
- pith["txt_is"] = eN.txt_is.para;
- line_occur["para"] = eN.bi.off;
- an_object_key = "blurb_nugget";
- if (line.matchFirst(rgx.heading_blurb)) {
- {
- comp_obj_heading_ = comp_obj_heading_.init;
- comp_obj_heading_.metainfo.is_of_part = "backmatter";
- comp_obj_heading_.metainfo.is_of_section = "blurb";
- comp_obj_heading_.metainfo.is_of_type = "para";
- comp_obj_heading_.metainfo.is_a = "heading";
- comp_obj_heading_.text = "Blurb";
- comp_obj_heading_.metainfo.ocn = 0;
- comp_obj_heading_.metainfo.identifier = "";
- comp_obj_heading_.metainfo.dummy_heading = false;
- comp_obj_heading_.metainfo.object_number_off = false;
- comp_obj_heading_.metainfo.object_number_type = 0;
- comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_blurb";
- comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub;
- comp_obj_heading_.tags.in_segment_html = "blurb";
- comp_obj_heading_.tags.anchor_tags = ["section_blurb"];
- comp_obj_heading_.metainfo.heading_lev_markup = 1;
- comp_obj_heading_.metainfo.heading_lev_collapsed = 1;
- comp_obj_heading_.metainfo.parent_ocn = 1;
- comp_obj_heading_.metainfo.parent_lev_markup = 0;
- comp_obj_heading_.metainfo.dom_structure_markedup_tags_status = [ 1, 1, 0, 0, 0, 0, 0, 0];
- comp_obj_heading_.metainfo.dom_structure_collapsed_tags_status = [ 1, 1, 0, 0, 0, 0, 0, 0];
- the_document_blurb_section ~= comp_obj_heading_;
- tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html;
- tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1to4"] = comp_obj_heading_.tags.segment_anchor_tag_epub;
+ bullet = false;
+ if (auto m = line.matchFirst(rgx.para_indent)) {
+ debug(paraindent) {
+ writeln(line);
+ }
+ indent["hang_position"] = (m["indent"]).to!int;
+ indent["base_position"] = (m["indent"]).to!int;
+ } else if (line.matchFirst(rgx.para_bullet)) {
+ debug(parabullet) {
+ writeln(line);
+ }
+ bullet = true;
+ } else if (auto m = line.matchFirst(rgx.para_indent_hang)) {
+ debug(paraindenthang) {
+ writeln(line);
+ }
+ indent = [
+ "hang_position" : (m["hang"]).to!int,
+ "base_position" : (m["indent"]).to!int,
+ ];
+ } else if (auto m = line.matchFirst(rgx.para_bullet_indent)) {
+ debug(parabulletindent) {
+ writeln(line);
+ }
+ indent = [
+ "hang_position" : (m["indent"]).to!int,
+ "base_position" : (m["indent"]).to!int,
+ ];
+ bullet = true;
}
- {
+ pith["txt_is"] = eN.txt_is.para;
+ line_occur["para"] = eN.bi.off;
+ an_object_key = "blurb_nugget";
+ if (line.matchFirst(rgx.heading_blurb)) {
+ {
+ comp_obj_heading_ = comp_obj_heading_.init;
+ comp_obj_heading_.metainfo.is_of_part = "backmatter";
+ comp_obj_heading_.metainfo.is_of_section = "blurb";
+ comp_obj_heading_.metainfo.is_of_type = "para";
+ comp_obj_heading_.metainfo.is_a = "heading";
+ comp_obj_heading_.text = "Blurb";
+ comp_obj_heading_.metainfo.ocn = 0;
+ comp_obj_heading_.metainfo.identifier = "";
+ comp_obj_heading_.metainfo.dummy_heading = false;
+ comp_obj_heading_.metainfo.object_number_off = false;
+ comp_obj_heading_.metainfo.object_number_type = 0;
+ comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_blurb";
+ comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub;
+ comp_obj_heading_.tags.in_segment_html = "blurb";
+ comp_obj_heading_.tags.anchor_tags = ["section_blurb"];
+ comp_obj_heading_.metainfo.heading_lev_markup = 1;
+ comp_obj_heading_.metainfo.heading_lev_collapsed = 1;
+ comp_obj_heading_.metainfo.parent_ocn = 1;
+ comp_obj_heading_.metainfo.parent_lev_markup = 0;
+ comp_obj_heading_.metainfo.dom_structure_markedup_tags_status = [ 1, 1, 0, 0, 0, 0, 0, 0];
+ comp_obj_heading_.metainfo.dom_structure_collapsed_tags_status = [ 1, 1, 0, 0, 0, 0, 0, 0];
+ the_document_blurb_section ~= comp_obj_heading_;
+ tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html;
+ tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1to4"] = comp_obj_heading_.tags.segment_anchor_tag_epub;
+ }
+ {
+ comp_obj_heading_ = comp_obj_heading_.init;
+ comp_obj_heading_.metainfo.is_of_part = "backmatter";
+ comp_obj_heading_.metainfo.is_of_section = "blurb";
+ comp_obj_heading_.metainfo.is_of_type = "para";
+ comp_obj_heading_.metainfo.is_a = "heading";
+ comp_obj_heading_.text = "Blurb";
+ comp_obj_heading_.metainfo.ocn = 0;
+ comp_obj_heading_.metainfo.identifier = "";
+ comp_obj_heading_.metainfo.dummy_heading = true;
+ comp_obj_heading_.metainfo.object_number_off = true;
+ comp_obj_heading_.metainfo.object_number_type = 0;
+ comp_obj_heading_.tags.segment_anchor_tag_epub = "blurb";
+ comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub;
+ comp_obj_heading_.tags.in_segment_html = comp_obj_heading_.tags.anchor_tag_html;
+ comp_obj_heading_.metainfo.heading_lev_markup = 4;
+ comp_obj_heading_.metainfo.heading_lev_collapsed = 2;
+ comp_obj_heading_.metainfo.parent_ocn = 1;
+ comp_obj_heading_.metainfo.parent_lev_markup = 0;
+ comp_obj_heading_.tags.anchor_tags = ["blurb"];
+ comp_obj_heading_.metainfo.dom_structure_markedup_tags_status = [ 1, 1, 0, 0, 1, 0, 0, 0];
+ comp_obj_heading_.metainfo.dom_structure_collapsed_tags_status = [ 1, 1, 1, 0, 0, 0, 0, 0];
+ the_document_blurb_section ~= comp_obj_heading_;
+ tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html;
+ tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1to4"] = comp_obj_heading_.tags.segment_anchor_tag_epub;
+ }
+ } else if (line.matchFirst(rgx.headings)
+ && (opt_action.backmatter && opt_action.section_blurb)) {
comp_obj_heading_ = comp_obj_heading_.init;
comp_obj_heading_.metainfo.is_of_part = "backmatter";
comp_obj_heading_.metainfo.is_of_section = "blurb";
comp_obj_heading_.metainfo.is_of_type = "para";
comp_obj_heading_.metainfo.is_a = "heading";
- comp_obj_heading_.text = "Blurb";
+ comp_obj_heading_.text = line.to!string;
comp_obj_heading_.metainfo.ocn = 0;
comp_obj_heading_.metainfo.identifier = "";
- comp_obj_heading_.metainfo.dummy_heading = true;
+ comp_obj_heading_.metainfo.dummy_heading = false;
comp_obj_heading_.metainfo.object_number_off = true;
comp_obj_heading_.metainfo.object_number_type = 0;
comp_obj_heading_.tags.segment_anchor_tag_epub = "blurb";
comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub;
comp_obj_heading_.tags.in_segment_html = comp_obj_heading_.tags.anchor_tag_html;
- comp_obj_heading_.metainfo.heading_lev_markup = 4;
- comp_obj_heading_.metainfo.heading_lev_collapsed = 2;
+ comp_obj_heading_.metainfo.heading_lev_markup = an_object["lev_markup_number"].to!int; // make int, remove need to conv
+ comp_obj_heading_.metainfo.heading_lev_collapsed = an_object["lev_collapsed_number"].to!int; // make int, remove need to conv
comp_obj_heading_.metainfo.parent_ocn = 1;
comp_obj_heading_.metainfo.parent_lev_markup = 0;
- comp_obj_heading_.tags.anchor_tags = ["blurb"];
- comp_obj_heading_.metainfo.dom_structure_markedup_tags_status = [ 1, 1, 0, 0, 1, 0, 0, 0];
- comp_obj_heading_.metainfo.dom_structure_collapsed_tags_status = [ 1, 1, 1, 0, 0, 0, 0, 0];
the_document_blurb_section ~= comp_obj_heading_;
tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html;
tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1to4"] = comp_obj_heading_.tags.segment_anchor_tag_epub;
+ } else if (!(line.empty)) {
+ {
+ auto _get = line.flow_para_match_(an_object, an_object_key, indent, bullet, pith, line_occur);
+ {
+ an_object = _get.this_object;
+ an_object_key = _get.this_object_key;
+ pith = _get.pith;
+ indent = _get.indent;
+ bullet = _get.bullet;
+ line_occur = _get.line_occur;
+ }
+ }
+ comp_obj_para = comp_obj_para.init;
+ comp_obj_para.metainfo.is_of_part = "backmatter";
+ comp_obj_para.metainfo.is_of_section = "blurb";
+ comp_obj_para.metainfo.is_of_type = "para";
+ comp_obj_para.metainfo.is_a = "blurb";
+ comp_obj_para.text = links_and_images(line.to!string.strip).replaceFirst(rgx.para_attribs, "");
+ comp_obj_para.metainfo.ocn = 0;
+ comp_obj_para.metainfo.identifier = "";
+ comp_obj_para.metainfo.object_number_off = true;
+ comp_obj_para.metainfo.object_number_type = 0;
+ comp_obj_para.attrib.indent_hang = indent["hang_position"];
+ comp_obj_para.attrib.indent_base = indent["base_position"];
+ comp_obj_para.has.inline_links = true;
+ comp_obj_para.attrib.bullet = bullet;
+ the_document_blurb_section ~= comp_obj_para;
}
- } else if (line.matchFirst(rgx.headings)
- && (opt_action.backmatter && opt_action.section_blurb)) {
- comp_obj_heading_ = comp_obj_heading_.init;
- comp_obj_heading_.metainfo.is_of_part = "backmatter";
- comp_obj_heading_.metainfo.is_of_section = "blurb";
- comp_obj_heading_.metainfo.is_of_type = "para";
- comp_obj_heading_.metainfo.is_a = "heading";
- comp_obj_heading_.text = line.to!string;
- comp_obj_heading_.metainfo.ocn = 0;
- comp_obj_heading_.metainfo.identifier = "";
- comp_obj_heading_.metainfo.dummy_heading = false;
- comp_obj_heading_.metainfo.object_number_off = true;
- comp_obj_heading_.metainfo.object_number_type = 0;
- comp_obj_heading_.tags.segment_anchor_tag_epub = "blurb";
- comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub;
- comp_obj_heading_.tags.in_segment_html = comp_obj_heading_.tags.anchor_tag_html;
- comp_obj_heading_.metainfo.heading_lev_markup = an_object["lev_markup_number"].to!int; // make int, remove need to conv
- comp_obj_heading_.metainfo.heading_lev_collapsed = an_object["lev_collapsed_number"].to!int; // make int, remove need to conv
- comp_obj_heading_.metainfo.parent_ocn = 1;
- comp_obj_heading_.metainfo.parent_lev_markup = 0;
- the_document_blurb_section ~= comp_obj_heading_;
- tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html;
- tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1to4"] = comp_obj_heading_.tags.segment_anchor_tag_epub;
- } else if (!(line.empty)) {
- an_object = line.flow_para_match_(an_object, an_object_key, indent, bullet, pith, line_occur);
- comp_obj_para = comp_obj_para.init;
- comp_obj_para.metainfo.is_of_part = "backmatter";
- comp_obj_para.metainfo.is_of_section = "blurb";
- comp_obj_para.metainfo.is_of_type = "para";
- comp_obj_para.metainfo.is_a = "blurb";
- comp_obj_para.text = links_and_images(line.to!string.strip).replaceFirst(rgx.para_attribs, "");
- comp_obj_para.metainfo.ocn = 0;
- comp_obj_para.metainfo.identifier = "";
- comp_obj_para.metainfo.object_number_off = true;
- comp_obj_para.metainfo.object_number_type = 0;
- comp_obj_para.attrib.indent_hang = indent["hang_position"];
- comp_obj_para.attrib.indent_base = indent["base_position"];
- comp_obj_para.has.inline_links = true;
- comp_obj_para.attrib.bullet = bullet;
- the_document_blurb_section ~= comp_obj_para;
+ pith["ocn"] = eN.ocn.on;
}
- pith["ocn"] = eN.ocn.on;
- }
- continue;
- } else if (pith["block_state"] == eN.blk_state.on) {
- if (pith["block_is"] == eN.blk_is.quote) {
- line = line
- ._doc_header_and_make_substitutions_(conf_make_meta)
- ._doc_header_and_make_substitutions_fontface_(conf_make_meta);
- an_object = line.flow_txt_block_quote(an_object, pith);
- continue;
- } else if (pith["block_is"] == eN.blk_is.group) {
- line = line
- ._doc_header_and_make_substitutions_(conf_make_meta)
- ._doc_header_and_make_substitutions_fontface_(conf_make_meta)
- .replaceAll(rgx.para_delimiter, mkup.br_line_spaced ~ "$1");
- an_object = line.flow_txt_block_group(an_object, pith);
continue;
- } else if (pith["block_is"] == eN.blk_is.block) {
- line = line
- ._doc_header_and_make_substitutions_(conf_make_meta)
- ._doc_header_and_make_substitutions_fontface_(conf_make_meta);
- if (auto m = line.match(rgx.spaces_keep)) {
+ } else if (pith["block_state"] == eN.blk_state.on) {
+ if (pith["block_is"] == eN.blk_is.quote) {
line = line
- .replaceAll(rgx.spaces_keep, (m.captures[1]).translate([ ' ' : mkup.nbsp ]));
- }
- an_object = line.flow_txt_block_block(an_object, pith);
- continue;
- } else if (pith["block_is"] == eN.blk_is.poem) {
- an_object = line.flow_txt_block_poem(an_object, pith, cntr, object_number_poem, conf_make_meta, tag_in_seg);
- continue;
- } else if (pith["block_is"] == eN.blk_is.table) {
- an_object = line.flow_txt_block_table(an_object, pith, conf_make_meta);
- continue;
- }
- } else { /+ not within a block group +/
- assert(
- (pith["block_state"] == eN.blk_state.off)
- || (pith["block_state"] == eN.blk_state.closing),
- "block status: none or closed"
- );
- if (line.matchFirst(rgx.block_open)) {
- if (line.matchFirst(rgx.block_poem_open)) { /+ poem to verse exceptions! +/
- object_reset(an_object);
- processing.remove("verse");
- object_number_poem["start"] = obj_cite_digits.object_number.to!string;
+ ._doc_header_and_make_substitutions_(conf_make_meta)
+ ._doc_header_and_make_substitutions_fontface_(conf_make_meta);
+ {
+ auto _get = line.txt_by_line_block_quote(an_object, pith);
+ {
+ an_object = _get.this_object;
+ pith = _get.pith;
+ }
+ }
+ continue;
+ } else if (pith["block_is"] == eN.blk_is.group) {
+ line = line
+ ._doc_header_and_make_substitutions_(conf_make_meta)
+ ._doc_header_and_make_substitutions_fontface_(conf_make_meta)
+ .replaceAll(rgx.para_delimiter, mkup.br_line_spaced ~ "$1");
+ {
+ auto _get = line.txt_by_line_block_group(an_object, pith);
+ {
+ an_object = _get.this_object;
+ pith = _get.pith;
+ }
+ }
+ continue;
+ } else if (pith["block_is"] == eN.blk_is.block) {
+ line = line
+ ._doc_header_and_make_substitutions_(conf_make_meta)
+ ._doc_header_and_make_substitutions_fontface_(conf_make_meta);
+ if (auto m = line.match(rgx.spaces_keep)) {
+ line = line
+ .replaceAll(rgx.spaces_keep, (m.captures[1]).translate([ ' ' : mkup.nbsp ]));
+ }
+ {
+ auto _get = line.txt_by_line_block_block(an_object, pith);
+ {
+ an_object = _get.this_object;
+ pith = _get.pith;
+ }
+ }
+ continue;
+ } else if (pith["block_is"] == eN.blk_is.poem) {
+ {
+ auto _get = line.txt_by_line_block_poem(an_object, pith, cntr, object_number_poem, conf_make_meta, tag_in_seg);
+ {
+ an_object = _get.this_object;
+ pith = _get.pith;
+ cntr = _get.cntr;
+ }
+ }
+ continue;
+ } else if (pith["block_is"] == eN.blk_is.table) {
+ {
+ auto _get = line.txt_by_line_block_table(an_object, pith, conf_make_meta);
+ {
+ an_object = _get.this_object;
+ pith = _get.pith;
+ conf_make_meta = _get.conf_make_meta;
+ }
+ }
+ continue;
}
- line.flow_txt_block_start(pith, dochas, object_number_poem);
- continue;
- } else if (!line.empty) { /+ line not empty +/
- /+ non blocks (headings, paragraphs) & closed blocks +/
- assert(
- !line.empty,
- "line tested, line not empty surely:\n \"" ~ line ~ "\""
- );
+ } else { /+ not within a block group +/
assert(
(pith["block_state"] == eN.blk_state.off)
|| (pith["block_state"] == eN.blk_state.closing),
- "code block status: none or closed"
+ "block status: none or closed"
);
- if (pith["block_state"] == eN.blk_state.closing) {
- debug(check) {
- writeln(__LINE__);
- writeln(line);
+ if (line.matchFirst(rgx.block_open)) {
+ if (line.matchFirst(rgx.block_poem_open)) { /+ poem to verse exceptions! +/
+ object_reset(an_object);
+ processing.remove("verse");
+ object_number_poem["start"] = obj_cite_digits.object_number.to!string;
+ }
+ {
+ auto _get = line.txt_by_line_block_start(pith, dochas, object_number_poem);
+ {
+ pith = _get.pith;
+ dochas = _get.dochas;
+ object_number_poem = _get.object_number_poem;
+ }
}
+ continue;
+ } else if (!line.empty) { /+ line not empty - non blocks (headings, paragraphs) & closed blocks +/
assert(
- line.matchFirst(rgx.book_index_item)
- || line.matchFirst(rgx.book_index_item_open)
- || pith["section"] == eN.sect.book_index,
- "\nblocks closed, unless followed by book index, non-matching line:\n \""
- ~ line ~ "\""
+ !line.empty,
+ "line tested, line not empty surely:\n \"" ~ line ~ "\""
);
- }
- if (line.matchFirst(rgx.book_index_item)
- || line.matchFirst(rgx.book_index_item_open)
- || pith["section"] == eN.sect.book_index) { /+ book_index +/
- an_object = line.flow_book_index_(an_object, book_idx_tmp, pith, opt_action);
- } else { /+ not book_index +/
- an_object_key = "body_nugget";
- if (auto m = line.matchFirst(rgx.comment)) { /+ matched comment +/
- debug(comment) {
+ assert(
+ (pith["block_state"] == eN.blk_state.off)
+ || (pith["block_state"] == eN.blk_state.closing),
+ "code block status: none or closed"
+ );
+ if (pith["block_state"] == eN.blk_state.closing) {
+ debug(check) {
+ writeln(__LINE__);
writeln(line);
}
- an_object[an_object_key] ~= line ~= "\n";
- comp_obj_comment = comp_obj_comment.init;
- comp_obj_comment.metainfo.is_of_part = "comment"; // breaks flow
- comp_obj_comment.metainfo.is_of_section = "comment"; // breaks flow
- comp_obj_comment.metainfo.is_of_type = "comment";
- comp_obj_comment.metainfo.is_a = "comment";
- comp_obj_comment.text = an_object[an_object_key].strip;
- the_document_body_section ~= comp_obj_comment;
- flow_common_reset_(line_occur, an_object, pith);
- processing.remove("verse");
- ++cntr;
- } else if ((line_occur["para"] == eN.bi.off
- && line_occur["heading"] == eN.bi.off)
- && pith["txt_is"] == eN.txt_is.off
- ) { /+ heading or para but neither flag nor line exists +/
- if ((conf_make_meta.make.headings.length > 2)
- && (pith["make_headings"] == eN.bi.off)) { /+ heading found +/
- heading_match_str = line.flow_heading_found_(heading_match_str, conf_make_meta.make.headings, heading_match_rgx, pith);
+ assert(
+ line.matchFirst(rgx.book_index_item)
+ || line.matchFirst(rgx.book_index_item_open)
+ || pith["section"] == eN.sect.book_index,
+ "\nblocks closed, unless followed by book index, non-matching line:\n \""
+ ~ line ~ "\""
+ );
+ }
+ if (line.matchFirst(rgx.book_index_item)
+ || line.matchFirst(rgx.book_index_item_open)
+ || pith["section"] == eN.sect.book_index) { /+ book_index +/
+ {
+ auto _get = line.flow_book_index_(an_object, book_idx_tmp, pith, opt_action);
+ {
+ an_object = _get.this_object;
+ pith = _get.pith;
+ book_idx_tmp = _get.book_idx_tmp;
+ }
}
- if (pith["make_headings"] == eN.bi.on
- && (line_occur["para"] == eN.bi.off
+ } else { /+ not book_index +/
+ an_object_key = "body_nugget";
+ if (auto m = line.matchFirst(rgx.comment)) { /+ matched comment +/
+ debug(comment) {
+ writeln(line);
+ }
+ an_object[an_object_key] ~= line ~= "\n";
+ comp_obj_comment = comp_obj_comment.init;
+ comp_obj_comment.metainfo.is_of_part = "comment"; // breaks flow
+ comp_obj_comment.metainfo.is_of_section = "comment"; // breaks flow
+ comp_obj_comment.metainfo.is_of_type = "comment";
+ comp_obj_comment.metainfo.is_a = "comment";
+ comp_obj_comment.text = an_object[an_object_key].strip;
+ the_document_body_section ~= comp_obj_comment;
+ {
+ auto _get = txt_by_line_common_reset_(line_occur, an_object, pith);
+ {
+ line_occur = _get.line_occur;
+ an_object = _get.this_object;
+ pith = _get.pith;
+ }
+ }
+ processing.remove("verse");
+ ++cntr;
+ } else if ((line_occur["para"] == eN.bi.off
&& line_occur["heading"] == eN.bi.off)
&& pith["txt_is"] == eN.txt_is.off
- ) { /+ heading make set +/
- line = line.flow_heading_make_set_(line_occur, heading_match_rgx, pith);
- }
- /+ TODO node info: all headings identified at this point,
- - extract node info here??
- - how long can it wait?
- - should be incorporated in composite objects
- - should happen before endnote links set (they need to be moved down?)
- +/
- if (line.matchFirst(rgx.headings)) { /+ heading match +/
- line = line._doc_header_and_make_substitutions_(conf_make_meta);
- an_object = line.flow_heading_matched_(
- an_object,
- line_occur,
- an_object_key,
- lv,
- collapsed_lev,
- pith,
- conf_make_meta,
- );
- } else if (line_occur["para"] == eN.bi.off) { /+ para match +/
- an_object_key = "body_nugget";
+ ) { /+ heading or para but neither flag nor line exists +/
+ if ((conf_make_meta.make.headings.length > 2)
+ && (pith["make_headings"] == eN.bi.off)) { /+ heading found +/
+ {
+ auto _get = line.flow_heading_found_(heading_match_str, conf_make_meta.make.headings, heading_match_rgx, pith);
+ {
+ heading_match_str = _get.heading_match_str;
+ heading_match_rgx = _get.heading_match_rgx;
+ pith = _get.pith;
+ }
+ }
+ }
+ if (pith["make_headings"] == eN.bi.on
+ && (line_occur["para"] == eN.bi.off
+ && line_occur["heading"] == eN.bi.off)
+ && pith["txt_is"] == eN.txt_is.off
+ ) { /+ heading make set +/
+ {
+ auto _get = line.flow_heading_make_set_(line_occur, heading_match_rgx, pith);
+ {
+ line = _get.line;
+ an_object = _get.this_object;
+ pith = _get.pith;
+ }
+ }
+ }
+ /+ TODO node info: all headings identified at this point,
+ - extract node info here??
+ - how long can it wait?
+ - should be incorporated in composite objects
+ - should happen before endnote links set (they need to be moved down?)
+ +/
+ if (line.matchFirst(rgx.headings)) { /+ heading match +/
+ line = line._doc_header_and_make_substitutions_(conf_make_meta);
+ {
+ auto _get = line.flow_heading_matched_(
+ an_object,
+ line_occur,
+ an_object_key,
+ lv,
+ collapsed_lev,
+ pith,
+ conf_make_meta,
+ );
+ {
+ an_object = _get.this_object;
+ pith = _get.pith;
+ }
+ }
+ } else if (line_occur["para"] == eN.bi.off) { /+ para match +/
+ an_object_key = "body_nugget";
+ line = line
+ ._doc_header_and_make_substitutions_(conf_make_meta)
+ ._doc_header_and_make_substitutions_fontface_(conf_make_meta);
+ {
+ auto _get = line.flow_para_match_(an_object, an_object_key, indent, bullet, pith, line_occur);
+ {
+ an_object = _get.this_object;
+ an_object_key = _get.this_object_key;
+ pith = _get.pith;
+ indent = _get.indent;
+ bullet = _get.bullet;
+ line_occur = _get.line_occur;
+ }
+ }
+ }
+ } else if (line_occur["heading"] > eN.bi.off) { /+ heading +/
+ debug(heading) {
+ writeln(line);
+ }
+ an_object[an_object_key] ~= line ~= "\n";
+ ++line_occur["heading"];
+ } else if (line_occur["para"] > eN.bi.off) { /+ paragraph +/
+ debug(para) {
+ writeln(an_object_key, "-> ", line);
+ }
line = line
._doc_header_and_make_substitutions_(conf_make_meta)
._doc_header_and_make_substitutions_fontface_(conf_make_meta);
- an_object = line.flow_para_match_(an_object, an_object_key, indent, bullet, pith, line_occur);
+ an_object[an_object_key] ~= " " ~ line;
+ ++line_occur["para"];
}
- } else if (line_occur["heading"] > eN.bi.off) { /+ heading +/
- debug(heading) {
- writeln(line);
- }
- an_object[an_object_key] ~= line ~= "\n";
- ++line_occur["heading"];
- } else if (line_occur["para"] > eN.bi.off) { /+ paragraph +/
- debug(para) {
- writeln(an_object_key, "-> ", line);
+ }
+ } else if (pith["block_state"] == eN.blk_state.closing) { /+ line empty, with blocks flag +/
+ {
+ auto _get = line.flow_block_flag_line_empty_(
+ an_object,
+ bookindex_extract_hash,
+ the_document_body_section,
+ bookindex_unordered_hashes,
+ obj_cite_digits,
+ comp_obj_heading,
+ cntr,
+ pith,
+ object_number_poem,
+ conf_make_meta,
+ tag_in_seg,
+ );
+ {
+ an_object = _get.this_object;
+ the_document_body_section = _get.the_document_body_section;
+ bookindex_unordered_hashes = _get.bookindex_unordered_hashes;
+ obj_cite_digits = _get.obj_cite_digits;
+ comp_obj_heading = _get.comp_obj_heading;
+ cntr = _get.cntr;
+ pith = _get.pith;
}
- line = line
- ._doc_header_and_make_substitutions_(conf_make_meta)
- ._doc_header_and_make_substitutions_fontface_(conf_make_meta);
- an_object[an_object_key] ~= " " ~ line;
- ++line_occur["para"];
}
- }
- } else if (pith["block_state"] == eN.blk_state.closing) { /+ line empty, with blocks flag +/
- an_object = line.flow_block_flag_line_empty_(
- an_object,
- bookindex_extract_hash,
- the_document_body_section,
- bookindex_unordered_hashes,
- obj_cite_digits,
- comp_obj_heading,
- cntr,
- pith,
- object_number_poem,
- conf_make_meta,
- tag_in_seg,
- );
- } else { /+ line.empty, post contents, empty variables: +/
- assert(
- line.empty,
- "\nline should be empty:\n \""
- ~ line ~ "\""
- );
- assert(
- (pith["block_state"] == eN.blk_state.off),
- "code block status: none"
- );
- if (_new_doc) {
- tag_assoc = tag_assoc.init;
- lv0to3_tags = lv0to3_tags.init;
- tag_in_seg = tag_in_seg.init;
- }
- if (pith["txt_is"] == eN.txt_is.heading
- && line_occur["heading"] > eN.bi.off
- ) { /+ heading object (current line empty) +/
- obj_cite_digits = (an_object["lev_markup_number"].to!int == 0)
- ? ocn_emit(eN.ocn.reset)
- : ocn_emit(pith["ocn"]);
- an_object["is"] = "heading";
- an_object_key = "body_nugget";
- TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_object_and_anchor_tags_tuple
- = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, ((_new_doc) ? Yes._new_doc : No._new_doc));
- an_object["substantive"] = substantive_object_and_anchor_tags_tuple[sObj.content];
- anchor_tag = substantive_object_and_anchor_tags_tuple[sObj.anchor_tag];
+ } else { /+ line.empty, post contents, empty variables: +/
+ assert(
+ line.empty,
+ "\nline should be empty:\n \""
+ ~ line ~ "\""
+ );
+ assert(
+ (pith["block_state"] == eN.blk_state.off),
+ "code block status: none"
+ );
if (_new_doc) {
- cnt1 = 1;
- cnt2 = 1;
- cnt3 = 1;
- _new_doc = false;
+ tag_assoc = tag_assoc.init;
+ lv0to3_tags = lv0to3_tags.init;
+ tag_in_seg = tag_in_seg.init;
}
- if (
- an_object["lev_markup_number"].to!int == 4
- && (!(anchor_tag.empty)
- || (lv0to3_tags.length > 0))
- ) {
- tag_in_seg["seg_lv4"] = anchor_tag;
- tag_in_seg["seg_lv1to4"] = anchor_tag;
- lev_anchor_tag = anchor_tag;
- tag_assoc[anchor_tag]["seg_lv4"] = tag_in_seg["seg_lv4"];
- tag_assoc[anchor_tag]["seg_lv1to4"] = tag_in_seg["seg_lv1to4"];
- if (lv0to3_tags.length > 0) { /+ names used for html markup segments 1 to 4 (rather than epub which has separate segments for A to D) +/
- foreach (lv0_to_lv3_html_tag; lv0to3_tags) {
- tag_assoc[lv0_to_lv3_html_tag]["seg_lv4"] = anchor_tag;
+ if (pith["txt_is"] == eN.txt_is.heading
+ && line_occur["heading"] > eN.bi.off
+ ) { /+ heading object (current line empty) +/
+ obj_cite_digits = (an_object["lev_markup_number"].to!int == 0)
+ ? ocn_emit(eN.ocn.reset)
+ : ocn_emit(pith["ocn"]);
+ an_object["is"] = "heading";
+ an_object_key = "body_nugget";
+ TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_object_and_anchor_tags_tuple
+ = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, ((_new_doc) ? Yes._new_doc : No._new_doc));
+ an_object["substantive"] = substantive_object_and_anchor_tags_tuple[sObj.content];
+ anchor_tag = substantive_object_and_anchor_tags_tuple[sObj.anchor_tag];
+ if (_new_doc) {
+ cnt1 = 1;
+ cnt2 = 1;
+ cnt3 = 1;
+ _new_doc = false;
+ }
+ if (
+ an_object["lev_markup_number"].to!int == 4
+ && (!(anchor_tag.empty)
+ || (lv0to3_tags.length > 0))
+ ) {
+ tag_in_seg["seg_lv4"] = anchor_tag;
+ tag_in_seg["seg_lv1to4"] = anchor_tag;
+ lev_anchor_tag = anchor_tag;
+ tag_assoc[anchor_tag]["seg_lv4"] = tag_in_seg["seg_lv4"];
+ tag_assoc[anchor_tag]["seg_lv1to4"] = tag_in_seg["seg_lv1to4"];
+ if (lv0to3_tags.length > 0) { /+ names used for html markup segments 1 to 4 (rather than epub which has separate segments for A to D) +/
+ foreach (lv0_to_lv3_html_tag; lv0to3_tags) {
+ tag_assoc[lv0_to_lv3_html_tag]["seg_lv4"] = anchor_tag;
+ }
+ }
+ anchor_tag_ = anchor_tag;
+ lv0to3_tags = lv0to3_tags.init;
+ } else if (an_object["lev_markup_number"].to!int > 4) {
+ tag_in_seg["seg_lv4"] = anchor_tag_;
+ tag_in_seg["seg_lv1to4"] = anchor_tag_;
+ lev_anchor_tag = anchor_tag;
+ tag_assoc[anchor_tag]["seg_lv4"] = tag_in_seg["seg_lv4"];
+ tag_assoc[anchor_tag]["seg_lv1to4"] = tag_in_seg["seg_lv1to4"];
+ } else if (an_object["lev_markup_number"].to!int < 4) {
+ string segn;
+ switch (an_object["lev_markup_number"].to!int) { /+ names used for epub markup segments A to D +/
+ case 0:
+ segn = "_the_title";
+ goto default;
+ case 1:
+ segn = "_part_" ~ cnt1.to!string;
+ ++cnt1;
+ goto default;
+ case 2:
+ segn = "_part_" ~ cnt1.to!string ~ "_" ~ cnt2.to!string;
+ ++cnt2;
+ goto default;
+ case 3:
+ segn = "_part_" ~ cnt1.to!string ~ "_" ~ cnt2.to!string ~ "_" ~ cnt3.to!string;
+ ++cnt3;
+ goto default;
+ default:
+ lv0to3_tags ~= obj_cite_digits.object_number.to!string;
+ lv0to3_tags ~= segn;
+ tag_in_seg["seg_lv4"] = segn; // for html segname need following lv4 not yet known
+ tag_in_seg["seg_lv1to4"] = segn;
+ break;
}
}
- anchor_tag_ = anchor_tag;
- lv0to3_tags = lv0to3_tags.init;
- } else if (an_object["lev_markup_number"].to!int > 4) {
- tag_in_seg["seg_lv4"] = anchor_tag_;
- tag_in_seg["seg_lv1to4"] = anchor_tag_;
- lev_anchor_tag = anchor_tag;
- tag_assoc[anchor_tag]["seg_lv4"] = tag_in_seg["seg_lv4"];
- tag_assoc[anchor_tag]["seg_lv1to4"] = tag_in_seg["seg_lv1to4"];
- } else if (an_object["lev_markup_number"].to!int < 4) {
- string segn;
- switch (an_object["lev_markup_number"].to!int) { /+ names used for epub markup segments A to D +/
- case 0:
- segn = "_the_title";
- goto default;
- case 1:
- segn = "_part_" ~ cnt1.to!string;
- ++cnt1;
- goto default;
- case 2:
- segn = "_part_" ~ cnt1.to!string ~ "_" ~ cnt2.to!string;
- ++cnt2;
- goto default;
- case 3:
- segn = "_part_" ~ cnt1.to!string ~ "_" ~ cnt2.to!string ~ "_" ~ cnt3.to!string;
- ++cnt3;
- goto default;
- default:
- lv0to3_tags ~= obj_cite_digits.object_number.to!string;
- lv0to3_tags ~= segn;
- tag_in_seg["seg_lv4"] = segn; // for html segname need following lv4 not yet known
- tag_in_seg["seg_lv1to4"] = segn;
- break;
+ an_object["bookindex_nugget"]
+ = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";
+ bookindex_unordered_hashes
+ = bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_digits, tag_in_seg);
+ /+ (incrementally build toc) table of contents here! +/
+ _anchor_tag = obj_cite_digits.identifier;
+ {
+ auto _get = obj_im.flow_table_of_contents_gather_headings(
+ an_object,
+ conf_make_meta,
+ tag_in_seg,
+ _anchor_tag,
+ lev4_subtoc,
+ the_document_toc_section,
+ );
+ {
+ the_document_toc_section = _get.the_document_toc_section;
+ lev4_subtoc = _get.lev4_subtoc;
+ }
}
+ if (an_object["lev_markup_number"] == "4") {
+ segnames["html"] ~= tag_in_seg["seg_lv4"];
+ html_segnames_ptr = html_segnames_ptr_cntr;
+ html_segnames_ptr_cntr++;
+ }
+ if (an_object["lev_markup_number"].to!int <= 4) {
+ segnames["epub"] ~= tag_in_seg["seg_lv1to4"];
+ }
+ auto comp_obj_heading = node_construct.node_emitter_heading(
+ an_object["substantive"],
+ an_object["lev_markup_number"],
+ an_object["lev_collapsed_number"],
+ an_object["dummy_heading_status"],
+ tag_in_seg,
+ lev_anchor_tag,
+ tag_assoc,
+ obj_cite_digits, // OCNset
+ cntr, // int
+ heading_ptr, // int
+ lv_ancestors_txt, // string[]
+ an_object["is"], // string
+ html_segnames_ptr, // int
+ substantive_object_and_anchor_tags_tuple[sObj.notes_reg],
+ substantive_object_and_anchor_tags_tuple[sObj.notes_star],
+ substantive_object_and_anchor_tags_tuple[sObj.links],
+ );
+ ++heading_ptr;
+ debug(segments) {
+ writeln(an_object["lev_markup_number"]);
+ writeln(tag_in_seg["seg_lv4"]);
+ writeln(tag_in_seg["seg_lv1to4"]);
+ }
+ the_document_body_section ~= comp_obj_heading;
+ debug(objectrelated1) { // check
+ writeln(line);
+ }
+ {
+ auto _get = txt_by_line_common_reset_(line_occur, an_object, pith);
+ {
+ line_occur = _get.line_occur;
+ an_object = _get.this_object;
+ pith = _get.pith;
+ }
+ }
+ an_object.remove("lev");
+ an_object.remove("lev_markup_number");
+ processing.remove("verse");
+ ++cntr;
+ } else if (pith["txt_is"] == eN.txt_is.para
+ && line_occur["para"] > eN.bi.off
+ ) { /+ paragraph object (current line empty) - repeated character paragraph separator +/
+ if ((an_object[an_object_key].to!string).matchFirst(rgx.repeated_character_line_separator)) {
+ pith["ocn"] = eN.ocn.off;
+ }
+ obj_cite_digits = ocn_emit(pith["ocn"]);
+ an_object["bookindex_nugget"] = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";
+ bookindex_unordered_hashes = bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_digits, tag_in_seg);
+ an_object["is"] = "para";
+ auto comp_obj_heading = node_construct.node_location_emitter(
+ content_non_header,
+ tag_in_seg,
+ lev_anchor_tag,
+ tag_assoc,
+ obj_cite_digits,
+ cntr,
+ heading_ptr-1,
+ an_object["is"],
+ );
+ TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple
+ = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc);
+ an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
+ anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag];
+ comp_obj_para = comp_obj_para.init;
+ comp_obj_para.metainfo.is_of_part = "body";
+ comp_obj_para.metainfo.is_of_section = "body";
+ comp_obj_para.metainfo.is_of_type = "para";
+ comp_obj_para.metainfo.is_a = "para";
+ comp_obj_para.text = an_object["substantive"].to!string.strip;
+ comp_obj_para.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"];
+ comp_obj_para.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1to4"];
+ comp_obj_para.metainfo.ocn = obj_cite_digits.object_number;
+ comp_obj_para.metainfo.identifier = obj_cite_digits.identifier;
+ comp_obj_para.metainfo.object_number_off = (obj_cite_digits.off == 0) ? true : false; // TODO
+ comp_obj_para.metainfo.o_n_book_index = obj_cite_digits.bkidx;
+ comp_obj_para.metainfo.object_number_type = obj_cite_digits.type;
+ comp_obj_para.attrib.indent_hang = indent["hang_position"];
+ comp_obj_para.attrib.indent_base = indent["base_position"];
+ comp_obj_para.attrib.bullet = bullet;
+ comp_obj_para.tags.anchor_tags = [anchor_tag]; anchor_tag="";
+ comp_obj_para.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg];
+ comp_obj_para.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star];
+ comp_obj_para.has.inline_links = substantive_obj_misc_tuple[sObj.links];
+ comp_obj_para.has.image_without_dimensions = substantive_obj_misc_tuple[sObj.image_no_dimensions];
+ the_document_body_section ~= comp_obj_para;
+ tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc);
+ {
+ auto _get = txt_by_line_common_reset_(line_occur, an_object, pith);
+ {
+ line_occur = _get.line_occur;
+ an_object = _get.this_object;
+ pith = _get.pith;
+ }
+ }
+ indent = [
+ "hang_position" : 0,
+ "base_position" : 0,
+ ];
+ bullet = false;
+ processing.remove("verse");
+ ++cntr;
+ // } else { // could be useful to test line variable should be empty and never null
}
- an_object["bookindex_nugget"]
- = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";
- bookindex_unordered_hashes
- = bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_digits, tag_in_seg);
- /+ (incrementally build toc) table of contents here! +/
- _anchor_tag = obj_cite_digits.identifier;
- the_document_toc_section = obj_im.flow_table_of_contents_gather_headings(
- an_object,
- conf_make_meta,
- tag_in_seg,
- _anchor_tag,
- lev4_subtoc,
- the_document_toc_section,
- );
- if (an_object["lev_markup_number"] == "4") {
- segnames["html"] ~= tag_in_seg["seg_lv4"];
- html_segnames_ptr = html_segnames_ptr_cntr;
- html_segnames_ptr_cntr++;
- }
- if (an_object["lev_markup_number"].to!int <= 4) {
- segnames["epub"] ~= tag_in_seg["seg_lv1to4"];
+ } // close else for line empty
+ } // close else for not the above
+ } // close after non code, other blocks or regular text
+ /+ unless (the_document_body_section.length == 0) ? +/
+ if (the_document_body_section.length > 0) {
+ if (((the_document_body_section[$-1].metainfo.is_a == "para")
+ || (the_document_body_section[$-1].metainfo.is_a == "heading")
+ || (the_document_body_section[$-1].metainfo.is_a == "quote")
+ || (the_document_body_section[$-1].metainfo.is_a == "group")
+ || (the_document_body_section[$-1].metainfo.is_a == "block")
+ || (the_document_body_section[$-1].metainfo.is_a == "verse"))
+ && (the_document_body_section.length > previous_length)) {
+ if ((the_document_body_section[$-1].metainfo.is_a == "heading")
+ && (the_document_body_section[$-1].metainfo.heading_lev_markup < 5)) {
+ pith["section"] = eN.sect.unset;
+ }
+ if (the_document_body_section[$-1].metainfo.is_a == "verse") { /+ scan for endnotes for whole poem (each verse in poem) +/
+ foreach (i; previous_length .. the_document_body_section.length) {
+ if (the_document_body_section[i].metainfo.is_a == "verse") {
+ if ((the_document_body_section[i].text).match(
+ rgx.inline_notes_al_all_note
+ )) {
+ object_notes = note_section.gather_notes_for_endnote_section(
+ the_document_body_section,
+ tag_in_seg,
+ (i).to!int,
+ );
+ }
+ }
}
- auto comp_obj_heading
- = node_construct.node_emitter_heading(
- an_object["substantive"],
- an_object["lev_markup_number"],
- an_object["lev_collapsed_number"],
- an_object["dummy_heading_status"],
+ } else { /+ scan object for endnotes +/
+ previous_length = the_document_body_section.length.to!int;
+ if ((the_document_body_section[$-1].text).match(
+ rgx.inline_notes_al_all_note
+ )) {
+ previous_count = (the_document_body_section.length -1).to!int;
+ object_notes = note_section.gather_notes_for_endnote_section(
+ the_document_body_section,
tag_in_seg,
- lev_anchor_tag,
- tag_assoc,
- obj_cite_digits, // OCNset
- cntr, // int
- heading_ptr, // int
- lv_ancestors_txt, // string[]
- an_object["is"], // string
- html_segnames_ptr, // int
- substantive_object_and_anchor_tags_tuple[sObj.notes_reg],
- substantive_object_and_anchor_tags_tuple[sObj.notes_star],
- substantive_object_and_anchor_tags_tuple[sObj.links],
+ (the_document_body_section.length-1).to!int,
);
- ++heading_ptr;
- debug(segments) {
- writeln(an_object["lev_markup_number"]);
- writeln(tag_in_seg["seg_lv4"]);
- writeln(tag_in_seg["seg_lv1to4"]);
- }
- the_document_body_section ~= comp_obj_heading;
- debug(objectrelated1) { // check
- writeln(line);
- }
- flow_common_reset_(line_occur, an_object, pith);
- an_object.remove("lev");
- an_object.remove("lev_markup_number");
- processing.remove("verse");
- ++cntr;
- } else if (pith["txt_is"] == eN.txt_is.para
- && line_occur["para"] > eN.bi.off
- ) {
- /+ paragraph object (current line empty) +/
- /+ repeated character paragraph separator +/
- if ((an_object[an_object_key].to!string).matchFirst(rgx.repeated_character_line_separator)) {
- pith["ocn"] = eN.ocn.off;
- }
- obj_cite_digits = ocn_emit(pith["ocn"]);
- an_object["bookindex_nugget"]
- = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";
- bookindex_unordered_hashes
- = bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_digits, tag_in_seg);
- an_object["is"] = "para";
- auto comp_obj_heading
- = node_construct.node_location_emitter(
- content_non_header,
- tag_in_seg,
- lev_anchor_tag,
- tag_assoc,
- obj_cite_digits,
- cntr,
- heading_ptr-1,
- an_object["is"],
- );
- TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple
- = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc);
- an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
- anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag];
- comp_obj_para = comp_obj_para.init;
- comp_obj_para.metainfo.is_of_part = "body";
- comp_obj_para.metainfo.is_of_section = "body";
- comp_obj_para.metainfo.is_of_type = "para";
- comp_obj_para.metainfo.is_a = "para";
- comp_obj_para.text = an_object["substantive"].to!string.strip;
- comp_obj_para.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"];
- comp_obj_para.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1to4"];
- comp_obj_para.metainfo.ocn = obj_cite_digits.object_number;
- comp_obj_para.metainfo.identifier = obj_cite_digits.identifier;
- comp_obj_para.metainfo.object_number_off = (obj_cite_digits.off == 0) ? true : false; // TODO
- comp_obj_para.metainfo.o_n_book_index = obj_cite_digits.bkidx;
- comp_obj_para.metainfo.object_number_type = obj_cite_digits.type;
- comp_obj_para.attrib.indent_hang = indent["hang_position"];
- comp_obj_para.attrib.indent_base = indent["base_position"];
- comp_obj_para.attrib.bullet = bullet;
- comp_obj_para.tags.anchor_tags = [anchor_tag]; anchor_tag="";
- comp_obj_para.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg];
- comp_obj_para.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star];
- comp_obj_para.has.inline_links = substantive_obj_misc_tuple[sObj.links];
- comp_obj_para.has.image_without_dimensions = substantive_obj_misc_tuple[sObj.image_no_dimensions];
- the_document_body_section ~= comp_obj_para;
- tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc);
- flow_common_reset_(line_occur, an_object, pith);
- indent = [
- "hang_position" : 0,
- "base_position" : 0,
- ];
- bullet = false;
- processing.remove("verse");
- ++cntr;
- } else {
- // could be useful to test line variable should be empty and never null
- }
- } // close else for line empty
- } // close else for not the above
- } // close after non code, other blocks or regular text
- /+ unless (the_document_body_section.length == 0) ? +/
- if (the_document_body_section.length > 0) {
- if (((the_document_body_section[$-1].metainfo.is_a == "para")
- || (the_document_body_section[$-1].metainfo.is_a == "heading")
- || (the_document_body_section[$-1].metainfo.is_a == "quote")
- || (the_document_body_section[$-1].metainfo.is_a == "group")
- || (the_document_body_section[$-1].metainfo.is_a == "block")
- || (the_document_body_section[$-1].metainfo.is_a == "verse"))
- && (the_document_body_section.length > previous_length)) {
- if ((the_document_body_section[$-1].metainfo.is_a == "heading")
- && (the_document_body_section[$-1].metainfo.heading_lev_markup < 5)) {
- pith["section"] = eN.sect.unset;
- }
- if (the_document_body_section[$-1].metainfo.is_a == "verse") { /+ scan for endnotes for whole poem (each verse in poem) +/
- foreach (i; previous_length .. the_document_body_section.length) {
- if (the_document_body_section[i].metainfo.is_a == "verse") {
- if ((the_document_body_section[i].text).match(
- rgx.inline_notes_al_all_note
- )) {
- note_section.gather_notes_for_endnote_section(
- the_document_body_section,
- tag_in_seg,
- (i).to!int,
- );
- }
}
}
- } else { /+ scan object for endnotes +/
previous_length = the_document_body_section.length.to!int;
- if ((the_document_body_section[$-1].text).match(
- rgx.inline_notes_al_all_note
- )) {
- previous_count = (the_document_body_section.length -1).to!int;
- note_section.gather_notes_for_endnote_section(
- the_document_body_section,
- tag_in_seg,
- (the_document_body_section.length-1).to!int,
- );
- }
}
- previous_length = the_document_body_section.length.to!int;
}
}
- } /+ ← srcDocLoop closed: loop markup document/text line by line +/
- /+ ↓ post loop markup document/text +/
+ ret.toc = the_document_toc_section;
+ ret.body = the_document_body_section;
+ ret.glossary = the_document_glossary_section;
+ ret.blurb = the_document_blurb_section;
+ ret.object_notes = object_notes;
+ ret.segnames = segnames;
+ return ret;
+ }
+ { // loopMarkupSrcByLine
+ auto _doc_by_line = loopMarkupSrcByLine(markup_sourcefile_content, an_object, pith);
+ the_document_toc_section = _doc_by_line.toc;
+ the_document_body_section = _doc_by_line.body;
+ the_document_glossary_section = _doc_by_line.glossary;
+ the_document_blurb_section = _doc_by_line.blurb;
+ segnames = _doc_by_line.segnames;
+ object_notes = _doc_by_line.object_notes; // endnotes, compare, not sure is used
+ destroy(_doc_by_line);
+ }
{ // EOF
comp_obj_heading_ = comp_obj_heading_.init;
comp_obj_heading_.metainfo.is_of_part = "backmatter";
@@ -1333,7 +1507,7 @@ template docAbstraction() {
tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html;
tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1to4"] = comp_obj_heading_.tags.segment_anchor_tag_epub;
}
- auto en_tuple = note_section.endnote_objects(obj_cite_digits, opt_action);
+ auto en_tuple = note_section.endnote_objects(obj_cite_digits, opt_action); // endnotes, check
auto the_document_endnotes_section = en_tuple[0];
obj_cite_digits = en_tuple[1];
debug(endnotes) {
@@ -1370,8 +1544,15 @@ template docAbstraction() {
}
auto biblio_unsorted_incomplete = biblio_arr_json.dup;
auto biblio = Bibliography();
- auto biblio_ordered
- = biblio.flow_bibliography_(biblio_unsorted_incomplete, bib_arr_json);
+ JSONValue[] biblio_ordered;
+ {
+ auto _get = biblio.flow_bibliography_(biblio_unsorted_incomplete, bib_arr_json);
+ {
+ biblio_ordered = _get.biblio_sorted;
+ bib_arr_json = _get.bib_arr_json;
+ biblio_unsorted_incomplete = _get.biblio_unsorted_incomplete;
+ }
+ }
if (biblio_ordered.length > 0) {
{
comp_obj_heading_ = comp_obj_heading_.init;
@@ -2513,181 +2694,94 @@ template docAbstraction() {
dom_structure_collapsed_tags_status_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0,];
lev_anchor_tag = "";
anchor_tag = "";
- @safe auto doc_has() {
- struct DocHas_ {
- uint inline_links() {
- return dochas["inline_links"];
- }
- uint inline_notes_reg() {
- return dochas["inline_notes"];
- }
- uint inline_notes_star() {
- return dochas["inline_notes_star"];
- }
- uint codeblocks() {
- return dochas["codeblock"];
- }
- uint tables() {
- return dochas["table"];
- }
- uint blocks() {
- return dochas["block"];
- }
- uint groups() {
- return dochas["group"];
- }
- uint poems() {
- return dochas["poem"];
- }
- uint quotes() {
- return dochas["quote"];
- }
- ulong images() { // TODO not ideal rethink
- return (image_list.to!string.strip("[","]").split(",").length);
- }
- auto imagelist() {
- return image_list;
- }
- auto keys_seq() {
- return docSectKeysSeq!()(document_section_keys_sequenced);
- }
- string[] segnames_lv4() {
- return segnames_4;
- }
- string[] segnames_lv_0_to_4() {
- return segnames_0_to_4;
- }
- string[string][string] tag_associations() {
- return tag_assoc;
- }
+ struct DocHas_ {
+ uint inline_links() {
+ return dochas["inline_links"];
+ }
+ uint inline_notes_reg() {
+ return dochas["inline_notes"];
+ }
+ uint inline_notes_star() {
+ return dochas["inline_notes_star"];
}
+ uint codeblocks() {
+ return dochas["codeblock"];
+ }
+ uint tables() {
+ return dochas["table"];
+ }
+ uint blocks() {
+ return dochas["block"];
+ }
+ uint groups() {
+ return dochas["group"];
+ }
+ uint poems() {
+ return dochas["poem"];
+ }
+ uint quotes() {
+ return dochas["quote"];
+ }
+ ulong images() { // TODO not ideal rethink
+ return (image_list.to!string.strip("[","]").split(",").length);
+ }
+ auto imagelist() {
+ return image_list;
+ }
+ auto keys_seq() {
+ return docSectKeysSeq!()(document_section_keys_sequenced);
+ }
+ string[] segnames_lv4() {
+ return segnames_4;
+ }
+ string[] segnames_lv_0_to_4() {
+ return segnames_0_to_4;
+ }
+ string[string][string] tag_associations() {
+ return tag_assoc;
+ }
+ }
+ @safe auto doc_has() {
return DocHas_();
}
- auto t = tuple(
- document_the,
- doc_has,
- );
- return t;
- /+ post loop markup document/text ↑ +/
+ struct retStruct {
+ ObjGenericComposite[][string] document_the;
+ DocHas_ doc_has;
+ }
+ retStruct ret;
+ {
+ ret.document_the = document_the;
+ ret.doc_has = doc_has;
+ }
+ return ret;
} /+ ← closed: abstract doc source +/
- /+ ↓ abstraction functions +/
- @safe static string[string] object_reset()(string[string] an_object) {
- an_object.remove("body_nugget");
- an_object.remove("substantive");
- an_object.remove("is");
- an_object.remove("attrib");
- an_object.remove("bookindex_nugget");
- return an_object;
- }
- @system void flow_common_reset_()(
- return ref int[string] line_occur,
- return ref string[string] an_object,
- return ref uint[string] pith,
+ @system auto txt_by_line_common_reset_()(
+ int[string] line_occur,
+ string[string] an_object,
+ uint[string] pith,
) {
line_occur["heading"] = eN.bi.off;
line_occur["para"] = eN.bi.off;
pith["txt_is"] = eN.txt_is.off;
an_object = an_object.object_reset;
+ struct retStruct {
+ int[string] line_occur;
+ string[string] this_object;
+ uint[string] pith;
+ }
+ retStruct ret;
+ {
+ ret.line_occur = line_occur;
+ ret.this_object = an_object;
+ ret.pith = pith;
+ }
+ return ret;
}
- @safe static uint[string] _check_ocn_status_()(
- char[] line,
- uint[string] pith,
- ) {
- static auto rgx = RgxI();
- if (!(line.empty)) {
- if (pith["no_ocn_multiple_objects"] == eN.bi.off) {
- /+ not multi-line object, check whether object_number is on or turned off +/
- if (line.matchFirst(rgx.object_number_block_marks)) { /+ switch off object_number +/
- if (line.matchFirst(rgx.object_number_off_block)) {
- pith["no_ocn_multiple_objects"] = eN.bi.on;
- pith["ocn"] = eN.ocn.off;
- debug(ocnoff) {
- writeln(line);
- }
- }
- if (line.matchFirst(rgx.object_number_off_block_dummy_heading)) {
- pith["no_ocn_multiple_objects"] = eN.bi.on;
- pith["dummy_heading_multiple_objects"] = eN.bi.on;
- pith["ocn"] = eN.ocn.off;
- debug(ocnoff) {
- writeln(line);
- }
- }
- } else if (pith["no_ocn_multiple_objects"] == eN.bi.off) {
- pith["dummy_heading_status"] = eN.bi.off;
- if (pith["dummy_heading_multiple_objects"]) {
- pith["dummy_heading_status"] = eN.bi.on;
- }
- if (line.matchFirst(rgx.object_number_off)) {
- pith["ocn"] = eN.ocn.off;
- } else if (line.matchFirst(rgx.object_number_off_dummy_heading)) {
- pith["ocn"] = eN.ocn.off;
- pith["dummy_heading_status"] = eN.bi.on;
- } else {
- pith["ocn"] = eN.ocn.on;
- pith["dummy_heading_status"] = eN.bi.off;
- }
- } else {
- pith["ocn"] = pith["no_ocn_multiple_objects"];
- }
- } else if (pith["no_ocn_multiple_objects"] == eN.bi.on) {
- if (line.matchFirst(rgx.object_number_off_block_close)) {
- pith["no_ocn_multiple_objects"] = eN.bi.off;
- pith["ocn"] = eN.ocn.on;
- pith["dummy_heading_status"] = eN.bi.off;
- debug(ocnoff) {
- writeln(line);
- }
- }
- }
- }
- return pith;
- }
- @safe char[] _doc_header_and_make_substitutions_(CMM)(
- char[] line,
- CMM conf_make_meta,
- ) {
- enum Substitute { match, markup, }
- if (conf_make_meta.make.substitute) {
- foreach(substitution_pair; conf_make_meta.make.substitute) {
- line = line.replaceAll(
- regex("\b" ~ substitution_pair[Substitute.match]),
- substitution_pair[Substitute.markup]
- );
- }
- }
- return line;
- }
- @safe char[] _doc_header_and_make_substitutions_fontface_(CMM)(
- char[] line,
- CMM conf_make_meta,
- ) {
- enum Substitute { match, markup, }
- if ( conf_make_meta.make.bold) {
- line = line.replaceAll(
- regex("\b" ~ conf_make_meta.make.bold[Substitute.match]),
- conf_make_meta.make.bold[Substitute.markup]
- );
- }
- if (conf_make_meta.make.emphasis) {
- line = line.replaceAll(
- regex("\b" ~ conf_make_meta.make.emphasis[Substitute.match]),
- conf_make_meta.make.emphasis[Substitute.markup]
- );
- }
- if (conf_make_meta.make.italics) {
- line = line.replaceAll(
- regex("\b" ~ conf_make_meta.make.italics[Substitute.match]),
- conf_make_meta.make.italics[Substitute.markup]
- );
- }
- return line;
- }
- @safe void flow_txt_block_start()(
- char[] line,
- return ref uint[string] pith,
- return ref uint[string] dochas,
- return ref string[string] object_number_poem
+ @safe auto txt_by_line_block_start()(
+ char[] line,
+ uint[string] pith,
+ uint[string] dochas,
+ string[string] object_number_poem
) {
static auto rgx = RgxI();
if (auto m = line.matchFirst(rgx.block_curly_code_open)) {
@@ -2868,11 +2962,23 @@ template docAbstraction() {
pith["block_state"] = eN.blk_state.on;
pith["block_delim"] = eN.blk_delim.tic;
}
+ struct retStruct {
+ uint[string] pith;
+ uint[string] dochas;
+ string[string] object_number_poem;
+ }
+ retStruct ret;
+ {
+ ret.pith = pith;
+ ret.dochas = dochas;
+ ret.object_number_poem = object_number_poem;
+ }
+ return ret;
}
- @safe string[string] flow_txt_block_quote()(
- char[] line,
- string[string] an_object,
- return ref uint[string] pith,
+ @safe auto txt_by_line_block_quote()(
+ char[] line,
+ string[string] an_object,
+ uint[string] pith,
) {
static auto rgx = RgxI();
if (pith["block_is"] == eN.blk_is.quote){
@@ -2908,12 +3014,21 @@ template docAbstraction() {
}
}
}
- return an_object;
+ struct retStruct {
+ uint[string] pith;
+ string[string] this_object;
+ }
+ retStruct ret;
+ {
+ ret.pith = pith;
+ ret.this_object = an_object;
+ }
+ return ret;
}
- @safe string[string] flow_txt_block_group()(
- char[] line,
- string[string] an_object,
- return ref uint[string] pith,
+ @safe auto txt_by_line_block_group()(
+ char[] line,
+ string[string] an_object,
+ uint[string] pith,
) {
static auto rgx = RgxI();
if (pith["block_is"] == eN.blk_is.group) {
@@ -2949,12 +3064,21 @@ template docAbstraction() {
}
}
}
- return an_object;
+ struct retStruct {
+ uint[string] pith;
+ string[string] this_object;
+ }
+ retStruct ret;
+ {
+ ret.pith = pith;
+ ret.this_object = an_object;
+ }
+ return ret;
}
- @safe string[string] flow_txt_block_block()(
- char[] line,
- string[string] an_object,
- return ref uint[string] pith,
+ @safe auto txt_by_line_block_block()(
+ char[] line,
+ string[string] an_object,
+ uint[string] pith,
) {
static auto rgx = RgxI();
if (pith["block_is"] == eN.blk_is.block) {
@@ -2990,16 +3114,25 @@ template docAbstraction() {
}
}
}
- return an_object;
+ struct retStruct {
+ uint[string] pith;
+ string[string] this_object;
+ }
+ retStruct ret;
+ {
+ ret.pith = pith;
+ ret.this_object = an_object;
+ }
+ return ret;
}
- @safe string[string] flow_txt_block_poem(CMM)(
- char[] line,
- string[string] an_object,
- return ref uint[string] pith,
- return ref int cntr,
- string[string] object_number_poem,
- CMM conf_make_meta,
- string[string] tag_in_seg,
+ @safe auto txt_by_line_block_poem(CMM)(
+ char[] line,
+ string[string] an_object,
+ uint[string] pith,
+ int cntr,
+ string[string] object_number_poem,
+ CMM conf_make_meta,
+ string[string] tag_in_seg,
) {
static auto rgx = RgxI();
if (pith["block_is"] == eN.blk_is.poem) {
@@ -3234,12 +3367,23 @@ template docAbstraction() {
}
}
}
- return an_object;
+ struct retStruct {
+ int cntr;
+ uint[string] pith;
+ string[string] this_object;
+ }
+ retStruct ret;
+ {
+ ret.cntr = cntr;
+ ret.pith = pith;
+ ret.this_object = an_object;
+ }
+ return ret;
}
- @safe void flow_txt_block_code()(
- char[] line,
- return ref string[string] an_object,
- return ref uint[string] pith,
+ @safe auto txt_by_line_block_code()(
+ char[] line,
+ string[string] an_object,
+ uint[string] pith,
) {
static auto rgx = RgxI();
if ( pith["block_is"] == eN.blk_is.code) {
@@ -3279,12 +3423,22 @@ template docAbstraction() {
}
}
}
+ struct retStruct {
+ uint[string] pith;
+ string[string] this_object;
+ }
+ retStruct ret;
+ {
+ ret.pith = pith;
+ ret.this_object = an_object;
+ }
+ return ret;
}
- @system string[string] flow_txt_block_table(CMM)(
- char[] line,
- string[string] an_object,
- return ref uint[string] pith,
- return ref CMM conf_make_meta,
+ @system auto txt_by_line_block_table(CMM)(
+ char[] line,
+ string[string] an_object,
+ uint[string] pith,
+ CMM conf_make_meta,
) {
static auto rgx = RgxI();
if (pith["block_is"] == eN.blk_is.table) {
@@ -3307,15 +3461,25 @@ template docAbstraction() {
pith["block_is"] = eN.blk_is.table;
pith["block_state"] = eN.blk_state.off;
pith["block_delim"] = eN.blk_delim.off;
- line.flow_table_closed_make_special_notation_table_(
- an_object,
- the_document_body_section,
- obj_cite_digits,
- comp_obj_heading,
- cntr,
- pith,
- conf_make_meta,
- );
+ {
+ auto _get = line.flow_table_closed_make_special_notation_table_(
+ an_object,
+ the_document_body_section,
+ obj_cite_digits,
+ comp_obj_heading,
+ cntr,
+ pith,
+ conf_make_meta,
+ );
+ {
+ an_object = _get.this_object;
+ the_document_body_section = _get.the_document_body_section;
+ obj_cite_digits = _get.obj_cite_digits;
+ comp_obj_heading = _get._comp_obj_heading;
+ cntr = _get.cntr;
+ pith = _get.pith;
+ }
+ }
} else {
debug(table) {
writeln(line);
@@ -3338,37 +3502,48 @@ template docAbstraction() {
}
}
}
- return an_object;
- }
- @safe final string biblio_tag_map()(string abr) {
- auto btm = [
- "au" : "author_raw",
- "ed" : "editor_raw",
- "ti" : "fulltitle",
- "lng" : "language",
- "jo" : "journal",
- "vol" : "volume",
- "edn" : "edition",
- "yr" : "year",
- "pl" : "place",
- "pb" : "publisher",
- "pub" : "publisher",
- "pg" : "pages",
- "pgs" : "pages",
- "sn" : "short_name"
- ];
- return btm[abr];
+ struct retStruct {
+ CMM conf_make_meta;
+ uint[string] pith;
+ string[string] this_object;
+ }
+ retStruct ret;
+ {
+ ret.conf_make_meta = conf_make_meta,
+ ret.pith = pith;
+ ret.this_object = an_object;
+ }
+ return ret;
}
- @system void flow_txt_block_biblio(
+ @system auto txt_by_line_block_biblio(
char[] line,
- return ref uint[string] pith,
- return ref int bib_entry,
- return ref string biblio_entry_str_json,
- return ref string[] biblio_arr_json,
+ uint[string] pith,
+ int bib_entry,
+ string biblio_entry_str_json,
+ string[] biblio_arr_json,
) {
mixin spineBiblio;
auto jsn = BibJsnStr();
static auto rgx = RgxI();
+ string biblio_tag_map()(string abr) {
+ auto btm = [
+ "au" : "author_raw",
+ "ed" : "editor_raw",
+ "ti" : "fulltitle",
+ "lng" : "language",
+ "jo" : "journal",
+ "vol" : "volume",
+ "edn" : "edition",
+ "yr" : "year",
+ "pl" : "place",
+ "pb" : "publisher",
+ "pub" : "publisher",
+ "pg" : "pages",
+ "pgs" : "pages",
+ "sn" : "short_name"
+ ];
+ return btm[abr];
+ }
if (line.matchFirst(rgx.heading_biblio)) {
pith["section"] = eN.sect.bibliography;
}
@@ -3478,21 +3653,137 @@ template docAbstraction() {
}
header_tag_value = "";
}
+ struct retStruct {
+ uint[string] pith;
+ int bib_entry;
+ string biblio_entry_str_json;
+ string[] biblio_arr_json;
+ }
+ retStruct ret;
+ {
+ ret.pith = pith;
+ ret.bib_entry = bib_entry;
+ ret.biblio_entry_str_json = biblio_entry_str_json;
+ ret.biblio_arr_json = biblio_arr_json;
+ }
+ return ret;
}
- @system void flow_table_closed_make_special_notation_table_(N,CMM)(
- char[] line,
- return ref string[string] an_object,
- return ref ObjGenericComposite[] the_document_body_section,
- return ref N obj_cite_digits,
- return ref ObjGenericComposite _comp_obj_heading,
- return ref int cntr,
- return ref uint[string] pith,
- CMM conf_make_meta
+ /+ ↓ abstraction functions +/
+ @safe static string[string] object_reset()(string[string] an_object) {
+ an_object.remove("body_nugget");
+ an_object.remove("substantive");
+ an_object.remove("is");
+ an_object.remove("attrib");
+ an_object.remove("bookindex_nugget");
+ return an_object;
+ }
+ @safe static uint[string] _check_ocn_status_()(
+ char[] line,
+ uint[string] pith,
+ ) {
+ static auto rgx = RgxI();
+ if (!(line.empty)) {
+ if (pith["no_ocn_multiple_objects"] == eN.bi.off) {
+ /+ not multi-line object, check whether object_number is on or turned off +/
+ if (line.matchFirst(rgx.object_number_block_marks)) { /+ switch off object_number +/
+ if (line.matchFirst(rgx.object_number_off_block)) {
+ pith["no_ocn_multiple_objects"] = eN.bi.on;
+ pith["ocn"] = eN.ocn.off;
+ debug(ocnoff) {
+ writeln(line);
+ }
+ }
+ if (line.matchFirst(rgx.object_number_off_block_dummy_heading)) {
+ pith["no_ocn_multiple_objects"] = eN.bi.on;
+ pith["dummy_heading_multiple_objects"] = eN.bi.on;
+ pith["ocn"] = eN.ocn.off;
+ debug(ocnoff) {
+ writeln(line);
+ }
+ }
+ } else if (pith["no_ocn_multiple_objects"] == eN.bi.off) {
+ pith["dummy_heading_status"] = eN.bi.off;
+ if (pith["dummy_heading_multiple_objects"]) {
+ pith["dummy_heading_status"] = eN.bi.on;
+ }
+ if (line.matchFirst(rgx.object_number_off)) {
+ pith["ocn"] = eN.ocn.off;
+ } else if (line.matchFirst(rgx.object_number_off_dummy_heading)) {
+ pith["ocn"] = eN.ocn.off;
+ pith["dummy_heading_status"] = eN.bi.on;
+ } else {
+ pith["ocn"] = eN.ocn.on;
+ pith["dummy_heading_status"] = eN.bi.off;
+ }
+ } else {
+ pith["ocn"] = pith["no_ocn_multiple_objects"];
+ }
+ } else if (pith["no_ocn_multiple_objects"] == eN.bi.on) {
+ if (line.matchFirst(rgx.object_number_off_block_close)) {
+ pith["no_ocn_multiple_objects"] = eN.bi.off;
+ pith["ocn"] = eN.ocn.on;
+ pith["dummy_heading_status"] = eN.bi.off;
+ debug(ocnoff) {
+ writeln(line);
+ }
+ }
+ }
+ }
+ return pith;
+ }
+ @safe char[] _doc_header_and_make_substitutions_(CMM)(
+ char[] line,
+ CMM conf_make_meta,
+ ) {
+ enum Substitute { match, markup, }
+ if (conf_make_meta.make.substitute) {
+ foreach(substitution_pair; conf_make_meta.make.substitute) {
+ line = line.replaceAll(
+ regex("\b" ~ substitution_pair[Substitute.match]),
+ substitution_pair[Substitute.markup]
+ );
+ }
+ }
+ return line;
+ }
+ @safe char[] _doc_header_and_make_substitutions_fontface_(CMM)(
+ char[] line,
+ CMM conf_make_meta,
+ ) {
+ enum Substitute { match, markup, }
+ if ( conf_make_meta.make.bold) {
+ line = line.replaceAll(
+ regex("\b" ~ conf_make_meta.make.bold[Substitute.match]),
+ conf_make_meta.make.bold[Substitute.markup]
+ );
+ }
+ if (conf_make_meta.make.emphasis) {
+ line = line.replaceAll(
+ regex("\b" ~ conf_make_meta.make.emphasis[Substitute.match]),
+ conf_make_meta.make.emphasis[Substitute.markup]
+ );
+ }
+ if (conf_make_meta.make.italics) {
+ line = line.replaceAll(
+ regex("\b" ~ conf_make_meta.make.italics[Substitute.match]),
+ conf_make_meta.make.italics[Substitute.markup]
+ );
+ }
+ return line;
+ }
+ @system auto flow_table_closed_make_special_notation_table_(CMM)(
+ char[] line,
+ string[string] an_object,
+ ObjGenericComposite[] the_document_body_section,
+ OCNset obj_cite_digits,
+ ObjGenericComposite _comp_obj_heading,
+ int cntr,
+ uint[string] pith,
+ CMM conf_make_meta
) {
comp_obj_block = comp_obj_block.init;
obj_cite_digits = ocn_emit(pith["ocn"]);
- auto comp_obj_location
- = node_construct.node_location_emitter(
+ auto comp_obj_location = node_construct.node_location_emitter(
content_non_header,
tag_in_seg,
lev_anchor_tag,
@@ -3514,25 +3805,49 @@ template docAbstraction() {
comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx;
comp_obj_block.metainfo.object_number_type = obj_cite_digits.type;
comp_obj_block = comp_obj_block.flow_table_instructions(an_object["table_head"]);
- comp_obj_block = comp_obj_block.flow_table_substantive_munge_special(an_object["substantive"]);
+ {
+ auto _get = comp_obj_block.flow_table_substantive_munge_special(an_object["substantive"]);
+ {
+ comp_obj_block = _get.table_object;
+ an_object["substantive"] = _get.table_substantive;
+ }
+ }
the_document_body_section ~= comp_obj_block;
object_reset(an_object);
processing.remove("verse");
++cntr;
+ struct retStruct {
+ string[string] this_object;
+ ObjGenericComposite[] the_document_body_section;
+ OCNset obj_cite_digits;
+ ObjGenericComposite _comp_obj_heading;
+ int cntr;
+ uint[string] pith;
+ }
+ retStruct ret;
+ {
+ ret.this_object = an_object;
+ ret.the_document_body_section = the_document_body_section;
+ ret.obj_cite_digits = obj_cite_digits;
+ ret._comp_obj_heading = _comp_obj_heading;
+ ret.cntr = cntr;
+ ret.pith = pith;
+ }
+ return ret;
}
- @system string[string] flow_block_flag_line_empty_(B,N,CMM,Ts)(
- char[] line,
- string[string] an_object,
- B bookindex_extract_hash,
- return ref ObjGenericComposite[] the_document_body_section,
- return ref string[][string][string] bookindex_unordered_hashes,
- return ref N obj_cite_digits,
- return ref ObjGenericComposite _comp_obj_heading,
- return ref int cntr,
- return ref uint[string] pith,
- string[string] object_number_poem,
- CMM conf_make_meta,
- Ts tag_in_seg,
+ @system auto flow_block_flag_line_empty_(B,CMM,Ts)(
+ char[] line,
+ string[string] an_object,
+ B bookindex_extract_hash,
+ ObjGenericComposite[] the_document_body_section,
+ string[][string][string] bookindex_unordered_hashes,
+ OCNset obj_cite_digits,
+ ObjGenericComposite _comp_obj_heading,
+ int cntr,
+ uint[string] pith,
+ string[string] object_number_poem,
+ CMM conf_make_meta,
+ Ts tag_in_seg,
) {
assert(
line.empty,
@@ -3825,7 +4140,13 @@ template docAbstraction() {
comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx;
comp_obj_block.metainfo.object_number_type = obj_cite_digits.type;
comp_obj_block = comp_obj_block.flow_table_instructions(an_object["table_head"]);
- comp_obj_block = comp_obj_block.flow_table_substantive_munge(an_object["substantive"]);
+ {
+ auto _get = comp_obj_block.flow_table_substantive_munge(an_object["substantive"]);
+ {
+ comp_obj_block = _get.table_object;
+ an_object["substantive"] = _get.table_substantive;
+ }
+ }
the_document_body_section ~= comp_obj_block;
pith["block_is"] = eN.blk_is.table;
pith["block_state"] = eN.blk_state.off;
@@ -3835,14 +4156,33 @@ template docAbstraction() {
++cntr;
}
}
- return an_object;
+ struct retStruct {
+ string[string] this_object;
+ ObjGenericComposite[] the_document_body_section;
+ string[][string][string] bookindex_unordered_hashes;
+ OCNset obj_cite_digits;
+ ObjGenericComposite comp_obj_heading;
+ int cntr;
+ uint[string] pith;
+ }
+ retStruct ret;
+ {
+ ret.this_object = an_object;
+ ret.the_document_body_section = the_document_body_section;
+ ret.bookindex_unordered_hashes = bookindex_unordered_hashes;
+ ret.obj_cite_digits = obj_cite_digits;
+ ret.comp_obj_heading = _comp_obj_heading; //
+ ret.cntr = cntr;
+ ret.pith = pith;
+ }
+ return ret;
}
- @system string[string] flow_book_index_(B)(
- char[] line,
- string[string] an_object,
- return ref string book_idx_tmp,
- return ref uint[string] pith,
- B opt_action,
+ @system auto flow_book_index_(B)(
+ char[] line,
+ string[string] an_object,
+ string book_idx_tmp,
+ uint[string] pith,
+ B opt_action,
) {
static auto rgx = RgxI();
if (auto m = line.match(rgx.book_index_item)) { /+ match book_index +/
@@ -3885,14 +4225,25 @@ template docAbstraction() {
}
}
}
- return an_object;
+ struct retStruct {
+ string[string] this_object;
+ uint[string] pith;
+ string book_idx_tmp;
+ }
+ retStruct ret;
+ {
+ ret.this_object = an_object;
+ ret.pith = pith;
+ ret.book_idx_tmp = book_idx_tmp;
+ }
+ return ret;
}
- @safe string[string] flow_heading_found_()(
- char[] line,
- string[string] heading_match_str,
- string[] _make_unmarked_headings,
- return ref Regex!(char)[string] heading_match_rgx,
- return ref uint[string] pith,
+ @safe auto flow_heading_found_()(
+ char[] line,
+ string[string] heading_match_str,
+ string[] _make_unmarked_headings,
+ Regex!(char)[string] heading_match_rgx,
+ uint[string] pith,
) {
static auto rgx = RgxI();
if ((_make_unmarked_headings.length > 2)
@@ -3966,9 +4317,20 @@ template docAbstraction() {
}
pith["make_headings"] = eN.bi.on;
}
- return heading_match_str;
+ struct retStruct {
+ string[string] heading_match_str;
+ Regex!(char)[string] heading_match_rgx;
+ uint[string] pith;
+ }
+ retStruct ret;
+ {
+ ret.heading_match_str = heading_match_str;
+ ret.heading_match_rgx = heading_match_rgx;
+ ret.pith = pith;
+ }
+ return ret;
}
- @safe char[] flow_heading_make_set_()(
+ @safe auto flow_heading_make_set_()(
char[] line,
int[string] line_occur,
return ref Regex!(char)[string] heading_match_rgx,
@@ -4022,17 +4384,28 @@ template docAbstraction() {
}
}
}
- return line;
+ struct retStruct {
+ char[] line;
+ uint[string] pith;
+ string[string] this_object;
+ }
+ retStruct ret;
+ {
+ ret.line = line;
+ ret.pith = pith;
+ ret.this_object = an_object;
+ }
+ return ret;
}
- @safe string[string] flow_heading_matched_(CMM)(
- char[] line,
- string[string] an_object,
- return ref int[string] line_occur,
- return ref string an_object_key,
- return ref int[string] lv,
- return ref int[string] collapsed_lev,
- return ref uint[string] pith,
- return ref CMM conf_make_meta,
+ @safe auto flow_heading_matched_(CMM)(
+ char[] line,
+ string[string] an_object,
+ int[string] line_occur,
+ string an_object_key,
+ int[string] lv,
+ int[string] collapsed_lev,
+ uint[string] pith,
+ CMM conf_make_meta,
) {
static auto rgx = RgxI();
static auto mkup = InlineMarkup();
@@ -4194,16 +4567,35 @@ template docAbstraction() {
writeln(line.strip);
}
}
- return an_object;
+ struct retStruct {
+ string[string] this_object;
+ int[string] line_occur;
+ string an_object_key;
+ int[string] lv;
+ int[string] collapsed_lev;
+ uint[string] pith;
+ CMM conf_make_meta;
+ }
+ retStruct ret;
+ {
+ ret.this_object = an_object;
+ ret.line_occur = line_occur;
+ ret.an_object_key = an_object_key;
+ ret.lv = lv;
+ ret.collapsed_lev = collapsed_lev;
+ ret.pith = pith;
+ ret.conf_make_meta = conf_make_meta;
+ }
+ return ret;
}
- @safe string[string] flow_para_match_()(
- char[] line,
- string[string] an_object,
- return ref string an_object_key,
- return ref int[string] indent,
- return ref bool bullet,
- return ref uint[string] pith,
- return ref int[string] line_occur,
+ @safe auto flow_para_match_()(
+ char[] line,
+ string[string] an_object,
+ string an_object_key,
+ int[string] indent,
+ bool bullet,
+ uint[string] pith,
+ int[string] line_occur,
) {
static auto rgx = RgxI();
if (line_occur["para"] == eN.bi.off) {
@@ -4247,7 +4639,24 @@ template docAbstraction() {
}
++line_occur["para"];
}
- return an_object;
+ struct retStruct {
+ uint[string] pith;
+ string[string] this_object;
+ string this_object_key;
+ int[string] indent;
+ bool bullet;
+ int[string] line_occur;
+ }
+ retStruct ret;
+ {
+ ret.pith = pith;
+ ret.this_object = an_object;
+ ret.this_object_key = an_object_key;
+ ret.indent = indent;
+ ret.bullet = bullet;
+ ret.line_occur = line_occur;
+ }
+ return ret;
}
@safe char[] font_faces_line()(
char[] textline,
@@ -4272,8 +4681,8 @@ template docAbstraction() {
return textline;
}
@safe ObjGenericComposite flow_table_instructions(H)(
- return ref ObjGenericComposite table_object,
- H table_head,
+ ObjGenericComposite table_object,
+ H table_head,
) {
static auto rgx = RgxI();
table_object.metainfo.is_of_part = "body";
@@ -4296,9 +4705,9 @@ template docAbstraction() {
}
return table_object;
}
- @safe ObjGenericComposite flow_table_array_munge(T)(
- return ref ObjGenericComposite table_object,
- return ref T table_array,
+ @safe auto flow_table_array_munge()(
+ ObjGenericComposite table_object,
+ string[][] table_array,
) {
static auto rgx = RgxI();
static auto mng = InlineMarkup();
@@ -4333,26 +4742,24 @@ template docAbstraction() {
}
col_num_ = idx_c;
_table_substantive ~= col ~ mng.tc_s;
- if (idx_r == 0 && comp_obj_block.table.heading) {
+ if (idx_r == 0 && table_object.table.heading) {
} else if (col.match(rgx.numeric_col) && idx_r == 1) { // conditions reversed to avoid: gdc compiled program run segfault
- if ((comp_obj_block.table.column_aligns.length > idx_c)
- && (comp_obj_block.table.column_aligns[idx_c].matchFirst(rgx.table_col_align_match))) {
- comp_obj_block.table.column_aligns[idx_c]
- = comp_obj_block.table.column_aligns[idx_c];
- } else if (comp_obj_block.table.column_aligns.length > idx_c) {
- comp_obj_block.table.column_aligns[idx_c] = "r";
+ if ((table_object.table.column_aligns.length > idx_c)
+ && (table_object.table.column_aligns[idx_c].matchFirst(rgx.table_col_align_match))) {
+ table_object.table.column_aligns[idx_c] = table_object.table.column_aligns[idx_c];
+ } else if (table_object.table.column_aligns.length > idx_c) {
+ table_object.table.column_aligns[idx_c] = "r";
} else {
- comp_obj_block.table.column_aligns ~= "r";
+ table_object.table.column_aligns ~= "r";
}
} else if (idx_r == 1) {
- if ((comp_obj_block.table.column_aligns.length > idx_c)
- && (comp_obj_block.table.column_aligns[idx_c].matchFirst(rgx.table_col_align_match))) {
- comp_obj_block.table.column_aligns[idx_c]
- = comp_obj_block.table.column_aligns[idx_c];
- } else if (comp_obj_block.table.column_aligns.length > idx_c) {
- comp_obj_block.table.column_aligns[idx_c] = "l";
+ if ((table_object.table.column_aligns.length > idx_c)
+ && (table_object.table.column_aligns[idx_c].matchFirst(rgx.table_col_align_match))) {
+ table_object.table.column_aligns[idx_c] = table_object.table.column_aligns[idx_c];
+ } else if (table_object.table.column_aligns.length > idx_c) {
+ table_object.table.column_aligns[idx_c] = "l";
} else {
- comp_obj_block.table.column_aligns ~= "l";
+ table_object.table.column_aligns ~= "l";
}
}
}
@@ -4366,12 +4773,12 @@ template docAbstraction() {
}
_table_substantive = _table_substantive.replaceFirst(rgx.table_col_separator_nl, "\n");
}
- if (comp_obj_block.table.number_of_columns != col_num) {
- if (comp_obj_block.table.number_of_columns == 0) {
- comp_obj_block.table.number_of_columns = (col_num).to!int;
+ if (table_object.table.number_of_columns != col_num) {
+ if (table_object.table.number_of_columns == 0) {
+ table_object.table.number_of_columns = (col_num).to!int;
} else {
debug(table_dev) {
- writeln(comp_obj_block.table.number_of_columns, " != ", col_num);
+ writeln(table_object.table.number_of_columns, " != ", col_num);
}
}
}
@@ -4411,46 +4818,85 @@ template docAbstraction() {
writeln(_table_substantive);
}
debug(table_res) {
- writeln("aligns: ", comp_obj_block.table.column_aligns, "\n",
- "no. of columns: ", comp_obj_block.table.number_of_columns, "\n",
- "col widths: ", comp_obj_block.table.column_widths,
- " sum: ", comp_obj_block.table.column_widths.sum, "\n",
+ writeln("aligns: ", table_object.table.column_aligns, "\n",
+ "no. of columns: ", table_object.table.number_of_columns, "\n",
+ "col widths: ", table_object.table.column_widths,
+ " sum: ", table_object.table.column_widths.sum, "\n",
_table_substantive);
}
- comp_obj_block.text = _table_substantive;
- return table_object;
+ table_object.text = _table_substantive;
+ struct retStruct {
+ ObjGenericComposite table_object;
+ string[][] table_array;
+ }
+ retStruct ret;
+ {
+ ret.table_object = table_object;
+ ret.table_array = table_array;
+ }
+ return ret;
}
- @system ObjGenericComposite flow_table_substantive_munge(T)(
- return ref ObjGenericComposite table_object,
- return ref T table_substantive,
+ @system auto flow_table_substantive_munge()(
+ ObjGenericComposite table_object,
+ string table_substantive,
) {
static auto rgx = RgxI();
static auto munge = ObjInlineMarkupMunge();
string[] _table_rows = (table_substantive).split(rgx.table_row_delimiter);
string[] _table_cols;
- string[][] _table;
+ string[][] _table_array;
foreach(col; _table_rows) {
_table_cols = col.split(rgx.table_col_delimiter);
- _table ~= _table_cols;
+ _table_array ~= _table_cols;
}
- table_object = table_object.flow_table_array_munge(_table);
- return table_object;
+ {
+ auto _get = table_object.flow_table_array_munge(_table_array);
+ {
+ table_object = _get.table_object;
+ _table_array = _get.table_array; // what do you do with this? how is this passed down?
+ }
+ }
+ struct retStruct {
+ ObjGenericComposite table_object;
+ string table_substantive;
+ }
+ retStruct ret;
+ {
+ ret.table_object = table_object;
+ ret.table_substantive = table_substantive; // has anything been changed here?
+ }
+ return ret;
}
- @system ObjGenericComposite flow_table_substantive_munge_special(T)(
- return ref ObjGenericComposite table_object,
- return ref T table_substantive,
+ @system auto flow_table_substantive_munge_special()(
+ ObjGenericComposite table_object,
+ string table_substantive,
) {
static auto rgx = RgxI();
static auto munge = ObjInlineMarkupMunge();
string[] _table_rows = (table_substantive).split(rgx.table_row_delimiter_special);
string[] _table_cols;
- string[][] _table;
+ string[][] _table_array;
foreach(col; _table_rows) {
_table_cols = col.split(rgx.table_col_delimiter_special);
- _table ~= _table_cols;
+ _table_array ~= _table_cols;
}
- table_object = table_object.flow_table_array_munge(_table);
- return table_object;
+ {
+ auto _get = table_object.flow_table_array_munge(_table_array);
+ {
+ table_object = _get.table_object;
+ _table_array = _get.table_array;
+ }
+ }
+ struct retStruct {
+ ObjGenericComposite table_object;
+ string table_substantive;
+ }
+ retStruct ret;
+ {
+ ret.table_object = table_object;
+ ret.table_substantive = table_substantive;
+ }
+ return ret;
}
/+ abstraction functions ↑ +/
/+ ↓ abstraction function emitters +/
@@ -4865,13 +5311,13 @@ template docAbstraction() {
heading_toc_ = (m.post).replaceAll(rgx.inline_notes_curly_gen, "");
return heading_toc_;
};
- @safe ObjGenericComposite[] flow_table_of_contents_gather_headings(CMM)(
- string[string] obj_,
- CMM conf_make_meta,
- string[string] tag_in_seg,
- string _anchor_tag,
- return ref string[][string] lev4_subtoc,
- ObjGenericComposite[] the_document_toc_section,
+ @safe auto flow_table_of_contents_gather_headings(CMM)( //
+ string[string] obj_,
+ CMM conf_make_meta,
+ string[string] tag_in_seg,
+ string _anchor_tag,
+ string[][string] lev4_subtoc,
+ ObjGenericComposite[] the_document_toc_section,
) {
ObjGenericComposite comp_obj_toc;
mixin InternalMarkup;
@@ -4948,7 +5394,16 @@ template docAbstraction() {
default:
break;
}
- return the_document_toc_section;
+ struct retStruct {
+ ObjGenericComposite[] the_document_toc_section;
+ string[][string] lev4_subtoc;
+ }
+ retStruct ret;
+ {
+ ret.the_document_toc_section = the_document_toc_section;
+ ret.lev4_subtoc = lev4_subtoc;
+ }
+ return ret;
}
invariant() {
}
@@ -5326,9 +5781,9 @@ template docAbstraction() {
string[] object_numbers;
string[][string][string] bi_hash_nugget;
string[] bi_main_terms_split_arr;
- @safe string[][string][string] bookindex_nugget_hash(N,S)(
+ @safe string[][string][string] bookindex_nugget_hash(S)(
string bookindex_section,
- N obj_cite_digits,
+ OCNset obj_cite_digits,
S tag_in_seg,
) {
debug(asserts) {
@@ -5453,9 +5908,9 @@ template docAbstraction() {
++mkn;
}
}
- @system auto bookindex_build_abstraction_section(N,B)(
+ @system auto bookindex_build_abstraction_section(B)(
string[][string][string] bookindex_unordered_hashes,
- N obj_cite_digits,
+ OCNset obj_cite_digits,
B opt_action,
) {
debug(asserts) {
@@ -5708,8 +6163,8 @@ template docAbstraction() {
}
return endnotes_;
}
- @safe private auto endnote_objects(N,O)(
- N obj_cite_digits,
+ @safe private auto endnote_objects(O)(
+ OCNset obj_cite_digits,
O opt_action,
) {
mixin spineNode;
@@ -5821,9 +6276,9 @@ template docAbstraction() {
}
/+ +/
struct Bibliography {
- @system public JSONValue[] flow_bibliography_()(
- return ref string[] biblio_unsorted_incomplete,
- return ref JSONValue[] bib_arr_json
+ @system public auto flow_bibliography_()(
+ string[] biblio_unsorted_incomplete,
+ JSONValue[] bib_arr_json
) {
JSONValue[] biblio_unsorted
= biblio_make_unsorted_array_of_json_objects(biblio_unsorted_incomplete, bib_arr_json); // TODO lookat returns
@@ -5844,7 +6299,18 @@ template docAbstraction() {
cntr++;
}
}
- return biblio_sorted__;
+ struct retStruct {
+ JSONValue[] biblio_sorted;
+ JSONValue[] bib_arr_json;
+ string[] biblio_unsorted_incomplete;
+ }
+ retStruct ret;
+ {
+ ret.biblio_sorted = biblio_sorted__;
+ ret.bib_arr_json = bib_arr_json;
+ ret.biblio_unsorted_incomplete = biblio_unsorted_incomplete;
+ }
+ return ret;
}
@system final private JSONValue[] biblio_make_unsorted_array_of_json_objects()(
string[] biblio_unordered,
@@ -5905,12 +6371,12 @@ template docAbstraction() {
int obj_cite_digit;
int[string] p_; // p_ parent_
static auto rgx = RgxI();
- @safe ObjGenericComposite node_location_emitter(La,Ta,N)(
+ @safe ObjGenericComposite node_location_emitter(La,Ta)(
string lev_markup_number,
string[string] tag_in_seg,
La lev_anchor_tag,
Ta tag_assoc,
- N obj_cite_digits,
+ OCNset obj_cite_digits,
int cntr_,
int ptr_,
string is_
@@ -5959,7 +6425,7 @@ template docAbstraction() {
}
invariant() {
}
- @safe ObjGenericComposite node_emitter_heading(Hd,TaL,TA,N,fNr,fNs,fL)(
+ @safe ObjGenericComposite node_emitter_heading(Hd,TaL,TA,fNr,fNs,fL)(
string _text,
string lev_markup_number,
string lev_collapsed_number,
@@ -5967,7 +6433,7 @@ template docAbstraction() {
string[string] tag_in_seg,
TaL lev_anchor_tag,
TA tag_assoc,
- N obj_cite_digits,
+ OCNset obj_cite_digits,
int cntr_,
int ptr_,
string[] lv_ancestors_txt,