aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc_reform/meta/metadoc_from_src.d
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2019-03-20 13:03:02 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2019-05-17 16:59:38 -0400
commitda32ec40fc237b03f22aac329017d06735289a3a (patch)
treedf8f2ddcf1dda26914939c73f11b87db57ae6c64 /src/doc_reform/meta/metadoc_from_src.d
parent0.5.0 per object inline munging (rather than by line) (diff)
housekeepingdoc-reform_v0.5.0
Diffstat (limited to 'src/doc_reform/meta/metadoc_from_src.d')
-rw-r--r--src/doc_reform/meta/metadoc_from_src.d310
1 files changed, 164 insertions, 146 deletions
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"];
}