diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2023-11-19 16:00:36 -0500 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2023-11-19 16:51:54 -0500 |
commit | 7924d2a226e59678e941d15fbe12b342ce67ad08 (patch) | |
tree | fd35ad92010805f15ed4af22342c20e6499f10ac | |
parent | ocda, arrange structs, continue (diff) |
ocda, minor text formatting for comments & debugs
- side-note: issues with doom emacs org babel
tangle
(not completely resolved, and have persisted)
-rw-r--r-- | flake.lock | 6 | ||||
-rw-r--r-- | org/ocda.org | 809 | ||||
-rw-r--r-- | src/doc_reform/meta/metadoc_from_src.d | 809 |
3 files changed, 491 insertions, 1133 deletions
@@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1700108881, - "narHash": "sha256-+Lqybl8kj0+nD/IlAWPPG/RDTa47gff9nbei0u7BntE=", + "lastModified": 1700385946, + "narHash": "sha256-J6hzbr93aJjTMYD9ujvN0htwHSZDE4LxPZXREaFKyLY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "7414e9ee0b3e9903c24d3379f577a417f0aae5f1", + "rev": "53aeb5c67b78a1bb565467043b79c3948afacbc9", "type": "github" }, "original": { diff --git a/org/ocda.org b/org/ocda.org index b484299..99f7d1a 100644 --- a/org/ocda.org +++ b/org/ocda.org @@ -26,14 +26,12 @@ Process markup document, create document abstraction. #+HEADER: :noweb yes #+BEGIN_SRC d <<doc_header_including_copyright_and_license>> -/++ - document abstraction: - abstraction of sisu markup for downstream processing - metadoc_from_src.d -+/ +// document abstraction: +// abstraction of sisu markup for downstream processing +// metadoc_from_src.d module doc_reform.meta.metadoc_from_src; template docAbstraction() { - /+ ↓ abstraction imports +/ + // ↓ abstraction imports <<docInitialize>> <<docAbstraction>> <<docSortOut>> @@ -60,11 +58,11 @@ import doc_reform.meta.rgx, doc_reform.meta.metadoc_object_setter, doc_reform.meta.rgx; -/+ ↓ abstraction mixins +/ +// ↓ abstraction mixins mixin ObjectSetter; mixin InternalMarkup; mixin spineRgxIn; -/+ ↓ abstraction struct init +/ +// ↓ abstraction struct init @safe static auto eN() { struct _e { enum bi { @@ -117,7 +115,7 @@ mixin spineRgxIn; } return _e(); } -/+ initialize +/ +// initialize ObjGenericComposite[] the_document_toc_section, the_document_head_section, the_document_body_section, the_document_bibliography_section, the_document_glossary_section, the_document_blurb_section, the_document_xml_dom_tail_section; struct _theDoc { ObjGenericComposite[] toc; @@ -138,7 +136,7 @@ string[string] tag_in_seg; string lev_anchor_tag; string[string][string] tag_assoc; string[] lv0to3_tags; -/+ enum +/ +// enum enum DocStructMarkupHeading { h_sect_A, h_sect_B, @@ -153,26 +151,26 @@ enum DocStructMarkupHeading { } // header section A-D; header text 1-4 enum Status { off, on, } enum OCNtype { ocn, non, bkidx, } -/+ biblio variables +/ +// biblio variables string biblio_tag_name, biblio_tag_entry, st; string[] biblio_arr_json; string biblio_entry_str_json; JSONValue[] bib_arr_json; int bib_entry; -/+ counters +/ +// counters int cntr, previous_count, previous_length; bool reset_note_numbers = true; int[string] line_occur; int html_segnames_ptr = 0; int html_segnames_ptr_cntr = 0; int verse_line, heading_ptr; -/+ paragraph attributes +/ +// paragraph attributes int[string] indent; bool bullet = true; string content_non_header = "8"; static auto obj_im = ObjInlineMarkup(); static auto obj_att = ObjAttributes(); -/+ ocn +/ +// ocn struct OCNset { int digit; int object_number; @@ -302,9 +300,7 @@ enum DomTags { none, open, close, close_and_open, open_still, } } } } - debug(dom_magic_numbers) { - writeln("marked up: ", lev, ": ", dom); - } + debug(dom_magic_numbers) { writeln("marked up: ", lev, ": ", dom); } obj.metainfo.dom_structure_markedup_tags_status = dom.dup; return obj; } @@ -346,9 +342,7 @@ enum DomTags { none, open, close, close_and_open, open_still, } } } } - debug(dom_magic_numbers) { - writeln("collapsed: ", lev, ": ", dom); - } + debug(dom_magic_numbers) { writeln("collapsed: ", lev, ": ", dom); } obj.metainfo.dom_structure_collapsed_tags_status = dom.dup; return obj; } @@ -406,10 +400,10 @@ enum DomTags { none, open, close, close_and_open, open_still, } } return obj_txt; } -/+ book index variables +/ +// book index variables string book_idx_tmp; string[][string][string] bookindex_unordered_hashes; -/+ node +/ +// node ObjGenericComposite comp_obj_heading, comp_obj_location, comp_obj_block, comp_obj_code, comp_obj_poem_ocn, comp_obj_comment; auto node_construct = NodeStructureMetadata(); enum sObj { content, anchor_tag, notes_reg, notes_star, links, image_no_dimensions } @@ -526,7 +520,7 @@ struct retStruct_flow_table_substantive_munge { bool _new_doc ) { static auto rgx = RgxI(); - /+ ↓ abstraction init +/ + // ↓ abstraction init scope(success) { } scope(failure) { @@ -667,7 +661,7 @@ struct retStruct_flow_table_substantive_munge { string[][string] lev4_subtoc; string[][string] segnames = ["html": ["toc"], "epub": ["toc"]]; int cnt1 = 1; int cnt2 = 1; int cnt3 = 1; - /+ abstraction init ↑ +/ + // abstraction init ↑ enum Substitute { match, markup, } debug (substitutions) { writeln(__LINE__, ":", __FILE__, ": DEBUG substitutions:"); @@ -709,9 +703,9 @@ struct retStruct_flow_table_substantive_munge { _loopMarkupSrcByLineStruct ret; srcDocLoopLineByLine_: foreach (line; markup_sourcefile_content) { - /+ ↓ markup document/text line by line +/ + // ↓ markup document/text line by line // "line" variable can be empty but should never be null - /+ scope +/ + // scope scope(exit) { } scope(failure) { stderr.writefln( @@ -721,17 +715,13 @@ struct retStruct_flow_table_substantive_munge { manifested.src.filename, line, ); } - debug(source) { - writeln(line); - } - debug(srclines) { - if (!line.empty) { writefln("* %s", line); } - } + debug(source) { writeln(line); } + debug(srclines) { if (!line.empty) { writefln("* %s", line); } } if (!line.empty) { pith = line._check_ocn_status_(pith); } if ( pith["block_is"] == eN.blk_is.code && pith["block_state"] == eN.blk_state.on ) { - /+ block object: code +/ + // block object: code { auto _get = line.txt_by_line_block_code(an_object, pith); an_object = _get.this_object; @@ -739,9 +729,9 @@ struct retStruct_flow_table_substantive_munge { } continue; } else if (!matchFirst(line, rgx.skip_from_regular_parse)) { - /+ object other than "code block" object +/ - /+ (includes regular text paragraph, headings & blocks other than code) +/ - /+ heading, glossary, blurb, poem, group, block, quote, table +/ + // object other than "code block" object + // (includes regular text paragraph, headings & blocks other than code) + // heading, glossary, blurb, poem, group, block, quote, table line = line.inline_markup_faces; // by text line (rather than by text object), linebreaks in para problematic if (line.matchFirst(rgx.heading_biblio) || (pith["section"] == eN.sect.bibliography @@ -774,11 +764,8 @@ struct retStruct_flow_table_substantive_munge { && (!(line.matchFirst(rgx.heading))) && (!(line.matchFirst(rgx.comment))))) ) { - /+ within section (block object): glossary +/ - debug(glossary) { - writeln(__LINE__); - writeln(line); - } + // within section (block object): glossary + debug(glossary) { writeln(__LINE__); writeln(line); } pith["section"] = eN.sect.glossary; if (opt_action.backmatter && opt_action.section_glossary) { indent = [ @@ -880,10 +867,7 @@ struct retStruct_flow_table_substantive_munge { && (!(line.matchFirst(rgx.comment))))) ) { pith["section"] = eN.sect.blurb; - debug(blurb) { - writeln(__LINE__); - writeln(line); - } + debug(blurb) { writeln(__LINE__); writeln(line); } if (opt_action.backmatter && opt_action.section_blurb) { indent = [ "hang_position" : 0, @@ -891,28 +875,20 @@ struct retStruct_flow_table_substantive_munge { ]; bullet = false; if (auto m = line.matchFirst(rgx.para_indent)) { - debug(paraindent) { - writeln(line); - } + debug(paraindent) { writeln(line); } indent["hang_position"] = (m["indent"]).to!int; indent["base_position"] = (m["indent"]).to!int; } else if (line.matchFirst(rgx.para_bullet)) { - debug(parabullet) { - writeln(line); - } + debug(parabullet) { writeln(line); } bullet = true; } else if (auto m = line.matchFirst(rgx.para_indent_hang)) { - debug(paraindenthang) { - writeln(line); - } + debug(paraindenthang) { writeln(line); } indent = [ "hang_position" : (m["hang"]).to!int, "base_position" : (m["indent"]).to!int, ]; } else if (auto m = line.matchFirst(rgx.para_bullet_indent)) { - debug(parabulletindent) { - writeln(line); - } + debug(parabulletindent) { writeln(line); } indent = [ "hang_position" : (m["indent"]).to!int, "base_position" : (m["indent"]).to!int, @@ -1093,7 +1069,7 @@ struct retStruct_flow_table_substantive_munge { continue; } } else { - /+ not within a block group +/ + // not within a block group assert( (pith["block_state"] == eN.blk_state.off) || (pith["block_state"] == eN.blk_state.closing), @@ -1101,7 +1077,7 @@ struct retStruct_flow_table_substantive_munge { ); if (line.matchFirst(rgx.block_open)) { if (line.matchFirst(rgx.block_poem_open)) { - /+ poem to verse exceptions! +/ + // poem to verse exceptions! object_reset(an_object); processing.remove("verse"); object_number_poem["start"] = obj_cite_digits.object_number.to!string; @@ -1116,7 +1092,7 @@ struct retStruct_flow_table_substantive_munge { } continue; } else if (!line.empty) { - /+ line not empty - non blocks (headings, paragraphs) & closed blocks +/ + // line not empty - non blocks (headings, paragraphs) & closed blocks assert( !line.empty, "line tested, line not empty surely:\n \"" ~ line ~ "\"" @@ -1127,10 +1103,7 @@ struct retStruct_flow_table_substantive_munge { "code block status: none or closed" ); if (pith["block_state"] == eN.blk_state.closing) { - debug(check) { - writeln(__LINE__); - writeln(line); - } + debug(check) { writeln(__LINE__); writeln(line); } assert( line.matchFirst(rgx.book_index_item) || line.matchFirst(rgx.book_index_item_open) @@ -1142,7 +1115,7 @@ struct retStruct_flow_table_substantive_munge { if (line.matchFirst(rgx.book_index_item) || line.matchFirst(rgx.book_index_item_open) || pith["section"] == eN.sect.book_index) { - /+ book_index +/ + // book_index { auto _get = line.flow_book_index_(an_object, book_idx_tmp, pith, opt_action); { @@ -1152,13 +1125,11 @@ struct retStruct_flow_table_substantive_munge { } } } else { - /+ not book_index +/ + // not book_index an_object_key = "body_nugget"; if (auto m = line.matchFirst(rgx.comment)) { - /+ matched comment +/ - debug(comment) { - writeln(line); - } + // matched comment + debug(comment) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; comp_obj_comment = comp_obj_comment.init; comp_obj_comment.metainfo.is_of_part = "comment"; // breaks flow @@ -1180,10 +1151,10 @@ struct retStruct_flow_table_substantive_munge { } else if ((line_occur["para"] == eN.bi.off && line_occur["heading"] == eN.bi.off) && pith["txt_is"] == eN.txt_is.off - ) { /+ heading or para but neither flag nor line exists +/ + ) { // heading or para but neither flag nor line exists if ((conf_make_meta.make.headings.length > 2) && (pith["make_headings"] == eN.bi.off)) { - /+ heading found +/ + // heading found { auto _get = line.flow_heading_found_(heading_match_str, conf_make_meta.make.headings, heading_match_rgx, pith); { @@ -1198,7 +1169,7 @@ struct retStruct_flow_table_substantive_munge { && line_occur["heading"] == eN.bi.off) && pith["txt_is"] == eN.txt_is.off ) { - /+ heading make set +/ + // heading make set { auto _get = line.flow_heading_make_set_(line_occur, heading_match_rgx, pith); { @@ -1208,14 +1179,13 @@ struct retStruct_flow_table_substantive_munge { } } } - /+ TODO node info: all headings identified at this point, - - extract node info here?? - - how long can it wait? - - should be incorporated in composite objects - - should happen before endnote links set (they need to be moved down?) - +/ + // TODO node info: all headings identified at this point, + // - extract node info here?? + // - how long can it wait? + // - should be incorporated in composite objects + // - should happen before endnote links set (they need to be moved down?) if (line.matchFirst(rgx.headings)) { - /+ heading match +/ + // heading match line = line._doc_header_and_make_substitutions_(conf_make_meta); { auto _get = line.flow_heading_matched_( @@ -1233,7 +1203,7 @@ struct retStruct_flow_table_substantive_munge { } } } else if (line_occur["para"] == eN.bi.off) { - /+ para match +/ + // para match an_object_key = "body_nugget"; line = line ._doc_header_and_make_substitutions_(conf_make_meta) @@ -1251,17 +1221,13 @@ struct retStruct_flow_table_substantive_munge { } } } else if (line_occur["heading"] > eN.bi.off) { - /+ heading +/ - debug(heading) { - writeln(line); - } + // heading + debug(heading) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; ++line_occur["heading"]; } else if (line_occur["para"] > eN.bi.off) { - /+ paragraph +/ - debug(para) { - writeln(an_object_key, "-> ", line); - } + // paragraph + debug(para) { writeln(an_object_key, "-> ", line); } line = line ._doc_header_and_make_substitutions_(conf_make_meta) ._doc_header_and_make_substitutions_fontface_(conf_make_meta); @@ -1270,7 +1236,7 @@ struct retStruct_flow_table_substantive_munge { } } } else if (pith["block_state"] == eN.blk_state.closing) { - /+ line empty, with blocks flag +/ + // line empty, with blocks flag { auto _get = line.flow_block_flag_line_empty_( an_object, @@ -1296,7 +1262,7 @@ struct retStruct_flow_table_substantive_munge { } } } else { - /+ line.empty, post contents, empty variables: +/ + // line.empty, post contents, empty variables: assert( line.empty, "\nline should be empty:\n \"" @@ -1314,7 +1280,7 @@ struct retStruct_flow_table_substantive_munge { if (pith["txt_is"] == eN.txt_is.heading && line_occur["heading"] > eN.bi.off ) { - /+ heading object (current line empty) +/ + // heading object (current line empty) obj_cite_digits = (an_object["lev_markup_number"].to!int == 0) ? ocn_emit(eN.ocn.reset) : ocn_emit(pith["ocn"]); @@ -1341,7 +1307,7 @@ struct retStruct_flow_table_substantive_munge { tag_assoc[anchor_tag]["seg_lv4"] = tag_in_seg["seg_lv4"]; tag_assoc[anchor_tag]["seg_lv1to4"] = tag_in_seg["seg_lv1to4"]; if (lv0to3_tags.length > 0) { - /+ names used for html markup segments 1 to 4 (rather than epub which has separate segments for A to D) +/ + // names used for html markup segments 1 to 4 (rather than epub which has separate segments for A to D) foreach (lv0_to_lv3_html_tag; lv0to3_tags) { tag_assoc[lv0_to_lv3_html_tag]["seg_lv4"] = anchor_tag; } @@ -1357,7 +1323,7 @@ struct retStruct_flow_table_substantive_munge { } else if (an_object["lev_markup_number"].to!int < 4) { string segn; switch (an_object["lev_markup_number"].to!int) { - /+ names used for epub markup segments A to D +/ + // names used for epub markup segments A to D case 0: segn = "_the_title"; goto default; @@ -1385,8 +1351,8 @@ struct retStruct_flow_table_substantive_munge { = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; bookindex_unordered_hashes = bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_digits, tag_in_seg); - /+ (incrementally build toc) table of contents here! +/ _anchor_tag = obj_cite_digits.identifier; + // (incrementally build toc) table of contents here! { auto _get = obj_im.flow_table_of_contents_gather_headings( an_object, @@ -1434,9 +1400,7 @@ struct retStruct_flow_table_substantive_munge { writeln(tag_in_seg["seg_lv1to4"]); } the_document_body_section ~= comp_obj_heading; - debug(objectrelated1) { // check - writeln(line); - } + debug(objectrelated1) { writeln(line); } // check { auto _get = txt_by_line_common_reset_(line_occur, an_object, pith); { @@ -1451,7 +1415,7 @@ struct retStruct_flow_table_substantive_munge { ++cntr; } else if (pith["txt_is"] == eN.txt_is.para && line_occur["para"] > eN.bi.off - ) { /+ paragraph object (current line empty) - repeated character paragraph separator +/ + ) { // paragraph object (current line empty) - repeated character paragraph separator if ((an_object[an_object_key].to!string).matchFirst(rgx.repeated_character_line_separator)) { pith["ocn"] = eN.ocn.off; } @@ -1516,7 +1480,7 @@ struct retStruct_flow_table_substantive_munge { } // close else for line empty } // close else for not the above } // close after non code, other blocks or regular text - /+ unless (the_document_body_section.length == 0) ? +/ + // unless (the_document_body_section.length == 0) ? if (the_document_body_section.length > 0) { if (((the_document_body_section[$-1].metainfo.is_a == "para") || (the_document_body_section[$-1].metainfo.is_a == "heading") @@ -1530,7 +1494,7 @@ struct retStruct_flow_table_substantive_munge { pith["section"] = eN.sect.unset; } if (the_document_body_section[$-1].metainfo.is_a == "verse") { - /+ scan for endnotes for whole poem (each verse in poem) +/ + // scan for endnotes for whole poem (each verse in poem) foreach (i; previous_length .. the_document_body_section.length) { if (the_document_body_section[i].metainfo.is_a == "verse") { if ((the_document_body_section[i].text).match( @@ -1545,7 +1509,7 @@ struct retStruct_flow_table_substantive_munge { } } } else { - /+ scan object for endnotes +/ + // scan object for endnotes previous_length = the_document_body_section.length.to!int; if ((the_document_body_section[$-1].text).match( rgx.inline_notes_al_all_note @@ -1610,13 +1574,8 @@ struct retStruct_flow_table_substantive_munge { auto the_document_endnotes_section = en_tuple[0]; obj_cite_digits = en_tuple[1]; debug(endnotes) { - writefln("%s %s", - __LINE__, - the_document_endnotes_section.length - ); - foreach (o; the_document_endnotes_section) { - writeln(o); - } + writefln("%s %s", __LINE__, the_document_endnotes_section.length); + foreach (o; the_document_endnotes_section) { writeln(o); } } if (an_object["glossary_nugget"].length == 0) { comp_obj_heading_ = comp_obj_heading_.init; @@ -1636,11 +1595,7 @@ struct retStruct_flow_table_substantive_munge { comp_obj_heading_.metainfo.parent_lev_markup = 0; the_document_glossary_section ~= comp_obj_heading_; } - debug(glossary) { - foreach (gloss; the_document_glossary_section) { - writeln(gloss.text); - } - } + debug(glossary) { foreach (gloss; the_document_glossary_section) { writeln(gloss.text); } } auto biblio_unsorted_incomplete = biblio_arr_json.dup; auto biblio = Bibliography(); JSONValue[] biblio_ordered; @@ -1756,11 +1711,7 @@ struct retStruct_flow_table_substantive_munge { comp_obj_heading_.metainfo.parent_lev_markup = 0; the_document_bibliography_section ~= comp_obj_heading_; } - debug(bibliosection) { - foreach (o; the_document_bibliography_section) { - writeln(o.text); - } - } + debug(bibliosection) { foreach (o; the_document_bibliography_section) { writeln(o.text); } } auto bi = BookIndexReportSection(); auto bi_tuple = bi.bookindex_build_abstraction_section( @@ -1771,11 +1722,7 @@ struct retStruct_flow_table_substantive_munge { destroy(bookindex_unordered_hashes); auto the_document_bookindex_section = bi_tuple[0]; obj_cite_digits = bi_tuple[1]; - debug(bookindex) { - foreach (bi_entry; the_document_bookindex_section) { - writeln(bi_entry); - } - } + debug(bookindex) { foreach (bi_entry; the_document_bookindex_section) { writeln(bi_entry); } } if (an_object["blurb_nugget"].length == 0) { comp_obj_heading_ = comp_obj_heading_.init; comp_obj_heading_.metainfo.is_of_part = "empty"; @@ -1796,11 +1743,7 @@ struct retStruct_flow_table_substantive_munge { comp_obj_heading_.metainfo.parent_lev_markup = 0; the_document_blurb_section ~= comp_obj_heading_; } - debug(blurb) { - foreach (blurb; the_document_blurb_section) { - writeln(blurb.text); - } - } + debug(blurb) { foreach (blurb; the_document_blurb_section) { writeln(blurb.text); } } indent = [ "hang_position" : 1, "base_position" : 1, @@ -1888,10 +1831,7 @@ struct retStruct_flow_table_substantive_munge { the_document_toc_section ~= comp_obj_toc; } debug(toc) { - writefln( - "%s %s", - __LINE__, - ); + writefln( "%s %s", __LINE__,); foreach (toc_linked_heading; the_document_toc_section) { writeln(mkup.indent_by_spaces_provided(toc_linked_heading.attrib.indent_hang), toc_linked_heading.text); } @@ -1900,9 +1840,7 @@ struct retStruct_flow_table_substantive_munge { the_document_body_section = the_document_body_section[1..$]; @safe int[] _get_ancestors_markup(O)(O obj, ref int[] _ancestors_markup) { if (obj.metainfo.is_a == "heading") { - debug(dom) { - writeln(obj.text); - } + debug(dom) { writeln(obj.text); } if (obj.metainfo.heading_lev_markup == 1) { _ancestors_markup = [ _ancestors_markup[0], @@ -1980,9 +1918,7 @@ struct retStruct_flow_table_substantive_munge { } _ancestors_markup[obj.metainfo.heading_lev_markup] = obj.metainfo.ocn; } - debug(ancestor_markup) { - writeln("marked up: ", _ancestors_markup); - } + debug(ancestor_markup) { writeln("marked up: ", _ancestors_markup); } return _ancestors_markup; } @safe int[] _get_ancestors_collapsed(O)(O obj, ref int[] _ancestors_collapsed) { @@ -2064,12 +2000,10 @@ struct retStruct_flow_table_substantive_munge { } _ancestors_collapsed[obj.metainfo.heading_lev_collapsed] = obj.metainfo.ocn; } - debug(ancestor_collapsed) { - writeln("collapsed: ", _ancestors_collapsed); - } + debug(ancestor_collapsed) { writeln("collapsed: ", _ancestors_collapsed); } return _ancestors_collapsed; } - /+ multiple 1~ levels, loop through document body +/ + // multiple 1~ levels, loop through document body if (the_document_body_section.length > 1) { int[] _ancestors_markup = [0,0,0,0,0,0,0,0]; int[][] _ancestors_markup_; @@ -2231,14 +2165,12 @@ struct retStruct_flow_table_substantive_munge { int max_width = 640; foreach (img; obj.text.matchAll(rgx.inline_image_without_dimensions)) { try { - read_image_info(manifested.src.image_dir_path ~ "/" ~ img["img"], w, h, chans); // + read_image_info(manifested.src.image_dir_path ~ "/" ~ img["img"], w, h, chans); } catch (Exception ex) { writeln("WARNING, image not found: ", img["img"], "\n ", manifested.src.image_dir_path ~ "/" ~ img["img"]); } // calculate, decide max width and proportionally reduce to keep w & h within it - debug(images) { - writeln("width: ", w, ", height: ", h); - } + debug(images) { writeln("width: ", w, ", height: ", h); } if (w > max_width) { _w = max_width; _h = round((max_width / w.to!real) * h.to!real); @@ -2257,9 +2189,7 @@ struct retStruct_flow_table_substantive_munge { ) ); } - debug(images) { - writeln("image without dimensions: ", obj.text); - } + debug(images) { writeln("image without dimensions: ", obj.text); } } return obj; } @@ -2284,22 +2214,19 @@ struct retStruct_flow_table_substantive_munge { } foreach (ref obj; the_document_head_section) { if (obj.metainfo.is_a == "heading") { - debug(dom) { - writeln(obj.text); - } + debug(dom) { writeln(obj.text); } if (obj.metainfo.heading_lev_markup <= 4) { segnames_0_to_4 ~= obj.tags.segment_anchor_tag_epub; } if (obj.metainfo.heading_lev_markup == 0) { - /+ TODO second hit (of two) with same assertion failure, check, fix and reinstate - assert( obj.metainfo.ocn == 1, - "Title OCN should be 1 not: " ~ obj.metainfo.ocn.to!string); // bug introduced 0.18.1 - +/ + // TODO second hit (of two) with same assertion failure, check, fix and reinstate + // assert( obj.metainfo.ocn == 1, + // "Title OCN should be 1 not: " ~ obj.metainfo.ocn.to!string); // bug introduced 0.18.1 obj.metainfo.ocn = 1; obj.metainfo.identifier = "1"; obj.metainfo.object_number_type = OCNtype.ocn; } - /+ dom structure (marked up & collapsed) +/ + // dom structure (marked up & collapsed) if (opt_action.meta_processing_xml_dom) { obj = obj.obj_dom_structure_set_markup_tags(dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); obj = obj.obj_dom_set_collapsed_tags(dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); @@ -2309,7 +2236,7 @@ struct retStruct_flow_table_substantive_munge { obj = _links(obj); } if (the_document_toc_section.length > 1) { - /+ scroll +/ + // scroll dom_structure_markedup_tags_status_buffer = dom_structure_markedup_tags_status.dup; dom_structure_collapsed_tags_status_buffer = dom_structure_collapsed_tags_status.dup; foreach (ref obj; the_document_toc_section) { @@ -2322,7 +2249,7 @@ struct retStruct_flow_table_substantive_munge { obj.tags.anchor_tag_html ~ "!=" ~ segnames["html"][obj.ptr.html_segnames]); } } - /+ dom structure (marked up & collapsed) +/ + // dom structure (marked up & collapsed) if (opt_action.meta_processing_xml_dom) { obj = obj.obj_dom_structure_set_markup_tags(dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); obj = obj.obj_dom_set_collapsed_tags(dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); @@ -2332,7 +2259,7 @@ struct retStruct_flow_table_substantive_munge { obj = _links(obj); } } - /+ multiple 1~ levels, loop through document body +/ + // multiple 1~ levels, loop through document body if (the_document_body_section.length > 1) { foreach (ref obj; the_document_body_section) { if (!(obj.metainfo.identifier.empty)) { @@ -2346,9 +2273,7 @@ struct retStruct_flow_table_substantive_munge { = obj.tags.epub_segment_anchor_tag_is; } if (obj.metainfo.is_a == "heading") { - debug(dom) { - writeln(obj.text); - } + debug(dom) { writeln(obj.text); } if (obj.metainfo.heading_lev_markup <= 4) { segnames_0_to_4 ~= obj.tags.segment_anchor_tag_epub; if (obj.metainfo.heading_lev_markup == 4) { @@ -2361,7 +2286,7 @@ struct retStruct_flow_table_substantive_munge { obj.tags.anchor_tag_html ~ "!=" ~ segnames["html"][obj.ptr.html_segnames]); } } - /+ dom structure (marked up & collapsed) +/ + // dom structure (marked up & collapsed) if (opt_action.meta_processing_xml_dom) { obj = obj.obj_dom_structure_set_markup_tags(dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); obj = obj.obj_dom_set_collapsed_tags(dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); @@ -2375,7 +2300,7 @@ struct retStruct_flow_table_substantive_munge { } } auto image_list = (_images.sort()).uniq; - /+ optional only one 1~ level +/ + // optional only one 1~ level if (the_document_endnotes_section.length > 1) { dom_structure_markedup_tags_status_buffer = dom_structure_markedup_tags_status.dup; dom_structure_collapsed_tags_status_buffer = dom_structure_collapsed_tags_status.dup; @@ -2383,9 +2308,7 @@ struct retStruct_flow_table_substantive_munge { dom_structure_collapsed_tags_status = dom_structure_collapsed_tags_status_buffer.dup; foreach (ref obj; the_document_endnotes_section) { if (obj.metainfo.is_a == "heading") { - debug(dom) { - writeln(obj.text); - } + debug(dom) { writeln(obj.text); } if (obj.metainfo.heading_lev_markup == 1) { obj_cite_digits = ocn_emit(eN.ocn.on); obj.metainfo.ocn = obj_cite_digits.object_number; @@ -2402,7 +2325,7 @@ struct retStruct_flow_table_substantive_munge { obj.tags.anchor_tag_html ~ "!=" ~ segnames["html"][obj.ptr.html_segnames]); } } - /+ dom structure (marked up & collapsed) +/ + // dom structure (marked up & collapsed) if (opt_action.meta_processing_xml_dom) { obj = obj.obj_dom_structure_set_markup_tags(dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); obj = obj.obj_dom_set_collapsed_tags(dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); @@ -2412,13 +2335,11 @@ struct retStruct_flow_table_substantive_munge { obj = _links(obj); } } - /+ optional only one 1~ level +/ + // optional only one 1~ level if (the_document_glossary_section.length > 1) { foreach (ref obj; the_document_glossary_section) { if (obj.metainfo.is_a == "heading") { - debug(dom) { - writeln(obj.text); - } + debug(dom) { writeln(obj.text); } if (obj.metainfo.heading_lev_markup == 1) { obj_cite_digits = ocn_emit(eN.ocn.on); obj.metainfo.ocn = obj_cite_digits.object_number; @@ -2435,7 +2356,7 @@ struct retStruct_flow_table_substantive_munge { obj.tags.anchor_tag_html ~ "!=" ~ segnames["html"][obj.ptr.html_segnames]); } } - /+ dom structure (marked up & collapsed) +/ + // dom structure (marked up & collapsed) if (opt_action.meta_processing_xml_dom) { obj = obj.obj_dom_structure_set_markup_tags(dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); obj = obj.obj_dom_set_collapsed_tags(dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); @@ -2449,13 +2370,11 @@ struct retStruct_flow_table_substantive_munge { obj = _links(obj); } } - /+ optional only one 1~ level +/ + // optional only one 1~ level if (the_document_bibliography_section.length > 1) { foreach (ref obj; the_document_bibliography_section) { if (obj.metainfo.is_a == "heading") { - debug(dom) { - writeln(obj.text); - } + debug(dom) { writeln(obj.text); } if (obj.metainfo.heading_lev_markup == 1) { obj_cite_digits = ocn_emit(eN.ocn.on); obj.metainfo.ocn = obj_cite_digits.object_number; @@ -2472,7 +2391,7 @@ struct retStruct_flow_table_substantive_munge { obj.tags.anchor_tag_html ~ "!=" ~ segnames["html"][obj.ptr.html_segnames]); } } - /+ dom structure (marked up & collapsed) +/ + // dom structure (marked up & collapsed) if (opt_action.meta_processing_xml_dom) { obj = obj.obj_dom_structure_set_markup_tags(dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); obj = obj.obj_dom_set_collapsed_tags(dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); @@ -2486,17 +2405,16 @@ struct retStruct_flow_table_substantive_munge { obj = _links(obj); } } - /+ optional only one 1~ level +/ + // optional only one 1~ level int ocn_ = obj_cite_digits.object_number; int ocn_bkidx_ = 0; int ocn_bidx_; - if (the_document_bookindex_section.length > 1) { /+ scroll +/ + if (the_document_bookindex_section.length > 1) { // scroll dom_structure_markedup_tags_status_buffer = dom_structure_markedup_tags_status.dup; dom_structure_collapsed_tags_status_buffer = dom_structure_collapsed_tags_status.dup; foreach (ref obj; the_document_bookindex_section) { if (obj.metainfo.is_a == "heading") { - debug(dom) { - } + // debug(dom) { } if (obj.metainfo.heading_lev_markup <= 4) { segnames_0_to_4 ~= obj.tags.segment_anchor_tag_epub; } @@ -2515,7 +2433,7 @@ struct retStruct_flow_table_substantive_munge { obj.tags.anchor_tag_html ~ "!=" ~ segnames["html"][obj.ptr.html_segnames]); } } - /+ dom structure (marked up & collapsed) +/ + // dom structure (marked up & collapsed) if (opt_action.meta_processing_xml_dom) { obj = obj.obj_dom_structure_set_markup_tags(dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); obj = obj.obj_dom_set_collapsed_tags(dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); @@ -2530,18 +2448,14 @@ struct retStruct_flow_table_substantive_munge { } obj = _links(obj); } - /+ TODO assert failure, reinstate - assert(obj_cite_digit_bkidx == ocn_bidx_ - obj_cite_digit_bkidx ~ " == ocn_" ~ ocn_ ~ "?"); - +/ + // TODO assert failure, reinstate + // assert(obj_cite_digit_bkidx == ocn_bidx_ obj_cite_digit_bkidx ~ " == ocn_" ~ ocn_ ~ "?"); } - /+ optional only one 1~ level +/ + // optional only one 1~ level if (the_document_blurb_section.length > 1) { foreach (ref obj; the_document_blurb_section) { if (obj.metainfo.is_a == "heading") { - debug(dom) { - writeln(obj.text); - } + debug(dom) { writeln(obj.text); } if (obj.metainfo.heading_lev_markup == 1) { obj_cite_digits = ocn_emit(eN.ocn.on); obj.metainfo.ocn = obj_cite_digits.object_number; @@ -2558,7 +2472,7 @@ struct retStruct_flow_table_substantive_munge { obj.tags.anchor_tag_html ~ "!=" ~ segnames["html"][obj.ptr.html_segnames]); } } - /+ dom structure (marked up & collapsed) +/ + // dom structure (marked up & collapsed) if (opt_action.meta_processing_xml_dom) { obj = obj.obj_dom_structure_set_markup_tags(dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); obj = obj.obj_dom_set_collapsed_tags(dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); @@ -2585,7 +2499,7 @@ struct retStruct_flow_table_substantive_munge { ); debug(decendants_tuple) { pairs = pairs.sort(); - foreach (pair; pairs) { // (pair; pairs.sort()) + foreach (pair; pairs) { // (pair; pairs.sort()) writeln(pair[0], "..", pair[1]); } } @@ -2676,12 +2590,11 @@ struct retStruct_flow_table_substantive_munge { } } } - /+ TODO - - note create/insert heading object sole purpose eof close all open tags - sort out: - - obj.metainfo.dom_structure_markedup_tags_status = dom_structure_markedup_tags_status; - - obj.metainfo.dom_structure_collapsed_tags_status = dom_structure_collapsed_tags_status; - +/ + // TODO + // - note create/insert heading object sole purpose eof close all open tags + // sort out: + // - obj.metainfo.dom_structure_markedup_tags_status = dom_structure_markedup_tags_status; + // - obj.metainfo.dom_structure_collapsed_tags_status = dom_structure_collapsed_tags_status; comp_obj_heading_ = comp_obj_heading_.init; comp_obj_heading_.metainfo.is_of_part = "empty"; comp_obj_heading_.metainfo.is_of_section = "empty"; @@ -2710,15 +2623,15 @@ struct retStruct_flow_table_substantive_munge { ObjGenericComposite[][string] document_the = [ "head": the_document_head_section, "toc": the_document_toc_section, - /+ substantive/body: +/ + // substantive/body: "body": the_document_body_section, - /+ backmatter: +/ + // backmatter: "endnotes": the_document_endnotes_section, "glossary": the_document_glossary_section, "bibliography": the_document_bibliography_section, "bookindex": the_document_bookindex_section, "blurb": the_document_blurb_section, - /+ dom tail only +/ + // dom tail only "tail": the_document_xml_dom_tail_section, ]; string[][string] document_section_keys_sequenced = [ @@ -2853,7 +2766,7 @@ struct retStruct_flow_table_substantive_munge { ret.doc_has = doc_has; } return ret; -} /+ ← closed: abstract doc source +/ +} // ← closed: abstract doc source #+END_SRC ** sort @@ -2890,12 +2803,7 @@ struct retStruct_flow_table_substantive_munge { an_object["lang"] = ""; an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : ""; an_object["syntax"] = (m["syntax"]) ? m["syntax"].to!string : ""; - debug(codecurly) { // code (curly) open - writefln( - "* [code curly] %s", - line - ); - } + debug(codecurly) { writefln( "* [code curly] %s", line); } // code (curly) open pith["block_is"] = eN.blk_is.code; pith["block_state"] = eN.blk_state.on; pith["block_delim"] = eN.blk_delim.curly; @@ -2904,12 +2812,7 @@ struct retStruct_flow_table_substantive_munge { an_object["syntax"] = ""; an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : ""; an_object["lang"] = (m["lang"]) ? m["lang"].to!string : ""; - debug(poem) { // poem (curly) open - writefln( - "* [poem curly] %s", - line - ); - } + debug(poem) { writefln( "* [poem curly] %s", line); } // poem (curly) open object_number_poem["start"] = obj_cite_digits.object_number.to!string; pith["block_is"] = eN.blk_is.poem; pith["block_state"] = eN.blk_state.on; @@ -2920,12 +2823,7 @@ struct retStruct_flow_table_substantive_munge { an_object["syntax"] = ""; an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : ""; an_object["lang"] = (m["lang"]) ? m["lang"].to!string : ""; - debug(group) { // group (curly) open - writefln( - "* [group curly] %s", - line - ); - } + debug(group) { writefln( "* [group curly] %s", line); } // group (curly) open pith["block_is"] = eN.blk_is.group; pith["block_state"] = eN.blk_state.on; pith["block_delim"] = eN.blk_delim.curly; @@ -2934,12 +2832,7 @@ struct retStruct_flow_table_substantive_munge { an_object["syntax"] = ""; an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : ""; an_object["lang"] = (m["lang"]) ? m["lang"].to!string : ""; - debug(block) { - writefln( - "* [block curly] %s", - line - ); - } + debug(block) { writefln( "* [block curly] %s", line); } pith["block_is"] = eN.blk_is.block; pith["block_state"] = eN.blk_state.on; pith["block_delim"] = eN.blk_delim.curly; @@ -2948,29 +2841,19 @@ struct retStruct_flow_table_substantive_munge { an_object["syntax"] = ""; an_object["attrib"] = m["attrib"].to!string; an_object["lang"] = m["lang"].to!string; - debug(quote) { - writefln( - "* [quote curly] %s", - line - ); - } + debug(quote) { writefln( "* [quote curly] %s", line); } pith["block_is"] = eN.blk_is.quote; pith["block_state"] = eN.blk_state.on; pith["block_delim"] = eN.blk_delim.curly; - } else if (auto m = line.matchFirst(rgx.block_curly_table_open)) { /+ curly table open +/ - debug(table) { // table (curly) open - writefln( - "* [table curly] %s", - line - ); - } + } else if (auto m = line.matchFirst(rgx.block_curly_table_open)) { // curly table open + debug(table) { writefln( "* [table curly] %s", line); } dochas["table"] ++; an_object["table_head"] = m["attrib"].to!string; an_object["block_type"] = "curly"; pith["block_is"] = eN.blk_is.table; pith["block_state"] = eN.blk_state.on; pith["block_delim"] = eN.blk_delim.curly; - } else if (auto m = line.matchFirst(rgx.block_curly_table_special_markup)) { /+ table: special table block markup syntax! +/ + } else if (auto m = line.matchFirst(rgx.block_curly_table_special_markup)) { // table: special table block markup syntax! dochas["table"]++; an_object["table_head"] = m["attrib"].to!string; an_object["block_type"] = "special"; @@ -2982,12 +2865,7 @@ struct retStruct_flow_table_substantive_munge { an_object["lang"] = ""; an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : ""; an_object["syntax"] = (m["syntax"]) ? m["syntax"].to!string : ""; - debug(codetic) { - writefln( - "* [code tic] %s", - line - ); - } + debug(codetic) { writefln( "* [code tic] %s", line); } pith["block_is"] = eN.blk_is.code; pith["block_state"] = eN.blk_state.on; pith["block_delim"] = eN.blk_delim.tic; @@ -2996,12 +2874,7 @@ struct retStruct_flow_table_substantive_munge { an_object["syntax"] = ""; an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : ""; an_object["lang"] = (m["lang"]) ? m["lang"].to!string : ""; - debug(poem) { - writefln( - "* [poem tic] %s", - line - ); - } + debug(poem) { writefln( "* [poem tic] %s", line); } object_number_poem["start"] = obj_cite_digits.object_number.to!string; pith["block_is"] = eN.blk_is.poem; pith["block_state"] = eN.blk_state.on; @@ -3012,12 +2885,7 @@ struct retStruct_flow_table_substantive_munge { an_object["syntax"] = ""; an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : ""; an_object["lang"] = (m["lang"]) ? m["lang"].to!string : ""; - debug(group) { - writefln( - "* [group tic] %s", - line - ); - } + debug(group) { writefln( "* [group tic] %s", line); } pith["block_is"] = eN.blk_is.group; pith["block_state"] = eN.blk_state.on; pith["block_delim"] = eN.blk_delim.tic; @@ -3026,12 +2894,7 @@ struct retStruct_flow_table_substantive_munge { an_object["syntax"] = ""; an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : ""; an_object["lang"] = (m["lang"]) ? m["lang"].to!string : ""; - debug(block) { - writefln( - "* [block tic] %s", - line - ); - } + debug(block) { writefln( "* [block tic] %s", line); } pith["block_is"] = eN.blk_is.block; pith["block_state"] = eN.blk_state.on; pith["block_delim"] = eN.blk_delim.tic; @@ -3040,22 +2903,13 @@ struct retStruct_flow_table_substantive_munge { an_object["syntax"] = ""; an_object["attrib"] = m["attrib"].to!string; an_object["lang"] = m["lang"].to!string; - debug(quote) { // quote (tic) open - writefln( - "* [quote tic] %s", - line - ); + debug(quote) { writefln( "* [quote tic] %s", line); // quote (tic) open } pith["block_is"] = eN.blk_is.quote; pith["block_state"] = eN.blk_state.on; pith["block_delim"] = eN.blk_delim.tic; - } else if (auto m = line.matchFirst(rgx.block_tic_table_open)) { /+ tic table open +/ - debug(table) { // table (tic) open - writefln( - "* [table tic] %s", - line - ); - } + } else if (auto m = line.matchFirst(rgx.block_tic_table_open)) { // tic table open + debug(table) { writefln( "* [table tic] %s", line); } dochas["table"] ++; an_object["table_head"] = m["attrib"].to!string; an_object["block_type"] = "tic"; @@ -3080,32 +2934,24 @@ struct retStruct_flow_table_substantive_munge { if (pith["block_is"] == eN.blk_is.quote){ if (pith["block_delim"] == eN.blk_delim.curly) { if (line.matchFirst(rgx.block_curly_quote_close)) { - debug(quote) { - writeln(line); - } + debug(quote) { writeln(line); } an_object[an_object_key] = an_object[an_object_key].stripRight; pith["block_is"] = eN.blk_is.quote; pith["block_state"] = eN.blk_state.closing; pith["block_delim"] = eN.blk_delim.off; } else { - debug(quote) { - writeln(line); - } + debug(quote) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; } } else if (pith["block_delim"] == eN.blk_delim.tic) { if (line.matchFirst(rgx.block_tic_close)) { - debug(quote) { - writeln(line); - } + debug(quote) { writeln(line); } an_object[an_object_key] = an_object[an_object_key].stripRight; pith["block_is"] = eN.blk_is.quote; pith["block_state"] = eN.blk_state.closing; pith["block_delim"] = eN.blk_delim.off; } else { - debug(quote) { - writeln(line); - } + debug(quote) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; } } @@ -3126,32 +2972,24 @@ struct retStruct_flow_table_substantive_munge { if (pith["block_is"] == eN.blk_is.group) { if (pith["block_delim"] == eN.blk_delim.curly) { if (line.matchFirst(rgx.block_curly_group_close)) { - debug(group) { - writeln(line); - } + debug(group) { writeln(line); } an_object[an_object_key] = an_object[an_object_key].stripRight; pith["block_is"] = eN.blk_is.group; pith["block_state"] = eN.blk_state.closing; pith["block_delim"] = eN.blk_delim.off; } else { - debug(group) { - writeln(line); - } + debug(group) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; } } else if (pith["block_delim"] == eN.blk_delim.tic) { if (line.matchFirst(rgx.block_tic_close)) { - debug(group) { - writeln(line); - } + debug(group) { writeln(line); } an_object[an_object_key] = an_object[an_object_key].stripRight; pith["block_is"] = eN.blk_is.group; pith["block_state"] = eN.blk_state.closing; pith["block_delim"] = eN.blk_delim.off; } else { - debug(group) { - writeln(line); - } + debug(group) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; } } @@ -3172,32 +3010,24 @@ struct retStruct_flow_table_substantive_munge { if (pith["block_is"] == eN.blk_is.block) { if (pith["block_delim"] == eN.blk_delim.curly) { if (line.matchFirst(rgx.block_curly_block_close)) { - debug(block) { - writeln(line); - } + debug(block) { writeln(line); } an_object[an_object_key] = an_object[an_object_key].stripRight; pith["block_is"] = eN.blk_is.block; pith["block_state"] = eN.blk_state.closing; pith["block_delim"] = eN.blk_delim.off; } else { - debug(block) { - writeln(line); - } + debug(block) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; } } else if (pith["block_delim"] == eN.blk_delim.tic) { if (line.matchFirst(rgx.block_tic_close)) { - debug(block) { - writeln(line); - } + debug(block) { writeln(line); } an_object[an_object_key] = an_object[an_object_key].stripRight; pith["block_is"] = eN.blk_is.block; pith["block_state"] = eN.blk_state.closing; pith["block_delim"] = eN.blk_delim.off; } else { - debug(block) { - writeln(line); - } + debug(block) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; } } @@ -3225,30 +3055,16 @@ struct retStruct_flow_table_substantive_munge { if (an_object_key in an_object || processing.length > 0) { an_object[an_object_key] = ""; - debug(poem) { - writefln( - "* [poem curly] %s", - line - ); - } + debug(poem) { writefln( "* [poem curly] %s", line); } if (processing.length > 0) { an_object[an_object_key] = processing["verse"]; } debug(poem) { writeln(__LINE__); - writefln( - "* %s %s", - obj_cite_digits.object_number, - line - ); + writefln( "* %s %s", obj_cite_digits.object_number, line); } if (an_object.length > 0) { - debug(poem) { - writeln( - obj_cite_digits.object_number, - an_object[an_object_key] - ); - } + debug(poem) { writeln( obj_cite_digits.object_number, an_object[an_object_key]); } an_object["is"] = "verse"; TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); @@ -3294,8 +3110,7 @@ struct retStruct_flow_table_substantive_munge { if (pith["verse_new"] == eN.bi.on) { verse_line = 1; an_object[an_object_key] = processing["verse"]; - debug(poem) { - writefln( + debug(poem) { writefln( "* %s curly\n%s", obj_cite_digits.object_number, an_object[an_object_key] @@ -3343,20 +3158,12 @@ struct retStruct_flow_table_substantive_munge { } else if (pith["block_delim"] == eN.blk_delim.tic) { if (auto m = line.matchFirst(rgx.block_tic_close)) { an_object[an_object_key] = "verse"; - debug(poem) { - writefln( - "* [poem tic] %s", - line - ); - } + debug(poem) { writefln( "* [poem tic] %s", line); } if (processing.length > 0) { an_object[an_object_key] = processing["verse"]; } if (an_object.length > 0) { - debug(poem) { - writeln(__LINE__); - writeln(obj_cite_digits.object_number, line); - } + debug(poem) { writeln(__LINE__); writeln(obj_cite_digits.object_number, line); } processing.remove("verse"); an_object["is"] = "verse"; TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple @@ -3402,8 +3209,7 @@ struct retStruct_flow_table_substantive_munge { if (pith["verse_new"] == eN.bi.on) { verse_line = 1; an_object[an_object_key] = processing["verse"]; - debug(poem) { - writefln( + debug(poem) { writefln( "* %s tic\n%s", obj_cite_digits.object_number, an_object[an_object_key] @@ -3468,9 +3274,7 @@ struct retStruct_flow_table_substantive_munge { if ( pith["block_is"] == eN.blk_is.code) { if (pith["block_delim"] == eN.blk_delim.curly) { if (line.matchFirst(rgx.block_curly_code_close)) { - debug(codecurly) { - writeln(line); - } + debug(codecurly) { writeln(line); } an_object[an_object_key] = an_object[an_object_key] .replaceFirst(rgx.newline_eol_delimiter_only, "") .stripRight; @@ -3478,16 +3282,12 @@ struct retStruct_flow_table_substantive_munge { pith["block_state"] = eN.blk_state.closing; pith["block_delim"] = eN.blk_delim.off; } else { - debug(codecurly) { - writeln(line); - } + debug(codecurly) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; } } else if (pith["block_delim"] == eN.blk_delim.tic) { if (line.matchFirst(rgx.block_tic_close)) { - debug(codetic) { - writeln(line); - } + debug(codetic) { writeln(line); } an_object[an_object_key] = an_object[an_object_key] .replaceFirst(rgx.newline_eol_delimiter_only, "") .stripRight; @@ -3495,9 +3295,7 @@ struct retStruct_flow_table_substantive_munge { pith["block_state"] = eN.blk_state.closing; pith["block_delim"] = eN.blk_delim.off; } else { - debug(codetic) { - writeln(line); - } + debug(codetic) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; } } @@ -3519,16 +3317,12 @@ struct retStruct_flow_table_substantive_munge { if (pith["block_is"] == eN.blk_is.table) { if (pith["block_delim"] == eN.blk_delim.curly) { if (line.matchFirst(rgx.block_curly_table_close)) { - debug(table) { - writeln(line); - } + debug(table) { writeln(line); } pith["block_is"] = eN.blk_is.table; pith["block_state"] = eN.blk_state.closing; pith["block_delim"] = eN.blk_delim.off; } else { - debug(table) { - writeln(line); - } + debug(table) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; } } else if (pith["block_delim"] == eN.blk_delim.curly_special) { @@ -3556,23 +3350,17 @@ struct retStruct_flow_table_substantive_munge { } } } else { - debug(table) { - writeln(line); - } + debug(table) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; } } else if (pith["block_delim"] == eN.blk_delim.tic) { if (line.matchFirst(rgx.block_tic_close)) { - debug(table) { - writeln(line); - } + debug(table) { writeln(line); } pith["block_is"] = eN.blk_is.table; pith["block_state"] = eN.blk_state.closing; pith["block_delim"] = eN.blk_delim.off; } else { - debug(table) { - writeln(line); - } + debug(table) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; } } @@ -3624,12 +3412,8 @@ struct retStruct_flow_table_substantive_munge { } if (line.empty) { debug { - debug(biblioblock) { - writeln("---"); - } - debug(biblioblockinclude) { - writeln(biblio_entry_str_json.length); - } + debug(biblioblock) { writeln("---"); } + debug(biblioblockinclude) { writeln(biblio_entry_str_json.length); } } if ((bib_entry == eN.bi.off) && (biblio_entry_str_json.empty)) { @@ -3653,9 +3437,7 @@ struct retStruct_flow_table_substantive_munge { biblio_entry_str_json = ""; } } else if (line.matchFirst(rgx.biblio_tags)) { - debug(biblioblock) { - writeln(line); - } + debug(biblioblock) { writeln(line); } auto bt = line.match(rgx.biblio_tags); bib_entry = eN.bi.off; st = bt.captures[1].to!string; @@ -3665,10 +3447,7 @@ struct retStruct_flow_table_substantive_munge { ? (biblio_tag_map(st)) : st; j.object[biblio_tag_name] = header_tag_value; - debug(bibliounsortedcheckduplicates) { - writeln(biblio_tag_name, ": ", header_tag_value); - writeln("--"); - } + debug(bibliounsortedcheckduplicates) { writeln(biblio_tag_name, ": ", header_tag_value); writeln("--"); } switch (biblio_tag_name) { case "author_raw": // author_arr author (fn sn) j["author_arr"] @@ -3706,8 +3485,7 @@ struct retStruct_flow_table_substantive_munge { break; } auto s = j.toString(); - debug(biblio1) { - writefln( + debug(biblio1) { writefln( "* %s: %s\n%s", biblio_tag_name, biblio_tag_entry, @@ -3719,9 +3497,7 @@ struct retStruct_flow_table_substantive_munge { writeln("ERROR", s, "%%"); } if (!(match(line, rgx.comment))) { - debug(biblioblockinclude) { - writeln(line); - } + debug(biblioblockinclude) { writeln(line); } biblio_entry_str_json = s; } else { biblio_entry_str_json = ""; @@ -3737,7 +3513,7 @@ struct retStruct_flow_table_substantive_munge { } return ret; } - /+ ↓ abstraction functions +/ +// ↓ abstraction functions @safe static string[string] object_reset()(string[string] an_object) { an_object.remove("body_nugget"); an_object.remove("substantive"); @@ -3753,22 +3529,18 @@ struct retStruct_flow_table_substantive_munge { static auto rgx = RgxI(); if (!(line.empty)) { if (pith["no_ocn_multiple_objects"] == eN.bi.off) { - /+ not multi-line object, check whether object_number is on or turned off +/ - if (line.matchFirst(rgx.object_number_block_marks)) { /+ switch off object_number +/ + // not multi-line object, check whether object_number is on or turned off + if (line.matchFirst(rgx.object_number_block_marks)) { // switch off object_number if (line.matchFirst(rgx.object_number_off_block)) { pith["no_ocn_multiple_objects"] = eN.bi.on; pith["ocn"] = eN.ocn.off; - debug(ocnoff) { - writeln(line); - } + debug(ocnoff) { writeln(line); } } if (line.matchFirst(rgx.object_number_off_block_dummy_heading)) { pith["no_ocn_multiple_objects"] = eN.bi.on; pith["dummy_heading_multiple_objects"] = eN.bi.on; pith["ocn"] = eN.ocn.off; - debug(ocnoff) { - writeln(line); - } + debug(ocnoff) { writeln(line); } } } else if (pith["no_ocn_multiple_objects"] == eN.bi.off) { pith["dummy_heading_status"] = eN.bi.off; @@ -3792,9 +3564,7 @@ struct retStruct_flow_table_substantive_munge { pith["no_ocn_multiple_objects"] = eN.bi.off; pith["ocn"] = eN.ocn.on; pith["dummy_heading_status"] = eN.bi.off; - debug(ocnoff) { - writeln(line); - } + debug(ocnoff) { writeln(line); } } } } @@ -4237,37 +4007,26 @@ struct retStruct_flow_table_substantive_munge { B opt_action, ) { static auto rgx = RgxI(); - if (auto m = line.match(rgx.book_index_item)) { /+ match book_index +/ - debug(bookindexmatch) { - writefln( + if (auto m = line.match(rgx.book_index_item)) { // match book_index + debug(bookindexmatch) { writefln( "* [bookindex] %s\n", m["bookindex"].to!string, ); } an_object["bookindex_nugget"] = m.captures[1].to!string; - } else if (auto m = line.match(rgx.book_index_item_open)) { /+ match open book_index +/ + } else if (auto m = line.match(rgx.book_index_item_open)) { // match open book_index pith["section"] = eN.sect.book_index; if (opt_action.backmatter && opt_action.section_bookindex) { book_idx_tmp = m.captures[1].to!string; - debug(bookindexmatch) { - writefln( - "* [bookindex] %s\n", - book_idx_tmp, - ); - } + debug(bookindexmatch) { writefln( "* [bookindex] %s\n", book_idx_tmp,); } } - } else if (pith["section"] == eN.sect.book_index) { /+ book_index flag set +/ + } else if (pith["section"] == eN.sect.book_index) { // book_index flag set if (auto m = line.match(rgx.book_index_item_close)) { pith["section"] = eN.sect.unset; if (opt_action.backmatter && opt_action.section_bookindex) { an_object["bookindex_nugget"] = book_idx_tmp ~ m.captures[1].to!string; - debug(bookindexmatch) { - writefln( - "* [bookindex] %s\n", - book_idx_tmp, - ); - } + debug(bookindexmatch) { writefln( "* [bookindex] %s\n", book_idx_tmp,); } } book_idx_tmp = ""; } else { @@ -4294,10 +4053,8 @@ struct retStruct_flow_table_substantive_munge { ) { static auto rgx = RgxI(); if ((_make_unmarked_headings.length > 2) - && (pith["make_headings"] == eN.bi.off)) { /+ headings found +/ - debug(headingsfound) { - writeln(_make_unmarked_headings); - } + && (pith["make_headings"] == eN.bi.off)) { // headings found + debug(headingsfound) { writeln(_make_unmarked_headings); } debug(headingsfound) { writeln(_make_unmarked_headings.length); writeln(_make_unmarked_headings); @@ -4382,48 +4139,34 @@ struct retStruct_flow_table_substantive_munge { && (line_occur["para"] == eN.bi.off && line_occur["heading"] == eN.bi.off) && pith["txt_is"] == eN.txt_is.off - ) { /+ heading make set +/ + ) { // heading make set if (line.matchFirst(heading_match_rgx["h_B"])) { line = "B~ " ~ line; - debug(headingsfound) { - writeln(line); - } + debug(headingsfound) { writeln(line); } } if (line.matchFirst(heading_match_rgx["h_C"])) { line = "C~ " ~ line; - debug(headingsfound) { - writeln(line); - } + debug(headingsfound) { writeln(line); } } if (line.matchFirst(heading_match_rgx["h_D"])) { line = "D~ " ~ line; - debug(headingsfound) { - writeln(line); - } + debug(headingsfound) { writeln(line); } } if (line.matchFirst(heading_match_rgx["h_1"])) { line = "1~ " ~ line; - debug(headingsfound) { - writeln(line); - } + debug(headingsfound) { writeln(line); } } if (line.matchFirst(heading_match_rgx["h_2"])) { line = "2~ " ~ line; - debug(headingsfound) { - writeln(line); - } + debug(headingsfound) { writeln(line); } } if (line.matchFirst(heading_match_rgx["h_3"])) { line = "3~ " ~ line; - debug(headingsfound) { - writeln(line); - } + debug(headingsfound) { writeln(line); } } if (line.matchFirst(heading_match_rgx["h_4"])) { line = "4~ " ~ line; - debug(headingsfound) { - writeln(line); - } + debug(headingsfound) { writeln(line); } } } retStruct_flow_heading_make_set ret; @@ -4446,7 +4189,7 @@ struct retStruct_flow_table_substantive_munge { ) { static auto rgx = RgxI(); static auto mkup = InlineMarkup(); - if (auto m = line.match(rgx.headings)) { /+ heading match +/ + if (auto m = line.match(rgx.headings)) { // heading match ++line_occur["heading"]; pith["txt_is"] = eN.txt_is.heading; if (line.match(rgx.heading_seg_and_above)) { @@ -4600,9 +4343,7 @@ struct retStruct_flow_table_substantive_munge { an_object["lev_markup_number"] = lv["lv"].to!string; } an_object["dummy_heading_status"] = (pith["dummy_heading_status"] == eN.bi.off) ? "f" : "t"; - debug(heading) { - writeln(line.strip); - } + debug(heading) { writeln(line.strip); } } struct retStruct_flow_heading_matched { string[string] this_object; @@ -4637,7 +4378,7 @@ struct retStruct_flow_table_substantive_munge { static auto rgx = RgxI(); if (line_occur["para"] == eN.bi.off) { line = font_faces_line(line); - /+ para matches +/ + // para matches pith["txt_is"] = eN.txt_is.para; an_object[an_object_key] ~= line; indent = [ @@ -4646,28 +4387,20 @@ struct retStruct_flow_table_substantive_munge { ]; bullet = false; if (auto m = line.matchFirst(rgx.para_indent)) { - debug(paraindent) { - writeln(line); - } + debug(paraindent) { writeln(line); } indent["hang_position"] = (m["indent"]).to!int; indent["base_position"] = (m["indent"]).to!int; } else if (line.matchFirst(rgx.para_bullet)) { - debug(parabullet) { - writeln(line); - } + debug(parabullet) { writeln(line); } bullet = true; } else if (auto m = line.matchFirst(rgx.para_indent_hang)) { - debug(paraindenthang) { - writeln(line); - } + debug(paraindenthang) { writeln(line); } indent = [ "hang_position" : (m["hang"]).to!int, "base_position" : (m["indent"]).to!int, ]; } else if (auto m = line.matchFirst(rgx.para_bullet_indent)) { - debug(parabulletindent) { - writeln(line); - } + debug(parabulletindent) { writeln(line); } indent = [ "hang_position" : (m["indent"]).to!int, "base_position" : (m["indent"]).to!int, @@ -4745,9 +4478,7 @@ struct retStruct_flow_table_substantive_munge { ulong col_num_; ulong col_num_chk = 0; foreach(idx_r, row; table_array) { - debug(table_dev) { - writeln("row ", idx_r); - } + debug(table_dev) { writeln("row ", idx_r); } col_num_ = 0; if (col_num == 0 || col_num < row.length) { @@ -4756,19 +4487,13 @@ struct retStruct_flow_table_substantive_munge { if (col_num_chk == 0) { col_num_chk = col_num; } else if (col_num == 1) { - debug(table_dev) { - writeln("table note: "); - } + debug(table_dev) { writeln("table note: "); } } else if (col_num_chk != col_num) { - debug(table_dev) { - writeln("warning irregular number of columns: ", col_num_chk, " != ", col_num); - } + debug(table_dev) { writeln("warning irregular number of columns: ", col_num_chk, " != ", col_num); } } else { } foreach(idx_c, col; row) { - debug(table_dev) { - write(idx_c, ", "); - } + debug(table_dev) { write(idx_c, ", "); } col_num_ = idx_c; _table_substantive ~= col ~ mng.tc_s; if (idx_r == 0 && table_object.table.heading) { @@ -4792,9 +4517,7 @@ struct retStruct_flow_table_substantive_munge { } } } - debug(table_dev) { - writeln(""); - } + debug(table_dev) { writeln(""); } if (col_num_chk > 0 && (col_num != col_num_chk)) { } else if (col_num == col_num_chk){ } else { @@ -4806,9 +4529,7 @@ struct retStruct_flow_table_substantive_munge { if (table_object.table.number_of_columns == 0) { table_object.table.number_of_columns = (col_num).to!int; } else { - debug(table_dev) { - writeln(table_object.table.number_of_columns, " != ", col_num); - } + debug(table_dev) { writeln(table_object.table.number_of_columns, " != ", col_num); } } } if (table_object.table.number_of_columns == 0 @@ -4823,9 +4544,7 @@ struct retStruct_flow_table_substantive_munge { } } else if (table_object.table.number_of_columns != table_object.table.column_widths.length) { - debug(table_dev) { - writeln(m.hit); // further logic required - } + debug(table_dev) { writeln(m.hit); } // further logic required if (table_object.table.number_of_columns > table_object.table.column_widths.length) { double col_w = (100.00 - (table_object.table.column_widths).sum) / (table_object.table.number_of_columns - table_object.table.column_widths.length); @@ -4915,8 +4634,8 @@ struct retStruct_flow_table_substantive_munge { } return ret; } -/+ abstraction functions ↑ +/ -/+ ↓ abstraction function emitters +/ +// abstraction functions ↑ +// ↓ abstraction function emitters @safe pure struct OCNemitter { int ocn_digit, ocn_object_number, ocn_on_, ocn_off_, ocn_bkidx, ocn_bkidx_; string object_identifier; @@ -4965,7 +4684,6 @@ struct retStruct_flow_table_substantive_munge { invariant() { } } - /+ +/ @safe static struct ObjInlineMarkupMunge { string[string] obj_txt; int n_foot, n_foot_reg, n_foot_sp_asterisk, n_foot_sp_plus; @@ -4982,36 +4700,30 @@ struct retStruct_flow_table_substantive_munge { } @safe static auto images()(string obj_txt_in) { static auto mng = InlineMarkup(); - /+ url matched +/ + // url matched obj_txt_in = obj_txt_in.replaceAll(rgx.inline_notes_al_special, ""); // TODO reinstate when special footnotes are implemented - if (obj_txt_in.match(rgx.smid_image_generic)) { /+ images with and without links +/ - debug(images) { - writeln("Image: ", obj_txt_in); - } + if (obj_txt_in.match(rgx.smid_image_generic)) { // images with and without links + debug(images) { writeln("Image: ", obj_txt_in); } if (obj_txt_in.match(rgx.smid_image_with_dimensions)) { obj_txt_in = obj_txt_in .replaceAll(rgx.smid_image_with_dimensions, ("$1" ~ mkup.img ~ "$2,w$3h$4 " ~ "$5")) .replaceAll(rgx.smid_image_delimit, ("$1" ~ mkup.lnk_o ~ "$2".strip ~ mkup.lnk_c ~ mkup.url_o ~ mkup.url_c)); - debug(images) { - writeln("IMAGE with size: ", obj_txt_in); - } + debug(images) { writeln("IMAGE with size: ", obj_txt_in); } } else if (obj_txt_in.match(rgx.smid_image)) { obj_txt_in = obj_txt_in .replaceAll(rgx.smid_image, ("$1" ~ mkup.img ~ "$2,w0h0" ~ "$3")) .replaceAll(rgx.smid_image_delimit, ("$1" ~ mkup.lnk_o ~ "$2".strip ~ mkup.lnk_c ~ mkup.url_o ~ mkup.url_c)); - debug(images) { - writeln("IMAGE: ", obj_txt_in); // decide on representation - } + debug(images) { writeln("IMAGE: ", obj_txt_in); } // decide on representation } } return obj_txt_in; } @safe TxtPlusHasFootnotes footnotes_endnotes_markup_and_number_or_stars()(string obj_txt_in, bool reset_note_numbers) { - /+ endnotes (regular) +/ + // endnotes (regular) bool flg_notes_reg = false; bool flg_notes_star = false; bool flg_notes_plus = false; @@ -5089,7 +4801,7 @@ struct retStruct_flow_table_substantive_munge { bool urls = false; bool images_without_dimensions = false; tail = ""; - /+ special endnotes +/ + // special endnotes obj_txt_in = obj_txt_in.replaceAll( rgx.inline_notes_curly_sp_asterisk, (mkup.en_a_o ~ "*" ~ " $1" ~ mkup.en_a_c) @@ -5099,14 +4811,14 @@ struct retStruct_flow_table_substantive_munge { rgx.inline_notes_curly_sp_plus, (mkup.en_a_o ~ "+" ~ " $1" ~ mkup.en_a_c) ); - /+ image matched +/ + // image matched if (obj_txt_in.match(rgx.smid_image_generic)) { obj_txt_in = images(obj_txt_in); if (obj_txt_in.match(rgx.smid_mod_image_without_dimensions)) { images_without_dimensions = true; } } - /+ url matched +/ + // url matched if (obj_txt_in.match(rgx.smid_inline_url)) { urls = true; obj_txt_in = obj_txt_in.links_and_images; @@ -5117,13 +4829,10 @@ struct retStruct_flow_table_substantive_munge { } TxtPlusHasFootnotes ftn = footnotes_endnotes_markup_and_number_or_stars(obj_txt_in, reset_note_numbers); obj_txt_out = ftn.obj_txt; - debug(footnotes) { - writeln(obj_txt_out, tail); - } + debug(footnotes) { writeln(obj_txt_out, tail); } obj_txt_out = obj_txt_out ~ tail; debug(footnotesdone) { - foreach(m; matchAll(obj_txt_out, - (mkup.en_a_o ~ `\s*(.+?)` ~ mkup.en_a_c))) { + foreach(m; matchAll(obj_txt_out, (mkup.en_a_o ~ `\s*(.+?)` ~ mkup.en_a_c))) { writeln(m[1]); writeln(m.hit); } @@ -5444,8 +5153,8 @@ private: heading_num[3] = 0; heading_number_auto_composite = ""; } - /+ auto_num_depth minimum 0 - (1.) default 2 (1.1.1) max 3 (1.1.1.1) implement +/ + // auto_num_depth minimum 0 + // (1.) default 2 (1.1.1) max 3 (1.1.1.1) implement if ( conf_make_meta.make.auto_num_top_lv > obj_["lev_markup_number"].to!uint @@ -5554,9 +5263,7 @@ private: (heading_number_auto_composite.empty) ? "" : "seg_" ~ heading_number_auto_composite; - debug(heading_number_auto) { - writeln(heading_number_auto_composite); - } + debug(heading_number_auto) { writeln(heading_number_auto_composite); } if ((!empty(heading_number_auto_composite)) && (obj_["lev_markup_number"].to!uint >= conf_make_meta.make.auto_num_top_lv)) { munge_ = munge_ @@ -5603,7 +5310,6 @@ private: return munge_; } } - /+ +/ struct ObjAttributes { string[string] _obj_attrib; @safe string obj_attributes()( @@ -5787,7 +5493,6 @@ struct ObjAttributes { return _obj_attrib; } } - /+ +/ struct BookIndexNuggetHash { string main_term, sub_term, sub_term_bits; int object_number_offset, object_number_endpoint; @@ -5799,9 +5504,7 @@ struct BookIndexNuggetHash { OCNset obj_cite_digits, S tag_in_seg, ) { - debug(asserts) { - static assert(is(typeof(obj_cite_digits.object_number) == int)); - } + debug(asserts) { static assert(is(typeof(obj_cite_digits.object_number) == int)); } debug(bookindexraw) { if (!bookindex_section.empty) { writeln( @@ -5870,9 +5573,7 @@ struct BookIndexReportIndent { auto mainkeys = bookindex_unordered_hashes.byKey.array.sort().release; foreach (mainkey; mainkeys) { - debug(bookindex1) { - writeln(mainkey); - } + debug(bookindex1) { writeln(mainkey); } auto subkeys = bookindex_unordered_hashes[mainkey].byKey.array.sort().release; foreach (subkey; subkeys) { @@ -5926,9 +5627,7 @@ struct BookIndexReportSection { OCNset obj_cite_digits, B opt_action, ) { - debug(asserts) { - static assert(is(typeof(obj_cite_digits.object_number) == int)); - } + debug(asserts) { static assert(is(typeof(obj_cite_digits.object_number) == int)); } mixin spineNode; mixin InternalMarkup; static auto mkup = InlineMarkup(); @@ -6079,7 +5778,6 @@ struct BookIndexReportSection { return t; } } - /+ +/ struct NotesSection { string[string] object_notes; int previous_count; @@ -6109,8 +5807,7 @@ struct NotesSection { (contents_am[cntr].text).matchAll( rgx.inline_notes_al_special_char_note) ) { - debug(endnotes_build) { - writeln( + debug(endnotes_build) { writeln( "{", mkup.ff_i, mkup.superscript, mkup.ff_o, m["char"], ".", mkup.ff_c, mkup.superscript, "}" ~ mkup.mark_internal_site_lnk, tag_in_seg["seg_lv4"], @@ -6138,8 +5835,7 @@ struct NotesSection { (contents_am[cntr].text).matchAll( rgx.inline_notes_al_regular_number_note) ) { - debug(endnotes_build) { - writeln( + debug(endnotes_build) { writeln( "{", mkup.ff_i, mkup.superscipt, mkup.ff_o, m["num"], ".", mkup.ff_c, mkup.superscipt, "}" ~ mkup.mark_internal_site_lnk, tag_in_seg["seg_lv4"], @@ -6287,7 +5983,6 @@ struct NotesSection { return t; } } - /+ +/ struct Bibliography { @system public retStruct_flow_bibliography flow_bibliography_()( string[] biblio_unsorted_incomplete, @@ -6325,10 +6020,9 @@ struct Bibliography { JSONValue[] bib_arr_json ) { foreach (bibent; biblio_unordered) { - /+ update bib to include deemed_author, needed for: - sort_bibliography_array_by_deemed_author_year_title - either: sort on multiple fields, or; create such sort field - +/ + // update bib to include deemed_author, needed for: + // sort_bibliography_array_by_deemed_author_year_title + // either: sort on multiple fields, or; create such sort field JSONValue j = parseJSON(bibent); if (!empty(j["fulltitle"].str)) { if (!empty(j["author_raw"].str)) { @@ -6356,9 +6050,7 @@ struct Bibliography { })(biblio_unordered).array; debug(bibliosorted) { foreach (j; biblio_sorted_) { - if (!empty(j["fulltitle"].str)) { - writeln(j["sortby_deemed_author_year_title"]); - } + if (!empty(j["fulltitle"].str)) { writeln(j["sortby_deemed_author_year_title"]); } } } return biblio_sorted_; @@ -6366,14 +6058,11 @@ struct Bibliography { @system void biblio_debug()(JSONValue[] biblio_sorted) { debug(biblio0) { foreach (j; biblio_sorted) { - if (!empty(j["fulltitle"].str)) { - writeln(j["sortby_deemed_author_year_title"]); - } + if (!empty(j["fulltitle"].str)) { writeln(j["sortby_deemed_author_year_title"]); } } } } } - /+ +/ struct NodeStructureMetadata { int lv, lv0, lv1, lv2, lv3, lv4, lv5, lv6, lv7; int obj_cite_digit; @@ -6389,9 +6078,7 @@ struct NodeStructureMetadata { int ptr_, string is_ ) { - debug(asserts) { - static assert(is(typeof(obj_cite_digits.object_number) == int)); - } + debug(asserts) { static assert(is(typeof(obj_cite_digits.object_number) == int)); } assert(is_ != "heading"); assert(obj_cite_digits.object_number.to!int >= 0); assert(is_ != "heading"); // should not be necessary @@ -6420,11 +6107,8 @@ struct NodeStructureMetadata { comp_obj_location.metainfo.parent_ocn = p_["object_number"]; comp_obj_location.metainfo.parent_lev_markup = p_["lev_markup_number"]; debug(_node) { - if (lev_markup_number.match(rgx.levels_numbered_headings)) { - writeln("x ", _node.to!string); - } else { - writeln("- ", _node.to!string); - } + if (lev_markup_number.match(rgx.levels_numbered_headings)) { writeln("x ", _node.to!string); + } else { writeln("- ", _node.to!string); } } assert(comp_obj_location.metainfo.parent_lev_markup >= 4); assert(comp_obj_location.metainfo.parent_lev_markup <= 7); @@ -6463,14 +6147,13 @@ struct NodeStructureMetadata { ); if (lev_markup_number.match(rgx.levels_numbered)) { if (lev_markup_number.to!int == 0) { - /+ TODO first hit (of two) with this assertion failure, check, fix & reinstate - assert(obj_cite_digits.object_number.to!int == 1, - "ERROR header lev markup number is: " ~ - lev_markup_number.to!string ~ - " obj_cite_digits.object_number.to!int should == 1 but is: " ~ - obj_cite_digits.object_number.to!string ~ - "\n" ~ _text); - +/ + // TODO first hit (of two) with this assertion failure, check, fix & reinstate + // assert(obj_cite_digits.object_number.to!int == 1, + // "ERROR header lev markup number is: " ~ + // lev_markup_number.to!string ~ + // " obj_cite_digits.object_number.to!int should == 1 but is: " ~ + // obj_cite_digits.object_number.to!string ~ + // "\n" ~ _text); } } switch (lev_markup_number.to!int) { @@ -6586,14 +6269,10 @@ struct NodeStructureMetadata { tag_assoc[_comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = _comp_obj_heading_.tags.in_segment_html; tag_assoc[_comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1to4"] = _comp_obj_heading_.tags.segment_anchor_tag_epub; debug(_node) { - if (lev_markup_number.match(rgx.levels_numbered_headings)) { - writeln("* ", _node.to!string); - } + if (lev_markup_number.match(rgx.levels_numbered_headings)) { writeln("* ", _node.to!string); } } debug(nodeheading) { - if (lev_markup_number.match(rgx.levels_numbered_headings)) { - writeln("* ", _node.to!string); - } + if (lev_markup_number.match(rgx.levels_numbered_headings)) { writeln("* ", _node.to!string); } } assert(_comp_obj_heading_.metainfo.parent_lev_markup <= 7); assert(_comp_obj_heading_.metainfo.parent_ocn >= 0); @@ -6630,8 +6309,8 @@ struct NodeStructureMetadata { invariant() { } } - /+ abstraction functions emitters ↑ +/ - /+ ↓ abstraction functions assertions +/ +// abstraction functions emitters ↑ +// ↓ abstraction functions assertions @safe pure void assertions_doc_structure()( string[string] an_object, string an_object_key, @@ -7202,7 +6881,7 @@ struct NodeStructureMetadata { break; } } -/+ abstraction functions assertions ↑ +/ +// abstraction functions assertions ↑ #+END_SRC * template docSectKeysSeq diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index da8949e..d8b3b75 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -47,14 +47,12 @@ [https://git.sisudoc.org/projects/?p=software/spine.git;a=summary] +/ -/++ - document abstraction: - abstraction of sisu markup for downstream processing - metadoc_from_src.d -+/ +// document abstraction: +// abstraction of sisu markup for downstream processing +// metadoc_from_src.d module doc_reform.meta.metadoc_from_src; template docAbstraction() { - /+ ↓ abstraction imports +/ + // ↓ abstraction imports import std.algorithm, std.container, @@ -67,11 +65,11 @@ template docAbstraction() { doc_reform.meta.rgx, doc_reform.meta.metadoc_object_setter, doc_reform.meta.rgx; - /+ ↓ abstraction mixins +/ + // ↓ abstraction mixins mixin ObjectSetter; mixin InternalMarkup; mixin spineRgxIn; - /+ ↓ abstraction struct init +/ + // ↓ abstraction struct init @safe static auto eN() { struct _e { enum bi { @@ -124,7 +122,7 @@ template docAbstraction() { } return _e(); } - /+ initialize +/ + // initialize ObjGenericComposite[] the_document_toc_section, the_document_head_section, the_document_body_section, the_document_bibliography_section, the_document_glossary_section, the_document_blurb_section, the_document_xml_dom_tail_section; struct _theDoc { ObjGenericComposite[] toc; @@ -145,7 +143,7 @@ template docAbstraction() { string lev_anchor_tag; string[string][string] tag_assoc; string[] lv0to3_tags; - /+ enum +/ + // enum enum DocStructMarkupHeading { h_sect_A, h_sect_B, @@ -160,26 +158,26 @@ template docAbstraction() { } // header section A-D; header text 1-4 enum Status { off, on, } enum OCNtype { ocn, non, bkidx, } - /+ biblio variables +/ + // biblio variables string biblio_tag_name, biblio_tag_entry, st; string[] biblio_arr_json; string biblio_entry_str_json; JSONValue[] bib_arr_json; int bib_entry; - /+ counters +/ + // counters int cntr, previous_count, previous_length; bool reset_note_numbers = true; int[string] line_occur; int html_segnames_ptr = 0; int html_segnames_ptr_cntr = 0; int verse_line, heading_ptr; - /+ paragraph attributes +/ + // paragraph attributes int[string] indent; bool bullet = true; string content_non_header = "8"; static auto obj_im = ObjInlineMarkup(); static auto obj_att = ObjAttributes(); - /+ ocn +/ + // ocn struct OCNset { int digit; int object_number; @@ -309,9 +307,7 @@ template docAbstraction() { } } } - debug(dom_magic_numbers) { - writeln("marked up: ", lev, ": ", dom); - } + debug(dom_magic_numbers) { writeln("marked up: ", lev, ": ", dom); } obj.metainfo.dom_structure_markedup_tags_status = dom.dup; return obj; } @@ -353,9 +349,7 @@ template docAbstraction() { } } } - debug(dom_magic_numbers) { - writeln("collapsed: ", lev, ": ", dom); - } + debug(dom_magic_numbers) { writeln("collapsed: ", lev, ": ", dom); } obj.metainfo.dom_structure_collapsed_tags_status = dom.dup; return obj; } @@ -413,10 +407,10 @@ template docAbstraction() { } return obj_txt; } - /+ book index variables +/ + // book index variables string book_idx_tmp; string[][string][string] bookindex_unordered_hashes; - /+ node +/ + // node ObjGenericComposite comp_obj_heading, comp_obj_location, comp_obj_block, comp_obj_code, comp_obj_poem_ocn, comp_obj_comment; auto node_construct = NodeStructureMetadata(); enum sObj { content, anchor_tag, notes_reg, notes_star, links, image_no_dimensions } @@ -526,7 +520,7 @@ template docAbstraction() { bool _new_doc ) { static auto rgx = RgxI(); - /+ ↓ abstraction init +/ + // ↓ abstraction init scope(success) { } scope(failure) { @@ -667,7 +661,7 @@ template docAbstraction() { string[][string] lev4_subtoc; string[][string] segnames = ["html": ["toc"], "epub": ["toc"]]; int cnt1 = 1; int cnt2 = 1; int cnt3 = 1; - /+ abstraction init ↑ +/ + // abstraction init ↑ enum Substitute { match, markup, } debug (substitutions) { writeln(__LINE__, ":", __FILE__, ": DEBUG substitutions:"); @@ -709,9 +703,9 @@ template docAbstraction() { _loopMarkupSrcByLineStruct ret; srcDocLoopLineByLine_: foreach (line; markup_sourcefile_content) { - /+ ↓ markup document/text line by line +/ + // ↓ markup document/text line by line // "line" variable can be empty but should never be null - /+ scope +/ + // scope scope(exit) { } scope(failure) { stderr.writefln( @@ -721,17 +715,13 @@ template docAbstraction() { manifested.src.filename, line, ); } - debug(source) { - writeln(line); - } - debug(srclines) { - if (!line.empty) { writefln("* %s", line); } - } + debug(source) { writeln(line); } + debug(srclines) { if (!line.empty) { writefln("* %s", line); } } if (!line.empty) { pith = line._check_ocn_status_(pith); } if ( pith["block_is"] == eN.blk_is.code && pith["block_state"] == eN.blk_state.on ) { - /+ block object: code +/ + // block object: code { auto _get = line.txt_by_line_block_code(an_object, pith); an_object = _get.this_object; @@ -739,9 +729,9 @@ template docAbstraction() { } continue; } else if (!matchFirst(line, rgx.skip_from_regular_parse)) { - /+ object other than "code block" object +/ - /+ (includes regular text paragraph, headings & blocks other than code) +/ - /+ heading, glossary, blurb, poem, group, block, quote, table +/ + // object other than "code block" object + // (includes regular text paragraph, headings & blocks other than code) + // heading, glossary, blurb, poem, group, block, quote, table line = line.inline_markup_faces; // by text line (rather than by text object), linebreaks in para problematic if (line.matchFirst(rgx.heading_biblio) || (pith["section"] == eN.sect.bibliography @@ -774,11 +764,8 @@ template docAbstraction() { && (!(line.matchFirst(rgx.heading))) && (!(line.matchFirst(rgx.comment))))) ) { - /+ within section (block object): glossary +/ - debug(glossary) { - writeln(__LINE__); - writeln(line); - } + // within section (block object): glossary + debug(glossary) { writeln(__LINE__); writeln(line); } pith["section"] = eN.sect.glossary; if (opt_action.backmatter && opt_action.section_glossary) { indent = [ @@ -880,10 +867,7 @@ template docAbstraction() { && (!(line.matchFirst(rgx.comment))))) ) { pith["section"] = eN.sect.blurb; - debug(blurb) { - writeln(__LINE__); - writeln(line); - } + debug(blurb) { writeln(__LINE__); writeln(line); } if (opt_action.backmatter && opt_action.section_blurb) { indent = [ "hang_position" : 0, @@ -891,28 +875,20 @@ template docAbstraction() { ]; bullet = false; if (auto m = line.matchFirst(rgx.para_indent)) { - debug(paraindent) { - writeln(line); - } + debug(paraindent) { writeln(line); } indent["hang_position"] = (m["indent"]).to!int; indent["base_position"] = (m["indent"]).to!int; } else if (line.matchFirst(rgx.para_bullet)) { - debug(parabullet) { - writeln(line); - } + debug(parabullet) { writeln(line); } bullet = true; } else if (auto m = line.matchFirst(rgx.para_indent_hang)) { - debug(paraindenthang) { - writeln(line); - } + debug(paraindenthang) { writeln(line); } indent = [ "hang_position" : (m["hang"]).to!int, "base_position" : (m["indent"]).to!int, ]; } else if (auto m = line.matchFirst(rgx.para_bullet_indent)) { - debug(parabulletindent) { - writeln(line); - } + debug(parabulletindent) { writeln(line); } indent = [ "hang_position" : (m["indent"]).to!int, "base_position" : (m["indent"]).to!int, @@ -1093,7 +1069,7 @@ template docAbstraction() { continue; } } else { - /+ not within a block group +/ + // not within a block group assert( (pith["block_state"] == eN.blk_state.off) || (pith["block_state"] == eN.blk_state.closing), @@ -1101,7 +1077,7 @@ template docAbstraction() { ); if (line.matchFirst(rgx.block_open)) { if (line.matchFirst(rgx.block_poem_open)) { - /+ poem to verse exceptions! +/ + // poem to verse exceptions! object_reset(an_object); processing.remove("verse"); object_number_poem["start"] = obj_cite_digits.object_number.to!string; @@ -1116,7 +1092,7 @@ template docAbstraction() { } continue; } else if (!line.empty) { - /+ line not empty - non blocks (headings, paragraphs) & closed blocks +/ + // line not empty - non blocks (headings, paragraphs) & closed blocks assert( !line.empty, "line tested, line not empty surely:\n \"" ~ line ~ "\"" @@ -1127,10 +1103,7 @@ template docAbstraction() { "code block status: none or closed" ); if (pith["block_state"] == eN.blk_state.closing) { - debug(check) { - writeln(__LINE__); - writeln(line); - } + debug(check) { writeln(__LINE__); writeln(line); } assert( line.matchFirst(rgx.book_index_item) || line.matchFirst(rgx.book_index_item_open) @@ -1142,7 +1115,7 @@ template docAbstraction() { if (line.matchFirst(rgx.book_index_item) || line.matchFirst(rgx.book_index_item_open) || pith["section"] == eN.sect.book_index) { - /+ book_index +/ + // book_index { auto _get = line.flow_book_index_(an_object, book_idx_tmp, pith, opt_action); { @@ -1152,13 +1125,11 @@ template docAbstraction() { } } } else { - /+ not book_index +/ + // not book_index an_object_key = "body_nugget"; if (auto m = line.matchFirst(rgx.comment)) { - /+ matched comment +/ - debug(comment) { - writeln(line); - } + // matched comment + debug(comment) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; comp_obj_comment = comp_obj_comment.init; comp_obj_comment.metainfo.is_of_part = "comment"; // breaks flow @@ -1180,10 +1151,10 @@ template docAbstraction() { } else if ((line_occur["para"] == eN.bi.off && line_occur["heading"] == eN.bi.off) && pith["txt_is"] == eN.txt_is.off - ) { /+ heading or para but neither flag nor line exists +/ + ) { // heading or para but neither flag nor line exists if ((conf_make_meta.make.headings.length > 2) && (pith["make_headings"] == eN.bi.off)) { - /+ heading found +/ + // heading found { auto _get = line.flow_heading_found_(heading_match_str, conf_make_meta.make.headings, heading_match_rgx, pith); { @@ -1198,7 +1169,7 @@ template docAbstraction() { && line_occur["heading"] == eN.bi.off) && pith["txt_is"] == eN.txt_is.off ) { - /+ heading make set +/ + // heading make set { auto _get = line.flow_heading_make_set_(line_occur, heading_match_rgx, pith); { @@ -1208,14 +1179,13 @@ template docAbstraction() { } } } - /+ TODO node info: all headings identified at this point, - - extract node info here?? - - how long can it wait? - - should be incorporated in composite objects - - should happen before endnote links set (they need to be moved down?) - +/ + // TODO node info: all headings identified at this point, + // - extract node info here?? + // - how long can it wait? + // - should be incorporated in composite objects + // - should happen before endnote links set (they need to be moved down?) if (line.matchFirst(rgx.headings)) { - /+ heading match +/ + // heading match line = line._doc_header_and_make_substitutions_(conf_make_meta); { auto _get = line.flow_heading_matched_( @@ -1233,7 +1203,7 @@ template docAbstraction() { } } } else if (line_occur["para"] == eN.bi.off) { - /+ para match +/ + // para match an_object_key = "body_nugget"; line = line ._doc_header_and_make_substitutions_(conf_make_meta) @@ -1251,17 +1221,13 @@ template docAbstraction() { } } } else if (line_occur["heading"] > eN.bi.off) { - /+ heading +/ - debug(heading) { - writeln(line); - } + // heading + debug(heading) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; ++line_occur["heading"]; } else if (line_occur["para"] > eN.bi.off) { - /+ paragraph +/ - debug(para) { - writeln(an_object_key, "-> ", line); - } + // paragraph + debug(para) { writeln(an_object_key, "-> ", line); } line = line ._doc_header_and_make_substitutions_(conf_make_meta) ._doc_header_and_make_substitutions_fontface_(conf_make_meta); @@ -1270,7 +1236,7 @@ template docAbstraction() { } } } else if (pith["block_state"] == eN.blk_state.closing) { - /+ line empty, with blocks flag +/ + // line empty, with blocks flag { auto _get = line.flow_block_flag_line_empty_( an_object, @@ -1296,7 +1262,7 @@ template docAbstraction() { } } } else { - /+ line.empty, post contents, empty variables: +/ + // line.empty, post contents, empty variables: assert( line.empty, "\nline should be empty:\n \"" @@ -1314,7 +1280,7 @@ template docAbstraction() { if (pith["txt_is"] == eN.txt_is.heading && line_occur["heading"] > eN.bi.off ) { - /+ heading object (current line empty) +/ + // heading object (current line empty) obj_cite_digits = (an_object["lev_markup_number"].to!int == 0) ? ocn_emit(eN.ocn.reset) : ocn_emit(pith["ocn"]); @@ -1341,7 +1307,7 @@ template docAbstraction() { tag_assoc[anchor_tag]["seg_lv4"] = tag_in_seg["seg_lv4"]; tag_assoc[anchor_tag]["seg_lv1to4"] = tag_in_seg["seg_lv1to4"]; if (lv0to3_tags.length > 0) { - /+ names used for html markup segments 1 to 4 (rather than epub which has separate segments for A to D) +/ + // names used for html markup segments 1 to 4 (rather than epub which has separate segments for A to D) foreach (lv0_to_lv3_html_tag; lv0to3_tags) { tag_assoc[lv0_to_lv3_html_tag]["seg_lv4"] = anchor_tag; } @@ -1357,7 +1323,7 @@ template docAbstraction() { } else if (an_object["lev_markup_number"].to!int < 4) { string segn; switch (an_object["lev_markup_number"].to!int) { - /+ names used for epub markup segments A to D +/ + // names used for epub markup segments A to D case 0: segn = "_the_title"; goto default; @@ -1385,8 +1351,8 @@ template docAbstraction() { = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; bookindex_unordered_hashes = bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_digits, tag_in_seg); - /+ (incrementally build toc) table of contents here! +/ _anchor_tag = obj_cite_digits.identifier; + // (incrementally build toc) table of contents here! { auto _get = obj_im.flow_table_of_contents_gather_headings( an_object, @@ -1434,9 +1400,7 @@ template docAbstraction() { writeln(tag_in_seg["seg_lv1to4"]); } the_document_body_section ~= comp_obj_heading; - debug(objectrelated1) { // check - writeln(line); - } + debug(objectrelated1) { writeln(line); } // check { auto _get = txt_by_line_common_reset_(line_occur, an_object, pith); { @@ -1451,7 +1415,7 @@ template docAbstraction() { ++cntr; } else if (pith["txt_is"] == eN.txt_is.para && line_occur["para"] > eN.bi.off - ) { /+ paragraph object (current line empty) - repeated character paragraph separator +/ + ) { // paragraph object (current line empty) - repeated character paragraph separator if ((an_object[an_object_key].to!string).matchFirst(rgx.repeated_character_line_separator)) { pith["ocn"] = eN.ocn.off; } @@ -1516,7 +1480,7 @@ template docAbstraction() { } // close else for line empty } // close else for not the above } // close after non code, other blocks or regular text - /+ unless (the_document_body_section.length == 0) ? +/ + // unless (the_document_body_section.length == 0) ? if (the_document_body_section.length > 0) { if (((the_document_body_section[$-1].metainfo.is_a == "para") || (the_document_body_section[$-1].metainfo.is_a == "heading") @@ -1530,7 +1494,7 @@ template docAbstraction() { pith["section"] = eN.sect.unset; } if (the_document_body_section[$-1].metainfo.is_a == "verse") { - /+ scan for endnotes for whole poem (each verse in poem) +/ + // scan for endnotes for whole poem (each verse in poem) foreach (i; previous_length .. the_document_body_section.length) { if (the_document_body_section[i].metainfo.is_a == "verse") { if ((the_document_body_section[i].text).match( @@ -1545,7 +1509,7 @@ template docAbstraction() { } } } else { - /+ scan object for endnotes +/ + // scan object for endnotes previous_length = the_document_body_section.length.to!int; if ((the_document_body_section[$-1].text).match( rgx.inline_notes_al_all_note @@ -1610,13 +1574,8 @@ template docAbstraction() { auto the_document_endnotes_section = en_tuple[0]; obj_cite_digits = en_tuple[1]; debug(endnotes) { - writefln("%s %s", - __LINE__, - the_document_endnotes_section.length - ); - foreach (o; the_document_endnotes_section) { - writeln(o); - } + writefln("%s %s", __LINE__, the_document_endnotes_section.length); + foreach (o; the_document_endnotes_section) { writeln(o); } } if (an_object["glossary_nugget"].length == 0) { comp_obj_heading_ = comp_obj_heading_.init; @@ -1636,11 +1595,7 @@ template docAbstraction() { comp_obj_heading_.metainfo.parent_lev_markup = 0; the_document_glossary_section ~= comp_obj_heading_; } - debug(glossary) { - foreach (gloss; the_document_glossary_section) { - writeln(gloss.text); - } - } + debug(glossary) { foreach (gloss; the_document_glossary_section) { writeln(gloss.text); } } auto biblio_unsorted_incomplete = biblio_arr_json.dup; auto biblio = Bibliography(); JSONValue[] biblio_ordered; @@ -1756,11 +1711,7 @@ template docAbstraction() { comp_obj_heading_.metainfo.parent_lev_markup = 0; the_document_bibliography_section ~= comp_obj_heading_; } - debug(bibliosection) { - foreach (o; the_document_bibliography_section) { - writeln(o.text); - } - } + debug(bibliosection) { foreach (o; the_document_bibliography_section) { writeln(o.text); } } auto bi = BookIndexReportSection(); auto bi_tuple = bi.bookindex_build_abstraction_section( @@ -1771,11 +1722,7 @@ template docAbstraction() { destroy(bookindex_unordered_hashes); auto the_document_bookindex_section = bi_tuple[0]; obj_cite_digits = bi_tuple[1]; - debug(bookindex) { - foreach (bi_entry; the_document_bookindex_section) { - writeln(bi_entry); - } - } + debug(bookindex) { foreach (bi_entry; the_document_bookindex_section) { writeln(bi_entry); } } if (an_object["blurb_nugget"].length == 0) { comp_obj_heading_ = comp_obj_heading_.init; comp_obj_heading_.metainfo.is_of_part = "empty"; @@ -1796,11 +1743,7 @@ template docAbstraction() { comp_obj_heading_.metainfo.parent_lev_markup = 0; the_document_blurb_section ~= comp_obj_heading_; } - debug(blurb) { - foreach (blurb; the_document_blurb_section) { - writeln(blurb.text); - } - } + debug(blurb) { foreach (blurb; the_document_blurb_section) { writeln(blurb.text); } } indent = [ "hang_position" : 1, "base_position" : 1, @@ -1888,10 +1831,7 @@ template docAbstraction() { the_document_toc_section ~= comp_obj_toc; } debug(toc) { - writefln( - "%s %s", - __LINE__, - ); + writefln( "%s %s", __LINE__,); foreach (toc_linked_heading; the_document_toc_section) { writeln(mkup.indent_by_spaces_provided(toc_linked_heading.attrib.indent_hang), toc_linked_heading.text); } @@ -1900,9 +1840,7 @@ template docAbstraction() { the_document_body_section = the_document_body_section[1..$]; @safe int[] _get_ancestors_markup(O)(O obj, ref int[] _ancestors_markup) { if (obj.metainfo.is_a == "heading") { - debug(dom) { - writeln(obj.text); - } + debug(dom) { writeln(obj.text); } if (obj.metainfo.heading_lev_markup == 1) { _ancestors_markup = [ _ancestors_markup[0], @@ -1980,9 +1918,7 @@ template docAbstraction() { } _ancestors_markup[obj.metainfo.heading_lev_markup] = obj.metainfo.ocn; } - debug(ancestor_markup) { - writeln("marked up: ", _ancestors_markup); - } + debug(ancestor_markup) { writeln("marked up: ", _ancestors_markup); } return _ancestors_markup; } @safe int[] _get_ancestors_collapsed(O)(O obj, ref int[] _ancestors_collapsed) { @@ -2064,12 +2000,10 @@ template docAbstraction() { } _ancestors_collapsed[obj.metainfo.heading_lev_collapsed] = obj.metainfo.ocn; } - debug(ancestor_collapsed) { - writeln("collapsed: ", _ancestors_collapsed); - } + debug(ancestor_collapsed) { writeln("collapsed: ", _ancestors_collapsed); } return _ancestors_collapsed; } - /+ multiple 1~ levels, loop through document body +/ + // multiple 1~ levels, loop through document body if (the_document_body_section.length > 1) { int[] _ancestors_markup = [0,0,0,0,0,0,0,0]; int[][] _ancestors_markup_; @@ -2231,14 +2165,12 @@ template docAbstraction() { int max_width = 640; foreach (img; obj.text.matchAll(rgx.inline_image_without_dimensions)) { try { - read_image_info(manifested.src.image_dir_path ~ "/" ~ img["img"], w, h, chans); // + read_image_info(manifested.src.image_dir_path ~ "/" ~ img["img"], w, h, chans); } catch (Exception ex) { writeln("WARNING, image not found: ", img["img"], "\n ", manifested.src.image_dir_path ~ "/" ~ img["img"]); } // calculate, decide max width and proportionally reduce to keep w & h within it - debug(images) { - writeln("width: ", w, ", height: ", h); - } + debug(images) { writeln("width: ", w, ", height: ", h); } if (w > max_width) { _w = max_width; _h = round((max_width / w.to!real) * h.to!real); @@ -2257,9 +2189,7 @@ template docAbstraction() { ) ); } - debug(images) { - writeln("image without dimensions: ", obj.text); - } + debug(images) { writeln("image without dimensions: ", obj.text); } } return obj; } @@ -2284,22 +2214,19 @@ template docAbstraction() { } foreach (ref obj; the_document_head_section) { if (obj.metainfo.is_a == "heading") { - debug(dom) { - writeln(obj.text); - } + debug(dom) { writeln(obj.text); } if (obj.metainfo.heading_lev_markup <= 4) { segnames_0_to_4 ~= obj.tags.segment_anchor_tag_epub; } if (obj.metainfo.heading_lev_markup == 0) { - /+ TODO second hit (of two) with same assertion failure, check, fix and reinstate - assert( obj.metainfo.ocn == 1, - "Title OCN should be 1 not: " ~ obj.metainfo.ocn.to!string); // bug introduced 0.18.1 - +/ + // TODO second hit (of two) with same assertion failure, check, fix and reinstate + // assert( obj.metainfo.ocn == 1, + // "Title OCN should be 1 not: " ~ obj.metainfo.ocn.to!string); // bug introduced 0.18.1 obj.metainfo.ocn = 1; obj.metainfo.identifier = "1"; obj.metainfo.object_number_type = OCNtype.ocn; } - /+ dom structure (marked up & collapsed) +/ + // dom structure (marked up & collapsed) if (opt_action.meta_processing_xml_dom) { obj = obj.obj_dom_structure_set_markup_tags(dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); obj = obj.obj_dom_set_collapsed_tags(dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); @@ -2309,7 +2236,7 @@ template docAbstraction() { obj = _links(obj); } if (the_document_toc_section.length > 1) { - /+ scroll +/ + // scroll dom_structure_markedup_tags_status_buffer = dom_structure_markedup_tags_status.dup; dom_structure_collapsed_tags_status_buffer = dom_structure_collapsed_tags_status.dup; foreach (ref obj; the_document_toc_section) { @@ -2322,7 +2249,7 @@ template docAbstraction() { obj.tags.anchor_tag_html ~ "!=" ~ segnames["html"][obj.ptr.html_segnames]); } } - /+ dom structure (marked up & collapsed) +/ + // dom structure (marked up & collapsed) if (opt_action.meta_processing_xml_dom) { obj = obj.obj_dom_structure_set_markup_tags(dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); obj = obj.obj_dom_set_collapsed_tags(dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); @@ -2332,7 +2259,7 @@ template docAbstraction() { obj = _links(obj); } } - /+ multiple 1~ levels, loop through document body +/ + // multiple 1~ levels, loop through document body if (the_document_body_section.length > 1) { foreach (ref obj; the_document_body_section) { if (!(obj.metainfo.identifier.empty)) { @@ -2346,9 +2273,7 @@ template docAbstraction() { = obj.tags.epub_segment_anchor_tag_is; } if (obj.metainfo.is_a == "heading") { - debug(dom) { - writeln(obj.text); - } + debug(dom) { writeln(obj.text); } if (obj.metainfo.heading_lev_markup <= 4) { segnames_0_to_4 ~= obj.tags.segment_anchor_tag_epub; if (obj.metainfo.heading_lev_markup == 4) { @@ -2361,7 +2286,7 @@ template docAbstraction() { obj.tags.anchor_tag_html ~ "!=" ~ segnames["html"][obj.ptr.html_segnames]); } } - /+ dom structure (marked up & collapsed) +/ + // dom structure (marked up & collapsed) if (opt_action.meta_processing_xml_dom) { obj = obj.obj_dom_structure_set_markup_tags(dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); obj = obj.obj_dom_set_collapsed_tags(dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); @@ -2375,7 +2300,7 @@ template docAbstraction() { } } auto image_list = (_images.sort()).uniq; - /+ optional only one 1~ level +/ + // optional only one 1~ level if (the_document_endnotes_section.length > 1) { dom_structure_markedup_tags_status_buffer = dom_structure_markedup_tags_status.dup; dom_structure_collapsed_tags_status_buffer = dom_structure_collapsed_tags_status.dup; @@ -2383,9 +2308,7 @@ template docAbstraction() { dom_structure_collapsed_tags_status = dom_structure_collapsed_tags_status_buffer.dup; foreach (ref obj; the_document_endnotes_section) { if (obj.metainfo.is_a == "heading") { - debug(dom) { - writeln(obj.text); - } + debug(dom) { writeln(obj.text); } if (obj.metainfo.heading_lev_markup == 1) { obj_cite_digits = ocn_emit(eN.ocn.on); obj.metainfo.ocn = obj_cite_digits.object_number; @@ -2402,7 +2325,7 @@ template docAbstraction() { obj.tags.anchor_tag_html ~ "!=" ~ segnames["html"][obj.ptr.html_segnames]); } } - /+ dom structure (marked up & collapsed) +/ + // dom structure (marked up & collapsed) if (opt_action.meta_processing_xml_dom) { obj = obj.obj_dom_structure_set_markup_tags(dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); obj = obj.obj_dom_set_collapsed_tags(dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); @@ -2412,13 +2335,11 @@ template docAbstraction() { obj = _links(obj); } } - /+ optional only one 1~ level +/ + // optional only one 1~ level if (the_document_glossary_section.length > 1) { foreach (ref obj; the_document_glossary_section) { if (obj.metainfo.is_a == "heading") { - debug(dom) { - writeln(obj.text); - } + debug(dom) { writeln(obj.text); } if (obj.metainfo.heading_lev_markup == 1) { obj_cite_digits = ocn_emit(eN.ocn.on); obj.metainfo.ocn = obj_cite_digits.object_number; @@ -2435,7 +2356,7 @@ template docAbstraction() { obj.tags.anchor_tag_html ~ "!=" ~ segnames["html"][obj.ptr.html_segnames]); } } - /+ dom structure (marked up & collapsed) +/ + // dom structure (marked up & collapsed) if (opt_action.meta_processing_xml_dom) { obj = obj.obj_dom_structure_set_markup_tags(dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); obj = obj.obj_dom_set_collapsed_tags(dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); @@ -2449,13 +2370,11 @@ template docAbstraction() { obj = _links(obj); } } - /+ optional only one 1~ level +/ + // optional only one 1~ level if (the_document_bibliography_section.length > 1) { foreach (ref obj; the_document_bibliography_section) { if (obj.metainfo.is_a == "heading") { - debug(dom) { - writeln(obj.text); - } + debug(dom) { writeln(obj.text); } if (obj.metainfo.heading_lev_markup == 1) { obj_cite_digits = ocn_emit(eN.ocn.on); obj.metainfo.ocn = obj_cite_digits.object_number; @@ -2472,7 +2391,7 @@ template docAbstraction() { obj.tags.anchor_tag_html ~ "!=" ~ segnames["html"][obj.ptr.html_segnames]); } } - /+ dom structure (marked up & collapsed) +/ + // dom structure (marked up & collapsed) if (opt_action.meta_processing_xml_dom) { obj = obj.obj_dom_structure_set_markup_tags(dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); obj = obj.obj_dom_set_collapsed_tags(dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); @@ -2486,17 +2405,16 @@ template docAbstraction() { obj = _links(obj); } } - /+ optional only one 1~ level +/ + // optional only one 1~ level int ocn_ = obj_cite_digits.object_number; int ocn_bkidx_ = 0; int ocn_bidx_; - if (the_document_bookindex_section.length > 1) { /+ scroll +/ + if (the_document_bookindex_section.length > 1) { // scroll dom_structure_markedup_tags_status_buffer = dom_structure_markedup_tags_status.dup; dom_structure_collapsed_tags_status_buffer = dom_structure_collapsed_tags_status.dup; foreach (ref obj; the_document_bookindex_section) { if (obj.metainfo.is_a == "heading") { - debug(dom) { - } + // debug(dom) { } if (obj.metainfo.heading_lev_markup <= 4) { segnames_0_to_4 ~= obj.tags.segment_anchor_tag_epub; } @@ -2515,7 +2433,7 @@ template docAbstraction() { obj.tags.anchor_tag_html ~ "!=" ~ segnames["html"][obj.ptr.html_segnames]); } } - /+ dom structure (marked up & collapsed) +/ + // dom structure (marked up & collapsed) if (opt_action.meta_processing_xml_dom) { obj = obj.obj_dom_structure_set_markup_tags(dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); obj = obj.obj_dom_set_collapsed_tags(dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); @@ -2530,18 +2448,14 @@ template docAbstraction() { } obj = _links(obj); } - /+ TODO assert failure, reinstate - assert(obj_cite_digit_bkidx == ocn_bidx_ - obj_cite_digit_bkidx ~ " == ocn_" ~ ocn_ ~ "?"); - +/ + // TODO assert failure, reinstate + // assert(obj_cite_digit_bkidx == ocn_bidx_ obj_cite_digit_bkidx ~ " == ocn_" ~ ocn_ ~ "?"); } - /+ optional only one 1~ level +/ + // optional only one 1~ level if (the_document_blurb_section.length > 1) { foreach (ref obj; the_document_blurb_section) { if (obj.metainfo.is_a == "heading") { - debug(dom) { - writeln(obj.text); - } + debug(dom) { writeln(obj.text); } if (obj.metainfo.heading_lev_markup == 1) { obj_cite_digits = ocn_emit(eN.ocn.on); obj.metainfo.ocn = obj_cite_digits.object_number; @@ -2558,7 +2472,7 @@ template docAbstraction() { obj.tags.anchor_tag_html ~ "!=" ~ segnames["html"][obj.ptr.html_segnames]); } } - /+ dom structure (marked up & collapsed) +/ + // dom structure (marked up & collapsed) if (opt_action.meta_processing_xml_dom) { obj = obj.obj_dom_structure_set_markup_tags(dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); obj = obj.obj_dom_set_collapsed_tags(dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); @@ -2585,7 +2499,7 @@ template docAbstraction() { ); debug(decendants_tuple) { pairs = pairs.sort(); - foreach (pair; pairs) { // (pair; pairs.sort()) + foreach (pair; pairs) { // (pair; pairs.sort()) writeln(pair[0], "..", pair[1]); } } @@ -2676,12 +2590,11 @@ template docAbstraction() { } } } - /+ TODO - - note create/insert heading object sole purpose eof close all open tags - sort out: - - obj.metainfo.dom_structure_markedup_tags_status = dom_structure_markedup_tags_status; - - obj.metainfo.dom_structure_collapsed_tags_status = dom_structure_collapsed_tags_status; - +/ + // TODO + // - note create/insert heading object sole purpose eof close all open tags + // sort out: + // - obj.metainfo.dom_structure_markedup_tags_status = dom_structure_markedup_tags_status; + // - obj.metainfo.dom_structure_collapsed_tags_status = dom_structure_collapsed_tags_status; comp_obj_heading_ = comp_obj_heading_.init; comp_obj_heading_.metainfo.is_of_part = "empty"; comp_obj_heading_.metainfo.is_of_section = "empty"; @@ -2710,15 +2623,15 @@ template docAbstraction() { ObjGenericComposite[][string] document_the = [ "head": the_document_head_section, "toc": the_document_toc_section, - /+ substantive/body: +/ + // substantive/body: "body": the_document_body_section, - /+ backmatter: +/ + // backmatter: "endnotes": the_document_endnotes_section, "glossary": the_document_glossary_section, "bibliography": the_document_bibliography_section, "bookindex": the_document_bookindex_section, "blurb": the_document_blurb_section, - /+ dom tail only +/ + // dom tail only "tail": the_document_xml_dom_tail_section, ]; string[][string] document_section_keys_sequenced = [ @@ -2853,7 +2766,7 @@ template docAbstraction() { ret.doc_has = doc_has; } return ret; - } /+ ← closed: abstract doc source +/ + } // ← closed: abstract doc source @system retStruct_txt_by_line_common_reset txt_by_line_common_reset_()( int[string] line_occur, string[string] an_object, @@ -2883,12 +2796,7 @@ template docAbstraction() { an_object["lang"] = ""; an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : ""; an_object["syntax"] = (m["syntax"]) ? m["syntax"].to!string : ""; - debug(codecurly) { // code (curly) open - writefln( - "* [code curly] %s", - line - ); - } + debug(codecurly) { writefln( "* [code curly] %s", line); } // code (curly) open pith["block_is"] = eN.blk_is.code; pith["block_state"] = eN.blk_state.on; pith["block_delim"] = eN.blk_delim.curly; @@ -2897,12 +2805,7 @@ template docAbstraction() { an_object["syntax"] = ""; an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : ""; an_object["lang"] = (m["lang"]) ? m["lang"].to!string : ""; - debug(poem) { // poem (curly) open - writefln( - "* [poem curly] %s", - line - ); - } + debug(poem) { writefln( "* [poem curly] %s", line); } // poem (curly) open object_number_poem["start"] = obj_cite_digits.object_number.to!string; pith["block_is"] = eN.blk_is.poem; pith["block_state"] = eN.blk_state.on; @@ -2913,12 +2816,7 @@ template docAbstraction() { an_object["syntax"] = ""; an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : ""; an_object["lang"] = (m["lang"]) ? m["lang"].to!string : ""; - debug(group) { // group (curly) open - writefln( - "* [group curly] %s", - line - ); - } + debug(group) { writefln( "* [group curly] %s", line); } // group (curly) open pith["block_is"] = eN.blk_is.group; pith["block_state"] = eN.blk_state.on; pith["block_delim"] = eN.blk_delim.curly; @@ -2927,12 +2825,7 @@ template docAbstraction() { an_object["syntax"] = ""; an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : ""; an_object["lang"] = (m["lang"]) ? m["lang"].to!string : ""; - debug(block) { - writefln( - "* [block curly] %s", - line - ); - } + debug(block) { writefln( "* [block curly] %s", line); } pith["block_is"] = eN.blk_is.block; pith["block_state"] = eN.blk_state.on; pith["block_delim"] = eN.blk_delim.curly; @@ -2941,29 +2834,19 @@ template docAbstraction() { an_object["syntax"] = ""; an_object["attrib"] = m["attrib"].to!string; an_object["lang"] = m["lang"].to!string; - debug(quote) { - writefln( - "* [quote curly] %s", - line - ); - } + debug(quote) { writefln( "* [quote curly] %s", line); } pith["block_is"] = eN.blk_is.quote; pith["block_state"] = eN.blk_state.on; pith["block_delim"] = eN.blk_delim.curly; - } else if (auto m = line.matchFirst(rgx.block_curly_table_open)) { /+ curly table open +/ - debug(table) { // table (curly) open - writefln( - "* [table curly] %s", - line - ); - } + } else if (auto m = line.matchFirst(rgx.block_curly_table_open)) { // curly table open + debug(table) { writefln( "* [table curly] %s", line); } dochas["table"] ++; an_object["table_head"] = m["attrib"].to!string; an_object["block_type"] = "curly"; pith["block_is"] = eN.blk_is.table; pith["block_state"] = eN.blk_state.on; pith["block_delim"] = eN.blk_delim.curly; - } else if (auto m = line.matchFirst(rgx.block_curly_table_special_markup)) { /+ table: special table block markup syntax! +/ + } else if (auto m = line.matchFirst(rgx.block_curly_table_special_markup)) { // table: special table block markup syntax! dochas["table"]++; an_object["table_head"] = m["attrib"].to!string; an_object["block_type"] = "special"; @@ -2975,12 +2858,7 @@ template docAbstraction() { an_object["lang"] = ""; an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : ""; an_object["syntax"] = (m["syntax"]) ? m["syntax"].to!string : ""; - debug(codetic) { - writefln( - "* [code tic] %s", - line - ); - } + debug(codetic) { writefln( "* [code tic] %s", line); } pith["block_is"] = eN.blk_is.code; pith["block_state"] = eN.blk_state.on; pith["block_delim"] = eN.blk_delim.tic; @@ -2989,12 +2867,7 @@ template docAbstraction() { an_object["syntax"] = ""; an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : ""; an_object["lang"] = (m["lang"]) ? m["lang"].to!string : ""; - debug(poem) { - writefln( - "* [poem tic] %s", - line - ); - } + debug(poem) { writefln( "* [poem tic] %s", line); } object_number_poem["start"] = obj_cite_digits.object_number.to!string; pith["block_is"] = eN.blk_is.poem; pith["block_state"] = eN.blk_state.on; @@ -3005,12 +2878,7 @@ template docAbstraction() { an_object["syntax"] = ""; an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : ""; an_object["lang"] = (m["lang"]) ? m["lang"].to!string : ""; - debug(group) { - writefln( - "* [group tic] %s", - line - ); - } + debug(group) { writefln( "* [group tic] %s", line); } pith["block_is"] = eN.blk_is.group; pith["block_state"] = eN.blk_state.on; pith["block_delim"] = eN.blk_delim.tic; @@ -3019,12 +2887,7 @@ template docAbstraction() { an_object["syntax"] = ""; an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : ""; an_object["lang"] = (m["lang"]) ? m["lang"].to!string : ""; - debug(block) { - writefln( - "* [block tic] %s", - line - ); - } + debug(block) { writefln( "* [block tic] %s", line); } pith["block_is"] = eN.blk_is.block; pith["block_state"] = eN.blk_state.on; pith["block_delim"] = eN.blk_delim.tic; @@ -3033,22 +2896,13 @@ template docAbstraction() { an_object["syntax"] = ""; an_object["attrib"] = m["attrib"].to!string; an_object["lang"] = m["lang"].to!string; - debug(quote) { // quote (tic) open - writefln( - "* [quote tic] %s", - line - ); + debug(quote) { writefln( "* [quote tic] %s", line); // quote (tic) open } pith["block_is"] = eN.blk_is.quote; pith["block_state"] = eN.blk_state.on; pith["block_delim"] = eN.blk_delim.tic; - } else if (auto m = line.matchFirst(rgx.block_tic_table_open)) { /+ tic table open +/ - debug(table) { // table (tic) open - writefln( - "* [table tic] %s", - line - ); - } + } else if (auto m = line.matchFirst(rgx.block_tic_table_open)) { // tic table open + debug(table) { writefln( "* [table tic] %s", line); } dochas["table"] ++; an_object["table_head"] = m["attrib"].to!string; an_object["block_type"] = "tic"; @@ -3073,32 +2927,24 @@ template docAbstraction() { if (pith["block_is"] == eN.blk_is.quote){ if (pith["block_delim"] == eN.blk_delim.curly) { if (line.matchFirst(rgx.block_curly_quote_close)) { - debug(quote) { - writeln(line); - } + debug(quote) { writeln(line); } an_object[an_object_key] = an_object[an_object_key].stripRight; pith["block_is"] = eN.blk_is.quote; pith["block_state"] = eN.blk_state.closing; pith["block_delim"] = eN.blk_delim.off; } else { - debug(quote) { - writeln(line); - } + debug(quote) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; } } else if (pith["block_delim"] == eN.blk_delim.tic) { if (line.matchFirst(rgx.block_tic_close)) { - debug(quote) { - writeln(line); - } + debug(quote) { writeln(line); } an_object[an_object_key] = an_object[an_object_key].stripRight; pith["block_is"] = eN.blk_is.quote; pith["block_state"] = eN.blk_state.closing; pith["block_delim"] = eN.blk_delim.off; } else { - debug(quote) { - writeln(line); - } + debug(quote) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; } } @@ -3119,32 +2965,24 @@ template docAbstraction() { if (pith["block_is"] == eN.blk_is.group) { if (pith["block_delim"] == eN.blk_delim.curly) { if (line.matchFirst(rgx.block_curly_group_close)) { - debug(group) { - writeln(line); - } + debug(group) { writeln(line); } an_object[an_object_key] = an_object[an_object_key].stripRight; pith["block_is"] = eN.blk_is.group; pith["block_state"] = eN.blk_state.closing; pith["block_delim"] = eN.blk_delim.off; } else { - debug(group) { - writeln(line); - } + debug(group) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; } } else if (pith["block_delim"] == eN.blk_delim.tic) { if (line.matchFirst(rgx.block_tic_close)) { - debug(group) { - writeln(line); - } + debug(group) { writeln(line); } an_object[an_object_key] = an_object[an_object_key].stripRight; pith["block_is"] = eN.blk_is.group; pith["block_state"] = eN.blk_state.closing; pith["block_delim"] = eN.blk_delim.off; } else { - debug(group) { - writeln(line); - } + debug(group) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; } } @@ -3165,32 +3003,24 @@ template docAbstraction() { if (pith["block_is"] == eN.blk_is.block) { if (pith["block_delim"] == eN.blk_delim.curly) { if (line.matchFirst(rgx.block_curly_block_close)) { - debug(block) { - writeln(line); - } + debug(block) { writeln(line); } an_object[an_object_key] = an_object[an_object_key].stripRight; pith["block_is"] = eN.blk_is.block; pith["block_state"] = eN.blk_state.closing; pith["block_delim"] = eN.blk_delim.off; } else { - debug(block) { - writeln(line); - } + debug(block) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; } } else if (pith["block_delim"] == eN.blk_delim.tic) { if (line.matchFirst(rgx.block_tic_close)) { - debug(block) { - writeln(line); - } + debug(block) { writeln(line); } an_object[an_object_key] = an_object[an_object_key].stripRight; pith["block_is"] = eN.blk_is.block; pith["block_state"] = eN.blk_state.closing; pith["block_delim"] = eN.blk_delim.off; } else { - debug(block) { - writeln(line); - } + debug(block) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; } } @@ -3218,30 +3048,16 @@ template docAbstraction() { if (an_object_key in an_object || processing.length > 0) { an_object[an_object_key] = ""; - debug(poem) { - writefln( - "* [poem curly] %s", - line - ); - } + debug(poem) { writefln( "* [poem curly] %s", line); } if (processing.length > 0) { an_object[an_object_key] = processing["verse"]; } debug(poem) { writeln(__LINE__); - writefln( - "* %s %s", - obj_cite_digits.object_number, - line - ); + writefln( "* %s %s", obj_cite_digits.object_number, line); } if (an_object.length > 0) { - debug(poem) { - writeln( - obj_cite_digits.object_number, - an_object[an_object_key] - ); - } + debug(poem) { writeln( obj_cite_digits.object_number, an_object[an_object_key]); } an_object["is"] = "verse"; TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); @@ -3287,8 +3103,7 @@ template docAbstraction() { if (pith["verse_new"] == eN.bi.on) { verse_line = 1; an_object[an_object_key] = processing["verse"]; - debug(poem) { - writefln( + debug(poem) { writefln( "* %s curly\n%s", obj_cite_digits.object_number, an_object[an_object_key] @@ -3336,20 +3151,12 @@ template docAbstraction() { } else if (pith["block_delim"] == eN.blk_delim.tic) { if (auto m = line.matchFirst(rgx.block_tic_close)) { an_object[an_object_key] = "verse"; - debug(poem) { - writefln( - "* [poem tic] %s", - line - ); - } + debug(poem) { writefln( "* [poem tic] %s", line); } if (processing.length > 0) { an_object[an_object_key] = processing["verse"]; } if (an_object.length > 0) { - debug(poem) { - writeln(__LINE__); - writeln(obj_cite_digits.object_number, line); - } + debug(poem) { writeln(__LINE__); writeln(obj_cite_digits.object_number, line); } processing.remove("verse"); an_object["is"] = "verse"; TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple @@ -3395,8 +3202,7 @@ template docAbstraction() { if (pith["verse_new"] == eN.bi.on) { verse_line = 1; an_object[an_object_key] = processing["verse"]; - debug(poem) { - writefln( + debug(poem) { writefln( "* %s tic\n%s", obj_cite_digits.object_number, an_object[an_object_key] @@ -3461,9 +3267,7 @@ template docAbstraction() { if ( pith["block_is"] == eN.blk_is.code) { if (pith["block_delim"] == eN.blk_delim.curly) { if (line.matchFirst(rgx.block_curly_code_close)) { - debug(codecurly) { - writeln(line); - } + debug(codecurly) { writeln(line); } an_object[an_object_key] = an_object[an_object_key] .replaceFirst(rgx.newline_eol_delimiter_only, "") .stripRight; @@ -3471,16 +3275,12 @@ template docAbstraction() { pith["block_state"] = eN.blk_state.closing; pith["block_delim"] = eN.blk_delim.off; } else { - debug(codecurly) { - writeln(line); - } + debug(codecurly) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; } } else if (pith["block_delim"] == eN.blk_delim.tic) { if (line.matchFirst(rgx.block_tic_close)) { - debug(codetic) { - writeln(line); - } + debug(codetic) { writeln(line); } an_object[an_object_key] = an_object[an_object_key] .replaceFirst(rgx.newline_eol_delimiter_only, "") .stripRight; @@ -3488,9 +3288,7 @@ template docAbstraction() { pith["block_state"] = eN.blk_state.closing; pith["block_delim"] = eN.blk_delim.off; } else { - debug(codetic) { - writeln(line); - } + debug(codetic) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; } } @@ -3512,16 +3310,12 @@ template docAbstraction() { if (pith["block_is"] == eN.blk_is.table) { if (pith["block_delim"] == eN.blk_delim.curly) { if (line.matchFirst(rgx.block_curly_table_close)) { - debug(table) { - writeln(line); - } + debug(table) { writeln(line); } pith["block_is"] = eN.blk_is.table; pith["block_state"] = eN.blk_state.closing; pith["block_delim"] = eN.blk_delim.off; } else { - debug(table) { - writeln(line); - } + debug(table) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; } } else if (pith["block_delim"] == eN.blk_delim.curly_special) { @@ -3549,23 +3343,17 @@ template docAbstraction() { } } } else { - debug(table) { - writeln(line); - } + debug(table) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; } } else if (pith["block_delim"] == eN.blk_delim.tic) { if (line.matchFirst(rgx.block_tic_close)) { - debug(table) { - writeln(line); - } + debug(table) { writeln(line); } pith["block_is"] = eN.blk_is.table; pith["block_state"] = eN.blk_state.closing; pith["block_delim"] = eN.blk_delim.off; } else { - debug(table) { - writeln(line); - } + debug(table) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; } } @@ -3617,12 +3405,8 @@ template docAbstraction() { } if (line.empty) { debug { - debug(biblioblock) { - writeln("---"); - } - debug(biblioblockinclude) { - writeln(biblio_entry_str_json.length); - } + debug(biblioblock) { writeln("---"); } + debug(biblioblockinclude) { writeln(biblio_entry_str_json.length); } } if ((bib_entry == eN.bi.off) && (biblio_entry_str_json.empty)) { @@ -3646,9 +3430,7 @@ template docAbstraction() { biblio_entry_str_json = ""; } } else if (line.matchFirst(rgx.biblio_tags)) { - debug(biblioblock) { - writeln(line); - } + debug(biblioblock) { writeln(line); } auto bt = line.match(rgx.biblio_tags); bib_entry = eN.bi.off; st = bt.captures[1].to!string; @@ -3658,10 +3440,7 @@ template docAbstraction() { ? (biblio_tag_map(st)) : st; j.object[biblio_tag_name] = header_tag_value; - debug(bibliounsortedcheckduplicates) { - writeln(biblio_tag_name, ": ", header_tag_value); - writeln("--"); - } + debug(bibliounsortedcheckduplicates) { writeln(biblio_tag_name, ": ", header_tag_value); writeln("--"); } switch (biblio_tag_name) { case "author_raw": // author_arr author (fn sn) j["author_arr"] @@ -3699,8 +3478,7 @@ template docAbstraction() { break; } auto s = j.toString(); - debug(biblio1) { - writefln( + debug(biblio1) { writefln( "* %s: %s\n%s", biblio_tag_name, biblio_tag_entry, @@ -3712,9 +3490,7 @@ template docAbstraction() { writeln("ERROR", s, "%%"); } if (!(match(line, rgx.comment))) { - debug(biblioblockinclude) { - writeln(line); - } + debug(biblioblockinclude) { writeln(line); } biblio_entry_str_json = s; } else { biblio_entry_str_json = ""; @@ -3730,7 +3506,7 @@ template docAbstraction() { } return ret; } - /+ ↓ abstraction functions +/ + // ↓ abstraction functions @safe static string[string] object_reset()(string[string] an_object) { an_object.remove("body_nugget"); an_object.remove("substantive"); @@ -3746,22 +3522,18 @@ template docAbstraction() { static auto rgx = RgxI(); if (!(line.empty)) { if (pith["no_ocn_multiple_objects"] == eN.bi.off) { - /+ not multi-line object, check whether object_number is on or turned off +/ - if (line.matchFirst(rgx.object_number_block_marks)) { /+ switch off object_number +/ + // not multi-line object, check whether object_number is on or turned off + if (line.matchFirst(rgx.object_number_block_marks)) { // switch off object_number if (line.matchFirst(rgx.object_number_off_block)) { pith["no_ocn_multiple_objects"] = eN.bi.on; pith["ocn"] = eN.ocn.off; - debug(ocnoff) { - writeln(line); - } + debug(ocnoff) { writeln(line); } } if (line.matchFirst(rgx.object_number_off_block_dummy_heading)) { pith["no_ocn_multiple_objects"] = eN.bi.on; pith["dummy_heading_multiple_objects"] = eN.bi.on; pith["ocn"] = eN.ocn.off; - debug(ocnoff) { - writeln(line); - } + debug(ocnoff) { writeln(line); } } } else if (pith["no_ocn_multiple_objects"] == eN.bi.off) { pith["dummy_heading_status"] = eN.bi.off; @@ -3785,9 +3557,7 @@ template docAbstraction() { pith["no_ocn_multiple_objects"] = eN.bi.off; pith["ocn"] = eN.ocn.on; pith["dummy_heading_status"] = eN.bi.off; - debug(ocnoff) { - writeln(line); - } + debug(ocnoff) { writeln(line); } } } } @@ -4230,37 +4000,26 @@ template docAbstraction() { B opt_action, ) { static auto rgx = RgxI(); - if (auto m = line.match(rgx.book_index_item)) { /+ match book_index +/ - debug(bookindexmatch) { - writefln( + if (auto m = line.match(rgx.book_index_item)) { // match book_index + debug(bookindexmatch) { writefln( "* [bookindex] %s\n", m["bookindex"].to!string, ); } an_object["bookindex_nugget"] = m.captures[1].to!string; - } else if (auto m = line.match(rgx.book_index_item_open)) { /+ match open book_index +/ + } else if (auto m = line.match(rgx.book_index_item_open)) { // match open book_index pith["section"] = eN.sect.book_index; if (opt_action.backmatter && opt_action.section_bookindex) { book_idx_tmp = m.captures[1].to!string; - debug(bookindexmatch) { - writefln( - "* [bookindex] %s\n", - book_idx_tmp, - ); - } + debug(bookindexmatch) { writefln( "* [bookindex] %s\n", book_idx_tmp,); } } - } else if (pith["section"] == eN.sect.book_index) { /+ book_index flag set +/ + } else if (pith["section"] == eN.sect.book_index) { // book_index flag set if (auto m = line.match(rgx.book_index_item_close)) { pith["section"] = eN.sect.unset; if (opt_action.backmatter && opt_action.section_bookindex) { an_object["bookindex_nugget"] = book_idx_tmp ~ m.captures[1].to!string; - debug(bookindexmatch) { - writefln( - "* [bookindex] %s\n", - book_idx_tmp, - ); - } + debug(bookindexmatch) { writefln( "* [bookindex] %s\n", book_idx_tmp,); } } book_idx_tmp = ""; } else { @@ -4287,10 +4046,8 @@ template docAbstraction() { ) { static auto rgx = RgxI(); if ((_make_unmarked_headings.length > 2) - && (pith["make_headings"] == eN.bi.off)) { /+ headings found +/ - debug(headingsfound) { - writeln(_make_unmarked_headings); - } + && (pith["make_headings"] == eN.bi.off)) { // headings found + debug(headingsfound) { writeln(_make_unmarked_headings); } debug(headingsfound) { writeln(_make_unmarked_headings.length); writeln(_make_unmarked_headings); @@ -4375,48 +4132,34 @@ template docAbstraction() { && (line_occur["para"] == eN.bi.off && line_occur["heading"] == eN.bi.off) && pith["txt_is"] == eN.txt_is.off - ) { /+ heading make set +/ + ) { // heading make set if (line.matchFirst(heading_match_rgx["h_B"])) { line = "B~ " ~ line; - debug(headingsfound) { - writeln(line); - } + debug(headingsfound) { writeln(line); } } if (line.matchFirst(heading_match_rgx["h_C"])) { line = "C~ " ~ line; - debug(headingsfound) { - writeln(line); - } + debug(headingsfound) { writeln(line); } } if (line.matchFirst(heading_match_rgx["h_D"])) { line = "D~ " ~ line; - debug(headingsfound) { - writeln(line); - } + debug(headingsfound) { writeln(line); } } if (line.matchFirst(heading_match_rgx["h_1"])) { line = "1~ " ~ line; - debug(headingsfound) { - writeln(line); - } + debug(headingsfound) { writeln(line); } } if (line.matchFirst(heading_match_rgx["h_2"])) { line = "2~ " ~ line; - debug(headingsfound) { - writeln(line); - } + debug(headingsfound) { writeln(line); } } if (line.matchFirst(heading_match_rgx["h_3"])) { line = "3~ " ~ line; - debug(headingsfound) { - writeln(line); - } + debug(headingsfound) { writeln(line); } } if (line.matchFirst(heading_match_rgx["h_4"])) { line = "4~ " ~ line; - debug(headingsfound) { - writeln(line); - } + debug(headingsfound) { writeln(line); } } } retStruct_flow_heading_make_set ret; @@ -4439,7 +4182,7 @@ template docAbstraction() { ) { static auto rgx = RgxI(); static auto mkup = InlineMarkup(); - if (auto m = line.match(rgx.headings)) { /+ heading match +/ + if (auto m = line.match(rgx.headings)) { // heading match ++line_occur["heading"]; pith["txt_is"] = eN.txt_is.heading; if (line.match(rgx.heading_seg_and_above)) { @@ -4593,9 +4336,7 @@ template docAbstraction() { an_object["lev_markup_number"] = lv["lv"].to!string; } an_object["dummy_heading_status"] = (pith["dummy_heading_status"] == eN.bi.off) ? "f" : "t"; - debug(heading) { - writeln(line.strip); - } + debug(heading) { writeln(line.strip); } } struct retStruct_flow_heading_matched { string[string] this_object; @@ -4630,7 +4371,7 @@ template docAbstraction() { static auto rgx = RgxI(); if (line_occur["para"] == eN.bi.off) { line = font_faces_line(line); - /+ para matches +/ + // para matches pith["txt_is"] = eN.txt_is.para; an_object[an_object_key] ~= line; indent = [ @@ -4639,28 +4380,20 @@ template docAbstraction() { ]; bullet = false; if (auto m = line.matchFirst(rgx.para_indent)) { - debug(paraindent) { - writeln(line); - } + debug(paraindent) { writeln(line); } indent["hang_position"] = (m["indent"]).to!int; indent["base_position"] = (m["indent"]).to!int; } else if (line.matchFirst(rgx.para_bullet)) { - debug(parabullet) { - writeln(line); - } + debug(parabullet) { writeln(line); } bullet = true; } else if (auto m = line.matchFirst(rgx.para_indent_hang)) { - debug(paraindenthang) { - writeln(line); - } + debug(paraindenthang) { writeln(line); } indent = [ "hang_position" : (m["hang"]).to!int, "base_position" : (m["indent"]).to!int, ]; } else if (auto m = line.matchFirst(rgx.para_bullet_indent)) { - debug(parabulletindent) { - writeln(line); - } + debug(parabulletindent) { writeln(line); } indent = [ "hang_position" : (m["indent"]).to!int, "base_position" : (m["indent"]).to!int, @@ -4738,9 +4471,7 @@ template docAbstraction() { ulong col_num_; ulong col_num_chk = 0; foreach(idx_r, row; table_array) { - debug(table_dev) { - writeln("row ", idx_r); - } + debug(table_dev) { writeln("row ", idx_r); } col_num_ = 0; if (col_num == 0 || col_num < row.length) { @@ -4749,19 +4480,13 @@ template docAbstraction() { if (col_num_chk == 0) { col_num_chk = col_num; } else if (col_num == 1) { - debug(table_dev) { - writeln("table note: "); - } + debug(table_dev) { writeln("table note: "); } } else if (col_num_chk != col_num) { - debug(table_dev) { - writeln("warning irregular number of columns: ", col_num_chk, " != ", col_num); - } + debug(table_dev) { writeln("warning irregular number of columns: ", col_num_chk, " != ", col_num); } } else { } foreach(idx_c, col; row) { - debug(table_dev) { - write(idx_c, ", "); - } + debug(table_dev) { write(idx_c, ", "); } col_num_ = idx_c; _table_substantive ~= col ~ mng.tc_s; if (idx_r == 0 && table_object.table.heading) { @@ -4785,9 +4510,7 @@ template docAbstraction() { } } } - debug(table_dev) { - writeln(""); - } + debug(table_dev) { writeln(""); } if (col_num_chk > 0 && (col_num != col_num_chk)) { } else if (col_num == col_num_chk){ } else { @@ -4799,9 +4522,7 @@ template docAbstraction() { if (table_object.table.number_of_columns == 0) { table_object.table.number_of_columns = (col_num).to!int; } else { - debug(table_dev) { - writeln(table_object.table.number_of_columns, " != ", col_num); - } + debug(table_dev) { writeln(table_object.table.number_of_columns, " != ", col_num); } } } if (table_object.table.number_of_columns == 0 @@ -4816,9 +4537,7 @@ template docAbstraction() { } } else if (table_object.table.number_of_columns != table_object.table.column_widths.length) { - debug(table_dev) { - writeln(m.hit); // further logic required - } + debug(table_dev) { writeln(m.hit); } // further logic required if (table_object.table.number_of_columns > table_object.table.column_widths.length) { double col_w = (100.00 - (table_object.table.column_widths).sum) / (table_object.table.number_of_columns - table_object.table.column_widths.length); @@ -4908,8 +4627,8 @@ template docAbstraction() { } return ret; } - /+ abstraction functions ↑ +/ - /+ ↓ abstraction function emitters +/ + // abstraction functions ↑ + // ↓ abstraction function emitters @safe pure struct OCNemitter { int ocn_digit, ocn_object_number, ocn_on_, ocn_off_, ocn_bkidx, ocn_bkidx_; string object_identifier; @@ -4958,7 +4677,6 @@ template docAbstraction() { invariant() { } } - /+ +/ @safe static struct ObjInlineMarkupMunge { string[string] obj_txt; int n_foot, n_foot_reg, n_foot_sp_asterisk, n_foot_sp_plus; @@ -4975,36 +4693,30 @@ template docAbstraction() { } @safe static auto images()(string obj_txt_in) { static auto mng = InlineMarkup(); - /+ url matched +/ + // url matched obj_txt_in = obj_txt_in.replaceAll(rgx.inline_notes_al_special, ""); // TODO reinstate when special footnotes are implemented - if (obj_txt_in.match(rgx.smid_image_generic)) { /+ images with and without links +/ - debug(images) { - writeln("Image: ", obj_txt_in); - } + if (obj_txt_in.match(rgx.smid_image_generic)) { // images with and without links + debug(images) { writeln("Image: ", obj_txt_in); } if (obj_txt_in.match(rgx.smid_image_with_dimensions)) { obj_txt_in = obj_txt_in .replaceAll(rgx.smid_image_with_dimensions, ("$1" ~ mkup.img ~ "$2,w$3h$4 " ~ "$5")) .replaceAll(rgx.smid_image_delimit, ("$1" ~ mkup.lnk_o ~ "$2".strip ~ mkup.lnk_c ~ mkup.url_o ~ mkup.url_c)); - debug(images) { - writeln("IMAGE with size: ", obj_txt_in); - } + debug(images) { writeln("IMAGE with size: ", obj_txt_in); } } else if (obj_txt_in.match(rgx.smid_image)) { obj_txt_in = obj_txt_in .replaceAll(rgx.smid_image, ("$1" ~ mkup.img ~ "$2,w0h0" ~ "$3")) .replaceAll(rgx.smid_image_delimit, ("$1" ~ mkup.lnk_o ~ "$2".strip ~ mkup.lnk_c ~ mkup.url_o ~ mkup.url_c)); - debug(images) { - writeln("IMAGE: ", obj_txt_in); // decide on representation - } + debug(images) { writeln("IMAGE: ", obj_txt_in); } // decide on representation } } return obj_txt_in; } @safe TxtPlusHasFootnotes footnotes_endnotes_markup_and_number_or_stars()(string obj_txt_in, bool reset_note_numbers) { - /+ endnotes (regular) +/ + // endnotes (regular) bool flg_notes_reg = false; bool flg_notes_star = false; bool flg_notes_plus = false; @@ -5082,7 +4794,7 @@ template docAbstraction() { bool urls = false; bool images_without_dimensions = false; tail = ""; - /+ special endnotes +/ + // special endnotes obj_txt_in = obj_txt_in.replaceAll( rgx.inline_notes_curly_sp_asterisk, (mkup.en_a_o ~ "*" ~ " $1" ~ mkup.en_a_c) @@ -5092,14 +4804,14 @@ template docAbstraction() { rgx.inline_notes_curly_sp_plus, (mkup.en_a_o ~ "+" ~ " $1" ~ mkup.en_a_c) ); - /+ image matched +/ + // image matched if (obj_txt_in.match(rgx.smid_image_generic)) { obj_txt_in = images(obj_txt_in); if (obj_txt_in.match(rgx.smid_mod_image_without_dimensions)) { images_without_dimensions = true; } } - /+ url matched +/ + // url matched if (obj_txt_in.match(rgx.smid_inline_url)) { urls = true; obj_txt_in = obj_txt_in.links_and_images; @@ -5110,13 +4822,10 @@ template docAbstraction() { } TxtPlusHasFootnotes ftn = footnotes_endnotes_markup_and_number_or_stars(obj_txt_in, reset_note_numbers); obj_txt_out = ftn.obj_txt; - debug(footnotes) { - writeln(obj_txt_out, tail); - } + debug(footnotes) { writeln(obj_txt_out, tail); } obj_txt_out = obj_txt_out ~ tail; debug(footnotesdone) { - foreach(m; matchAll(obj_txt_out, - (mkup.en_a_o ~ `\s*(.+?)` ~ mkup.en_a_c))) { + foreach(m; matchAll(obj_txt_out, (mkup.en_a_o ~ `\s*(.+?)` ~ mkup.en_a_c))) { writeln(m[1]); writeln(m.hit); } @@ -5437,8 +5146,8 @@ template docAbstraction() { heading_num[3] = 0; heading_number_auto_composite = ""; } - /+ auto_num_depth minimum 0 - (1.) default 2 (1.1.1) max 3 (1.1.1.1) implement +/ + // auto_num_depth minimum 0 + // (1.) default 2 (1.1.1) max 3 (1.1.1.1) implement if ( conf_make_meta.make.auto_num_top_lv > obj_["lev_markup_number"].to!uint @@ -5547,9 +5256,7 @@ template docAbstraction() { (heading_number_auto_composite.empty) ? "" : "seg_" ~ heading_number_auto_composite; - debug(heading_number_auto) { - writeln(heading_number_auto_composite); - } + debug(heading_number_auto) { writeln(heading_number_auto_composite); } if ((!empty(heading_number_auto_composite)) && (obj_["lev_markup_number"].to!uint >= conf_make_meta.make.auto_num_top_lv)) { munge_ = munge_ @@ -5596,7 +5303,6 @@ template docAbstraction() { return munge_; } } - /+ +/ struct ObjAttributes { string[string] _obj_attrib; @safe string obj_attributes()( @@ -5780,7 +5486,6 @@ template docAbstraction() { return _obj_attrib; } } - /+ +/ struct BookIndexNuggetHash { string main_term, sub_term, sub_term_bits; int object_number_offset, object_number_endpoint; @@ -5792,9 +5497,7 @@ template docAbstraction() { OCNset obj_cite_digits, S tag_in_seg, ) { - debug(asserts) { - static assert(is(typeof(obj_cite_digits.object_number) == int)); - } + debug(asserts) { static assert(is(typeof(obj_cite_digits.object_number) == int)); } debug(bookindexraw) { if (!bookindex_section.empty) { writeln( @@ -5863,9 +5566,7 @@ template docAbstraction() { auto mainkeys = bookindex_unordered_hashes.byKey.array.sort().release; foreach (mainkey; mainkeys) { - debug(bookindex1) { - writeln(mainkey); - } + debug(bookindex1) { writeln(mainkey); } auto subkeys = bookindex_unordered_hashes[mainkey].byKey.array.sort().release; foreach (subkey; subkeys) { @@ -5919,9 +5620,7 @@ template docAbstraction() { OCNset obj_cite_digits, B opt_action, ) { - debug(asserts) { - static assert(is(typeof(obj_cite_digits.object_number) == int)); - } + debug(asserts) { static assert(is(typeof(obj_cite_digits.object_number) == int)); } mixin spineNode; mixin InternalMarkup; static auto mkup = InlineMarkup(); @@ -6072,7 +5771,6 @@ template docAbstraction() { return t; } } - /+ +/ struct NotesSection { string[string] object_notes; int previous_count; @@ -6102,8 +5800,7 @@ template docAbstraction() { (contents_am[cntr].text).matchAll( rgx.inline_notes_al_special_char_note) ) { - debug(endnotes_build) { - writeln( + debug(endnotes_build) { writeln( "{", mkup.ff_i, mkup.superscript, mkup.ff_o, m["char"], ".", mkup.ff_c, mkup.superscript, "}" ~ mkup.mark_internal_site_lnk, tag_in_seg["seg_lv4"], @@ -6131,8 +5828,7 @@ template docAbstraction() { (contents_am[cntr].text).matchAll( rgx.inline_notes_al_regular_number_note) ) { - debug(endnotes_build) { - writeln( + debug(endnotes_build) { writeln( "{", mkup.ff_i, mkup.superscipt, mkup.ff_o, m["num"], ".", mkup.ff_c, mkup.superscipt, "}" ~ mkup.mark_internal_site_lnk, tag_in_seg["seg_lv4"], @@ -6280,7 +5976,6 @@ template docAbstraction() { return t; } } - /+ +/ struct Bibliography { @system public retStruct_flow_bibliography flow_bibliography_()( string[] biblio_unsorted_incomplete, @@ -6318,10 +6013,9 @@ template docAbstraction() { JSONValue[] bib_arr_json ) { foreach (bibent; biblio_unordered) { - /+ update bib to include deemed_author, needed for: - sort_bibliography_array_by_deemed_author_year_title - either: sort on multiple fields, or; create such sort field - +/ + // update bib to include deemed_author, needed for: + // sort_bibliography_array_by_deemed_author_year_title + // either: sort on multiple fields, or; create such sort field JSONValue j = parseJSON(bibent); if (!empty(j["fulltitle"].str)) { if (!empty(j["author_raw"].str)) { @@ -6349,9 +6043,7 @@ template docAbstraction() { })(biblio_unordered).array; debug(bibliosorted) { foreach (j; biblio_sorted_) { - if (!empty(j["fulltitle"].str)) { - writeln(j["sortby_deemed_author_year_title"]); - } + if (!empty(j["fulltitle"].str)) { writeln(j["sortby_deemed_author_year_title"]); } } } return biblio_sorted_; @@ -6359,14 +6051,11 @@ template docAbstraction() { @system void biblio_debug()(JSONValue[] biblio_sorted) { debug(biblio0) { foreach (j; biblio_sorted) { - if (!empty(j["fulltitle"].str)) { - writeln(j["sortby_deemed_author_year_title"]); - } + if (!empty(j["fulltitle"].str)) { writeln(j["sortby_deemed_author_year_title"]); } } } } } - /+ +/ struct NodeStructureMetadata { int lv, lv0, lv1, lv2, lv3, lv4, lv5, lv6, lv7; int obj_cite_digit; @@ -6382,9 +6071,7 @@ template docAbstraction() { int ptr_, string is_ ) { - debug(asserts) { - static assert(is(typeof(obj_cite_digits.object_number) == int)); - } + debug(asserts) { static assert(is(typeof(obj_cite_digits.object_number) == int)); } assert(is_ != "heading"); assert(obj_cite_digits.object_number.to!int >= 0); assert(is_ != "heading"); // should not be necessary @@ -6413,11 +6100,8 @@ template docAbstraction() { comp_obj_location.metainfo.parent_ocn = p_["object_number"]; comp_obj_location.metainfo.parent_lev_markup = p_["lev_markup_number"]; debug(_node) { - if (lev_markup_number.match(rgx.levels_numbered_headings)) { - writeln("x ", _node.to!string); - } else { - writeln("- ", _node.to!string); - } + if (lev_markup_number.match(rgx.levels_numbered_headings)) { writeln("x ", _node.to!string); + } else { writeln("- ", _node.to!string); } } assert(comp_obj_location.metainfo.parent_lev_markup >= 4); assert(comp_obj_location.metainfo.parent_lev_markup <= 7); @@ -6456,14 +6140,13 @@ template docAbstraction() { ); if (lev_markup_number.match(rgx.levels_numbered)) { if (lev_markup_number.to!int == 0) { - /+ TODO first hit (of two) with this assertion failure, check, fix & reinstate - assert(obj_cite_digits.object_number.to!int == 1, - "ERROR header lev markup number is: " ~ - lev_markup_number.to!string ~ - " obj_cite_digits.object_number.to!int should == 1 but is: " ~ - obj_cite_digits.object_number.to!string ~ - "\n" ~ _text); - +/ + // TODO first hit (of two) with this assertion failure, check, fix & reinstate + // assert(obj_cite_digits.object_number.to!int == 1, + // "ERROR header lev markup number is: " ~ + // lev_markup_number.to!string ~ + // " obj_cite_digits.object_number.to!int should == 1 but is: " ~ + // obj_cite_digits.object_number.to!string ~ + // "\n" ~ _text); } } switch (lev_markup_number.to!int) { @@ -6579,14 +6262,10 @@ template docAbstraction() { tag_assoc[_comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = _comp_obj_heading_.tags.in_segment_html; tag_assoc[_comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1to4"] = _comp_obj_heading_.tags.segment_anchor_tag_epub; debug(_node) { - if (lev_markup_number.match(rgx.levels_numbered_headings)) { - writeln("* ", _node.to!string); - } + if (lev_markup_number.match(rgx.levels_numbered_headings)) { writeln("* ", _node.to!string); } } debug(nodeheading) { - if (lev_markup_number.match(rgx.levels_numbered_headings)) { - writeln("* ", _node.to!string); - } + if (lev_markup_number.match(rgx.levels_numbered_headings)) { writeln("* ", _node.to!string); } } assert(_comp_obj_heading_.metainfo.parent_lev_markup <= 7); assert(_comp_obj_heading_.metainfo.parent_ocn >= 0); @@ -6623,8 +6302,8 @@ template docAbstraction() { invariant() { } } - /+ abstraction functions emitters ↑ +/ - /+ ↓ abstraction functions assertions +/ + // abstraction functions emitters ↑ + // ↓ abstraction functions assertions @safe pure void assertions_doc_structure()( string[string] an_object, string an_object_key, @@ -7195,7 +6874,7 @@ template docAbstraction() { break; } } - /+ abstraction functions assertions ↑ +/ + // abstraction functions assertions ↑ } template docSectKeysSeq() { @safe auto docSectKeysSeq(string[][string] document_section_keys_sequenced) { |