diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2019-03-20 13:03:02 -0400 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2019-05-17 16:59:38 -0400 |
commit | da32ec40fc237b03f22aac329017d06735289a3a (patch) | |
tree | df8f2ddcf1dda26914939c73f11b87db57ae6c64 /org/meta_abstraction.org | |
parent | 0.5.0 per object inline munging (rather than by line) (diff) |
housekeepingdoc-reform_v0.5.0
Diffstat (limited to 'org/meta_abstraction.org')
-rw-r--r-- | org/meta_abstraction.org | 310 |
1 files changed, 164 insertions, 146 deletions
diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org index 6ea5d5d..1121d15 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -415,6 +415,7 @@ static auto ocn_emit(int ocn_status_flag) { 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]) { @@ -663,10 +664,6 @@ scope(failure) { 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); } @@ -884,8 +881,8 @@ if there is a blurb section you need to: 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); @@ -896,16 +893,16 @@ if there is a blurb section you need to: 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; } @@ -1290,7 +1287,7 @@ if ((obj_type_status["heading"] == State.on) 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) { @@ -1412,6 +1409,10 @@ if ((obj_type_status["heading"] == State.on) } 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"] : ""; @@ -1430,7 +1431,7 @@ if ((obj_type_status["heading"] == State.on) 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; @@ -1493,7 +1494,7 @@ if (the_document_body_section.length > 0) { 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, @@ -1507,7 +1508,7 @@ if (the_document_body_section.length > 0) { /+ 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( @@ -2269,20 +2270,20 @@ auto get_decendants(S)(S document_sections) { 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"; } @@ -2290,7 +2291,7 @@ auto get_decendants(S)(S document_sections) { _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; } } @@ -2338,9 +2339,9 @@ auto _image_dimensions(O,M)(O obj, M manifest_matter) { 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); @@ -2939,40 +2940,40 @@ auto document_the = [ #+name: abs_post #+BEGIN_SRC d 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); #+END_SRC @@ -3230,8 +3231,8 @@ void _start_block_(L,T,N)( #+BEGIN_SRC d 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( @@ -3326,7 +3327,7 @@ void _start_block_(L,T,N)( 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; @@ -3339,7 +3340,7 @@ void _start_block_(L,T,N)( #+BEGIN_SRC d } 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; @@ -3353,8 +3354,8 @@ void _start_block_(L,T,N)( #+BEGIN_SRC d } 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( @@ -3449,7 +3450,7 @@ void _start_block_(L,T,N)( 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; @@ -3919,7 +3920,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( } 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; @@ -3982,7 +3983,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( 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; @@ -4028,7 +4029,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( 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; @@ -4091,7 +4092,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( 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; @@ -4241,7 +4242,7 @@ void _table_closed_make_special_notation_table_(N,CMM)( ); 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; @@ -4318,7 +4319,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( 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; @@ -4373,7 +4374,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( 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; @@ -4428,7 +4429,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( 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; @@ -4525,7 +4526,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( 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; @@ -4580,7 +4581,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( 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; @@ -4631,7 +4632,7 @@ auto _book_index_(L,I,O,T,B)( debug(bookindexmatch) { writefln( "* [bookindex] %s\n", - m.captures[1].to!string, + m[1].to!string, ); } an_object["bookindex_nugget"] = m.captures[1].to!string; @@ -5033,8 +5034,8 @@ void _para_match_(L,O,K,I,B,T,C)( 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); @@ -5045,16 +5046,16 @@ void _para_match_(L,O,K,I,B,T,C)( 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; } @@ -5338,28 +5339,28 @@ pure struct OCNemitter { 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; @@ -5560,7 +5561,7 @@ static struct ObjInlineMarkupMunge { 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); } } @@ -5827,7 +5828,7 @@ static struct ObjInlineMarkup { O obj_, K obj_key_, CMM conf_make_meta, - bool _new_doc + Flag!"_new_doc" _new_doc ) in { debug(asserts) { @@ -5993,26 +5994,6 @@ static struct ObjInlineMarkup { 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"; @@ -6065,11 +6046,12 @@ private: 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)); @@ -6078,6 +6060,7 @@ private: 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) { @@ -6100,7 +6083,11 @@ private: 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; @@ -6108,55 +6095,86 @@ private: 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) @@ -6388,16 +6406,16 @@ struct ObjAttributes { ~ " \"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," @@ -6987,7 +7005,7 @@ struct NotesSection { 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 { @@ -6997,31 +7015,31 @@ struct NotesSection { 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; @@ -7145,7 +7163,7 @@ struct NotesSection { 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; @@ -7824,12 +7842,12 @@ pure void assertions_flag_types_block_status_none_or_closed(T)(T obj_type_status 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"]; } |