From 762439ade3de42d2043fafc0005b255c6c58ba49 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 11 Dec 2016 11:17:06 -0500 Subject: 0.10.0 generic object (ObjGenericComposite), removed "object_set" --- src/sdp.d | 22 +- src/sdp/ao_abstract_doc_source.d | 1554 ++++++++++++++++---------------------- src/sdp/ao_object_setter.d | 219 +----- src/sdp/ao_output_debugs.d | 75 +- src/sdp/output_html.d | 32 +- 5 files changed, 753 insertions(+), 1149 deletions(-) (limited to 'src') diff --git a/src/sdp.d b/src/sdp.d index a900b55..ff9128f 100755 --- a/src/sdp.d +++ b/src/sdp.d @@ -117,6 +117,7 @@ void main(string[] args) { "section_bookindex" : true, "section_blurb" : true, "backmatter" : true, + "skip_output" : false, ]; auto helpInfo = getopt(args, std.getopt.config.passThrough, @@ -151,6 +152,7 @@ void main(string[] args) { "section-bookindex", "--section-bookindex process document bookindex (default)", &opt_action_bool["section_bookindex"], "section-blurb", "--section-blurb process document blurb (default)", &opt_action_bool["section_blurb"], "backmatter", "--section-backmatter process document backmatter (default)", &opt_action_bool["backmatter"], + "skip_output", "--skip-output", &opt_action_bool["skip_output"], ); if (helpInfo.helpWanted) { defaultGetoptPrinter("Some information about the program.", helpInfo.options); @@ -274,15 +276,17 @@ void main(string[] args) { ); } /+ ↓ output hub +/ - output.hub( - doc_ao_contents, - document_section_keys_sequenced, - doc_html_segnames, - dochead_make, - dochead_meta, - fn_src, - opt_action_bool - ); + if (!(opt_action_bool["skip_output"])) { + output.hub( + doc_ao_contents, + document_section_keys_sequenced, + doc_html_segnames, + dochead_make, + dochead_meta, + fn_src, + opt_action_bool + ); + } scope(exit) { debug(checkdoc) { writefln( diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d index b89c1e1..1580238 100644 --- a/src/sdp/ao_abstract_doc_source.d +++ b/src/sdp/ao_abstract_doc_source.d @@ -17,13 +17,12 @@ template SiSUdocAbstraction() { /+ ↓ abstraction struct init +/ /+ initialize +/ auto rgx = Rgx(); - ObjComposite[][string] the_table_of_contents_section; - ObjComposite[] the_document_head_section, the_document_body_section, the_bibliography_section, the_glossary_section, the_blurb_section; + ObjGenericComposite[][string] the_table_of_contents_section; + ObjGenericComposite[] the_document_head_section, the_document_body_section, the_bibliography_section, the_glossary_section, the_blurb_section; string[string] an_object, processing; string an_object_key; string[] anchor_tags; string segment_anchor_tag_that_object_belongs_to; - auto set_abstract_object = ObjectAbstractSet(); auto note_section = NotesSection(); /+ enum +/ enum State { off, on } @@ -72,13 +71,12 @@ template SiSUdocAbstraction() { auto bookindex_extract_hash = BookIndexNuggetHash(); string[][string][string] bkidx_hash( string bookindex_section, - int obj_cite_number + int obj_cite_number ) { return bookindex_extract_hash.bookindex_nugget_hash(bookindex_section, obj_cite_number); } /+ node +/ - string[string] _node_heading_str; - int[string] _node_heading_int; + ObjGenericComposite comp_obj_heading, comp_obj_location, comp_obj_block, comp_obj_code, comp_obj_poem_ocn, comp_obj_comment; auto node_construct = NodeStructureMetadata(); /+ ↓ abstract marked up document +/ auto abstract_doc_source( @@ -101,10 +99,9 @@ template SiSUdocAbstraction() { destroy(processing); destroy(biblio_arr_json); } - auto node_heading_int_ = node_metadata_heading_int; - auto node_heading_str_ = node_metadata_heading_str; auto node_para_int_ = node_metadata_para_int; auto node_para_str_ = node_metadata_para_str; + ObjGenericComposite comp_obj_heading_, comp_obj_para, comp_obj_toc; line_occur = [ "heading" : 0, "para" : 0, @@ -162,22 +159,20 @@ template SiSUdocAbstraction() { string toc_txt_; an_object["glossary_nugget"] = ""; an_object["blurb_nugget"] = ""; - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = "toc"; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "1"; - node_heading_int_["heading_lev_markup"] = 4; - node_heading_int_["heading_lev_collapsed"] = 2; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - auto toc_head = - set_abstract_object.contents_heading( - "Table of Contents", // nugget/object - node_heading_str_, - node_heading_int_, - ["toc"], // anchor tag - ); + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = "Table of Contents"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.segment_anchor_tag = "toc"; + comp_obj_heading_.marked_up_level = "1"; + comp_obj_heading_.heading_lev_markup = 4; + comp_obj_heading_.heading_lev_collapsed = 2; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + comp_obj_heading_.anchor_tags = ["toc"]; + auto toc_head = comp_obj_heading_; the_table_of_contents_section = [ "seg": [toc_head], "scroll": [toc_head], @@ -265,54 +260,47 @@ template SiSUdocAbstraction() { line_occur["para"] = State.off; an_object_key="glossary_nugget"; // if (matchFirst(line, rgx.heading_glossary)) { - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = ""; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "B"; - node_heading_int_["heading_lev_markup"] = 1; - node_heading_int_["heading_lev_collapsed"] = 1; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - the_glossary_section ~= - set_abstract_object.contents_heading( - "Glossary", // nugget/object - node_heading_str_, - node_heading_int_, - [""], // anchor tag - ); - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = "glossary"; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "1"; - node_heading_int_["heading_lev_markup"] = 4; - node_heading_int_["heading_lev_collapsed"] = 2; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - the_glossary_section ~= - set_abstract_object.contents_heading( - "Glossary", // nugget/object - node_heading_str_, - node_heading_int_, - ["glossary"], // anchor tag - ); + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = "Glossary"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.marked_up_level = "B"; + comp_obj_heading_.heading_lev_markup = 1; + comp_obj_heading_.heading_lev_collapsed = 1; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + the_glossary_section ~= comp_obj_heading_; + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = "Glossary"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.segment_anchor_tag = "glossary"; + comp_obj_heading_.marked_up_level = "1"; + comp_obj_heading_.heading_lev_markup = 4; + comp_obj_heading_.heading_lev_collapsed = 2; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + comp_obj_heading_.anchor_tags = ["glossary"]; + the_glossary_section ~= comp_obj_heading_; // } else if (matchFirst(line, rgx.heading)) { // _heading_matched_(line, line_occur, an_object, an_object_key, lv, collapsed_lev, type, dochead_meta_aa); // levels? } else { _para_match_(line, an_object, an_object_key, indent, bullet, type, line_occur); - node_para_str_["is"] = "para"; - node_para_str_["attrib"] = ""; - node_para_int_["ocn"] = 0; - node_para_int_["indent_hang"] = indent["hang_position"]; - node_para_int_["indent_base"] = indent["base_position"]; - node_para_int_["bullet"] = (bullet) ? 1 : 0; - the_glossary_section ~= - set_abstract_object.contents_para( - to!string(line), // an_object["substantive"], - node_para_str_, - node_para_int_, - ); + comp_obj_para = comp_obj_para.init; + comp_obj_para.use = "content"; + comp_obj_para.of = "para"; + comp_obj_para.is_a = "para"; + comp_obj_para.text = to!string(line).strip; + comp_obj_para.ocn = 0; + comp_obj_para.obj_cite_number = "0"; + comp_obj_para.indent_hang = indent["hang_position"]; + comp_obj_para.indent_base = indent["base_position"]; + comp_obj_para.bullet = bullet; + the_glossary_section ~= comp_obj_para; } type["ocn_status"] = TriState.off; } @@ -341,71 +329,60 @@ template SiSUdocAbstraction() { line_occur["para"] = State.off; an_object_key="blurb_nugget"; if (matchFirst(line, rgx.heading_blurb)) { - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = ""; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "B"; - node_heading_int_["heading_lev_markup"] = 1; - node_heading_int_["heading_lev_collapsed"] = 1; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - the_blurb_section ~= - set_abstract_object.contents_heading( - "Blurb", // nugget/object - node_heading_str_, - node_heading_int_, - [""], // anchor tag - ); - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = "blurb"; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "1"; - node_heading_int_["heading_lev_markup"] = 4; - node_heading_int_["heading_lev_collapsed"] = 2; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - the_blurb_section ~= - set_abstract_object.contents_heading( - "Blurb", // nugget/object - node_heading_str_, - node_heading_int_, - ["blurb"], // anchor tag - ); + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = "Blurb"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.marked_up_level = "B"; + comp_obj_heading_.heading_lev_markup = 1; + comp_obj_heading_.heading_lev_collapsed = 1; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + the_blurb_section ~= comp_obj_heading_; + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = "Blurb"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.segment_anchor_tag = "blurb"; + comp_obj_heading_.marked_up_level = "1"; + comp_obj_heading_.heading_lev_markup = 4; + comp_obj_heading_.heading_lev_collapsed = 2; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + comp_obj_heading_.anchor_tags = ["blurb"]; + the_blurb_section ~= comp_obj_heading_; } else if ((matchFirst(line, rgx.heading)) && (opt_action_bool["backmatter"] && opt_action_bool["section_blurb"])) { - _heading_matched_(line, line_occur, an_object, an_object_key, lv, collapsed_lev, type, dochead_meta_aa); // levels? - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = "blurb"; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = to!string(an_object["lev"]); - node_heading_int_["heading_lev_markup"] = to!int(an_object["lev_markup_number"]); // make int, remove need to conv - node_heading_int_["heading_lev_collapsed"] = to!int(an_object["lev_collapsed_number"]); // make int, remove need to conv - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - the_blurb_section ~= - set_abstract_object.contents_heading( - to!string(line), // an_object["substantive"], - node_heading_str_, - node_heading_int_, - [""], // anchor tag - ); + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = to!string(line); + comp_obj_heading_.ocn = 0; + comp_obj_heading_.segment_anchor_tag = "blurb"; + comp_obj_heading_.marked_up_level = to!string(an_object["lev"]); + comp_obj_heading_.heading_lev_markup = to!int(an_object["lev_markup_number"]); // make int, remove need to conv + comp_obj_heading_.heading_lev_collapsed = to!int(an_object["lev_collapsed_number"]); // make int, remove need to conv + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + the_blurb_section ~= comp_obj_heading_; } else { _para_match_(line, an_object, an_object_key, indent, bullet, type, line_occur); - node_para_str_["is"] = "para"; - node_para_str_["attrib"] = ""; - node_para_int_["ocn"] = obj_cite_number; - node_para_int_["indent_hang"] = indent["hang_position"]; - node_para_int_["indent_base"] = indent["base_position"]; - node_para_int_["bullet"] = (bullet) ? 1 : 0; - the_blurb_section ~= - set_abstract_object.contents_para( - to!string(line), // an_object["substantive"], - node_para_str_, - node_para_int_, - ); + comp_obj_para = comp_obj_para.init; + comp_obj_para.use = "content"; + comp_obj_para.of = "para"; + comp_obj_para.is_a = "para"; + comp_obj_para.text = to!string(line).strip; + comp_obj_para.ocn = obj_cite_number; + comp_obj_para.obj_cite_number = to!string(obj_cite_number); + comp_obj_para.indent_hang = indent["hang_position"]; + comp_obj_para.indent_base = indent["base_position"]; + comp_obj_para.bullet = bullet; + the_blurb_section ~= comp_obj_para; } type["ocn_status"] = TriState.off; } @@ -486,8 +463,12 @@ template SiSUdocAbstraction() { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; - the_document_body_section ~= - set_abstract_object.contents_comment(strip(an_object[an_object_key])); + comp_obj_comment = comp_obj_comment.init; + comp_obj_comment.use = "comment"; + comp_obj_comment.of = "comment"; + comp_obj_comment.is_a = "comment"; + comp_obj_comment.text = an_object[an_object_key].strip; + the_document_body_section ~= comp_obj_comment; _common_reset_(line_occur, an_object, type); processing.remove("verse"); ++cntr; @@ -548,13 +529,12 @@ template SiSUdocAbstraction() { the_document_body_section, bookindex_unordered_hashes, obj_cite_number, - _node_heading_str, - _node_heading_int, + comp_obj_heading, cntr, type, obj_cite_number_poem, dochead_make_aa - ); // watch + ); } else { /+ line.empty, post contents, empty variables: +/ assert( @@ -597,8 +577,9 @@ template SiSUdocAbstraction() { html_segnames_ptr = html_segnames_ptr_cntr; html_segnames_ptr_cntr++; } - auto _node_t = + auto comp_obj_heading = node_construct.node_emitter_heading( + an_object["substantive"], // string an_object["lev"], // string an_object["lev_markup_number"], // string an_object["lev_collapsed_number"], // string @@ -609,22 +590,12 @@ template SiSUdocAbstraction() { an_object["is"], // string html_segnames_ptr, // int ); - _node_heading_str = _node_t[0]; - _node_heading_int = _node_t[1]; - an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_heading_str, _node_heading_int); ++heading_ptr; debug(segments) { writeln(an_object["lev_markup_number"]); writeln(segment_anchor_tag_that_object_belongs_to); } - the_document_body_section ~= - set_abstract_object.contents_heading( - an_object["substantive"], - _node_heading_str, - _node_heading_int, - anchor_tags, - ); + the_document_body_section ~= comp_obj_heading; // track previous heading and make assertions debug(objectrelated1) { // check writeln(line); @@ -642,8 +613,8 @@ template SiSUdocAbstraction() { bookindex_unordered_hashes = bkidx_hash(an_object["bookindex_nugget"], obj_cite_number); an_object["is"] = "para"; - auto _node_t = - node_construct.node_emitter( + auto comp_obj_heading = + node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, obj_cite_number, @@ -651,26 +622,22 @@ template SiSUdocAbstraction() { heading_ptr-1, an_object["is"], ); - _node_heading_str = _node_t[0]; - _node_heading_int = _node_t[1]; auto substantive_object_and_anchor_tags_tuple = obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); // ... an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; - an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_heading_str, _node_heading_int); - node_para_str_["is"] = an_object["is"]; - node_para_str_["attrib"] = an_object["attrib"]; - node_para_int_["ocn"] = obj_cite_number; - node_para_int_["indent_hang"] = indent["hang_position"]; - node_para_int_["indent_base"] = indent["base_position"]; - node_para_int_["bullet"] = (bullet) ? 1 : 0; - the_document_body_section ~= - set_abstract_object.contents_para( - an_object["substantive"], - node_para_str_, - node_para_int_, - ); + comp_obj_para = comp_obj_para.init; + comp_obj_para.use = "content"; + comp_obj_para.of = "para"; + comp_obj_para.is_a = "para"; + comp_obj_para.text = to!string(an_object["substantive"]).strip; + comp_obj_para.ocn = obj_cite_number; + comp_obj_para.obj_cite_number = to!string(obj_cite_number); + comp_obj_para.indent_hang = indent["hang_position"]; + comp_obj_para.indent_base = indent["base_position"]; + comp_obj_para.bullet = bullet; + comp_obj_para.anchor_tags = anchor_tags; + the_document_body_section ~= comp_obj_para; _common_reset_(line_occur, an_object, type); indent=[ "hang_position" : 0, @@ -697,14 +664,14 @@ template SiSUdocAbstraction() { && (the_document_body_section.length > previous_length) ) { if ((the_document_body_section[$-1].is_a == "heading") - && (the_document_body_section[$-1].heading_attrib.lev_int_markup < 5)) { + && (the_document_body_section[$-1].heading_lev_markup < 5)) { type["biblio_section"] = State.off; type["glossary_section"] = State.off; type["blurb_section"] = State.off; } previous_length = to!int(the_document_body_section.length); if ( - match(the_document_body_section[$-1].object, + match(the_document_body_section[$-1].text, rgx.inline_notes_delimiter_al_regular_number_note) ) { previous_count=to!int(the_document_body_section.length -1); @@ -748,28 +715,24 @@ template SiSUdocAbstraction() { } if (an_object["glossary_nugget"].length == 0) { writeln("no gloss"); - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = ""; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "B"; - node_heading_int_["heading_lev_markup"] = 1; - node_heading_int_["heading_lev_collapsed"] = 1; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - the_glossary_section ~= - set_abstract_object.contents_heading( - "(skip) there is no Glossary section", // nugget/object - node_heading_str_, - node_heading_int_, - [""], // anchor tag - ); + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = "(skip) there is no Glossary section"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.marked_up_level = "B"; + comp_obj_heading_.heading_lev_markup = 1; + comp_obj_heading_.heading_lev_collapsed = 1; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + the_glossary_section ~= comp_obj_heading_; } else { writeln("gloss"); } debug(glossary) { foreach (gloss; the_glossary_section) { - writeln(gloss.object); + writeln(gloss.text); } } auto biblio_unsorted_incomplete = biblio_arr_json.dup; @@ -778,55 +741,46 @@ template SiSUdocAbstraction() { auto biblio_ordered = biblio._bibliography_(biblio_unsorted_incomplete, bib_arr_json); if (biblio_ordered.length > 0) { - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = ""; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "B"; - node_heading_int_["heading_lev_markup"] = 1; - node_heading_int_["heading_lev_collapsed"] = 1; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - the_bibliography_section ~= - set_abstract_object.contents_heading( - "Bibliography", // nugget/object - node_heading_str_, - node_heading_int_, - [""], // anchor tag - ); - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = "bibliography"; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "1"; - node_heading_int_["heading_lev_markup"] = 4; - node_heading_int_["heading_lev_collapsed"] = 2; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - the_bibliography_section ~= - set_abstract_object.contents_heading( - "Bibliography", - node_heading_str_, - node_heading_int_, - ["bibliography"], // anchor tag - ); + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = "Bibliography"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.marked_up_level = "B"; + comp_obj_heading_.heading_lev_markup = 1; + comp_obj_heading_.heading_lev_collapsed = 1; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + the_bibliography_section ~= comp_obj_heading_; + // --- + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = "Bibliography"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.segment_anchor_tag = "bibliography"; + comp_obj_heading_.marked_up_level = "1"; + comp_obj_heading_.heading_lev_markup = 4; + comp_obj_heading_.heading_lev_collapsed = 2; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + comp_obj_heading_.anchor_tags = ["bibliography"]; + the_bibliography_section ~= comp_obj_heading_; } else { - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = ""; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "B"; - node_heading_int_["heading_lev_markup"] = 1; - node_heading_int_["heading_lev_collapsed"] = 1; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - the_bibliography_section ~= - set_abstract_object.contents_heading( - "(skip) there is no Bibliography", // nugget/object - node_heading_str_, - node_heading_int_, - [""], // anchor tag - ); + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = "(skip) there is no Bibliography"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.marked_up_level = "B"; + comp_obj_heading_.heading_lev_markup = 1; + comp_obj_heading_.heading_lev_collapsed = 1; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + the_bibliography_section ~= comp_obj_heading_; } string out_; foreach (entry; biblio_ordered) { @@ -844,22 +798,22 @@ template SiSUdocAbstraction() { ((entry["place"].str.empty) ? "" : ", " ~ entry["place"].str), ((entry["url"].str.empty) ? "" : ", [" ~ entry["url"].str ~ "]"), ); - node_para_str_["is"] = "bibliography"; - node_para_str_["attrib"] = ""; - node_para_int_["ocn"] = 0; - node_para_int_["indent_hang"] = 0; - node_para_int_["indent_base"] = 1; - node_para_int_["bullet"] = 0; - the_bibliography_section ~= - set_abstract_object.contents_para( - out_, // nugget/object - node_para_str_, - node_para_int_, - ); + comp_obj_para = comp_obj_para.init; + comp_obj_para.use = "content"; + comp_obj_para.of = "para"; + comp_obj_para.is_a = "bibliography"; + comp_obj_para.text = to!string(out_).strip; + comp_obj_para.ocn = 0; + comp_obj_para.obj_cite_number = "0"; + comp_obj_para.indent_hang = 0; + comp_obj_para.indent_base = 1; + comp_obj_para.bullet = bullet; + comp_obj_para.anchor_tags = anchor_tags; + the_bibliography_section ~= comp_obj_para; } debug(bibliosection) { foreach (o; the_bibliography_section) { - writeln(o.object); + writeln(o.text); } } auto bi = BookIndexReportSection(); @@ -880,28 +834,25 @@ template SiSUdocAbstraction() { } if (an_object["blurb_nugget"].length == 0) { writeln("no blurb"); - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = ""; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "B"; - node_heading_int_["heading_lev_markup"] = 1; - node_heading_int_["heading_lev_collapsed"] = 1; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - the_blurb_section ~= - set_abstract_object.contents_heading( - "(skip) there is no Blurb section", // nugget/object - node_heading_str_, - node_heading_int_, - [""], // anchor tag - ); + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = "(skip) there is no Blurb section"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.segment_anchor_tag = "bibliography"; + comp_obj_heading_.marked_up_level = "1"; + comp_obj_heading_.heading_lev_markup = 4; + comp_obj_heading_.heading_lev_collapsed = 2; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + the_blurb_section ~= comp_obj_heading_; } else { writeln("blurb"); } debug(blurb) { foreach (blurb; the_blurb_section) { - writeln(blurb.object); + writeln(blurb.text); } } @@ -909,6 +860,15 @@ template SiSUdocAbstraction() { "hang_position" : 1, "base_position" : 1, ]; + comp_obj_toc = comp_obj_toc.init; + comp_obj_toc.use = "content"; + comp_obj_toc.of = "para"; + comp_obj_toc.is_a = "toc"; + comp_obj_toc.ocn = 0; + comp_obj_toc.obj_cite_number = "0"; + comp_obj_toc.indent_hang = indent["hang_position"]; + comp_obj_toc.indent_base = indent["base_position"]; + comp_obj_toc.bullet = false; if (the_endnotes_section["seg"].length > 1) { toc_txt_ = format( "{ %s }../%s.fn_suffix", @@ -916,15 +876,8 @@ template SiSUdocAbstraction() { "endnotes", // segment_anchor_tag_that_object_belongs_to ); toc_txt_= munge.url_links(toc_txt_); - the_table_of_contents_section["seg"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["seg"] ~= comp_obj_toc; } if (the_endnotes_section["scroll"].length > 1) { toc_txt_ = format( @@ -933,15 +886,8 @@ template SiSUdocAbstraction() { "endnotes", // _anchor_tag ); toc_txt_= munge.url_links(toc_txt_); - the_table_of_contents_section["scroll"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["scroll"] ~= comp_obj_toc; } if (the_glossary_section.length > 1) { toc_txt_ = format( @@ -950,30 +896,16 @@ template SiSUdocAbstraction() { "glossary", // segment_anchor_tag_that_object_belongs_to ); toc_txt_= munge.url_links(toc_txt_); - the_table_of_contents_section["seg"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["seg"] ~= comp_obj_toc; toc_txt_ = format( "{ %s }#%s", "Glossary", "glossary", // _anchor_tag ); toc_txt_= munge.url_links(toc_txt_); - the_table_of_contents_section["scroll"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["scroll"] ~= comp_obj_toc; } if (the_bibliography_section.length > 1){ toc_txt_ = format( @@ -982,30 +914,17 @@ template SiSUdocAbstraction() { "bibliography", // segment_anchor_tag_that_object_belongs_to ); toc_txt_= munge.url_links(toc_txt_); - the_table_of_contents_section["seg"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["seg"] ~= comp_obj_toc; + toc_txt_ = format( "{ %s }#%s", "Bibliography", "bibliography", // _anchor_tag ); toc_txt_= munge.url_links(toc_txt_); - the_table_of_contents_section["scroll"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["scroll"] ~= comp_obj_toc; } if (the_bookindex_section["seg"].length > 1) { toc_txt_ = format( @@ -1014,15 +933,8 @@ template SiSUdocAbstraction() { "bookindex", // segment_anchor_tag_that_object_belongs_to ); toc_txt_= munge.url_links(toc_txt_); - the_table_of_contents_section["seg"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["seg"] ~= comp_obj_toc; } if (the_bookindex_section["scroll"].length > 1) { toc_txt_ = format( @@ -1031,15 +943,8 @@ template SiSUdocAbstraction() { "bookindex", // _anchor_tag ); toc_txt_= munge.url_links(toc_txt_); - the_table_of_contents_section["scroll"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["scroll"] ~= comp_obj_toc; } if (the_blurb_section.length > 1) { toc_txt_ = format( @@ -1048,30 +953,16 @@ template SiSUdocAbstraction() { "blurb", // segment_anchor_tag_that_object_belongs_to ); toc_txt_= munge.url_links(toc_txt_); - the_table_of_contents_section["seg"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["seg"] ~= comp_obj_toc; toc_txt_ = format( "{ %s }#%s", "Blurb", "blurb", // _anchor_tag ); toc_txt_= munge.url_links(toc_txt_); - the_table_of_contents_section["scroll"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["scroll"] ~= comp_obj_toc; } debug(toc) { writefln( @@ -1080,7 +971,7 @@ template SiSUdocAbstraction() { the_table_of_contents_section["seg"].length ); foreach (toc_linked_heading; the_table_of_contents_section["seg"]) { - writeln(mkup.indent_by_spaces_provided(toc_linked_heading.para_attrib.indent_start), toc_linked_heading.object); + writeln(mkup.indent_by_spaces_provided(toc_linked_heading.indent_hang), toc_linked_heading.text); } } the_document_head_section ~= the_document_body_section[0]; @@ -1089,7 +980,9 @@ template SiSUdocAbstraction() { "head": the_document_head_section, "toc_seg": the_table_of_contents_section["seg"], "toc_scroll": the_table_of_contents_section["scroll"], + /+ substantive/body: +/ "body": the_document_body_section, + /+ backmatter: +/ "endnotes_seg": the_endnotes_section["seg"], "endnotes_scroll": the_endnotes_section["scroll"], "glossary": the_glossary_section, @@ -1114,18 +1007,18 @@ template SiSUdocAbstraction() { an_object.remove("bookindex_nugget"); } auto _common_reset_( - ref int[string] line_occur, + ref int[string] line_occur, ref string[string] an_object, - ref int[string] type + ref int[string] type ) { line_occur["heading"] = State.off; - line_occur["para"]= State.off; - type["heading"] = State.off; - type["para"] = State.off; + line_occur["para"] = State.off; + type["heading"] = State.off; + type["para"] = State.off; object_reset(an_object); } void _check_ocn_status_( - char[] line, + char[] line, ref int[string] type ) { if ((!line.empty) && (type["ocn_status_multi_obj"] == TriState.off)) { @@ -1169,9 +1062,9 @@ template SiSUdocAbstraction() { } } void _start_block_( - char[] line, + char[] line, ref int[string] type, - string[string] obj_cite_number_poem + string[string] obj_cite_number_poem ) { if (matchFirst(line, rgx.block_curly_code_open)) { /+ curly code open +/ @@ -1313,9 +1206,9 @@ template SiSUdocAbstraction() { } } void _code_block_( - char[] line, + char[] line, ref string[string] an_object, - ref int[string] type + ref int[string] type ) { if (type["curly_code"] == TriState.on) { if (matchFirst(line, rgx.block_curly_code_close)) { @@ -1486,11 +1379,11 @@ template SiSUdocAbstraction() { } } void _poem_block_( - char[] line, - ref string[string] an_object, - ref int[string] type, - ref int cntr, - string[string] obj_cite_number_poem, + char[] line, + ref string[string] an_object, + ref int[string] type, + ref int cntr, + string[string] obj_cite_number_poem, string[string][string] dochead_make_aa, ) { if (type["curly_poem"] == TriState.on) { @@ -1525,15 +1418,14 @@ template SiSUdocAbstraction() { obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; - an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_heading_str, _node_heading_int); - the_document_body_section ~= - set_abstract_object.contents_block( - an_object["is"], - an_object["substantive"], - an_object["attrib"], - obj_cite_number - ); + comp_obj_block = comp_obj_block.init; + comp_obj_block.use = "content"; + comp_obj_block.of = "block"; + comp_obj_block.is_a = an_object["is"]; + comp_obj_block.ocn = obj_cite_number; + comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_block.text = an_object["substantive"]; + the_document_body_section ~= comp_obj_block; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -1565,7 +1457,7 @@ template SiSUdocAbstraction() { } processing.remove("verse"); an_object["is"] = "verse"; - auto _node_t = node_construct.node_emitter( + auto comp_obj_location = node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, obj_cite_number, @@ -1573,21 +1465,18 @@ template SiSUdocAbstraction() { heading_ptr-1, an_object["is"] ); - _node_heading_str = _node_t[0]; - _node_heading_int = _node_t[1]; auto substantive_object_and_anchor_tags_tuple = obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; - an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_heading_str, _node_heading_int); - the_document_body_section ~= - set_abstract_object.contents_block( - an_object["is"], - an_object["substantive"], - an_object["attrib"], - obj_cite_number - ); + comp_obj_block = comp_obj_block.init; + comp_obj_block.use = "content"; + comp_obj_block.of = "block"; + comp_obj_block.is_a = an_object["is"]; + comp_obj_block.ocn = obj_cite_number; + comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_block.text = an_object["substantive"]; + the_document_body_section ~= comp_obj_block; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -1616,15 +1505,14 @@ template SiSUdocAbstraction() { obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; - an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_heading_str, _node_heading_int); - the_document_body_section ~= - set_abstract_object.contents_block( - an_object["is"], - an_object["substantive"], - an_object["attrib"], - obj_cite_number - ); + comp_obj_block = comp_obj_block.init; + comp_obj_block.use = "content"; + comp_obj_block.of = "block"; + comp_obj_block.is_a = an_object["is"]; + comp_obj_block.ocn = obj_cite_number; + comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_block.text = an_object["substantive"]; + the_document_body_section ~= comp_obj_block; obj_cite_number_poem["end"] = to!string(obj_cite_number); object_reset(an_object); processing.remove("verse"); @@ -1655,8 +1543,8 @@ template SiSUdocAbstraction() { } processing.remove("verse"); an_object["is"] = "verse"; - auto _node_t = - node_construct.node_emitter( + auto comp_obj_location = + node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, obj_cite_number, @@ -1664,21 +1552,18 @@ template SiSUdocAbstraction() { heading_ptr-1, an_object["is"] ); - _node_heading_str = _node_t[0]; - _node_heading_int = _node_t[1]; auto substantive_object_and_anchor_tags_tuple = obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; - an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_heading_str, _node_heading_int); - the_document_body_section ~= - set_abstract_object.contents_block( - an_object["is"], - an_object["substantive"], - an_object["attrib"], - obj_cite_number - ); + comp_obj_block = comp_obj_block.init; + comp_obj_block.use = "content"; + comp_obj_block.of = "block"; + comp_obj_block.is_a = an_object["is"]; + comp_obj_block.ocn = obj_cite_number; + comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_block.text = an_object["substantive"]; + the_document_body_section ~= comp_obj_block; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -1687,9 +1572,9 @@ template SiSUdocAbstraction() { } } void _group_block_( - char[] line, + char[] line, ref string[string] an_object, - ref int[string] type + ref int[string] type ) { if (type["curly_group"] == State.on) { if (matchFirst(line, rgx.block_curly_group_close)) { @@ -1722,9 +1607,9 @@ template SiSUdocAbstraction() { } } void _block_block_( - char[] line, + char[] line, ref string[string] an_object, - ref int[string] type + ref int[string] type ) { if (type["curly_block"] == TriState.on) { if (matchFirst(line, rgx.block_curly_block_close)) { @@ -1757,9 +1642,9 @@ template SiSUdocAbstraction() { } } void _quote_block_( - char[] line, + char[] line, ref string[string] an_object, - ref int[string] type + ref int[string] type ) { if (type["curly_quote"] == TriState.on) { if (matchFirst(line, rgx.block_curly_quote_close)) { @@ -1792,9 +1677,9 @@ template SiSUdocAbstraction() { } } void _table_block_( - char[] line, + char[] line, ref string[string] an_object, - ref int[string] type + ref int[string] type ) { if (type["curly_table"] == TriState.on) { if (matchFirst(line, rgx.block_curly_table_close)) { @@ -1827,17 +1712,16 @@ template SiSUdocAbstraction() { } } void _block_flag_line_empty_( - char[] line, - ref string[string] an_object, - ref ObjComposite[] the_document_body_section, + char[] line, + ref string[string] an_object, + ref ObjGenericComposite[] the_document_body_section, ref string[][string][string] bookindex_unordered_hashes, - ref int obj_cite_number, - ref string[string] _node_heading_str, - ref int[string] _node_heading_int, - ref int cntr, - ref int[string] type, - string[string] obj_cite_number_poem, - string[string][string] dochead_make_aa, + ref int obj_cite_number, + ref ObjGenericComposite _comp_obj_heading, + ref int cntr, + ref int[string] type, + string[string] obj_cite_number_poem, + string[string][string] dochead_make_aa, ) { // line.empty, post contents, empty variables --------------- assert( @@ -1857,8 +1741,8 @@ template SiSUdocAbstraction() { bookindex_unordered_hashes = bkidx_hash(an_object["bookindex_nugget"], obj_cite_number); an_object["is"] = "code"; - auto _node_t = - node_construct.node_emitter( + auto comp_obj_location = + node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, obj_cite_number, @@ -1866,21 +1750,18 @@ template SiSUdocAbstraction() { heading_ptr-1, an_object["is"] ); - _node_heading_str = _node_t[0]; - _node_heading_int = _node_t[1]; auto substantive_object_and_anchor_tags_tuple = obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; - an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_heading_str, _node_heading_int); - the_document_body_section ~= - set_abstract_object.contents_block_code( - an_object["is"], - an_object["substantive"], - an_object["attrib"], - obj_cite_number - ); + comp_obj_code = comp_obj_code.init; + comp_obj_code.use = "content"; + comp_obj_code.of = "block"; + comp_obj_code.is_a = an_object["is"]; + comp_obj_code.ocn = obj_cite_number; + comp_obj_code.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_code.text = an_object["substantive"]; + the_document_body_section ~= comp_obj_code; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -1892,8 +1773,8 @@ template SiSUdocAbstraction() { bookindex_unordered_hashes = bkidx_hash(an_object["bookindex_nugget"], obj_cite_number); an_object["is"] = "verse"; // check also - auto _node_t = - node_construct.node_emitter( // + auto comp_obj_location = + node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, obj_cite_number, @@ -1901,16 +1782,14 @@ template SiSUdocAbstraction() { heading_ptr-1, an_object["is"] ); - _node_heading_str = _node_t[0]; - _node_heading_int = _node_t[1]; - the_document_body_section ~= - set_abstract_object.contents_block_obj_cite_number_string( - "poem", - "", - (obj_cite_number_poem["start"], obj_cite_number_poem["end"]), - _node_heading_str, - _node_heading_int, - ); // bookindex + comp_obj_poem_ocn = comp_obj_poem_ocn.init; + comp_obj_poem_ocn.use = "content"; + comp_obj_poem_ocn.of = "block"; + comp_obj_poem_ocn.is_a = "poem"; + comp_obj_poem_ocn.ocn = obj_cite_number; + comp_obj_poem_ocn.obj_cite_number = (obj_cite_number_poem["start"], obj_cite_number_poem["end"]); // not sure about this + comp_obj_poem_ocn.text = ""; // an_object["substantive"]; + the_document_body_section ~= comp_obj_poem_ocn; object_reset(an_object); processing.remove("verse"); type["blocks"] = TriState.off; @@ -1923,8 +1802,8 @@ template SiSUdocAbstraction() { bookindex_unordered_hashes = bkidx_hash(an_object["bookindex_nugget"], obj_cite_number); an_object["is"] = "table"; - auto _node_t = - node_construct.node_emitter( + auto comp_obj_location = + node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, obj_cite_number, @@ -1932,21 +1811,18 @@ template SiSUdocAbstraction() { heading_ptr-1, an_object["is"] ); - _node_heading_str = _node_t[0]; - _node_heading_int = _node_t[1]; auto substantive_object_and_anchor_tags_tuple = obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; - an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_heading_str, _node_heading_int); - the_document_body_section ~= - set_abstract_object.contents_block( - an_object["is"], - an_object["substantive"], - an_object["attrib"], - obj_cite_number - ); + comp_obj_block = comp_obj_block.init; + comp_obj_block.use = "content"; + comp_obj_block.of = "block"; + comp_obj_block.is_a = an_object["is"]; + comp_obj_block.ocn = obj_cite_number; + comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_block.text = an_object["substantive"]; + the_document_body_section ~= comp_obj_block; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -1960,8 +1836,8 @@ template SiSUdocAbstraction() { bookindex_unordered_hashes = bkidx_hash(an_object["bookindex_nugget"], obj_cite_number); an_object["is"] = "group"; - auto _node_t = - node_construct.node_emitter( + auto comp_obj_location = + node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, obj_cite_number, @@ -1969,21 +1845,18 @@ template SiSUdocAbstraction() { heading_ptr-1, an_object["is"] ); - _node_heading_str = _node_t[0]; - _node_heading_int = _node_t[1]; auto substantive_object_and_anchor_tags_tuple = obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; - an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_heading_str, _node_heading_int); - the_document_body_section ~= - set_abstract_object.contents_block( - an_object["is"], - an_object["substantive"], - an_object["attrib"], - obj_cite_number - ); + comp_obj_block = comp_obj_block.init; + comp_obj_block.use = "content"; + comp_obj_block.of = "block"; + comp_obj_block.is_a = an_object["is"]; + comp_obj_block.ocn = obj_cite_number; + comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_block.text = an_object["substantive"]; + the_document_body_section ~= comp_obj_block; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -1996,8 +1869,8 @@ template SiSUdocAbstraction() { bookindex_unordered_hashes = bkidx_hash(an_object["bookindex_nugget"], obj_cite_number); an_object["is"] = "block"; - auto _node_t = - node_construct.node_emitter( + auto comp_obj_location = + node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, obj_cite_number, @@ -2005,21 +1878,18 @@ template SiSUdocAbstraction() { heading_ptr-1, an_object["is"] ); - _node_heading_str = _node_t[0]; - _node_heading_int = _node_t[1]; auto substantive_object_and_anchor_tags_tuple = obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; - an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_heading_str, _node_heading_int); - the_document_body_section ~= - set_abstract_object.contents_block( - an_object["is"], - an_object["substantive"], - an_object["attrib"], - obj_cite_number - ); + comp_obj_block = comp_obj_block.init; + comp_obj_block.use = "content"; + comp_obj_block.of = "block"; + comp_obj_block.is_a = an_object["is"]; + comp_obj_block.ocn = obj_cite_number; + comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_block.text = an_object["substantive"]; + the_document_body_section ~= comp_obj_block; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -2033,8 +1903,8 @@ template SiSUdocAbstraction() { bookindex_unordered_hashes = bkidx_hash(an_object["bookindex_nugget"], obj_cite_number); an_object["is"] = "quote"; - auto _node_t = - node_construct.node_emitter( // + auto comp_obj_location = + node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, obj_cite_number, @@ -2042,21 +1912,18 @@ template SiSUdocAbstraction() { heading_ptr-1, an_object["is"] ); - _node_heading_str = _node_t[0]; - _node_heading_int = _node_t[1]; auto substantive_object_and_anchor_tags_tuple = obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; - an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_heading_str, _node_heading_int); - the_document_body_section ~= - set_abstract_object.contents_block( - an_object["is"], - an_object["substantive"], - an_object["attrib"], - obj_cite_number - ); + comp_obj_block = comp_obj_block.init; + comp_obj_block.use = "content"; + comp_obj_block.of = "block"; + comp_obj_block.is_a = an_object["is"]; + comp_obj_block.ocn = obj_cite_number; + comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_block.text = an_object["substantive"]; + the_document_body_section ~= comp_obj_block; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -2114,11 +1981,11 @@ template SiSUdocAbstraction() { } } auto _heading_found_( - char[] line, - string dochead_make_identify_unmarked_headings, - ref string[string] heading_match_str, + char[] line, + string dochead_make_identify_unmarked_headings, + ref string[string] heading_match_str, ref Regex!(char)[string] heading_match_rgx, - ref int[string] type + ref int[string] type ) { if ((dochead_make_identify_unmarked_headings.length > 2) && (type["make_headings"] == State.off)) { @@ -2198,10 +2065,10 @@ template SiSUdocAbstraction() { } } auto _heading_make_set_( - ref char[] line, - ref int[string] line_occur, + ref char[] line, + ref int[string] line_occur, ref Regex!(char)[string] heading_match_rgx, - ref int[string] type + ref int[string] type ) { if ((type["make_headings"] == State.on) && ((line_occur["para"] == State.off) @@ -2254,13 +2121,13 @@ template SiSUdocAbstraction() { } } auto _heading_matched_( - char[] line, - ref int[string] line_occur, - ref string[string] an_object, - ref string an_object_key, - ref int[string] lv, - ref int[string] collapsed_lev, - ref int[string] type, + char[] line, + ref int[string] line_occur, + ref string[string] an_object, + ref string an_object_key, + ref int[string] lv, + ref int[string] collapsed_lev, + ref int[string] type, ref string[string][string] dochead_meta_aa ) { if (auto m = match(line, rgx.heading)) { @@ -2397,13 +2264,13 @@ template SiSUdocAbstraction() { } } auto _para_match_( - char[] line, + char[] line, ref string[string] an_object, - ref string an_object_key, - ref int[string] indent, - ref bool bullet, - ref int[string] type, - ref int[string] line_occur, + ref string an_object_key, + ref int[string] indent, + ref bool bullet, + ref int[string] type, + ref int[string] line_occur, ) { if (line_occur["para"] == State.off) { /+ para matches +/ @@ -2696,8 +2563,8 @@ template SiSUdocAbstraction() { auto munge = ObjInlineMarkupMunge(); string[string] obj_txt; auto obj_inline_markup_and_anchor_tags( - string[string] obj_, - string obj_key_, + string[string] obj_, + string obj_key_, string[string][string] dochead_make_aa ) in { } @@ -2773,27 +2640,21 @@ template SiSUdocAbstraction() { return heading_toc_; }; auto table_of_contents_gather_headings( - string[string] obj_, - string[string][string] dochead_make_aa, - string segment_anchor_tag_that_object_belongs_to, - string _anchor_tag, - ObjComposite[][string] the_table_of_contents_section, + string[string] obj_, + string[string][string] dochead_make_aa, + string segment_anchor_tag_that_object_belongs_to, + string _anchor_tag, + ObjGenericComposite[][string] the_table_of_contents_section, ) in { } body { + ObjGenericComposite comp_obj_toc; char[] heading_toc_ = to!(char[])(obj_["body_nugget"].dup.strip); heading_toc_ = _clean_heading_toc_(heading_toc_); auto attrib=""; string toc_txt_; int[string] indent; - auto set_abstract_object = ObjectAbstractSet(); if (to!int(obj_["lev_markup_number"]) > 0) { - toc_txt_ = format( - "{ %s }#%s", - heading_toc_, - _anchor_tag, - ); - toc_txt_= munge.url_links(toc_txt_); indent=[ "hang_position" : to!int(obj_["lev_markup_number"]), "base_position" : to!int(obj_["lev_markup_number"]), @@ -2804,30 +2665,41 @@ template SiSUdocAbstraction() { _anchor_tag, ); toc_txt_= munge.url_links(toc_txt_); - the_table_of_contents_section["scroll"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc = comp_obj_toc.init; + comp_obj_toc.use = "content"; + comp_obj_toc.of = "para"; + comp_obj_toc.is_a = "toc"; + comp_obj_toc.ocn = 0; + comp_obj_toc.obj_cite_number = "0"; + comp_obj_toc.indent_hang = indent["hang_position"]; + comp_obj_toc.indent_base = indent["base_position"]; + comp_obj_toc.bullet = false; + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["scroll"] ~= comp_obj_toc; } else { indent=[ "hang_position" : 0, "base_position" : 0, ]; - the_table_of_contents_section["scroll"] ~= - set_abstract_object.contents_toc( - "toc", - "Table of Contents", - "", // attrib - 0, - indent, - false - ); - } + comp_obj_toc = comp_obj_toc.init; + comp_obj_toc.use = "content"; + comp_obj_toc.of = "para"; + comp_obj_toc.is_a = "toc"; + comp_obj_toc.ocn = 0; + comp_obj_toc.obj_cite_number = "0"; + comp_obj_toc.indent_hang = indent["hang_position"]; + comp_obj_toc.indent_base = indent["base_position"]; + comp_obj_toc.bullet = false; + comp_obj_toc.text = "Table of Contents"; + the_table_of_contents_section["scroll"] ~= comp_obj_toc; + } + comp_obj_toc = comp_obj_toc.init; + comp_obj_toc.use = "content"; + comp_obj_toc.of = "para"; + comp_obj_toc.is_a = "toc"; + comp_obj_toc.ocn = 0; + comp_obj_toc.obj_cite_number = "0"; + comp_obj_toc.bullet = false; switch (to!int(obj_["lev_markup_number"])) { case 0: indent=[ @@ -2836,15 +2708,10 @@ template SiSUdocAbstraction() { ]; toc_txt_ = "{ Table of Contents }../toc.fn_suffix"; toc_txt_= munge.url_links(toc_txt_); - the_table_of_contents_section["seg"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc.indent_hang = indent["hang_position"]; + comp_obj_toc.indent_base = indent["base_position"]; + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["seg"] ~= comp_obj_toc; break; case 1: .. case 3: indent=[ @@ -2856,15 +2723,10 @@ template SiSUdocAbstraction() { heading_toc_, ); toc_txt_= munge.url_links(toc_txt_); - the_table_of_contents_section["seg"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc.indent_hang = indent["hang_position"]; + comp_obj_toc.indent_base = indent["base_position"]; + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["seg"] ~= comp_obj_toc; break; case 4: toc_txt_ = format( @@ -2877,15 +2739,10 @@ template SiSUdocAbstraction() { "hang_position" : to!int(obj_["lev_markup_number"]), "base_position" : to!int(obj_["lev_markup_number"]), ]; - the_table_of_contents_section["seg"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc.indent_hang = indent["hang_position"]; + comp_obj_toc.indent_base = indent["base_position"]; + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["seg"] ~= comp_obj_toc; break; case 5: .. case 7: toc_txt_ = format( @@ -2899,15 +2756,10 @@ template SiSUdocAbstraction() { "hang_position" : to!int(obj_["lev_markup_number"]), "base_position" : to!int(obj_["lev_markup_number"]), ]; - the_table_of_contents_section["seg"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc.indent_hang = indent["hang_position"]; + comp_obj_toc.indent_base = indent["base_position"]; + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["seg"] ~= comp_obj_toc; break; default: break; @@ -2918,10 +2770,9 @@ template SiSUdocAbstraction() { } private: static string _configured_auto_heading_numbering_and_segment_anchor_tags( - string munge_, - string[string] obj_, - string[string][string] - dochead_make_aa + string munge_, + string[string] obj_, + string[string][string] dochead_make_aa ) { if (dochead_make_aa["make"]["num_top"].length > 0) { if (!(match(munge_, rgx.heading_anchor_tag))) { @@ -3103,20 +2954,17 @@ template SiSUdocAbstraction() { struct ObjAttributes { string[string] _obj_attrib; string obj_attributes( - string obj_is_, - string obj_raw, - string[string] _node_heading_str, - int[string] _node_heading_int + string obj_is_, + string obj_raw, + ObjGenericComposite _comp_obj_heading, ) in { } body { scope(exit) { destroy(obj_is_); destroy(obj_raw); - destroy(_node_heading_str); - destroy(_node_heading_int); + destroy(_comp_obj_heading); } - _obj_attrib.remove("json"); _obj_attrib["json"] ="{"; switch (obj_is_) { case "heading": @@ -3154,7 +3002,7 @@ template SiSUdocAbstraction() { break; } _obj_attrib["json"] ~=" }"; - _obj_attrib["json"]=_set_additional_values_parse_as_json(_obj_attrib["json"], obj_is_, _node_heading_str, _node_heading_int); // check + _obj_attrib["json"]=_set_additional_values_parse_as_json(_obj_attrib["json"], obj_is_, _comp_obj_heading); // check debug(structattrib) { if (oa_j["is"].str() == "heading") { writeln(_obj_attrib["json"]); @@ -3176,24 +3024,24 @@ template SiSUdocAbstraction() { auto rgx = Rgx(); if (matchFirst(obj_txt_in, rgx.para_bullet)) { _obj_attributes =" \"bullet\": \"true\"," - ~ " \"indent_start\": 0," - ~ " \"indent_rest\": 0,"; + ~ " \"indent_hang\": 0," + ~ " \"indent_base\": 0,"; } else if (auto m = matchFirst(obj_txt_in, rgx.para_bullet_indent)) { _obj_attributes =" \"bullet\": \"true\"," - ~ " \"indent_start\": " ~ to!string(m.captures[1]) ~ "," - ~ " \"indent_rest\": " ~ to!string(m.captures[1]) ~ ","; + ~ " \"indent_hang\": " ~ to!string(m.captures[1]) ~ "," + ~ " \"indent_base\": " ~ to!string(m.captures[1]) ~ ","; } else if (auto m = matchFirst(obj_txt_in, rgx.para_indent_hang)) { _obj_attributes =" \"bullet\": \"false\"," - ~ " \"indent_start\": " ~ to!string(m.captures[1]) ~ "," - ~ " \"indent_rest\": " ~ to!string(m.captures[2]) ~ ","; + ~ " \"indent_hang\": " ~ to!string(m.captures[1]) ~ "," + ~ " \"indent_base\": " ~ to!string(m.captures[2]) ~ ","; } else if (auto m = matchFirst(obj_txt_in, rgx.para_indent)) { _obj_attributes =" \"bullet\": \"false\"," - ~ " \"indent_start\": " ~ to!string(m.captures[1]) ~ "," - ~ " \"indent_rest\": " ~ to!string(m.captures[1]) ~ ","; + ~ " \"indent_hang\": " ~ to!string(m.captures[1]) ~ "," + ~ " \"indent_base\": " ~ to!string(m.captures[1]) ~ ","; } else { _obj_attributes =" \"bullet\": \"false\"," - ~ " \"indent_start\": 0," - ~ " \"indent_rest\": 0,"; + ~ " \"indent_hang\": 0," + ~ " \"indent_base\": 0,"; } return _obj_attributes; } @@ -3288,26 +3136,25 @@ template SiSUdocAbstraction() { invariant() { } string _set_additional_values_parse_as_json( - string _obj_attrib, - string obj_is_, - string[string] _node_heading_str, - int[string] _node_heading_int + string _obj_attrib, + string obj_is_, + ObjGenericComposite _comp_obj_heading, ) { // JSONValue oa_j = parseJSON(_obj_attrib); assert( (oa_j.type == JSON_TYPE.OBJECT) ); if (obj_is_ == "heading") { - oa_j.object["obj_cite_number"] = _node_heading_str["ocn"]; - oa_j.object["lev_markup_number"] = _node_heading_int["heading_lev_markup"]; - oa_j.object["lev_collapsed_number"] = _node_heading_int["heading_lev_collapsed"]; + oa_j.object["obj_cite_number"] = _comp_obj_heading.ocn; + oa_j.object["lev_markup_number"] = _comp_obj_heading.heading_lev_markup; + oa_j.object["lev_collapsed_number"] = _comp_obj_heading.heading_lev_collapsed; oa_j.object["heading_ptr"] = - _node_heading_int["ptr_heading"]; + _comp_obj_heading.ptr_heading; oa_j.object["doc_object_ptr"] = - _node_heading_int["ptr_doc_object"]; + _comp_obj_heading.ptr_doc_object; } - oa_j.object["parent_obj_cite_number"] = _node_heading_int["parent_ocn"]; // - oa_j.object["parent_lev_markup_number"] = _node_heading_int["parent_lev_markup"]; // + oa_j.object["parent_obj_cite_number"] = _comp_obj_heading.parent_ocn; + oa_j.object["parent_lev_markup_number"] = _comp_obj_heading.parent_lev_markup; _obj_attrib = oa_j.toString(); return _obj_attrib; } @@ -3322,7 +3169,7 @@ template SiSUdocAbstraction() { string[] bi_main_terms_split_arr; string[][string][string] bookindex_nugget_hash( string bookindex_section, - int obj_cite_number + int obj_cite_number ) in { debug(bookindexraw) { @@ -3451,68 +3298,48 @@ template SiSUdocAbstraction() { mixin SiSUnode; string type_is; string lev; - int lev_int_markup, lev_int_collapsed; + int heading_lev_markup, heading_lev_collapsed; string attrib; int[string] indent; - auto set_abstract_object = ObjectAbstractSet(); auto mainkeys = bookindex_unordered_hashes.byKey.array.sort().release; - ObjComposite[][string] bookindex_section; - auto node_heading_int_ = node_metadata_heading_int; - auto node_heading_str_ = node_metadata_heading_str; + ObjGenericComposite[][string] bookindex_section; + ObjGenericComposite comp_obj_heading_, comp_obj_para; auto node_para_int_ = node_metadata_para_int; auto node_para_str_ = node_metadata_para_str; if ((mainkeys.length > 0) && (opt_action_bool["backmatter"] && opt_action_bool["section_bookindex"])) { string bi_tmp_seg, bi_tmp_scroll; - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = ""; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "B"; - node_heading_int_["heading_lev_markup"] = 1; - node_heading_int_["heading_lev_collapsed"] = 1; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - bookindex_section["scroll"] ~= - set_abstract_object.contents_heading( - "Book Index", - node_heading_str_, - node_heading_int_, - [], - ); - bookindex_section["seg"] ~= - set_abstract_object.contents_heading( - "Book Index", - node_heading_str_, - node_heading_int_, - [], - ); + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = "Book Index"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.marked_up_level = "B"; + comp_obj_heading_.heading_lev_markup = 1; + comp_obj_heading_.heading_lev_collapsed = 1; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + bookindex_section["scroll"] ~= comp_obj_heading_; + bookindex_section["seg"] ~= comp_obj_heading_; ++obj_cite_number; ++mkn; - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = "bookindex"; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "1"; - node_heading_int_["heading_lev_markup"] = 4; - node_heading_int_["heading_lev_collapsed"] = 2; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - bookindex_section["scroll"] ~= - set_abstract_object.contents_heading( - "Index", - node_heading_str_, - node_heading_int_, - ["bookindex"], - ); - bookindex_section["seg"] ~= - set_abstract_object.contents_heading( - "Index", - node_heading_str_, - node_heading_int_, - ["bookindex"], - ); + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = "Index"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.segment_anchor_tag = "bookindex"; + comp_obj_heading_.marked_up_level = "1"; + comp_obj_heading_.heading_lev_markup = 4; + comp_obj_heading_.heading_lev_collapsed = 2; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + comp_obj_heading_.anchor_tags = ["bookindex"]; + bookindex_section["scroll"] ~= comp_obj_heading_; + bookindex_section["seg"] ~= comp_obj_heading_; ++obj_cite_number; ++mkn; foreach (mainkey; mainkeys) { @@ -3546,52 +3373,33 @@ template SiSUdocAbstraction() { } bi_tmp_scroll = replaceFirst(bi_tmp_scroll, rgx.trailing_linebreak, ""); bi_tmp_seg = replaceFirst(bi_tmp_seg, rgx.trailing_linebreak, ""); - indent=[ "hang_position" : 0, "base_position" : 1, ]; - node_para_str_["is"] = "para"; - node_para_str_["attrib"] = ""; - node_para_int_["ocn"] = obj_cite_number; - node_para_int_["indent_hang"] = 0; - node_para_int_["indent_base"] = 1; - node_para_int_["bullet"] = 0; - bookindex_section["scroll"] ~= - set_abstract_object.contents_para( - bi_tmp_scroll, - node_para_str_, - node_para_int_, - ); - bookindex_section["seg"] ~= - set_abstract_object.contents_para( - bi_tmp_seg, - node_para_str_, - node_para_int_, - ); + comp_obj_para = comp_obj_para.init; + comp_obj_para.use = "content"; + comp_obj_para.of = "para"; + comp_obj_para.is_a = "para"; + comp_obj_para.text = to!string(bi_tmp_scroll).strip; + comp_obj_para.ocn = obj_cite_number; + comp_obj_para.obj_cite_number = to!string(obj_cite_number); + comp_obj_para.indent_hang = 0; + comp_obj_para.indent_base = 1; + comp_obj_para.bullet = false; + bookindex_section["scroll"] ~= comp_obj_para; + comp_obj_para.text = to!string(bi_tmp_seg).strip; + bookindex_section["seg"] ~= comp_obj_para; ++obj_cite_number; ++mkn; } } else { // no book index, (figure out what to do here) - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = ""; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "B"; - node_heading_int_["heading_lev_markup"] = 1; - node_heading_int_["heading_lev_collapsed"] = 1; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - bookindex_section["scroll"] ~= - set_abstract_object.contents_heading( - "(skip) there is no Book Index", - node_heading_str_, - node_heading_int_, - [""], - ); - bookindex_section["seg"] ~= - set_abstract_object.contents_heading( - "(skip) there is no Book Index", - node_heading_str_, - node_heading_int_, - [""], - ); + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.text = "(skip) there is no Book Index"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.marked_up_level = "B"; + comp_obj_heading_.heading_lev_markup = 1; + comp_obj_heading_.heading_lev_collapsed = 1; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + bookindex_section["scroll"] ~= comp_obj_heading_; + bookindex_section["seg"] ~= comp_obj_heading_; } auto t = tuple(bookindex_section, obj_cite_number); return t; @@ -3604,9 +3412,9 @@ template SiSUdocAbstraction() { int mkn; auto rgx = Rgx(); private auto gather_notes_for_endnote_section( - ObjComposite[] contents_am, - string segment_anchor_tag_that_object_belongs_to, - int cntr, + ObjGenericComposite[] contents_am, + string segment_anchor_tag_that_object_belongs_to, + int cntr, ) in { // endnotes/ footnotes for @@ -3618,7 +3426,7 @@ template SiSUdocAbstraction() { assert(cntr >= previous_count); previous_count=cntr; assert( - match(contents_am[cntr].object, + match(contents_am[cntr].text, rgx.inline_notes_delimiter_al_regular_number_note) ); } @@ -3627,7 +3435,7 @@ template SiSUdocAbstraction() { foreach( m; matchAll( - contents_am[cntr].object, + contents_am[cntr].text, rgx.inline_notes_delimiter_al_regular_number_note ) ) { @@ -3679,102 +3487,88 @@ template SiSUdocAbstraction() { } body { mixin SiSUnode; - auto set_abstract_object = ObjectAbstractSet(); - ObjComposite[][string] the_endnotes_section; + ObjGenericComposite[][string] the_endnotes_section; auto endnotes_ = gathered_notes(); string type_is; string lev, lev_markup_number, lev_collapsed_number; string attrib; int[string] indent; - auto node_heading_int_ = node_metadata_heading_int; - auto node_heading_str_ = node_metadata_heading_str; + ObjGenericComposite comp_obj_heading_; if ((endnotes_["seg"].length > 0) && (opt_action_bool["backmatter"] && opt_action_bool["section_endnotes"])) { - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = ""; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "B"; - node_heading_int_["heading_lev_markup"] = 1; - node_heading_int_["heading_lev_collapsed"] = 1; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - the_endnotes_section["seg"] ~= - set_abstract_object.contents_heading( - "Endnotes", - node_heading_str_, - node_heading_int_, - [], - ); - the_endnotes_section["scroll"] ~= - set_abstract_object.contents_heading( - "Endnotes", - node_heading_str_, - node_heading_int_, - [], - ); + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = "Endnotes"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.marked_up_level = "B"; + comp_obj_heading_.heading_lev_markup = 1; + comp_obj_heading_.heading_lev_collapsed = 1; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + the_endnotes_section["seg"] ~= comp_obj_heading_; + the_endnotes_section["scroll"] ~= comp_obj_heading_; ++obj_cite_number; ++mkn; - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = "endnotes"; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "1"; - node_heading_int_["heading_lev_markup"] = 4; - node_heading_int_["heading_lev_collapsed"] = 2; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - the_endnotes_section["seg"] ~= - set_abstract_object.contents_heading( - "Endnotes", - node_heading_str_, - node_heading_int_, - ["endnotes"], - ); - the_endnotes_section["scroll"] ~= - set_abstract_object.contents_heading( - "Endnotes", - node_heading_str_, - node_heading_int_, - ["endnotes"], - ); + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = "Endnotes"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.segment_anchor_tag = "endnotes"; + comp_obj_heading_.marked_up_level = "1"; + comp_obj_heading_.heading_lev_markup = 4; + comp_obj_heading_.heading_lev_collapsed = 2; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + comp_obj_heading_.anchor_tags = ["endnotes"]; + the_endnotes_section["seg"] ~= comp_obj_heading_; + the_endnotes_section["scroll"] ~= comp_obj_heading_; ++obj_cite_number; ++mkn; } else { - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = ""; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "B"; - node_heading_int_["heading_lev_markup"] = 1; - node_heading_int_["heading_lev_collapsed"] = 1; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - the_endnotes_section["seg"] ~= - set_abstract_object.contents_heading( - "(skip) there are no Endnotes", - node_heading_str_, - node_heading_int_, - [""], - ); - the_endnotes_section["scroll"] ~= - set_abstract_object.contents_heading( - "(skip) there are no Endnotes", - node_heading_str_, - node_heading_int_, - [""], - ); + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = "(skip) there are no Endnotes"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.marked_up_level = "B"; + comp_obj_heading_.heading_lev_markup = 1; + comp_obj_heading_.heading_lev_collapsed = 1; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + the_endnotes_section["seg"] ~= comp_obj_heading_; + the_endnotes_section["scroll"] ~= comp_obj_heading_; } if (opt_action_bool["backmatter"] && opt_action_bool["section_endnotes"]) { + ObjGenericComposite comp_obj_endnote_; + comp_obj_endnote_ = comp_obj_endnote_.init; + comp_obj_endnote_.use = "content"; + comp_obj_endnote_.of = "para"; + comp_obj_endnote_.is_a = "endnote"; + comp_obj_endnote_.ocn = 0; + comp_obj_endnote_.obj_cite_number = "0"; + comp_obj_endnote_.indent_hang = 0; + comp_obj_endnote_.indent_base = 0; + comp_obj_endnote_.bullet = false; foreach (i, endnote; endnotes_["seg"]) { - attrib=""; - the_endnotes_section["seg"] ~= - set_abstract_object.contents_endnote(endnote, endnotes_["anchor"][i]); + auto m = (matchFirst(endnote, rgx.note_ref)); + string notenumber = to!string(m.captures[1]); + string anchor_tag = "note_" ~ notenumber; + comp_obj_endnote_.anchor_tags ~= [ endnotes_["anchor"][i] ]; // fix + comp_obj_endnote_.text = endnote.strip; + the_endnotes_section["seg"] ~= comp_obj_endnote_; } foreach (i, endnote; endnotes_["scroll"]) { - attrib=""; - the_endnotes_section["scroll"] ~= - set_abstract_object.contents_endnote(endnote, endnotes_["anchor"][i]); + auto m = (matchFirst(endnote, rgx.note_ref)); + string notenumber = to!string(m.captures[1]); + string anchor_tag = "note_" ~ notenumber; + comp_obj_endnote_.anchor_tags ~= [ endnotes_["anchor"][i] ]; // fix + comp_obj_endnote_.text = endnote.strip; + the_endnotes_section["scroll"] ~= comp_obj_endnote_; } } auto t = tuple(the_endnotes_section, obj_cite_number); @@ -3784,8 +3578,8 @@ template SiSUdocAbstraction() { /+ +/ struct Bibliography { public JSONValue[] _bibliography_( - ref string[] biblio_unsorted_incomplete, - ref JSONValue[] bib_arr_json + ref string[] biblio_unsorted_incomplete, + ref JSONValue[] bib_arr_json ) in { } body { @@ -3809,7 +3603,7 @@ template SiSUdocAbstraction() { return biblio_sorted__; } final private JSONValue[] _biblio_unsorted_complete_( - string[] biblio_unordered, + string[] biblio_unordered, ref JSONValue[] bib_arr_json ) { foreach (bibent; biblio_unordered) { @@ -3867,11 +3661,11 @@ template SiSUdocAbstraction() { int lv, lv0, lv1, lv2, lv3, lv4, lv5, lv6, lv7; int obj_cite_number; int[string] p_; // p_ parent_ - auto node_emitter( + ObjGenericComposite node_location_emitter( string lev_markup_number, string segment_anchor_tag, int obj_cite_number_, - int cntr_, + int cntr_, int ptr_, string is_ ) @@ -3897,23 +3691,13 @@ template SiSUdocAbstraction() { p_["lev_markup_number"] = DocStructMarkupHeading.h_text_1; p_["obj_cite_number"] = lv4; } - string[string] _node_heading_str = [ - "is" : is_, - "ocn" : to!string(obj_cite_number_), - "marked_up_lev" : "", - "segment_anchor_tag" : to!string(segment_anchor_tag), - "attrib" : "", - ]; - int[string] _node_heading_int = [ - "ocn" : obj_cite_number_, - "ptr_doc_object" : 0, - "ptr_html_segnames" : 0, - "ptr_heading" : 0, - "heading_lev_markup" : 0, - "heading_lev_collapsed" : 0, - "parent_ocn" : p_["obj_cite_number"], - "parent_lev_markup" : p_["lev_markup_number"], - ]; + ObjGenericComposite comp_obj_location; + comp_obj_location = comp_obj_location.init; + comp_obj_location.is_a = is_; + comp_obj_location.ocn = obj_cite_number_; + comp_obj_location.segment_anchor_tag = to!string(segment_anchor_tag); + comp_obj_location.parent_ocn = p_["obj_cite_number"]; + comp_obj_location.parent_lev_markup = p_["lev_markup_number"]; debug(node) { if (match(lev_markup_number, rgx.levels_numbered_headings)) { writeln("x ", to!string(_node)); @@ -3921,18 +3705,15 @@ template SiSUdocAbstraction() { writeln("- ", to!string(_node)); } } - assert(_node_heading_int["parent_lev_markup"] >= 4); // - assert(_node_heading_int["parent_lev_markup"] <= 7); // - assert(_node_heading_int["parent_ocn"] >= 0); // hmm, perhaps // - auto t = tuple( - _node_heading_str, - _node_heading_int, - ); - return t; + assert(comp_obj_location.parent_lev_markup >= 4); + assert(comp_obj_location.parent_lev_markup <= 7); + assert(comp_obj_location.parent_ocn >= 0); + return comp_obj_location; } invariant() { } - auto node_emitter_heading( + ObjGenericComposite node_emitter_heading( + string _text, string lev, string lev_markup_number, string lev_collapsed_number, @@ -3941,7 +3722,7 @@ template SiSUdocAbstraction() { int cntr_, int ptr_, string is_, - int html_segnames_ptr, + int html_segnames_ptr, ) in { auto rgx = Rgx(); @@ -4040,23 +3821,23 @@ template SiSUdocAbstraction() { default: break; } - string[string] _node_heading_str = [ - "is" : is_, - "ocn" : to!string(obj_cite_number_), - "marked_up_lev" : lev, - "segment_anchor_tag" : to!string(segment_anchor_tag), - "attrib" : "", - ]; - int[string] _node_heading_int = [ - "ocn" : obj_cite_number_, - "ptr_doc_object" : cntr_, - "ptr_html_segnames" : ((lev_markup_number == "4") ? html_segnames_ptr : 0), - "ptr_heading" : ptr_, - "heading_lev_markup" : (!(lev_markup_number.empty) ? to!int(lev_markup_number) : 0), // switch to use int if possible - "heading_lev_collapsed" : (!(lev_collapsed_number.empty) ? to!int(lev_collapsed_number) : 0), // switch to use int if possible - "parent_ocn" : p_["obj_cite_number"], - "parent_lev_markup" : p_["lev_markup_number"], - ]; + ObjGenericComposite _comp_obj_heading_; + _comp_obj_heading_ = _comp_obj_heading_.init; + _comp_obj_heading_.use = "content"; + _comp_obj_heading_.of = "para"; + _comp_obj_heading_.is_a = "heading"; + _comp_obj_heading_.text = to!string(_text).strip; + _comp_obj_heading_.ocn = obj_cite_number_; + _comp_obj_heading_.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + _comp_obj_heading_.segment_anchor_tag = to!string(segment_anchor_tag); + _comp_obj_heading_.marked_up_level = lev; + _comp_obj_heading_.heading_lev_markup = (!(lev_markup_number.empty) ? to!int(lev_markup_number) : 0); + _comp_obj_heading_.heading_lev_collapsed = (!(lev_collapsed_number.empty) ? to!int(lev_collapsed_number) : 0); + _comp_obj_heading_.parent_ocn = p_["obj_cite_number"]; + _comp_obj_heading_.parent_lev_markup = p_["lev_markup_number"]; + _comp_obj_heading_.ptr_doc_object = cntr_; + _comp_obj_heading_.ptr_html_segnames = ((lev_markup_number == "4") ? html_segnames_ptr : 0); + _comp_obj_heading_.ptr_heading = ptr_; debug(node) { if (match(lev_markup_number, rgx.levels_numbered_headings)) { writeln("* ", to!string(_node)); @@ -4067,44 +3848,37 @@ template SiSUdocAbstraction() { writeln("* ", to!string(_node)); } } - assert(_node_heading_int["parent_lev_markup"] <= 7); - assert(_node_heading_int["parent_ocn"] >= 0); + assert(_comp_obj_heading_.parent_lev_markup <= 7); + assert(_comp_obj_heading_.parent_ocn >= 0); if (match(lev_markup_number, rgx.levels_numbered_headings)) { - assert(_node_heading_int["heading_lev_markup"] <= 7); // issues - assert(to!int(_node_heading_str["ocn"]) >= 0); - if (_node_heading_int["parent_lev_markup"] > 0) { - assert(_node_heading_int["parent_lev_markup"] < _node_heading_int["heading_lev_markup"]); - if (to!int(_node_heading_str["ocn"]) != 0) { - assert(_node_heading_int["parent_ocn"] < to!int(_node_heading_str["ocn"])); + assert(_comp_obj_heading_.heading_lev_markup <= 7); + assert(_comp_obj_heading_.ocn >= 0); + if (_comp_obj_heading_.parent_lev_markup > 0) { + assert(_comp_obj_heading_.parent_lev_markup < _comp_obj_heading_.heading_lev_markup); + if (_comp_obj_heading_.ocn != 0) { + assert(_comp_obj_heading_.parent_ocn < _comp_obj_heading_.ocn); } } - if (_node_heading_int["heading_lev_markup"] == 0) { - assert(_node_heading_int["parent_lev_markup"] == DocStructMarkupHeading.h_sect_A); - } else if (_node_heading_int["heading_lev_markup"] == DocStructMarkupHeading.h_sect_B) { - assert(_node_heading_int["parent_lev_markup"] == DocStructMarkupHeading.h_sect_A); - } else if (_node_heading_int["heading_lev_markup"] == DocStructMarkupHeading.h_sect_C) { - assert(_node_heading_int["parent_lev_markup"] == DocStructMarkupHeading.h_sect_B); - } else if (_node_heading_int["heading_lev_markup"] == DocStructMarkupHeading.h_sect_D) { - assert(_node_heading_int["parent_lev_markup"] == DocStructMarkupHeading.h_sect_C); - } else if (_node_heading_int["heading_lev_markup"] == DocStructMarkupHeading.h_text_1) { - assert(_node_heading_int["parent_lev_markup"] <= DocStructMarkupHeading.h_sect_D); - } else if (_node_heading_int["heading_lev_markup"] == DocStructMarkupHeading.h_text_2) { - assert(_node_heading_int["parent_lev_markup"] == DocStructMarkupHeading.h_text_1); - } else if (_node_heading_int["heading_lev_markup"] == DocStructMarkupHeading.h_text_3) { - assert(_node_heading_int["parent_lev_markup"] == DocStructMarkupHeading.h_text_2); - } else if (_node_heading_int["heading_lev_markup"] == DocStructMarkupHeading.h_text_4) { - assert(_node_heading_int["parent_lev_markup"] == DocStructMarkupHeading.h_text_3); - } else if (_node_heading_int["heading_lev_markup"] == DocStructMarkupHeading.h_text_5) { - // // writeln(to!int(_node_heading_int["parent_lev_markup"])); - // // assert(to!int(_node_heading_int["parent_lev_markup"]) >= 4); - // // assert(to!int(_node_heading_int["parent_lev_markup"]) <= 7); - } - } - auto t = tuple( - _node_heading_str, - _node_heading_int, - ); - return t; + if (_comp_obj_heading_.heading_lev_markup == 0) { + assert(_comp_obj_heading_.parent_lev_markup == DocStructMarkupHeading.h_sect_A); + } else if (_comp_obj_heading_.heading_lev_markup == DocStructMarkupHeading.h_sect_B) { + assert(_comp_obj_heading_.parent_lev_markup == DocStructMarkupHeading.h_sect_A); + } else if (_comp_obj_heading_.heading_lev_markup == DocStructMarkupHeading.h_sect_C) { + assert(_comp_obj_heading_.parent_lev_markup == DocStructMarkupHeading.h_sect_B); + } else if (_comp_obj_heading_.heading_lev_markup == DocStructMarkupHeading.h_sect_D) { + assert(_comp_obj_heading_.parent_lev_markup == DocStructMarkupHeading.h_sect_C); + } else if (_comp_obj_heading_.heading_lev_markup == DocStructMarkupHeading.h_text_1) { + assert(_comp_obj_heading_.parent_lev_markup <= DocStructMarkupHeading.h_sect_D); + } else if (_comp_obj_heading_.heading_lev_markup == DocStructMarkupHeading.h_text_2) { + assert(_comp_obj_heading_.parent_lev_markup == DocStructMarkupHeading.h_text_1); + } else if (_comp_obj_heading_.heading_lev_markup == DocStructMarkupHeading.h_text_3) { + assert(_comp_obj_heading_.parent_lev_markup == DocStructMarkupHeading.h_text_2); + } else if (_comp_obj_heading_.heading_lev_markup == DocStructMarkupHeading.h_text_4) { + assert(_comp_obj_heading_.parent_lev_markup == DocStructMarkupHeading.h_text_3); + } else if (_comp_obj_heading_.heading_lev_markup == DocStructMarkupHeading.h_text_5) { + } + } + return _comp_obj_heading_; } invariant() { } @@ -4113,7 +3887,7 @@ template SiSUdocAbstraction() { /+ ↓ abstraction functions assertions +/ auto assertions_doc_structure( string[string] an_object, - int[string] lv + int[string] lv ) { if (lv["h3"] > State.off) { assert(lv["h0"] > State.off); diff --git a/src/sdp/ao_object_setter.d b/src/sdp/ao_object_setter.d index 9806285..f6f7641 100644 --- a/src/sdp/ao_object_setter.d +++ b/src/sdp/ao_object_setter.d @@ -7,187 +7,46 @@ template ObjectSetter() { /+ structs +/ struct HeadingAttrib { string lev = "9"; - int lev_int_markup = 9; - int lev_int_collapsed = 9; - int[] closes_lev_collapsed = []; // TODO track - int[] closes_lev_markup = []; // TODO track - int array_ptr = 0; - // heading segments, 1~ lev4: - int heading_array_ptr_segments = 0; // TODO - } - struct ParaAttrib { - int indent_start = 0; - int indent_rest = 0; - bool bullet = false; - } - struct BlockAttrib { - string syntax = ""; - } - struct Comment { - // no .attrib and no .obj_cite_number - } - struct Node { - int ocn = 0; - string seg_anchor_tag = ""; - // parent - int parent_lev_int_markup = 0; - int parent_ocn = 0; - int[] ancestors = []; // TODO track - // heading: - int heading_lev_int_markup = 0; - int heading_lev_int_collapsed = 0; - int[] heading_closes_lev_collapsed = []; // TODO track - int[] heading_closes_lev_markup = []; // TODO track - int heading_array_ptr = 0; - // heading segments, 1~ lev4: - int heading_array_ptr_segments = 0; // TODO - // node info json string: + int heading_lev_markup = 9; + int heading_lev_collapsed = 9; + int[] closes_lev_collapsed = []; + int[] closes_lev_markup = []; + int array_ptr = 0; + int heading_array_ptr_segments = 0; + } + struct ObjGenericComposite { + // size_t id; + string use = ""; + string of = ""; + string is_a = ""; + string text = ""; + string obj_cite_number = ""; + string[] anchor_tags = []; + string marked_up_level = "9"; + int[] closes_lev_collapsed = []; + int[] closes_lev_markup = []; + int indent_base = 0; + int indent_hang = 0; + bool bullet = false; + string syntax = ""; + int ocn = 0; + string segment_anchor_tag = ""; + int parent_lev_markup = 0; + int parent_ocn = 0; + int[] ancestors = []; + int heading_lev_markup = 9; + int heading_lev_collapsed = 9; + int[] heading_closes_lev_collapsed = []; + int[] heading_closes_lev_markup = []; + int heading_array_ptr = 0; + int ptr_doc_object = 0; + int ptr_html_segnames = 0; + int ptr_heading = 0; + int array_ptr = 0; + int heading_array_ptr_segments = 0; string[string][string] node; } - struct ObjComposite { - string use = ""; - string of = ""; - string is_a = ""; - string object = ""; - string obj_cite_number = ""; // not used for calculations? output only? else int - string[] anchor_tags = []; - HeadingAttrib heading_attrib; - ParaAttrib para_attrib; - BlockAttrib block_attrib; - Node node_structure; - } - struct ObjCompositeArr { - ObjComposite[] oca; - } - /+ structs setter +/ - struct ObjectAbstractSet { - import std.conv : to; - auto contents_comment(in string object) { - ObjComposite object_set; - object_set.use = "comment"; - object_set.of = "comment"; - object_set.is_a = "comment"; - object_set.object = object; - return object_set; - } - auto contents_heading( - in string object, - in string[string] _node_heading_str, - in int[string] _node_heading_int, - in string[] tags, - ) { - ObjComposite object_set; - object_set.use = "content"; - object_set.of = "para"; - object_set.is_a = "heading"; - object_set.object = object.strip; - object_set.obj_cite_number = _node_heading_str["ocn"]; - object_set.anchor_tags ~= tags; - object_set.heading_attrib.lev = _node_heading_str["marked_up_lev"]; - object_set.heading_attrib.lev_int_markup = _node_heading_int["heading_lev_markup"]; - object_set.heading_attrib.lev_int_collapsed = _node_heading_int["heading_lev_collapsed"]; - return object_set; - } - auto contents_para( - in string object, - in string[string] _node_para_str, - in int[string] _node_para_int, - ) { - ObjComposite object_set; - object_set.use = "content"; - object_set.of = "para"; - object_set.is_a = "para"; - object_set.object = object.strip; - object_set.obj_cite_number = (_node_para_int["ocn"]==0) ? "" : to!string(_node_para_int["ocn"]); - object_set.anchor_tags = []; - object_set.para_attrib.indent_start = _node_para_int["indent_hang"]; - object_set.para_attrib.indent_rest = _node_para_int["indent_base"]; - object_set.para_attrib.bullet = (_node_para_int["bullet"] == 1) ? true : false; - return object_set; - } - auto contents_toc( - in string is_a, - in string object, - in string attrib, - in int obj_cite_number, - in int[string] indent, - in bool bullet, - ) { - ObjComposite object_set; - object_set.use = "content"; - object_set.of = "para"; - object_set.is_a = "toc"; - object_set.object = object.strip; - object_set.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); - object_set.para_attrib.indent_start = to!int(indent["hang_position"]); - object_set.para_attrib.indent_rest = to!int(indent["base_position"]); - object_set.para_attrib.bullet = false; // bullet; - return object_set; - } - auto contents_endnote( - in string object, - in string tag, - ) { - auto m = (matchFirst(object, rgx.note_ref)); - string notenumber = to!string(m.captures[1]); - string anchor_tag = "note_" ~ notenumber; - ObjComposite object_set; - object_set.use = "content"; - object_set.of = "para"; - object_set.is_a = "endnote"; - object_set.object = object.strip; - object_set.obj_cite_number = ""; - object_set.anchor_tags ~= [ tag ]; - object_set.para_attrib.indent_start = 0; - object_set.para_attrib.indent_rest = 0; - object_set.para_attrib.bullet = false; - return object_set; - } - auto contents_block( - in string type_is, - in string object, - in string attrib, - in int obj_cite_number, - ) { - ObjComposite object_set; - object_set.use = "content"; - object_set.of = "block"; - object_set.is_a = type_is; - object_set.object = object; - object_set.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); - object_set.anchor_tags = []; - return object_set; - } - auto contents_block_code( - in string type_is, - in string object, - in string attrib_language_syntax, - in int obj_cite_number, - ) { - ObjComposite object_set; - object_set.use = "content"; - object_set.of = "block"; - object_set.is_a = type_is; - object_set.block_attrib.syntax = attrib_language_syntax; - object_set.object = object; - object_set.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); - object_set.anchor_tags = []; - return object_set; - } - auto contents_block_obj_cite_number_string( - in string type_is, - in string object, - in string obj_cite_number, - in string[string] _node_str, - in int[string] _node_int, - ) { - ObjComposite object_set; - object_set.use = "content"; - object_set.of = "block"; - object_set.is_a = type_is; - object_set.object = object; - object_set.obj_cite_number = obj_cite_number; - return object_set; - } + struct TheObjects { + ObjGenericComposite[] oca; } } diff --git a/src/sdp/ao_output_debugs.d b/src/sdp/ao_output_debugs.d index c6e8ac7..e4eaccb 100644 --- a/src/sdp/ao_output_debugs.d +++ b/src/sdp/ao_output_debugs.d @@ -32,8 +32,8 @@ template SiSUoutputDebugs() { "%s node: %s heading: %s %s", obj.obj_cite_number, obj.node, - obj.lev_int_markup, - obj.object, + obj.heading_lev_markup, + obj.text, ); } } @@ -53,7 +53,7 @@ template SiSUoutputDebugs() { "[%s][%s]\n%s", obj.obj_cite_number, obj.is_a, - obj.object + obj.text ); } } @@ -65,11 +65,11 @@ template SiSUoutputDebugs() { if (contents[key].length > 1) { string indent_spaces; foreach (obj; contents[key]) { - indent_spaces=markup.indent_by_spaces_provided(obj.para_attrib.indent_start); + indent_spaces=markup.indent_by_spaces_provided(obj.indent_hang); writefln( "%s%s", indent_spaces, - obj.object + obj.text ); } } @@ -83,7 +83,7 @@ template SiSUoutputDebugs() { writefln( "[%s]\n%s", obj.is_a, - obj.object + obj.text ); } } @@ -98,7 +98,7 @@ template SiSUoutputDebugs() { "[%s][%s]\n%s", obj.obj_cite_number, obj.is_a, - obj.object + obj.text ); } } @@ -111,7 +111,7 @@ template SiSUoutputDebugs() { "[%s][%s]\n%s", obj.obj_cite_number, obj.is_a, - obj.object + obj.text ); } } @@ -136,7 +136,7 @@ template SiSUoutputDebugs() { "[%s][%s]\n%s", obj.obj_cite_number, obj.is_a, - obj.object + obj.text ); } } @@ -161,7 +161,7 @@ template SiSUoutputDebugs() { "[%s][%s]\n%s", obj.obj_cite_number, obj.is_a, - obj.object + obj.text ); } } @@ -174,7 +174,7 @@ template SiSUoutputDebugs() { "[%s][%s]\n%s", obj.obj_cite_number, obj.is_a, - obj.object + obj.text ); } } @@ -199,7 +199,7 @@ template SiSUoutputDebugs() { "[%s][%s]\n%s", obj.obj_cite_number, obj.is_a, - obj.object + obj.text ); } } @@ -217,7 +217,7 @@ template SiSUoutputDebugs() { "* [%s][%s] %s", obj.obj_cite_number, obj.is_a, - obj.object + obj.text ); } } @@ -382,59 +382,26 @@ template SiSUoutputDebugs() { if (obj.is_a == "heading") { writefln( "%s~ [%s] %s %s", - obj.heading_attrib.lev, + obj.marked_up_level, obj.obj_cite_number, obj.anchor_tags, // "[", obj["is"], "] ", - obj.object + obj.text ); } } } } debug(heading) { // heading - string spc; foreach (k; document_section_keys_sequenced["seg"]) { foreach (o; contents[k]) { if (o.is_a == "heading") { - switch (o.heading_attrib.lev_int_markup) { - case 0: - spc=""; - break; - case 1: - spc=" "; - break; - case 2: - spc=" "; - break; - case 3: - spc=" "; - break; - case 4: - spc=" "; - break; - case 5: - spc=" "; - break; - case 6: - spc=" "; - break; - case 7: - spc=" "; - break; - case 8: - spc=" "; - break; - default: - spc=""; - break; - } writefln( "%s* %s\n (markup level: %s; collapsed level: %s)", - spc, - strip(o.object), - o.heading_attrib.lev_int_markup, - o.heading_attrib.lev_int_collapsed + replicate(" ", o.heading_lev_markup), + strip(o.text), + o.heading_lev_markup, + o.heading_lev_collapsed, ); } } @@ -456,10 +423,10 @@ template SiSUoutputDebugs() { if (obj.is_a == "heading") { writefln( "%s~ [%s] %s", - obj.heading_attrib.lev, + obj.marked_up_level, obj.obj_cite_number, // "[", obj["is"], "] ", - obj.object + obj.text ); } } diff --git a/src/sdp/output_html.d b/src/sdp/output_html.d index 4c92d58..42ecf0a 100644 --- a/src/sdp/output_html.d +++ b/src/sdp/output_html.d @@ -25,13 +25,13 @@ template SiSUoutputHTML() { ¶", obj.obj_cite_number, obj.obj_cite_number, - obj.heading_attrib.lev_int_markup, + obj.heading_lev_markup, obj.is_a, obj.obj_cite_number, obj.obj_cite_number, tags, - obj.object, - obj.heading_attrib.lev_int_markup + obj.text, + obj.heading_lev_markup, ); return o; } @@ -50,10 +50,10 @@ template SiSUoutputHTML() { obj.obj_cite_number, obj.obj_cite_number, obj.is_a, - obj.para_attrib.indent_start, - obj.para_attrib.indent_rest, + obj.indent_hang, + obj.indent_base, tags, - obj.object + obj.text ); } else { o = format(q"¶
@@ -65,11 +65,11 @@ template SiSUoutputHTML() { obj.obj_cite_number, obj.obj_cite_number, obj.is_a, - obj.para_attrib.indent_start, - obj.para_attrib.indent_rest, + obj.indent_hang, + obj.indent_base, obj.obj_cite_number, tags, - obj.object + obj.text ); } return o; @@ -88,7 +88,7 @@ template SiSUoutputHTML() { obj.obj_cite_number, obj.is_a, obj.obj_cite_number, - obj.object + obj.text ); return o; } @@ -133,9 +133,9 @@ template SiSUoutputHTML() {

¶", obj.is_a, - obj.para_attrib.indent_start, - obj.para_attrib.indent_rest, - obj.object + obj.indent_hang, + obj.indent_base, + obj.text ); return o; } @@ -147,9 +147,9 @@ template SiSUoutputHTML() { %s

¶", obj.is_a, - obj.para_attrib.indent_start, - obj.para_attrib.indent_rest, - obj.object + obj.indent_hang, + obj.indent_base, + obj.text ); return o; } -- cgit v1.2.3