From da32ec40fc237b03f22aac329017d06735289a3a Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 20 Mar 2019 13:03:02 -0400 Subject: housekeeping --- src/doc_reform/meta/defaults.d | 1 + src/doc_reform/meta/doc_debugs.d | 16 +- src/doc_reform/meta/metadoc_from_src.d | 310 +++++++++++++++++---------------- src/doc_reform/meta/metadochead.d | 85 +++++++++ src/doc_reform/meta/rgx.d | 43 ++++- 5 files changed, 292 insertions(+), 163 deletions(-) create mode 100644 src/doc_reform/meta/metadochead.d (limited to 'src/doc_reform/meta') diff --git a/src/doc_reform/meta/defaults.d b/src/doc_reform/meta/defaults.d index fbde36e..1bfc859 100644 --- a/src/doc_reform/meta/defaults.d +++ b/src/doc_reform/meta/defaults.d @@ -127,6 +127,7 @@ template InternalMarkup() { static struct InlineMarkup { auto en_a_o = "【"; auto en_a_c = "】"; auto en_b_o = "〖"; auto en_b_c = "〗"; + auto quote_o = "“"; auto quote_c = "”"; auto ff_o = "┨"; auto ff_c = "┣"; // fontface auto lnk_o = "┥"; auto lnk_c = "┝"; auto url_o = "┤"; auto url_c = "├"; diff --git a/src/doc_reform/meta/doc_debugs.d b/src/doc_reform/meta/doc_debugs.d index 8765c06..5ca5c39 100644 --- a/src/doc_reform/meta/doc_debugs.d +++ b/src/doc_reform/meta/doc_debugs.d @@ -104,17 +104,17 @@ template DocReformDebugs() { foreach (obj; contents[sect]) { if (obj.metainfo.is_a == "heading") { foreach_reverse (k; 0 .. 7) { - switch (obj.dom_structure_markedup_tags_status[k]) { - case DomTags.close : + switch (obj.dom_structure_markedup_tags_status[k]) with (DomTags) { + case close : writeln(markup.indent_by_spaces_provided(k), ""); break; - case DomTags.close_and_open : + case close_and_open : writeln(markup.indent_by_spaces_provided(k), ""); writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text, " file: ", obj.segment_anchor_tag_html, ".xhtml#", obj.ocn); break; - case DomTags.open : + case open : writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text, " file: ", obj.segment_anchor_tag_html, ".xhtml#", obj.ocn); @@ -131,17 +131,17 @@ template DocReformDebugs() { foreach (obj; contents[sect]) { if (obj.metainfo.is_a == "heading") { foreach_reverse (k; 0 .. 7) { - switch (obj.dom_structure_collapsed_tags_status[k]) { - case DomTags.close : + switch (obj.dom_structure_collapsed_tags_status[k]) with (DomTags) { + case close : writeln(markup.indent_by_spaces_provided(k), ""); break; - case DomTags.close_and_open : + case close_and_open : writeln(markup.indent_by_spaces_provided(k), ""); writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text, " file: ", obj.segment_anchor_tag_html, ".xhtml#", obj.ocn); break; - case DomTags.open : + case open : writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text, " file: ", obj.segment_anchor_tag_html, ".xhtml#", obj.ocn); diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index 38370db..f089a15 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -236,6 +236,7 @@ template DocReformDocAbstraction() { static auto inline_markup_faces(L)(L line) { static auto rgx = Rgx(); static auto mkup = InlineMarkup(); + line = replaceAll!(m => mkup.quote_o ~ m[1] ~ mkup.quote_c)(line, rgx.within_quotes); line = replaceAll!(m => mkup.mono ~ mkup.ff_o ~ m[2] ~ mkup.ff_c ~ mkup.mono)(line, rgx.inline_mark_mono); line = replaceAll!(m => mkup.cite ~ mkup.ff_o ~ m[2] ~ mkup.ff_c ~ mkup.cite)(line, rgx.inline_mark_cite); foreach (regx; [rgx.inline_mark_emphasis, rgx.inline_mark_bold, rgx.inline_mark_underscore, rgx.inline_mark_italics, rgx.inline_mark_superscript, rgx.inline_mark_subscript, rgx.inline_mark_strike, rgx.inline_mark_insert]) { @@ -472,10 +473,6 @@ template DocReformDocAbstraction() { line, ); } - line = line.replaceAll(rgx.true_dollar, "$$$$"); - /+ dollar represented as $$ needed to stop submatching on $ - (substitutions using ${identifiers} must take into account (i.e. happen earlier)) - +/ debug(source) { writeln(line); } @@ -645,8 +642,8 @@ template DocReformDocAbstraction() { debug(paraindent) { writeln(line); } - indent["hang_position"] = (m.captures[1]).to!int; - indent["base_position"] = 0; + indent["hang_position"] = (m[1]).to!int; + indent["base_position"] = (m[1]).to!int; } else if (line.matchFirst(rgx.para_bullet)) { debug(parabullet) { writeln(line); @@ -657,16 +654,16 @@ template DocReformDocAbstraction() { writeln(line); } indent=[ - "hang_position" : (m.captures[1]).to!int, - "base_position" : (m.captures[2]).to!int, + "hang_position" : (m[1]).to!int, + "base_position" : (m[2]).to!int, ]; } else if (auto m = line.matchFirst(rgx.para_bullet_indent)) { debug(parabulletindent) { writeln(line); } indent=[ - "hang_position" : (m.captures[1]).to!int, - "base_position" : 0, + "hang_position" : (m[1]).to!int, + "base_position" : (m[1]).to!int, ]; bullet = true; } @@ -955,7 +952,7 @@ template DocReformDocAbstraction() { an_object["is"] = "heading"; an_object_key="body_nugget"; auto substantive_object_and_anchor_tags_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, _new_doc); + = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, ((_new_doc) ? Yes._new_doc : No._new_doc)); an_object["substantive"] = substantive_object_and_anchor_tags_tuple[sObj.content]; anchor_tag = substantive_object_and_anchor_tags_tuple[sObj.anchor_tag]; if (_new_doc) { @@ -1071,6 +1068,10 @@ template DocReformDocAbstraction() { } else if ((obj_type_status["para"] == State.on) && (line_occur["para"] > State.off)) { /+ paragraph object (current line empty) +/ + /+ repeated character paragraph separator +/ + if ((an_object[an_object_key].to!string).matchFirst(rgx.repeated_character_line_separator)) { + obj_type_status["ocn_status"] = OCNstatus.off; + } obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]); an_object["bookindex_nugget"] = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; @@ -1089,7 +1090,7 @@ template DocReformDocAbstraction() { an_object["is"], ); auto substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false); + = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; comp_obj_para = comp_obj_para.init; @@ -1149,7 +1150,7 @@ template DocReformDocAbstraction() { foreach (i; previous_length .. the_document_body_section.length) { if (the_document_body_section[i].metainfo.is_a == "verse") { if ((the_document_body_section[i].text).match( - rgx.inline_notes_delimiter_al_regular_number_note + rgx.inline_notes_al_regular_number_note )) { note_section.gather_notes_for_endnote_section( the_document_body_section, @@ -1163,7 +1164,7 @@ template DocReformDocAbstraction() { /+ scan object for endnotes +/ previous_length = the_document_body_section.length.to!int; if ((the_document_body_section[$-1].text).match( - rgx.inline_notes_delimiter_al_regular_number_note + rgx.inline_notes_al_regular_number_note )) { previous_count=(the_document_body_section.length -1).to!int; note_section.gather_notes_for_endnote_section( @@ -1714,20 +1715,20 @@ template DocReformDocAbstraction() { foreach (_lg, ref obj; document_sections) { if (obj.metainfo.is_a == "heading") { foreach (_dts_lv, dom_tag_status; obj.metainfo.dom_structure_markedup_tags_status) { - switch (dom_tag_status) { - case DomTags.none: break; - case DomTags.open: + switch (dom_tag_status) with (DomTags) { + case none: break; + case open: _ocn_open_key[_dts_lv] = (obj.metainfo.ocn).to!string; _heading_ocn_decendants[_ocn_open_key[_dts_lv]] = obj.metainfo.ocn; break; - case DomTags.close: + case close: if (_ocn_open_key[_dts_lv].empty) { _ocn_open_key[_dts_lv] = "0"; } _heading_ocn_decendants[_ocn_open_key[_dts_lv]] = obj.metainfo.ocn - 1; _ocn_open_key[_dts_lv] = (0).to!string; break; - case DomTags.close_and_open: + case close_and_open: if (_ocn_open_key[_dts_lv].empty) { _ocn_open_key[_dts_lv] = "0"; } @@ -1735,7 +1736,7 @@ template DocReformDocAbstraction() { _ocn_open_key[_dts_lv] = (obj.metainfo.ocn).to!string; _heading_ocn_decendants[_ocn_open_key[_dts_lv]] = obj.metainfo.ocn; break; - case DomTags.open_still: break; + case open_still: break; default: break; } } @@ -1771,9 +1772,9 @@ template DocReformDocAbstraction() { int max_width = 640; foreach (m; obj.text.matchAll(rgx.inline_image_without_dimensions)) { debug(images) { - writeln(manifest_matter.src.image_dir_path ~ "/" ~ m.captures["img"]); + writeln(manifest_matter.src.image_dir_path ~ "/" ~ m["img"]); } - read_image_info(manifest_matter.src.image_dir_path ~ "/" ~ m.captures["img"], w, h, chans); + read_image_info(manifest_matter.src.image_dir_path ~ "/" ~ m["img"], w, h, chans); // calculate, decide max width and proportionally reduce to keep w & h within it debug(images) { writeln("width: ", w, ", height: ", h); @@ -2279,40 +2280,40 @@ template DocReformDocAbstraction() { "tail": the_dom_tail_section, ]; string[][string] document_section_keys_sequenced = [ - "seg": ["head", "toc", "body",], "scroll": ["head", "toc", "body",], + "seg": ["head", "toc", "body",], "sql": ["head", "body",] ]; if (document_the["endnotes"].length > 1) { - document_section_keys_sequenced["seg"] ~= "endnotes"; document_section_keys_sequenced["scroll"] ~= "endnotes"; + document_section_keys_sequenced["seg"] ~= "endnotes"; } if (document_the["glossary"].length > 1) { - document_section_keys_sequenced["seg"] ~= "glossary"; document_section_keys_sequenced["scroll"] ~= "glossary"; + document_section_keys_sequenced["seg"] ~= "glossary"; document_section_keys_sequenced["sql"] ~= "glossary"; } if (document_the["bibliography"].length > 1) { - document_section_keys_sequenced["seg"] ~= "bibliography"; document_section_keys_sequenced["scroll"] ~= "bibliography"; + document_section_keys_sequenced["seg"] ~= "bibliography"; document_section_keys_sequenced["sql"] ~= "bibliography"; } if (document_the["bookindex"].length > 1) { - document_section_keys_sequenced["seg"] ~= "bookindex"; document_section_keys_sequenced["scroll"] ~= "bookindex"; + document_section_keys_sequenced["seg"] ~= "bookindex"; document_section_keys_sequenced["sql"] ~= "bookindex"; } if (document_the["blurb"].length > 1) { - document_section_keys_sequenced["seg"] ~= "blurb"; document_section_keys_sequenced["scroll"] ~= "blurb"; + document_section_keys_sequenced["seg"] ~= "blurb"; document_section_keys_sequenced["sql"] ~= "blurb"; } if ((opt_action.html) || (opt_action.html_scroll) || (opt_action.html_seg) || (opt_action.epub)) { - document_section_keys_sequenced["seg"] ~= "tail"; document_section_keys_sequenced["scroll"] ~= "tail"; + document_section_keys_sequenced["seg"] ~= "tail"; } auto sequenced_document_keys = docSectKeysSeq!()(document_section_keys_sequenced); auto segnames_lv4 = segnames["html"].dup; @@ -2500,8 +2501,8 @@ template DocReformDocAbstraction() { bool code_block_numbered = false; if (auto m = line.matchFirst(rgx.block_curly_code_open)) { /+ curly code open +/ - code_block_syntax = (m.captures[1]) ? m.captures[1].to!string : ""; - code_block_numbered = (m.captures[2].matchFirst(rgx.code_numbering)) + code_block_syntax = (m[1]) ? m[1].to!string : ""; + code_block_numbered = (m[2].matchFirst(rgx.code_numbering)) ? true : false; debug(codecurly) { // code (curly) open writefln( @@ -2566,22 +2567,22 @@ template DocReformDocAbstraction() { line ); } - an_object["table_head"] = m.captures[1].to!string; + an_object["table_head"] = m[1].to!string; an_object["block_type"] = "curly"; obj_type_status["blocks"] = TriState.on; obj_type_status["table"] = TriState.on; obj_type_status["curly_table"] = TriState.on; } else if (auto m = line.matchFirst(rgx.block_curly_table_special_markup)) { /+ table: special table block markup syntax! +/ - an_object["table_head"] = m.captures[1].to!string; + an_object["table_head"] = m[1].to!string; an_object["block_type"] = "special"; obj_type_status["blocks"] = TriState.on; obj_type_status["table"] = TriState.on; obj_type_status["curly_table_special_markup"] = TriState.on; } else if (auto m = line.matchFirst(rgx.block_tic_code_open)) { /+ tic code open +/ - code_block_syntax = (m.captures[1]) ? m.captures[1].to!string : ""; - code_block_numbered = (m.captures[2].matchFirst(rgx.code_numbering)) + code_block_syntax = (m[1]) ? m[1].to!string : ""; + code_block_numbered = (m[2].matchFirst(rgx.code_numbering)) ? true : false; debug(codetic) { // code (tic) open writefln( @@ -2646,7 +2647,7 @@ template DocReformDocAbstraction() { line ); } - an_object["table_head"] = m.captures[1].to!string; + an_object["table_head"] = m[1].to!string; an_object["block_type"] = "tic"; obj_type_status["blocks"] = TriState.on; obj_type_status["table"] = TriState.on; @@ -2830,7 +2831,7 @@ template DocReformDocAbstraction() { } an_object["is"] = "verse"; auto substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false); + = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; comp_obj_block = comp_obj_block.init; @@ -2893,7 +2894,7 @@ template DocReformDocAbstraction() { an_object["is"] ); auto substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false); + = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; comp_obj_block = comp_obj_block.init; @@ -2939,7 +2940,7 @@ template DocReformDocAbstraction() { processing.remove("verse"); an_object["is"] = "verse"; auto substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false); + = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; comp_obj_block = comp_obj_block.init; @@ -3002,7 +3003,7 @@ template DocReformDocAbstraction() { an_object["is"] ); auto substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false); + = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; comp_obj_block = comp_obj_block.init; @@ -3315,7 +3316,7 @@ template DocReformDocAbstraction() { ); an_object["is"] = "table"; auto substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, "body_nugget", conf_make_meta, false); + = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, "body_nugget", conf_make_meta, No._new_doc); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; @@ -3378,7 +3379,7 @@ template DocReformDocAbstraction() { an_object["is"] ); auto substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false); + = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; comp_obj_block = comp_obj_block.init; @@ -3427,7 +3428,7 @@ template DocReformDocAbstraction() { an_object["is"] ); auto substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false); + = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; comp_obj_block = comp_obj_block.init; @@ -3476,7 +3477,7 @@ template DocReformDocAbstraction() { an_object["is"] ); auto substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false); + = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; // anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; comp_obj_block = comp_obj_block.init; @@ -3561,7 +3562,7 @@ template DocReformDocAbstraction() { an_object["is"] ); auto substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false); + = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; comp_obj_code = comp_obj_code.init; @@ -3610,7 +3611,7 @@ template DocReformDocAbstraction() { an_object["is"] ); auto substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false); + = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; comp_obj_block = comp_obj_block.init; comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; @@ -3649,7 +3650,7 @@ template DocReformDocAbstraction() { debug(bookindexmatch) { writefln( "* [bookindex] %s\n", - m.captures[1].to!string, + m[1].to!string, ); } an_object["bookindex_nugget"] = m.captures[1].to!string; @@ -4026,8 +4027,8 @@ template DocReformDocAbstraction() { debug(paraindent) { writeln(line); } - indent["hang_position"] = (m.captures[1]).to!int; - indent["base_position"] = 0; + indent["hang_position"] = (m[1]).to!int; + indent["base_position"] = (m[1]).to!int; } else if (line.matchFirst(rgx.para_bullet)) { debug(parabullet) { writeln(line); @@ -4038,16 +4039,16 @@ template DocReformDocAbstraction() { writeln(line); } indent=[ - "hang_position" : (m.captures[1]).to!int, - "base_position" : (m.captures[2]).to!int, + "hang_position" : (m[1]).to!int, + "base_position" : (m[2]).to!int, ]; } else if (auto m = line.matchFirst(rgx.para_bullet_indent)) { debug(parabulletindent) { writeln(line); } indent=[ - "hang_position" : (m.captures[1]).to!int, - "base_position" : 0, + "hang_position" : (m[1]).to!int, + "base_position" : (m[1]).to!int, ]; bullet = true; } @@ -4280,28 +4281,28 @@ template DocReformDocAbstraction() { ocn_object_number = ocn_bkidx = 0; object_identifier = ""; ocn_is_off = false; - switch(ocn_status_flag) { - case OCNstatus.reset: + switch(ocn_status_flag) with (OCNstatus) { + case reset: ocn_digit = ocn_on_ = 1; object_identifier = "1"; ocn_is_off = false; ocn_off_ = ocn_bkidx_ = 0; break; - case OCNstatus.on: + case on: ocn_digit = ocn_object_number = ++ocn_on_; object_identifier = ocn_digit.to!string; ocn_is_off = false; break; - case OCNstatus.off: + case off: ocn_digit = 0; ocn_off_ = ++ocn_off_; object_identifier = "a" ~ ocn_off_.to!string; ocn_is_off = true; break; - case OCNstatus.bkidx: + case bkidx: ocn_bkidx = ++ocn_bkidx_; break; - case OCNstatus.closing: + case closing: break; default: ocn_digit = 0; @@ -4479,7 +4480,7 @@ template DocReformDocAbstraction() { debug(footnotesdone) { foreach(m; matchAll(obj_txt_out, (mkup.en_a_o ~ `\s*(.+?)` ~ mkup.en_a_c))) { - writeln(m.captures[1]); + writeln(m[1]); writeln(m.hit); } } @@ -4636,7 +4637,7 @@ template DocReformDocAbstraction() { O obj_, K obj_key_, CMM conf_make_meta, - bool _new_doc + Flag!"_new_doc" _new_doc ) in { debug(asserts) { @@ -4796,26 +4797,6 @@ template DocReformDocAbstraction() { comp_obj_toc.text = toc_txt_.to!string.strip; comp_obj_toc.has.inline_links = true; the_table_of_contents_section ~= comp_obj_toc; - } else { - indent=[ - "hang_position" : 0, - "base_position" : 0, - ]; - comp_obj_toc = comp_obj_toc.init; - comp_obj_toc.metainfo.is_of_part = "frontmatter"; - comp_obj_toc.metainfo.is_of_section = "toc"; - comp_obj_toc.metainfo.is_of_type = "para"; - comp_obj_toc.metainfo.is_a = "toc"; - comp_obj_toc.metainfo.ocn = 0; - comp_obj_toc.metainfo.identifier = ""; - comp_obj_toc.metainfo.object_number_off = true; - comp_obj_toc.metainfo.object_number_type = 0; - comp_obj_toc.attrib.indent_hang = indent["hang_position"]; - comp_obj_toc.attrib.indent_base = indent["base_position"]; - comp_obj_toc.attrib.bullet = false; - comp_obj_toc.text = "Table of Contents"; - comp_obj_toc.has.inline_links = true; - the_table_of_contents_section ~= comp_obj_toc; } comp_obj_toc = comp_obj_toc.init; comp_obj_toc.metainfo.is_of_part = "frontmatter"; @@ -4856,11 +4837,12 @@ template DocReformDocAbstraction() { static int[] heading_num = [ 0, 0, 0, 0 ]; static string heading_number_auto_composite = ""; static string heading_number_auto_composite_segname = ""; + static bool[] auto_heading_numbering = [ true, true, true, true]; static string _configured_auto_heading_numbering_and_segment_anchor_tags(M,O,CMM)( - M munge_, - O obj_, - CMM conf_make_meta, - bool _new_doc + M munge_, + O obj_, + CMM conf_make_meta, + bool _new_doc, ) { debug(asserts) { static assert(is(typeof(munge_) == string)); @@ -4869,6 +4851,7 @@ template DocReformDocAbstraction() { if (_new_doc) { heading_num = [ 0, 0, 0, 0 ]; heading_number_auto_composite = ""; + auto_heading_numbering = [ true, true, true, true]; } if (conf_make_meta.make.auto_num_top_lv) { if (obj_["lev_markup_number"].to!int == 0) { @@ -4891,7 +4874,11 @@ template DocReformDocAbstraction() { conf_make_meta.make.auto_num_top_lv == obj_["lev_markup_number"].to!uint ) { - heading_num[0] ++; + auto_heading_numbering[0] = + (munge_.match(rgx.auto_heading_numbering_off_lv1)) ? false : true; + if (auto_heading_numbering[0]) { + heading_num[0] ++; + } heading_num[1] = 0; heading_num[2] = 0; heading_num[3] = 0; @@ -4899,55 +4886,86 @@ template DocReformDocAbstraction() { conf_make_meta.make.auto_num_top_lv == (obj_["lev_markup_number"].to!uint - 1) ) { - heading_num[1] ++; + auto_heading_numbering[1] = + (munge_.match(rgx.auto_heading_numbering_off_lv2)) ? false : true; + if (auto_heading_numbering[0] + && auto_heading_numbering[1]) { + heading_num[1] ++; + } heading_num[2] = 0; heading_num[3] = 0; } else if ( conf_make_meta.make.auto_num_top_lv == (obj_["lev_markup_number"].to!uint - 2) ) { - heading_num[2] ++; + auto_heading_numbering[2] = + (munge_.match(rgx.auto_heading_numbering_off_lv3)) ? false : true; + if (auto_heading_numbering[0] + && auto_heading_numbering[1] + && auto_heading_numbering[2]) { + heading_num[2] ++; + } heading_num[3] = 0; } else if ( conf_make_meta.make.auto_num_top_lv == (obj_["lev_markup_number"].to!uint - 3) ) { - heading_num[3] ++; - } - if (heading_num[3] > 0) { - heading_number_auto_composite - = (conf_make_meta.make.auto_num_depth.to!uint == 3) - ? ( heading_num[0].to!string ~ "." - ~ heading_num[1].to!string ~ "." - ~ heading_num[2].to!string ~ "." - ~ heading_num[3].to!string - ) - : ""; - } else if (heading_num[2] > 0) { - heading_number_auto_composite - = ((conf_make_meta.make.auto_num_depth.to!uint >= 2) - && (conf_make_meta.make.auto_num_depth.to!uint <= 3)) - ? ( heading_num[0].to!string ~ "." - ~ heading_num[1].to!string ~ "." - ~ heading_num[2].to!string - ) - : ""; - } else if (heading_num[1] > 0) { - heading_number_auto_composite - = ((conf_make_meta.make.auto_num_depth.to!uint >= 1) - && (conf_make_meta.make.auto_num_depth.to!uint <= 3)) - ? ( heading_num[0].to!string ~ "." - ~ heading_num[1].to!string - ) - : ""; - } else if (heading_num[0] > 0) { - heading_number_auto_composite - = ((conf_make_meta.make.auto_num_depth.to!uint >= 0) - && (conf_make_meta.make.auto_num_depth.to!uint <= 3)) - ? (heading_num[0].to!string) - : ""; - } else { - heading_number_auto_composite = ""; + auto_heading_numbering[3] = + (munge_.match(rgx.auto_heading_numbering_off_lv4)) ? false : true; + if (auto_heading_numbering[0] + && auto_heading_numbering[1] + && auto_heading_numbering[2] + && auto_heading_numbering[3]) { + heading_num[3] ++; + } + } + if (auto_heading_numbering[0]) { + if (heading_num[3] > 0) { + heading_number_auto_composite + = (conf_make_meta.make.auto_num_depth.to!uint == 3 + && auto_heading_numbering[3]) + ? (format(q"┋%s.%s.%s.%s┋", + heading_num[0].to!string, + heading_num[1].to!string, + heading_num[2].to!string, + heading_num[3].to!string + )) + : ""; + } else if (heading_num[2] > 0) { + heading_number_auto_composite + = ((conf_make_meta.make.auto_num_depth.to!uint >= 2) + && (conf_make_meta.make.auto_num_depth.to!uint <= 3) + && auto_heading_numbering[2]) + ? (format(q"┋%s.%s.%s┋", + heading_num[0].to!string, + heading_num[1].to!string, + heading_num[2].to!string + )) + : ""; + } else if (heading_num[1] > 0) { + heading_number_auto_composite + = ((conf_make_meta.make.auto_num_depth.to!uint >= 1) + && (conf_make_meta.make.auto_num_depth.to!uint <= 3) + && auto_heading_numbering[1]) + ? (format(q"┋%s.%s┋", + heading_num[0].to!string, + heading_num[1].to!string + )) + : ""; + } else if (heading_num[0] > 0 + && munge_.match(rgx.auto_heading_numbering_lv1) + ) { + heading_number_auto_composite + = ((conf_make_meta.make.auto_num_depth.to!uint >= 0) + && (conf_make_meta.make.auto_num_depth.to!uint <= 3) + && auto_heading_numbering[0]) + ? (format(q"┋%s┋", + heading_num[0].to!string + )) + : ""; + } else { + heading_number_auto_composite = ""; + } } heading_number_auto_composite_segname = (heading_number_auto_composite.empty) @@ -5137,16 +5155,16 @@ template DocReformDocAbstraction() { ~ " \"indent_base\": 0,"; } else if (auto m = obj_txt_in.matchFirst(rgx.para_bullet_indent)) { _obj_attributes =" \"bullet\": \"true\"," - ~ " \"indent_hang\": " ~ m.captures[1].to!string ~ "," - ~ " \"indent_base\": " ~ m.captures[1].to!string ~ ","; + ~ " \"indent_hang\": " ~ m[1].to!string ~ "," + ~ " \"indent_base\": " ~ m[1].to!string ~ ","; } else if (auto m = obj_txt_in.matchFirst(rgx.para_indent_hang)) { _obj_attributes =" \"bullet\": \"false\"," - ~ " \"indent_hang\": " ~ m.captures[1].to!string ~ "," - ~ " \"indent_base\": " ~ m.captures[2].to!string ~ ","; + ~ " \"indent_hang\": " ~ m[1].to!string ~ "," + ~ " \"indent_base\": " ~ m[2].to!string ~ ","; } else if (auto m = obj_txt_in.matchFirst(rgx.para_indent)) { _obj_attributes =" \"bullet\": \"false\"," - ~ " \"indent_hang\": " ~ m.captures[1].to!string ~ "," - ~ " \"indent_base\": " ~ m.captures[1].to!string ~ ","; + ~ " \"indent_hang\": " ~ m[1].to!string ~ "," + ~ " \"indent_base\": " ~ m[1].to!string ~ ","; } else { _obj_attributes =" \"bullet\": \"false\"," ~ " \"indent_hang\": 0," @@ -5622,7 +5640,7 @@ template DocReformDocAbstraction() { assert(cntr >= previous_count); assert( (contents_am[cntr].text).match( - rgx.inline_notes_delimiter_al_regular_number_note) + rgx.inline_notes_al_regular_number_note) ); } body { @@ -5632,31 +5650,31 @@ template DocReformDocAbstraction() { static auto munge = ObjInlineMarkupMunge(); foreach(m; (contents_am[cntr].text).matchAll( - rgx.inline_notes_delimiter_al_regular_number_note) + rgx.inline_notes_al_regular_number_note) ) { debug(endnotes_build) { writeln( - "{^", mkup.ff_o, m.captures[1], ".", mkup.ff_c, "^}" + "{^", mkup.ff_o, m[1], ".", mkup.ff_c, "^}" ~ mkup.mark_internal_site_lnk, tag_in_seg["seg_lv4"], - ".fnSuffix#noteref_\n ", m.captures[1], " ", - m.captures[2]); // sometimes need segment name (segmented html & epub) + ".fnSuffix#noteref_\n ", m[1], " ", + m[2]); // sometimes need segment name (segmented html & epub) } // you need anchor for segments at this point -> - object_notes["anchor"] ~= "note_" ~ m.captures[1] ~ "』"; + object_notes["anchor"] ~= "note_" ~ m[1] ~ "』"; object_notes["notes"] ~= (tag_in_seg["seg_lv4"].empty) ? (links_and_images( - "{" ~ mkup.superscript ~ mkup.ff_o ~ m.captures[1] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}#noteref_" - ~ m.captures[1]) ~ " " - ~ m.captures[2] ~ "』" + "{" ~ mkup.superscript ~ mkup.ff_o ~ m[1] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}#noteref_" + ~ m[1]) ~ " " + ~ m[2] ~ "』" ) : (links_and_images( - "{" ~ mkup.superscript ~ mkup.ff_o ~ m.captures[1] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}" + "{" ~ mkup.superscript ~ mkup.ff_o ~ m[1] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}" ~ mkup.mark_internal_site_lnk ~ tag_in_seg["seg_lv4"] ~ ".fnSuffix#noteref_" - ~ m.captures[1]) ~ " " - ~ m.captures[2] ~ "』" + ~ m[1]) ~ " " + ~ m[2] ~ "』" ); } return object_notes; @@ -5768,7 +5786,7 @@ template DocReformDocAbstraction() { comp_obj_endnote_.attrib.bullet = false; foreach (i, endnote; endnotes_["notes"]) { auto m = endnote.matchFirst(rgx.note_ref); - string notenumber = m.captures[1].to!string; + string notenumber = m[1].to!string; string anchor_tag = "note_" ~ notenumber; comp_obj_endnote_.tags.anchor_tags = [ endnotes_["anchor"][i] ]; comp_obj_endnote_.has.inline_links = true; @@ -6366,12 +6384,12 @@ template DocReformDocAbstraction() { template docSectKeysSeq() { auto docSectKeysSeq(string[][string] document_section_keys_sequenced) { struct doc_sect_keys_seq { - auto seg() { - return document_section_keys_sequenced["seg"]; - } auto scroll() { return document_section_keys_sequenced["scroll"]; } + auto seg() { + return document_section_keys_sequenced["seg"]; + } auto sql() { return document_section_keys_sequenced["sql"]; } diff --git a/src/doc_reform/meta/metadochead.d b/src/doc_reform/meta/metadochead.d new file mode 100644 index 0000000..42f4845 --- /dev/null +++ b/src/doc_reform/meta/metadochead.d @@ -0,0 +1,85 @@ +module doc_reform.meta.metadochead; +template DocReformHarvestGetFromHead() { // TODO + import + std.datetime, + std.getopt, + std.file, + std.path, + std.process; + import + doc_reform.meta, + doc_reform.meta.metadoc_summary, + doc_reform.meta.metadoc_from_src, + doc_reform.meta.conf_make_meta_structs, + doc_reform.meta.conf_make_meta_toml, + doc_reform.meta.conf_make_meta_json, + doc_reform.meta.defaults, + doc_reform.meta.doc_debugs, + doc_reform.meta.rgx, + doc_reform.source.paths_source, + doc_reform.source.read_config_files, + doc_reform.source.read_source_files, + doc_reform.output.hub; + mixin DocReformRgxInit; + mixin contentJSONtoDocReformStruct; + mixin DocReformBiblio; + mixin DocReformRgxInitFlags; + mixin outputHub; + enum headBody { header, body_content, insert_file_list, image_list } + enum makeMeta { make, meta } + enum docAbst { doc_abstraction, section_keys, segnames, segnames_0_4, images } + static auto rgx = Rgx(); + auto DocReformHarvestGetFromHead(E,O,M)( // TODO + E _env, + O _opt_action, + M _manifest + ){ + auto _config_document_struct = readConfigDoc!()(_manifest, _env); // document config file + auto _config_local_site_struct = readConfigSite!()(_manifest, _env); // local site config + ConfCompositePlus _make_and_meta_struct; + _make_and_meta_struct = configParseTOMLreturnDocReformStruct!()(_make_and_meta_struct, _config_document_struct); + _make_and_meta_struct = configParseTOMLreturnDocReformStruct!()(_make_and_meta_struct, _config_local_site_struct); + /+ ↓ read file (filename with path) +/ + /+ ↓ file tuple of header and content +/ + if ((_opt_action.debug_do) + || (_opt_action.very_verbose) + ) { + writeln("step1 commence → (get document header & body & insert file list & if needed image list)" + ); + } + auto _header_body_insertfilelist_imagelist + = DocReformRawMarkupContent!()(_opt_action, _manifest.src.path_and_fn); + static assert(!isTypeTuple!(_header_body_insertfilelist_imagelist)); + static assert(_header_body_insertfilelist_imagelist.length==4); + if ((_opt_action.debug_do) + || (_opt_action.very_verbose) + ) { + writeln("- step1 complete"); + } + debug(header_and_body) { + writeln(header); + writeln(_header_body_insertfilelist_imagelist.length); + writeln(_header_body_insertfilelist_imagelist.length[headBody.body_content][0]); + } + /+ ↓ split header into make and meta +/ + if ((_opt_action.debug_do) + || (_opt_action.very_verbose) + ) { + writeln("step2 commence → (read document header - toml, return struct)"); + } + _make_and_meta_struct = + docHeaderMakeAndMetaTupTomlExtractAndConvertToStruct!()( + _make_and_meta_struct, + _header_body_insertfilelist_imagelist[headBody.header] + ); + if ((_opt_action.debug_do) + || (_opt_action.very_verbose) + ) { + writeln("- step2 complete"); + } + + auto t = tuple(doc_matters_shared, doc_matters_abridged_collected); + static assert(t.length==2); + return t; + } +} diff --git a/src/doc_reform/meta/rgx.d b/src/doc_reform/meta/rgx.d index 2bdb3ec..73900b6 100644 --- a/src/doc_reform/meta/rgx.d +++ b/src/doc_reform/meta/rgx.d @@ -88,8 +88,8 @@ static template DocReformRgxInit() { static heading_blurb_glossary = ctRegex!(`^:?(?:(1)[~][!](?:blurb|glossary)|[A-D1][~])`); static para_bullet = ctRegex!(`^_[*] `); static para_bullet_indent = ctRegex!(`^_([1-9])[*] `); - static para_indent = ctRegex!(`^_([1-9]) `); - static para_indent_hang = ctRegex!(`^_([0-9])_([0-9]) `); + static para_indent = ctRegex!(`^_(?P[1-9])[ ]`); + static para_indent_hang = ctRegex!(`^_(?P[0-9])_(?P[0-9])[ ]`); static para_attribs = ctRegex!(`^_(?:(?:[0-9])(?:_([0-9]))?|(?:[1-9])?[*]) `); static para_inline_link_anchor = ctRegex!(`\*[~](?P[a-z0-9_.-]+)(?= |$)`,"i"); /+ blocked markup +/ @@ -155,19 +155,37 @@ static template DocReformRgxInit() { static smid_inline_link_endnote_url_helper_punctuated = ctRegex!(`\{~\^\s+(?P.+?)\}(?P(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[.,;:?!]?([ ]|$))`, "mg"); static smid_inline_link_endnote_url_helper = ctRegex!(`\{~\^\s+(?P.+?)\}(?P(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+)`, "mg"); static image = ctRegex!(`([a-zA-Z0-9._-]+?\.(?:png|gif|jpg))`, "mg"); - static smid_image = ctRegex!(`(?P
(?:^|[ ]|[^\S]?)[{┥](?:~\^\s+|\s*))(?P\S+\.(?:png|gif|jpg))(?P(?:.*?)\s*[}┝](?:image|┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg");
+    static smid_image                                      = ctRegex!(`(?P
(?:^|[ ]|[^\S]?)[{┥](?:~\^\s+|\s*))(?P[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))(?P(?:.*?)\s*[}┝](?:image|┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg");
     static smid_image_generic                              = ctRegex!(`(?:^|[ ]|[^\S]?)[{┥](?:~\^\s+|\s*)\S+\.(?:png|gif|jpg).*?[}┝](?:image|┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$))`, "mg");
-    static smid_image_with_dimensions                      = ctRegex!(`(?P
(?:^|[ ]|[^\S]?)[{┥](?:~\^\s+|\s*))(?P\S+\.(?:png|gif|jpg))\s+(?P\d+)x(?P\d+)\s*(?P(?:.*?)\s*[}┝](?:image|┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg");
+    static smid_image_with_dimensions                      = ctRegex!(`(?P
(?:^|[ ]|[^\S]?)[{┥](?:~\^\s+|\s*))(?P[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))\s+(?P\d+)x(?P\d+)\s*(?P(?:.*?)\s*[}┝](?:image|┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg");
     static smid_mod_image_without_dimensions               = ctRegex!(`[{┥](?:~\^\s+|\s*)☼\S+\.(?:png|gif|jpg),w0h0.*[}┝](?:image|┤.*?├|(?:https?|git):\/\/\S+?)(?=[;:!,?.]?([ )\]]|$))`, "mg");
+    static smid_a_image                                    = ctRegex!(`(?P
(?:^|[ ]|[^\S]?)[{](?:~\^\s+|\s*))(?P[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))(?P(?:.*?)\s*[}](?:image|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg");
+    static smid_a_image_generic                            = ctRegex!(`(?:^|[ ]|[^\S]?)[{](?:~\^\s+|\s*)\S+\.(?:png|gif|jpg).*?[}](?:image|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$))`, "mg");
+    static smid_a_image_with_dimensions                    = ctRegex!(`(?P
(?:^|[ ]|[^\S]?)[{](?:~\^\s+|\s*))(?P[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))\s+(?P\d+)x(?P\d+)\s*(?P(?:.*?)\s*[}](?:image|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg");
+    static smid_a_mod_image_without_dimensions             = ctRegex!(`[{](?:~\^\s+|\s*)☼\S+\.(?:png|gif|jpg),w0h0.*[}](?:image|(?:https?|git):\/\/\S+?)(?=[;:!,?.]?([ )\]]|$))`, "mg");
+    static smid_b_image                                    = ctRegex!(`(?P
(?:^|[ ]|[^\S]?)[┥](?:~\^\s+|\s*))(?P[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))(?P(?:.*?)\s*[┝](?:┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg");
+    static smid_b_image_generic                            = ctRegex!(`(?:^|[ ]|[^\S]?)[┥](?:~\^\s+|\s*)\S+\.(?:png|gif|jpg).*?[┝](?:┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$))`, "mg");
+    static smid_b_image_with_dimensions                    = ctRegex!(`(?P
(?:^|[ ]|[^\S]?)[┥](?:~\^\s+|\s*))(?P[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))\s+(?P\d+)x(?P\d+)\s*(?P(?:.*?)\s*[┝](?:┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg");
+    static smid_b_mod_image_without_dimensions             = ctRegex!(`[┥](?:~\^\s+|\s*)☼\S+\.(?:png|gif|jpg),w0h0.*[┝](?:┤.*?├|(?:https?|git):\/\/\S+?)(?=[;:!,?.]?([ )\]]|$))`, "mg");
     static smid_image_delimit                              = ctRegex!(`(?P
^|[ ]|[^\S]?)\{\s*(?P.+?)\s*\}(?:image)(?=[;:!,?.]?([ )\]]|$))`, "mg");
     /+ inline markup book index +/
     static book_index                                     = ctRegex!(`^=\{\s*(.+?)\}$`, "m");
     static book_index_open                                = ctRegex!(`^=\{\s*([^}]*?)$`);
     static book_index_close                               = ctRegex!(`^(.*?)\}$`, "m");
+    static auto_heading_numbering_lv1                    = ctRegex!(`^1~`, "m");
+    static auto_heading_numbering_lv2                    = ctRegex!(`^2~`, "m");
+    static auto_heading_numbering_lv3                    = ctRegex!(`^3~`, "m");
+    static auto_heading_numbering_lv4                    = ctRegex!(`^4~`, "m");
+    static auto_heading_numbering_off                    = ctRegex!(`^[A-D1-4]~\S*?-\s`, "m");
+    static auto_heading_numbering_off_lv1                = ctRegex!(`^1~\S*?-\s`, "m");
+    static auto_heading_numbering_off_lv2                = ctRegex!(`^2~\S*?-\s`, "m");
+    static auto_heading_numbering_off_lv3                = ctRegex!(`^3~\S*?-\s`, "m");
+    static auto_heading_numbering_off_lv4                = ctRegex!(`^4~\S*?-\s`, "m");
     /+ no object_number object +/
     static object_number_off                            = ctRegex!(`~#[ ]*$`, "m");
     static object_number_off_dh                         = ctRegex!(`-#$`, "m");
     static object_number_off_all                        = ctRegex!(`[~-]#$`, "m");
+    static repeated_character_line_separator            = ctRegex!(`^(?:(?:(?:[.][ ]?){4,}|(?:[-][ ]?|[~][ ]?|[*][ ]?|[$][ ]?|[#][ ]?|[\\][ ]?|[/][ ]?){2,})\s*?)*$`);
     /+ no object_number block +/
     static object_number_off_block                      = ctRegex!(`^--~#$`);
     static object_number_off_block_dh                   = ctRegex!(`^---#$`);
@@ -231,6 +249,11 @@ static template DocReformRgxInit() {
     static src_base_parent_path                           = ctRegex!(`(?P(?:[/a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure
     static src_formalised_file_path_parts                 = ctRegex!(`(?P(?:[/a-zA-Z0-9._-]+?)(?P[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure
     /+ line breaks +/
+    static empty_line                                     = ctRegex!(`^\s*$`);
+    static empty_block                                    = ctRegex!(`^\s*$`, "mg");
+    static br_line_natural                                = ctRegex!(`\n`, "mg");
+    static br_empty_line                                  = ctRegex!(`\n[ ]*\n`, "mg");
+    static br_newlines_linebreaks                         = ctRegex!(`[\n┘┙]`, "mg");
     static br_line                                        = ctRegex!(`┘`, "mg");
     static br_nl                                          = ctRegex!(`┙`, "mg");
     static br_paragraph                                   = ctRegex!(`┚`, "mg");
@@ -241,22 +264,23 @@ static template DocReformRgxInit() {
     static inline_notes_al                                = ctRegex!(`【(?:[*+]\s+|\s*)(.+?)】`, "mg");
     static inline_notes_al_special                        = ctRegex!(`【(?:[*+]\s+)(.+?)】`, "mg"); // TODO remove match when special footnotes are implemented
     static inline_notes_al_gen                            = ctRegex!(`【.+?】`, "m");
+    static inline_notes_al_regular                        = ctRegex!(`【(.+?)】`, "mg");
     static inline_notes_al_gen_text                       = ctRegex!(`【(?P.+?)】`, "m");
     static inline_notes_al_gen_ref                        = ctRegex!(`【(?P[*+]\s+)\s*(?P.+?)】`, "mg");
+    static inline_notes_al_regular_number_note            = ctRegex!(`【(?P\d+)\s+(?P.+?)\s*】`, "mg");
     static inline_al_delimiter_open_regular               = ctRegex!(`【\s`, "m");
     static inline_al_delimiter_open_symbol_star           = ctRegex!(`【[*]\s`, "m");
     static inline_al_delimiter_open_symbol_plus           = ctRegex!(`【[+]\s`, "m");
     static inline_al_delimiter_close_regular              = ctRegex!(`】`, "m");
     static inline_al_delimiter_open_and_close_regular     = ctRegex!(`【|】`, "m");
-    static inline_notes_delimiter_al_regular              = ctRegex!(`【(.+?)】`, "mg");
-    static inline_notes_delimiter_al_regular_number_note  = ctRegex!(`【(?P\d+)\s+(?P.+?)】`, "mg");
     static inline_al_delimiter_open_asterisk              = ctRegex!(`【\*`, "m");
     static inline_al_delimiter_open_plus                  = ctRegex!(`【\+`, "m");
     static inline_text_and_note_al                        = ctRegex!(`(?P.+?)【(?:[*+ ]*)(?P.+?)】`, "mg");
     static inline_text_and_note_al_                       = ctRegex!(`(.+?(?:【[*+]*\s+.+?】|$))`, "mg");
-    /+ inline markup footnotes endnotes +/
-    static inline_image                                   = ctRegex!(`(?P
┥)☼(?P(?P\S+?\.(?:jpg|gif|png)),w(?P\d+)h(?P\d+))\s*(?P.*?┝┤.*?├)`, "mg");
-    static inline_image_without_dimensions                = ctRegex!(`(?P
┥)☼(?P(?P\S+?\.(?:jpg|gif|png)),w(?P0)h(?P0))\s*(?P.*?┝┤.*?├)`, "mg");
+    /+ inline markup links +/
+    static inline_image                                   = ctRegex!(`(?P
┥)☼(?P(?P[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P\d+)h(?P\d+))\s*(?P.*?┝┤.*?├)`, "mg");
+    static inline_image_without_dimensions                = ctRegex!(`(?P
┥)☼(?P(?P[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P0)h(?P0))\s*(?P.*?┝┤.*?├)`, "mg");
+    static inline_image_info                              = ctRegex!(`☼?(?P[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P\d+)h(?P\d+)`, "mg");
     static inline_link_anchor                             = ctRegex!(`┋(?P\S+?)┋`, "mg"); // TODO *~text_link_anchor
     static inline_link_                                   = ctRegex!(`┥(?P.+?)┝┤(?P.+?)├`, "mg");
     static inline_link                                    = ctRegex!(`┥(?P.+?)┝┤(?P\S+?)├`, "mg");
@@ -268,6 +292,7 @@ static template DocReformRgxInit() {
     static inline_link_clean                              = ctRegex!(`┤(?:.+?)├|[┥┝]`, "mg");
     static inline_a_url                                   = ctRegex!(`(┤)([^\s┥┝┤├]+)(├)`, "mg");
     static url                                            = ctRegex!(`https?://`, "mg");
+    static uri                                            = ctRegex!(`(?:https?|git)://`, "mg");
     static inline_link_subtoc                             = ctRegex!(`^(?P[5-7])~ ┥(?P.+?)┝┤(?P.+?)├`, "mg");
     static fn_suffix                                      = ctRegex!(`\.fnSuffix`, "mg");
     static inline_link_fn_suffix                          = ctRegex!(`¤(.+?)(\.fnSuffix)`, "mg");
-- 
cgit v1.2.3