aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2018-11-07 11:47:37 -0500
committerRalph Amissah <ralph.amissah@gmail.com>2019-04-10 15:14:15 -0400
commitaba135a5ce2c8a58551a478d064262bda19c9770 (patch)
treee90d87693f4af27bbf8fa95287d3792ddf9724a7 /src
parent0.3.0 internal links, anchor tags & segment associations (diff)
0.3.1 internal links, anchor tags & segment associations, toc
Diffstat (limited to 'src')
-rw-r--r--src/doc_reform/meta/metadoc_from_src.d403
-rw-r--r--src/doc_reform/meta/object_setter.d3
-rw-r--r--src/doc_reform/output/sqlite.d14
-rw-r--r--src/doc_reform/output/xmls.d16
4 files changed, 258 insertions, 178 deletions
diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d
index 64dd6e6..cdb1e6b 100644
--- a/src/doc_reform/meta/metadoc_from_src.d
+++ b/src/doc_reform/meta/metadoc_from_src.d
@@ -51,6 +51,7 @@ template DocReformDocAbstraction() {
content_non_header
} // header section A-D; header text 1-4
enum OCNstatus { on, off, bkidx, closing, reset, }
+ enum OCN_off_block_status { off, on }
enum OCNtype { ocn, non, bkidx, }
/+ biblio variables +/
string biblio_tag_name, biblio_tag_entry, st;
@@ -74,8 +75,9 @@ template DocReformDocAbstraction() {
/+ ocn +/
struct OCNset {
int digit;
- int on;
- int off;
+ int object_number;
+ bool off;
+ string identifier;
int bkidx;
int type;
}
@@ -352,7 +354,8 @@ template DocReformDocAbstraction() {
comp_obj_heading_.metainfo.is_a = "heading";
comp_obj_heading_.text = "Table of Contents";
comp_obj_heading_.metainfo.ocn = 0;
- comp_obj_heading_.metainfo.object_number_off = "";
+ comp_obj_heading_.metainfo.identifier = "";
+ comp_obj_heading_.metainfo.object_number_off = true;
comp_obj_heading_.metainfo.object_number_type = 0;
comp_obj_heading_.tags.segment_anchor_tag_epub = "toc";
comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub;
@@ -492,7 +495,8 @@ template DocReformDocAbstraction() {
comp_obj_heading_.metainfo.is_a = "heading";
comp_obj_heading_.text = "Glossary";
comp_obj_heading_.metainfo.ocn = 0;
- comp_obj_heading_.metainfo.object_number_off = "";
+ comp_obj_heading_.metainfo.identifier = "";
+ comp_obj_heading_.metainfo.object_number_off = true;
comp_obj_heading_.metainfo.object_number_type = 0;
comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_glossary";
comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub;
@@ -513,7 +517,8 @@ template DocReformDocAbstraction() {
comp_obj_heading_.metainfo.is_a = "heading";
comp_obj_heading_.text = "Glossary";
comp_obj_heading_.metainfo.ocn = 0;
- comp_obj_heading_.metainfo.object_number_off = "";
+ comp_obj_heading_.metainfo.identifier = "";
+ comp_obj_heading_.metainfo.object_number_off = true;
comp_obj_heading_.metainfo.object_number_type = 0;
comp_obj_heading_.tags.segment_anchor_tag_epub = "glossary";
comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub;
@@ -537,7 +542,8 @@ template DocReformDocAbstraction() {
comp_obj_para.metainfo.is_a = "glossary";
comp_obj_para.text = line.to!string.strip;
comp_obj_para.metainfo.ocn = 0;
- comp_obj_para.metainfo.object_number_off = "";
+ comp_obj_para.metainfo.identifier = "";
+ comp_obj_para.metainfo.object_number_off = true;
comp_obj_para.metainfo.object_number_type = 0;
comp_obj_para.attrib.indent_hang = indent["hang_position"];
comp_obj_para.attrib.indent_base = indent["base_position"];
@@ -606,7 +612,8 @@ template DocReformDocAbstraction() {
comp_obj_heading_.metainfo.is_a = "heading";
comp_obj_heading_.text = "Blurb";
comp_obj_heading_.metainfo.ocn = 0;
- comp_obj_heading_.metainfo.object_number_off = "";
+ comp_obj_heading_.metainfo.identifier = "";
+ comp_obj_heading_.metainfo.object_number_off = true;
comp_obj_heading_.metainfo.object_number_type = 0;
comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_blurb";
comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub;
@@ -627,7 +634,8 @@ template DocReformDocAbstraction() {
comp_obj_heading_.metainfo.is_a = "heading";
comp_obj_heading_.text = "Blurb";
comp_obj_heading_.metainfo.ocn = 0;
- comp_obj_heading_.metainfo.object_number_off = "";
+ comp_obj_heading_.metainfo.identifier = "";
+ comp_obj_heading_.metainfo.object_number_off = true;
comp_obj_heading_.metainfo.object_number_type = 0;
comp_obj_heading_.tags.segment_anchor_tag_epub = "blurb";
comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub;
@@ -651,7 +659,8 @@ template DocReformDocAbstraction() {
comp_obj_heading_.metainfo.is_a = "heading";
comp_obj_heading_.text = line.to!string;
comp_obj_heading_.metainfo.ocn = 0;
- comp_obj_heading_.metainfo.object_number_off = "";
+ comp_obj_heading_.metainfo.identifier = "";
+ comp_obj_heading_.metainfo.object_number_off = true;
comp_obj_heading_.metainfo.object_number_type = 0;
comp_obj_heading_.tags.segment_anchor_tag_epub = "blurb";
comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub;
@@ -672,7 +681,8 @@ template DocReformDocAbstraction() {
comp_obj_para.metainfo.is_a = "blurb";
comp_obj_para.text = munge.url_links(line.to!string.strip).replaceFirst(rgx.para_attribs, "");
comp_obj_para.metainfo.ocn = 0;
- comp_obj_para.metainfo.object_number_off = "";
+ comp_obj_para.metainfo.identifier = "";
+ comp_obj_para.metainfo.object_number_off = true;
comp_obj_para.metainfo.object_number_type = 0;
comp_obj_para.attrib.indent_hang = indent["hang_position"];
comp_obj_para.attrib.indent_base = indent["base_position"];
@@ -733,7 +743,7 @@ template DocReformDocAbstraction() {
/+ poem to verse exceptions! +/
object_reset(an_object);
processing.remove("verse");
- object_number_poem["start"] = obj_cite_digits.on.to!string;
+ object_number_poem["start"] = obj_cite_digits.object_number.to!string;
}
_start_block_(line, obj_type_status, object_number_poem);
continue;
@@ -876,7 +886,7 @@ template DocReformDocAbstraction() {
/+ heading object (current line empty) +/
obj_cite_digits = (an_object["lev_markup_number"].to!int == 0)
? ocn_emit(OCNstatus.reset)
- : ocn_emit(OCNstatus.on);
+ : ocn_emit(obj_type_status["ocn_status"]);
an_object["is"] = "heading";
an_object_key="body_nugget";
auto substantive_object_and_anchor_tags_tuple
@@ -931,7 +941,7 @@ template DocReformDocAbstraction() {
++cnt3;
goto default;
default:
- lv0_to_3_tags ~= obj_cite_digits.on.to!string;
+ lv0_to_3_tags ~= obj_cite_digits.object_number.to!string;
lv0_to_3_tags ~= segn;
tag_in_seg["seg_lv4"] = segn; // for html segname need following lv4 not yet known
tag_in_seg["seg_lv1_to_4"] = segn;
@@ -943,7 +953,7 @@ template DocReformDocAbstraction() {
bookindex_unordered_hashes
= bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_digits, tag_in_seg);
/+ (incrementally build toc) table of contents here! +/
- _anchor_tag=obj_cite_digits.on.to!string;
+ _anchor_tag = obj_cite_digits.identifier;
the_table_of_contents_section = obj_im.table_of_contents_gather_headings(
an_object,
conf_make_meta,
@@ -1025,8 +1035,9 @@ template DocReformDocAbstraction() {
comp_obj_para.text = an_object["substantive"].to!string.strip;
comp_obj_para.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"];
comp_obj_para.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"];
- comp_obj_para.metainfo.ocn = obj_cite_digits.digit;
- comp_obj_para.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string;
+ comp_obj_para.metainfo.ocn = obj_cite_digits.object_number;
+ comp_obj_para.metainfo.identifier = obj_cite_digits.identifier;
+ comp_obj_para.metainfo.object_number_off = (obj_cite_digits.off==0) ? true : false; // TODO
comp_obj_para.metainfo.o_n_book_index = obj_cite_digits.bkidx;
comp_obj_para.metainfo.object_number_type = obj_cite_digits.type;
comp_obj_para.attrib.indent_hang = indent["hang_position"];
@@ -1125,7 +1136,8 @@ template DocReformDocAbstraction() {
comp_obj_heading_.metainfo.is_a = "heading";
comp_obj_heading_.text = "(skip) there is no Glossary section";
comp_obj_heading_.metainfo.ocn = 0;
- comp_obj_heading_.metainfo.object_number_off = "";
+ comp_obj_heading_.metainfo.identifier = "";
+ comp_obj_heading_.metainfo.object_number_off = true;
comp_obj_heading_.metainfo.object_number_type = 0;
comp_obj_heading_.metainfo.heading_lev_markup = 1;
comp_obj_heading_.metainfo.heading_lev_collapsed = 1;
@@ -1150,7 +1162,8 @@ template DocReformDocAbstraction() {
comp_obj_heading_.metainfo.is_a = "heading";
comp_obj_heading_.text = "Bibliography";
comp_obj_heading_.metainfo.ocn = 0;
- comp_obj_heading_.metainfo.object_number_off = "";
+ comp_obj_heading_.metainfo.identifier = "";
+ comp_obj_heading_.metainfo.object_number_off = true;
comp_obj_heading_.metainfo.object_number_type = 0;
comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_bibliography";
comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub;
@@ -1169,7 +1182,8 @@ template DocReformDocAbstraction() {
comp_obj_heading_.metainfo.is_a = "heading";
comp_obj_heading_.text = "Bibliography";
comp_obj_heading_.metainfo.ocn = 0;
- comp_obj_heading_.metainfo.object_number_off = "";
+ comp_obj_heading_.metainfo.identifier = "";
+ comp_obj_heading_.metainfo.object_number_off = true;
comp_obj_heading_.metainfo.object_number_type = 0;
comp_obj_heading_.tags.segment_anchor_tag_epub = "bibliography";
comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub;
@@ -1190,7 +1204,8 @@ template DocReformDocAbstraction() {
comp_obj_heading_.metainfo.is_a = "heading";
comp_obj_heading_.text = "(skip) there is no Bibliography";
comp_obj_heading_.metainfo.ocn = 0;
- comp_obj_heading_.metainfo.object_number_off = "";
+ comp_obj_heading_.metainfo.identifier = "";
+ comp_obj_heading_.metainfo.object_number_off = true;
comp_obj_heading_.metainfo.object_number_type = 0;
comp_obj_heading_.metainfo.heading_lev_markup = 1;
comp_obj_heading_.metainfo.heading_lev_collapsed = 1;
@@ -1221,7 +1236,8 @@ template DocReformDocAbstraction() {
comp_obj_para.metainfo.is_a = "bibliography";
comp_obj_para.text = out_.to!string.strip;
comp_obj_para.metainfo.ocn = 0;
- comp_obj_para.metainfo.object_number_off = "";
+ comp_obj_para.metainfo.identifier = "";
+ comp_obj_para.metainfo.object_number_off = true;
comp_obj_para.metainfo.object_number_type = 0;
comp_obj_para.attrib.indent_hang = 0;
comp_obj_para.attrib.indent_base = 1;
@@ -1258,7 +1274,8 @@ template DocReformDocAbstraction() {
comp_obj_heading_.metainfo.is_a = "heading";
comp_obj_heading_.text = "(skip) there is no Blurb section";
comp_obj_heading_.metainfo.ocn = 0;
- comp_obj_para.metainfo.object_number_off = "";
+ comp_obj_heading_.metainfo.identifier = "";
+ comp_obj_para.metainfo.object_number_off = true;
comp_obj_para.metainfo.object_number_type = 0;
comp_obj_heading_.tags.segment_anchor_tag_epub = "";
comp_obj_heading_.tags.anchor_tag_html = "";
@@ -1284,14 +1301,15 @@ template DocReformDocAbstraction() {
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.object_number_off = "";
+ 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;
if (the_endnotes_section.length > 1) {
toc_txt_ = format(
- "{ %s }#%s",
+ mkup.lnk_o ~ " %s " ~ mkup.lnk_c ~ mkup.url_o ~ "#%s"~ mkup.url_c,
"Endnotes",
"endnotes",
);
@@ -1302,7 +1320,7 @@ template DocReformDocAbstraction() {
}
if (the_glossary_section.length > 1) {
toc_txt_ = format(
- "{ %s }#%s",
+ mkup.lnk_o ~ " %s " ~ mkup.lnk_c ~ mkup.url_o ~ "#%s"~ mkup.url_c,
"Glossary",
"glossary",
);
@@ -1313,7 +1331,7 @@ template DocReformDocAbstraction() {
}
if (the_bibliography_section.length > 1){
toc_txt_ = format(
- "{ %s }#%s",
+ mkup.lnk_o ~ " %s " ~ mkup.lnk_c ~ mkup.url_o ~ "#%s"~ mkup.url_c,
"Bibliography",
"bibliography",
);
@@ -1324,7 +1342,7 @@ template DocReformDocAbstraction() {
}
if (the_bookindex_section.length > 1) {
toc_txt_ = format(
- "{ %s }#%s",
+ mkup.lnk_o ~ " %s " ~ mkup.lnk_c ~ mkup.url_o ~ "#%s"~ mkup.url_c,
"Book Index",
"bookindex",
);
@@ -1335,7 +1353,7 @@ template DocReformDocAbstraction() {
}
if (the_blurb_section.length > 1) {
toc_txt_ = format(
- "{ %s }#%s",
+ mkup.lnk_o ~ " %s " ~ mkup.lnk_c ~ mkup.url_o ~ "#%s"~ mkup.url_c,
"Blurb",
"blurb",
);
@@ -1727,6 +1745,7 @@ template DocReformDocAbstraction() {
"Title OCN should be 1 not: " ~ obj.metainfo.ocn.to!string); // bug introduced 0.18.1
+/
obj.metainfo.ocn = 1;
+ obj.metainfo.identifier = "1";
obj.metainfo.object_number_type = OCNtype.ocn;
}
/+ dom structure (marked up & collapsed) +/
@@ -1773,14 +1792,16 @@ template DocReformDocAbstraction() {
/+ multiple 1~ levels, loop through document body +/
if (the_document_body_section.length > 1) {
foreach (ref obj; the_document_body_section) {
- if (!(((obj.metainfo.ocn.to!string) in tag_assoc)
- && ("seg_lv4" in tag_assoc[(obj.metainfo.ocn.to!string)]))
- ) {
- tag_assoc[(obj.metainfo.ocn.to!string)]["seg_lv4"]
- = obj.tags.html_segment_anchor_tag_is;
+ if (!(obj.metainfo.identifier.empty)) {
+ if (!(((obj.metainfo.identifier) in tag_assoc)
+ && ("seg_lv4" in tag_assoc[(obj.metainfo.identifier)]))
+ ) {
+ tag_assoc[(obj.metainfo.identifier)]["seg_lv4"]
+ = obj.tags.html_segment_anchor_tag_is;
+ }
+ tag_assoc[(obj.metainfo.identifier)]["seg_lv1_to_4"]
+ = obj.tags.epub_segment_anchor_tag_is;
}
- tag_assoc[(obj.metainfo.ocn.to!string)]["seg_lv1_to_4"]
- = obj.tags.epub_segment_anchor_tag_is;
if (obj.metainfo.is_a == "heading") {
debug(dom) {
writeln(obj.text);
@@ -1826,8 +1847,9 @@ template DocReformDocAbstraction() {
debug(dom) {
writeln(obj.text);
}
- obj_cite_digits = ocn_emit(OCNstatus.on);
- obj.metainfo.ocn = obj_cite_digits.digit;
+ obj_cite_digits = ocn_emit(OCNstatus.on);
+ obj.metainfo.ocn = obj_cite_digits.object_number;
+ obj.metainfo.identifier = obj_cite_digits.identifier;
if (obj.metainfo.heading_lev_markup <= 4) {
segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub;
if (obj.metainfo.heading_lev_markup == 4) {
@@ -1860,8 +1882,9 @@ template DocReformDocAbstraction() {
debug(dom) {
writeln(obj.text);
}
- obj_cite_digits = ocn_emit(OCNstatus.on);
- obj.metainfo.ocn = obj_cite_digits.digit;
+ obj_cite_digits = ocn_emit(OCNstatus.on);
+ obj.metainfo.ocn = obj_cite_digits.object_number;
+ obj.metainfo.identifier = obj_cite_digits.identifier;
if (obj.metainfo.heading_lev_markup <= 4) {
segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub;
if (obj.metainfo.heading_lev_markup == 4) {
@@ -1885,8 +1908,9 @@ template DocReformDocAbstraction() {
}
obj = obj_heading_ancestors(obj, lv_ancestors_txt);
} else if (obj.metainfo.is_a == "glossary") {
- obj_cite_digits = ocn_emit(OCNstatus.on);
- obj.metainfo.ocn = obj_cite_digits.digit;
+ obj_cite_digits = ocn_emit(OCNstatus.on);
+ obj.metainfo.ocn = obj_cite_digits.object_number;
+ obj.metainfo.identifier = obj_cite_digits.identifier;
}
}
}
@@ -1897,8 +1921,9 @@ template DocReformDocAbstraction() {
debug(dom) {
writeln(obj.text);
}
- obj_cite_digits = ocn_emit(OCNstatus.on);
- obj.metainfo.ocn = obj_cite_digits.digit;
+ obj_cite_digits = ocn_emit(OCNstatus.on);
+ obj.metainfo.ocn = obj_cite_digits.object_number;
+ obj.metainfo.identifier = obj_cite_digits.identifier;
if (obj.metainfo.heading_lev_markup <= 4) {
segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub;
if (obj.metainfo.heading_lev_markup == 4) {
@@ -1922,13 +1947,14 @@ template DocReformDocAbstraction() {
}
obj = obj_heading_ancestors(obj, lv_ancestors_txt);
} else if (obj.metainfo.is_a == "bibliography") {
- obj_cite_digits = ocn_emit(OCNstatus.on);
- obj.metainfo.ocn = obj_cite_digits.on;
+ obj_cite_digits = ocn_emit(OCNstatus.on);
+ obj.metainfo.ocn = obj_cite_digits.object_number;
+ obj.metainfo.identifier = obj_cite_digits.identifier;
}
}
}
/+ optional only one 1~ level +/
- int ocn_ = obj_cite_digits.on;
+ int ocn_ = obj_cite_digits.object_number;
int ocn_bkidx_ = 0;
int ocn_bidx_;
if (the_bookindex_section.length > 1) {
@@ -1942,8 +1968,9 @@ template DocReformDocAbstraction() {
if (obj.metainfo.heading_lev_markup <= 4) {
segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub;
}
- obj_cite_digits = ocn_emit(OCNstatus.on);
- obj.metainfo.ocn = obj_cite_digits.on;
+ obj_cite_digits = ocn_emit(OCNstatus.on);
+ obj.metainfo.ocn = obj_cite_digits.object_number;
+ obj.metainfo.identifier = obj_cite_digits.identifier;
if (obj.metainfo.heading_lev_markup <= 4) {
if (obj.metainfo.heading_lev_markup == 4) {
obj.tags.segname_prev = segnames["html"][obj.ptr.html_segnames - 1];
@@ -1967,7 +1994,8 @@ template DocReformDocAbstraction() {
obj = obj_heading_ancestors(obj, lv_ancestors_txt);
} else if (obj.metainfo.is_a == "bookindex") {
obj_cite_digits = ocn_emit(OCNstatus.bkidx);
- obj.metainfo.ocn = obj_cite_digits.digit;
+ obj.metainfo.ocn = obj_cite_digits.object_number;
+ obj.metainfo.identifier = obj_cite_digits.identifier;
obj.metainfo.o_n_book_index = obj_cite_digits.bkidx;
obj.metainfo.object_number_type = OCNtype.bkidx;
}
@@ -1984,8 +2012,9 @@ template DocReformDocAbstraction() {
debug(dom) {
writeln(obj.text);
}
- obj_cite_digits = ocn_emit(OCNstatus.on);
- obj.metainfo.ocn = obj_cite_digits.on;
+ obj_cite_digits = ocn_emit(OCNstatus.on);
+ obj.metainfo.ocn = obj_cite_digits.object_number;
+ obj.metainfo.identifier = obj_cite_digits.identifier;
if (obj.metainfo.heading_lev_markup <= 4) {
segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub;
if (obj.metainfo.heading_lev_markup == 4) {
@@ -2010,7 +2039,7 @@ template DocReformDocAbstraction() {
obj = obj_heading_ancestors(obj, lv_ancestors_txt);
} else if (obj.metainfo.is_a == "blurb") {
obj_cite_digits = ocn_emit(OCNstatus.off);
- obj.metainfo.object_number_off = obj_cite_digits.off.to!string;
+ obj.metainfo.object_number_off = obj_cite_digits.off;
obj.metainfo.object_number_type = OCNtype.non;
}
}
@@ -2119,7 +2148,8 @@ template DocReformDocAbstraction() {
comp_obj_heading_.metainfo.is_of_type = "para";
comp_obj_heading_.metainfo.is_a = "heading";
comp_obj_heading_.metainfo.ocn = 0;
- comp_obj_para.metainfo.object_number_off = "";
+ comp_obj_heading_.metainfo.identifier = "";
+ comp_obj_para.metainfo.object_number_off = true;
comp_obj_para.metainfo.object_number_type = 0;
comp_obj_heading_.tags.segment_anchor_tag_epub = "";
comp_obj_heading_.tags.anchor_tag_html = "";
@@ -2306,39 +2336,46 @@ template DocReformDocAbstraction() {
static assert(is(typeof(obj_type_status) == int[string]));
}
static auto rgx = Rgx();
- if ((!line.empty) && (obj_type_status["ocn_status_off_for_multiple_objects"] == TriState.off)) {
+ if (
+ !(line.empty)
+ && (obj_type_status["ocn_status_off_for_multiple_objects"] == OCN_off_block_status.off)
+ ) {
/+ not multi-line object, check whether object_number is on or turned off +/
if (line.matchFirst(rgx.object_number_block_marks)) {
/+ switch off object_number +/
if (line.matchFirst(rgx.object_number_off_block)) {
- obj_type_status["ocn_status_off_for_multiple_objects"] = TriState.on;
+ obj_type_status["ocn_status_off_for_multiple_objects"] = OCN_off_block_status.on;
+ obj_type_status["ocn_status"] = OCNstatus.off;
debug(ocnoff) {
writeln(line);
}
}
if (line.matchFirst(rgx.object_number_off_block_dh)) {
- obj_type_status["ocn_status_off_for_multiple_objects"] = TriState.closing;
+ obj_type_status["ocn_status_off_for_multiple_objects"] = OCN_off_block_status.on;
+ obj_type_status["ocn_status"] = OCNstatus.off;
debug(ocnoff) {
writeln(line);
}
}
} else {
- if (obj_type_status["ocn_status_off_for_multiple_objects"] == TriState.off) {
+ if (obj_type_status["ocn_status_off_for_multiple_objects"] == OCN_off_block_status.off) {
if (line.matchFirst(rgx.object_number_off)) {
obj_type_status["ocn_status"] = OCNstatus.off;
} else if (line.matchFirst(rgx.object_number_off_dh)) {
- obj_type_status["ocn_status"] = OCNstatus.closing;
+ obj_type_status["ocn_status"] = OCNstatus.off;
} else {
obj_type_status["ocn_status"] = OCNstatus.on;
}
} else {
- obj_type_status["ocn_status"]
- = obj_type_status["ocn_status_off_for_multiple_objects"];
+ obj_type_status["ocn_status"] = obj_type_status["ocn_status_off_for_multiple_objects"];
}
}
- } else if ((!line.empty) && (obj_type_status["ocn_status_off_for_multiple_objects"] > TriState.off)) {
+ } else if (
+ !(line.empty)
+ && (obj_type_status["ocn_status_off_for_multiple_objects"] > OCN_off_block_status.off)
+ ) {
if (line.matchFirst(rgx.object_number_off_block_close)) {
- obj_type_status["ocn_status_off_for_multiple_objects"] = TriState.off;
+ obj_type_status["ocn_status_off_for_multiple_objects"] = OCN_off_block_status.off;
obj_type_status["ocn_status"] = OCNstatus.on;
debug(ocnoff) {
writeln(line);
@@ -2410,7 +2447,7 @@ template DocReformDocAbstraction() {
/+ curly code open +/
code_block_syntax = (m.captures[1]) ? m.captures[1].to!string : "";
code_block_numbered = (m.captures[2] == "#") ? true : false;
- debug(code) { // code (curly) open
+ debug(codecurly) { // code (curly) open
writefln(
"* [code curly] %s",
line
@@ -2427,7 +2464,7 @@ template DocReformDocAbstraction() {
line
);
}
- object_number_poem["start"] = obj_cite_digits.on.to!string;
+ object_number_poem["start"] = obj_cite_digits.object_number.to!string;
obj_type_status["blocks"] = TriState.on;
obj_type_status["verse_new"] = State.on;
obj_type_status["poem"] = TriState.on;
@@ -2489,7 +2526,7 @@ template DocReformDocAbstraction() {
/+ tic code open +/
code_block_syntax = (m.captures[1]) ? m.captures[1].to!string : "";
code_block_numbered = (m.captures[2] == "#") ? true : false;
- debug(code) { // code (tic) open
+ debug(codetic) { // code (tic) open
writefln(
"* [code tic] %s",
line
@@ -2506,7 +2543,7 @@ template DocReformDocAbstraction() {
line
);
}
- object_number_poem["start"] = obj_cite_digits.on.to!string;
+ object_number_poem["start"] = obj_cite_digits.object_number.to!string;
obj_type_status["blocks"] = TriState.on;
obj_type_status["verse_new"] = State.on;
obj_type_status["poem"] = TriState.on;
@@ -2723,14 +2760,14 @@ template DocReformDocAbstraction() {
writeln(__LINE__);
writefln(
"* %s %s",
- obj_cite_digits.on,
+ obj_cite_digits.object_number,
line
);
}
if (an_object.length > 0) {
debug(poem) { // poem (curly) close
writeln(
- obj_cite_digits.on,
+ obj_cite_digits.object_number,
an_object[an_object_key]
);
}
@@ -2744,8 +2781,9 @@ template DocReformDocAbstraction() {
comp_obj_block.metainfo.is_of_section = "body";
comp_obj_block.metainfo.is_of_type = "block";
comp_obj_block.metainfo.is_a = "verse";
- comp_obj_block.metainfo.ocn = obj_cite_digits.on;
- comp_obj_block.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string;
+ comp_obj_block.metainfo.ocn = obj_cite_digits.object_number;
+ comp_obj_block.metainfo.identifier = obj_cite_digits.identifier;
+ comp_obj_block.metainfo.object_number_off = obj_cite_digits.off;
comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"];
comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"];
comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx;
@@ -2761,14 +2799,14 @@ template DocReformDocAbstraction() {
processing.remove("verse");
++cntr;
}
- object_number_poem["end"] = obj_cite_digits.on.to!string;
+ object_number_poem["end"] = obj_cite_digits.object_number.to!string;
obj_type_status["blocks"] = TriState.closing;
obj_type_status["poem"] = TriState.closing;
obj_type_status["curly_poem"] = TriState.off;
} else {
processing["verse"] ~= line ~= "\n";
if (obj_type_status["verse_new"] == State.on) {
- obj_cite_digits = ocn_emit(OCNstatus.on);
+ obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]);
obj_type_status["verse_new"] = State.off;
} else if (line.matchFirst(rgx.newline_eol_delimiter_only)) {
processing["verse"] = processing["verse"].stripRight;
@@ -2781,7 +2819,7 @@ template DocReformDocAbstraction() {
debug(poem) { // poem verse
writefln(
"* %s curly\n%s",
- obj_cite_digits.on,
+ obj_cite_digits.object_number,
an_object[an_object_key]
);
}
@@ -2806,8 +2844,9 @@ template DocReformDocAbstraction() {
comp_obj_block.metainfo.is_of_section = "body";
comp_obj_block.metainfo.is_of_type = "block";
comp_obj_block.metainfo.is_a = "verse";
- comp_obj_block.metainfo.ocn = obj_cite_digits.on;
- comp_obj_block.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string;
+ comp_obj_block.metainfo.ocn = obj_cite_digits.object_number;
+ comp_obj_block.metainfo.identifier = obj_cite_digits.identifier;
+ comp_obj_block.metainfo.object_number_off = obj_cite_digits.off;
comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"];
comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"];
comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx;
@@ -2838,7 +2877,7 @@ template DocReformDocAbstraction() {
if (an_object.length > 0) {
debug(poem) { // poem (tic) close
writeln(__LINE__);
- writeln(obj_cite_digits.on, line);
+ writeln(obj_cite_digits.object_number, line);
}
processing.remove("verse");
an_object["is"] = "verse";
@@ -2851,8 +2890,9 @@ template DocReformDocAbstraction() {
comp_obj_block.metainfo.is_of_section = "body";
comp_obj_block.metainfo.is_of_type = "block";
comp_obj_block.metainfo.is_a = "verse";
- comp_obj_block.metainfo.ocn = obj_cite_digits.on;
- comp_obj_block.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string;
+ comp_obj_block.metainfo.ocn = obj_cite_digits.object_number;
+ comp_obj_block.metainfo.identifier = obj_cite_digits.identifier;
+ comp_obj_block.metainfo.object_number_off = obj_cite_digits.off;
comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"];
comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"];
comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx;
@@ -2863,7 +2903,7 @@ template DocReformDocAbstraction() {
comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links];
the_document_body_section ~= comp_obj_block;
tag_assoc = inline_para_link_anchor(an_object, tag_in_seg, tag_assoc);
- object_number_poem["end"] = obj_cite_digits.on.to!string;
+ object_number_poem["end"] = obj_cite_digits.object_number.to!string;
object_reset(an_object);
processing.remove("verse");
++cntr;
@@ -2874,7 +2914,7 @@ template DocReformDocAbstraction() {
} else {
processing["verse"] ~= line ~= "\n";
if (obj_type_status["verse_new"] == State.on) {
- obj_cite_digits = ocn_emit(OCNstatus.on);
+ obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]);
obj_type_status["verse_new"] = State.off;
} else if (line.matchFirst(rgx.newline_eol_delimiter_only)) {
processing["verse"] = processing["verse"].stripRight;
@@ -2887,7 +2927,7 @@ template DocReformDocAbstraction() {
debug(poem) { // poem (tic) close
writefln(
"* %s tic\n%s",
- obj_cite_digits.on,
+ obj_cite_digits.object_number,
an_object[an_object_key]
);
}
@@ -2913,8 +2953,9 @@ template DocReformDocAbstraction() {
comp_obj_block.metainfo.is_of_section = "body";
comp_obj_block.metainfo.is_of_type = "block";
comp_obj_block.metainfo.is_a = "verse";
- comp_obj_block.metainfo.ocn = obj_cite_digits.on;
- comp_obj_block.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string;
+ comp_obj_block.metainfo.ocn = obj_cite_digits.object_number;
+ comp_obj_block.metainfo.identifier = obj_cite_digits.identifier;
+ comp_obj_block.metainfo.object_number_off = obj_cite_digits.off;
comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"];
comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"];
comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx;
@@ -2945,7 +2986,7 @@ template DocReformDocAbstraction() {
static auto rgx = Rgx();
if (obj_type_status["curly_code"] == TriState.on) {
if (line.matchFirst(rgx.block_curly_code_close)) {
- debug(code) { // code (curly) close
+ debug(codecurly) { // code (curly) close
writeln(line);
}
an_object[an_object_key] = an_object[an_object_key]
@@ -2955,14 +2996,14 @@ template DocReformDocAbstraction() {
obj_type_status["code"] = TriState.closing;
obj_type_status["curly_code"] = TriState.off;
} else {
- debug(code) { // code (curly) line
+ debug(codecurly) { // code (curly) line
writeln(line);
}
an_object[an_object_key] ~= line ~= "\n"; // code (curly) line
}
} else if (obj_type_status["tic_code"] == TriState.on) {
if (line.matchFirst(rgx.block_tic_close)) {
- debug(code) { // code (tic) close
+ debug(codetic) { // code (tic) close
writeln(line);
}
an_object[an_object_key] = an_object[an_object_key]
@@ -2972,7 +3013,7 @@ template DocReformDocAbstraction() {
obj_type_status["code"] = TriState.closing;
obj_type_status["tic_code"] = TriState.off;
} else {
- debug(code) { // code (tic) line
+ debug(codetic) { // code (tic) line
writeln(line);
}
an_object[an_object_key] ~= line ~= "\n"; // code (tic) line
@@ -3197,7 +3238,7 @@ template DocReformDocAbstraction() {
CMM conf_make_meta
) {
comp_obj_block = comp_obj_block.init;
- obj_cite_digits = ocn_emit(OCNstatus.on);
+ obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]);
auto comp_obj_location
= node_construct.node_location_emitter(
content_non_header,
@@ -3213,8 +3254,9 @@ template DocReformDocAbstraction() {
auto substantive_obj_misc_tuple
= obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, "body_nugget", conf_make_meta, false);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
- comp_obj_block.metainfo.ocn = obj_cite_digits.on;
- comp_obj_block.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string;
+ comp_obj_block.metainfo.ocn = obj_cite_digits.object_number;
+ comp_obj_block.metainfo.identifier = obj_cite_digits.identifier;
+ comp_obj_block.metainfo.object_number_off = obj_cite_digits.off;
comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"];
comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"];
comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx;
@@ -3251,7 +3293,7 @@ template DocReformDocAbstraction() {
);
assertions_flag_types_block_status_none_or_closed(obj_type_status);
if (obj_type_status["quote"] == TriState.closing) {
- obj_cite_digits = ocn_emit(OCNstatus.on);
+ obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]);
an_object["bookindex_nugget"]
= ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";
bookindex_unordered_hashes
@@ -3281,8 +3323,9 @@ template DocReformDocAbstraction() {
comp_obj_block.metainfo.is_of_section = "body";
comp_obj_block.metainfo.is_of_type = "block";
comp_obj_block.metainfo.is_a = "quote";
- comp_obj_block.metainfo.ocn = obj_cite_digits.on;
- comp_obj_block.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string;
+ comp_obj_block.metainfo.ocn = obj_cite_digits.object_number;
+ comp_obj_block.metainfo.identifier = obj_cite_digits.identifier;
+ comp_obj_block.metainfo.object_number_off = obj_cite_digits.off;
comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"];
comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"];
comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx;
@@ -3299,7 +3342,7 @@ template DocReformDocAbstraction() {
processing.remove("verse");
++cntr;
} else if (obj_type_status["group"] == TriState.closing) {
- obj_cite_digits = ocn_emit(OCNstatus.on);
+ obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]);
an_object["bookindex_nugget"]
= ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";
bookindex_unordered_hashes
@@ -3329,8 +3372,9 @@ template DocReformDocAbstraction() {
comp_obj_block.metainfo.is_of_section = "body";
comp_obj_block.metainfo.is_of_type = "block";
comp_obj_block.metainfo.is_a = "group";
- comp_obj_block.metainfo.ocn = obj_cite_digits.on;
- comp_obj_block.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string;
+ comp_obj_block.metainfo.ocn = obj_cite_digits.object_number;
+ comp_obj_block.metainfo.identifier = obj_cite_digits.identifier;
+ comp_obj_block.metainfo.object_number_off = obj_cite_digits.off;
comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"];
comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"];
comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx;
@@ -3347,7 +3391,7 @@ template DocReformDocAbstraction() {
processing.remove("verse");
++cntr;
} else if (obj_type_status["block"] == TriState.closing) {
- obj_cite_digits = ocn_emit(OCNstatus.on);
+ obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]);
an_object["bookindex_nugget"]
= ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";
bookindex_unordered_hashes
@@ -3377,8 +3421,9 @@ template DocReformDocAbstraction() {
comp_obj_block.metainfo.is_of_section = "body";
comp_obj_block.metainfo.is_of_type = "block";
comp_obj_block.metainfo.is_a = "block";
- comp_obj_block.metainfo.ocn = obj_cite_digits.on;
- comp_obj_block.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string;
+ comp_obj_block.metainfo.ocn = obj_cite_digits.object_number;
+ comp_obj_block.metainfo.identifier = obj_cite_digits.identifier;
+ comp_obj_block.metainfo.object_number_off = obj_cite_digits.off;
comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"];
comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"];
comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx;
@@ -3419,9 +3464,10 @@ template DocReformDocAbstraction() {
comp_obj_poem_ocn.metainfo.is_of_section = "body";
comp_obj_poem_ocn.metainfo.is_of_type = "block";
comp_obj_poem_ocn.metainfo.is_a = "poem";
- comp_obj_poem_ocn.metainfo.ocn = obj_cite_digits.on;
- comp_obj_poem_ocn.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string; //
- comp_obj_poem_ocn.metainfo.o_n_book_index = obj_cite_digits.bkidx; //
+ comp_obj_poem_ocn.metainfo.ocn = obj_cite_digits.object_number;
+ comp_obj_poem_ocn.metainfo.identifier = obj_cite_digits.identifier;
+ comp_obj_poem_ocn.metainfo.object_number_off = obj_cite_digits.off;
+ comp_obj_poem_ocn.metainfo.o_n_book_index = obj_cite_digits.bkidx;
comp_obj_poem_ocn.metainfo.object_number_type = obj_cite_digits.type;
comp_obj_poem_ocn.text = "";
the_document_body_section ~= comp_obj_poem_ocn;
@@ -3430,7 +3476,7 @@ template DocReformDocAbstraction() {
object_reset(an_object);
processing.remove("verse");
} else if (obj_type_status["code"] == TriState.closing) {
- obj_cite_digits = ocn_emit(OCNstatus.on);
+ obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]);
an_object["bookindex_nugget"]
= ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";
bookindex_unordered_hashes
@@ -3460,8 +3506,9 @@ template DocReformDocAbstraction() {
comp_obj_code.metainfo.is_of_section = "body";
comp_obj_code.metainfo.is_of_type = "block";
comp_obj_code.metainfo.is_a = "code";
- comp_obj_code.metainfo.ocn = obj_cite_digits.on;
- comp_obj_code.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string;
+ comp_obj_code.metainfo.ocn = obj_cite_digits.object_number;
+ comp_obj_code.metainfo.identifier = obj_cite_digits.identifier;
+ comp_obj_code.metainfo.object_number_off = obj_cite_digits.off;
comp_obj_code.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"];
comp_obj_code.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"];
comp_obj_code.metainfo.o_n_book_index = obj_cite_digits.bkidx;
@@ -3478,7 +3525,7 @@ template DocReformDocAbstraction() {
++cntr;
} else if (obj_type_status["table"] == TriState.closing) {
comp_obj_block = comp_obj_block.init;
- obj_cite_digits = ocn_emit(OCNstatus.on);
+ obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]);
an_object["bookindex_nugget"]
= ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";
bookindex_unordered_hashes
@@ -3503,8 +3550,9 @@ template DocReformDocAbstraction() {
= obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
comp_obj_block = comp_obj_block.init;
- comp_obj_block.metainfo.ocn = obj_cite_digits.on;
- comp_obj_block.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string;
+ comp_obj_block.metainfo.ocn = obj_cite_digits.object_number;
+ comp_obj_block.metainfo.identifier = obj_cite_digits.identifier;
+ comp_obj_block.metainfo.object_number_off = obj_cite_digits.off;
comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"];
comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"];
comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx;
@@ -4157,36 +4205,48 @@ template DocReformDocAbstraction() {
/+ abstraction functions ↑ +/
/+ ↓ abstraction function emitters +/
pure struct OCNemitter {
- int ocn_, ocn_on, ocn_on_, ocn_off, ocn_off_, ocn_bkidx, ocn_bkidx_;
+ int ocn_digit, ocn_object_number, ocn_on_, ocn_off_, ocn_bkidx, ocn_bkidx_;
+ string object_identifier;
+ bool ocn_is_off;
auto ocn_emitter(int ocn_status_flag) {
OCNset ocn;
assert(ocn_status_flag <= OCNstatus.reset);
- ocn_on = ocn_off = ocn_bkidx = 0;
+ ocn_object_number = ocn_bkidx = 0;
+ object_identifier = "";
+ ocn_is_off = false;
switch(ocn_status_flag) {
case OCNstatus.reset:
- ocn_ = ocn_on_ = ocn_off_ = 1;
- ocn_bkidx_ = 0;
+ ocn_digit = ocn_on_ = 1;
+ object_identifier = "1";
+ ocn_is_off = false;
+ ocn_off_ = ocn_bkidx_ = 0;
break;
case OCNstatus.on:
- ocn_ = ocn_on = ++ocn_on_;
+ ocn_digit = ocn_object_number = ++ocn_on_;
+ object_identifier = ocn_digit.to!string;
+ ocn_is_off = false;
break;
case OCNstatus.off:
- ocn_ = ocn_off = ++ocn_off_;
+ ocn_digit = 0;
+ ocn_off_ = ++ocn_off_;
+ object_identifier = "a" ~ ocn_off_.to!string;
+ ocn_is_off = true;
break;
case OCNstatus.bkidx:
- ocn_ = ocn_bkidx = ++ocn_bkidx_;
+ ocn_bkidx = ++ocn_bkidx_;
break;
case OCNstatus.closing:
break;
default:
- ocn_ = 0;
- }
- assert(ocn_ >= 0);
- ocn.digit = ocn_;
- ocn.on = ocn_on;
- ocn.off = ocn_off;
- ocn.bkidx = ocn_bkidx;
- ocn.type = ocn_status_flag;
+ ocn_digit = 0;
+ }
+ assert(ocn_digit >= 0);
+ ocn.digit = ocn_digit;
+ ocn.object_number = ocn_object_number; // difference between .object_number and .digit?
+ ocn.identifier = object_identifier;
+ ocn.off = ocn_is_off;
+ ocn.bkidx = ocn_bkidx;
+ ocn.type = ocn_status_flag;
return ocn;
}
invariant() {
@@ -4704,7 +4764,7 @@ template DocReformDocAbstraction() {
"base_position" : obj_["lev_markup_number"].to!int,
];
toc_txt_ = format(
- "{ %s }#%s",
+ mkup.lnk_o ~ " %s " ~ mkup.lnk_c ~ mkup.url_o ~ "#%s"~ mkup.url_c,
heading_toc_,
_anchor_tag,
);
@@ -4715,7 +4775,8 @@ template DocReformDocAbstraction() {
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.object_number_off = "";
+ 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"];
@@ -4734,7 +4795,8 @@ template DocReformDocAbstraction() {
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.object_number_off = "";
+ 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"];
@@ -4749,7 +4811,8 @@ template DocReformDocAbstraction() {
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.object_number_off = "";
+ 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.bullet = false;
comp_obj_toc.has.inline_links = true;
@@ -4761,7 +4824,7 @@ template DocReformDocAbstraction() {
break;
case 5: .. case 7:
subtoc_txt_ = format(
- "{ %s }#%s",
+ mkup.lnk_o ~ " %s " ~ mkup.lnk_c ~ mkup.url_o ~ "#%s"~ mkup.url_c,
heading_toc_,
_anchor_tag,
);
@@ -5250,15 +5313,15 @@ template DocReformDocAbstraction() {
in {
debug(asserts) {
static assert(is(typeof(bookindex_section) == string));
- static assert(is(typeof(obj_cite_digits.on) == int));
+ static assert(is(typeof(obj_cite_digits.object_number) == int));
}
debug(bookindexraw) {
if (!bookindex_section.empty) {
writeln(
"* [bookindex] ",
- "[", obj_cite_digits.on.to!string, ": ", tag_in_seg["seg_lv4"], "] ", bookindex_section,
+ "[", obj_cite_digits.object_number.to!string, ": ", tag_in_seg["seg_lv4"], "] ", bookindex_section,
" - - - ",
- "[", obj_cite_digits.on.to!string, "] ", bookindex_section
+ "[", obj_cite_digits.object_number.to!string, "] ", bookindex_section
);
}
}
@@ -5276,12 +5339,12 @@ template DocReformDocAbstraction() {
) {
main_term = m.captures[1].strip;
object_number_offset = m.captures[2].to!int;
- object_number_endpoint=(obj_cite_digits.on + object_number_offset);
- object_numbers ~= (obj_cite_digits.on.to!string
+ object_number_endpoint=(obj_cite_digits.object_number + object_number_offset);
+ object_numbers ~= (obj_cite_digits.object_number.to!string
~ "-" ~ object_number_endpoint.to!string);
} else {
main_term = bi_main_term_and_rest[0].strip;
- object_numbers ~= obj_cite_digits.on.to!string;
+ object_numbers ~= obj_cite_digits.object_number.to!string;
}
bi[main_term]["_a"] ~= object_numbers;
object_numbers = null;
@@ -5294,12 +5357,12 @@ template DocReformDocAbstraction() {
if (auto m = sub_terms_bits.match(rgx.bi_term_and_object_numbers_match)) {
sub_term = m.captures[1].strip;
object_number_offset = m.captures[2].to!int;
- object_number_endpoint=(obj_cite_digits.on + object_number_offset);
- object_numbers ~= (obj_cite_digits.on.to!string
+ object_number_endpoint=(obj_cite_digits.object_number + object_number_offset);
+ object_numbers ~= (obj_cite_digits.object_number.to!string
~ " - " ~ object_number_endpoint.to!string);
} else {
sub_term = sub_terms_bits.strip;
- object_numbers ~= obj_cite_digits.on.to!string;
+ object_numbers ~= obj_cite_digits.object_number.to!string;
}
if (!empty(sub_term)) {
bi[main_term][sub_term] ~= object_numbers;
@@ -5384,7 +5447,7 @@ template DocReformDocAbstraction() {
) {
debug(asserts) {
static assert(is(typeof(bookindex_unordered_hashes) == string[][string][string]));
- static assert(is(typeof(obj_cite_digits.on) == int));
+ static assert(is(typeof(obj_cite_digits.object_number) == int));
}
mixin DocReformNode;
mixin InternalMarkup;
@@ -5412,7 +5475,8 @@ template DocReformDocAbstraction() {
comp_obj_heading_.metainfo.is_a = "heading";
comp_obj_heading_.text = "Book Index";
comp_obj_heading_.metainfo.ocn = 0;
- comp_obj_heading_.metainfo.object_number_off = "";
+ comp_obj_heading_.metainfo.identifier = "";
+ comp_obj_heading_.metainfo.object_number_off = true;
comp_obj_heading_.metainfo.object_number_type = 0;
comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_book_index";
comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub;
@@ -5433,7 +5497,8 @@ template DocReformDocAbstraction() {
comp_obj_heading_.metainfo.is_a = "heading";
comp_obj_heading_.text = "Index";
comp_obj_heading_.metainfo.ocn = 0;
- comp_obj_heading_.metainfo.object_number_off = "";
+ comp_obj_heading_.metainfo.identifier = "";
+ comp_obj_heading_.metainfo.object_number_off = true;
comp_obj_heading_.metainfo.object_number_type = 0;
comp_obj_heading_.tags.segment_anchor_tag_epub = "bookindex";
comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub;
@@ -5492,7 +5557,8 @@ template DocReformDocAbstraction() {
comp_obj_para.metainfo.is_a = "bookindex";
comp_obj_para.text = bi_tmp.to!string.strip;
comp_obj_para.metainfo.ocn = 0;
- comp_obj_para.metainfo.object_number_off = "";
+ comp_obj_para.metainfo.identifier = "";
+ comp_obj_para.metainfo.object_number_off = true;
comp_obj_para.metainfo.object_number_type = 0;
comp_obj_para.tags.anchor_tags = bi_tmp_tags;
comp_obj_para.attrib.indent_hang = 0;
@@ -5507,7 +5573,8 @@ template DocReformDocAbstraction() {
comp_obj_heading_ = comp_obj_heading_.init;
comp_obj_heading_.text = "(skip) there is no Book Index";
comp_obj_heading_.metainfo.ocn = 0;
- comp_obj_heading_.metainfo.object_number_off = "";
+ comp_obj_heading_.metainfo.identifier = "";
+ comp_obj_heading_.metainfo.object_number_off = true;
comp_obj_heading_.metainfo.object_number_type = 0;
comp_obj_heading_.metainfo.heading_lev_markup = 1;
comp_obj_heading_.metainfo.heading_lev_collapsed = 1;
@@ -5622,7 +5689,8 @@ template DocReformDocAbstraction() {
comp_obj_heading_.metainfo.is_a = "heading";
comp_obj_heading_.text = "Endnotes";
comp_obj_heading_.metainfo.ocn = 0;
- comp_obj_heading_.metainfo.object_number_off = "";
+ comp_obj_heading_.metainfo.identifier = "";
+ comp_obj_heading_.metainfo.object_number_off = true;
comp_obj_heading_.metainfo.object_number_type = 0;
comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_endnotes";
comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub;
@@ -5642,7 +5710,8 @@ template DocReformDocAbstraction() {
comp_obj_heading_.metainfo.is_a = "heading";
comp_obj_heading_.text = "Endnotes";
comp_obj_heading_.metainfo.ocn = 0;
- comp_obj_heading_.metainfo.object_number_off = "";
+ comp_obj_heading_.metainfo.identifier = "";
+ comp_obj_heading_.metainfo.object_number_off = true;
comp_obj_heading_.metainfo.object_number_type = 0;
comp_obj_heading_.tags.segment_anchor_tag_epub = "endnotes";
comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub;
@@ -5664,7 +5733,8 @@ template DocReformDocAbstraction() {
comp_obj_heading_.metainfo.is_a = "heading";
comp_obj_heading_.text = "(skip) there are no Endnotes";
comp_obj_heading_.metainfo.ocn = 0;
- comp_obj_heading_.metainfo.object_number_off = "";
+ comp_obj_heading_.metainfo.identifier = "";
+ comp_obj_heading_.metainfo.object_number_off = true;
comp_obj_heading_.metainfo.object_number_type = 0;
comp_obj_heading_.metainfo.heading_lev_markup = 1;
comp_obj_heading_.metainfo.heading_lev_collapsed = 1;
@@ -5680,8 +5750,9 @@ template DocReformDocAbstraction() {
comp_obj_endnote_.metainfo.is_of_type = "para";
comp_obj_endnote_.metainfo.is_a = "endnote";
comp_obj_endnote_.metainfo.ocn = 0;
- comp_obj_heading_.metainfo.object_number_off = "";
- comp_obj_heading_.metainfo.object_number_type = 0;
+ comp_obj_endnote_.metainfo.identifier = "";
+ comp_obj_heading_.metainfo.object_number_off = true; // check
+ comp_obj_heading_.metainfo.object_number_type = 0; // check
comp_obj_endnote_.attrib.indent_hang = 0;
comp_obj_endnote_.attrib.indent_base = 0;
comp_obj_endnote_.attrib.bullet = false;
@@ -5817,19 +5888,19 @@ template DocReformDocAbstraction() {
)
in {
debug(asserts) {
- static assert(is(typeof(lev_markup_number) == string));
- static assert(is(typeof(tag_in_seg) == string[string]));
- static assert(is(typeof(obj_cite_digits.on) == int));
- static assert(is(typeof(cntr_) == int));
- static assert(is(typeof(ptr_) == int));
- static assert(is(typeof(is_) == string));
+ static assert(is(typeof(lev_markup_number) == string));
+ static assert(is(typeof(tag_in_seg) == string[string]));
+ static assert(is(typeof(obj_cite_digits.object_number) == int));
+ static assert(is(typeof(cntr_) == int));
+ static assert(is(typeof(ptr_) == int));
+ static assert(is(typeof(is_) == string));
}
assert(is_ != "heading");
- assert(obj_cite_digits.on.to!int >= 0);
+ assert(obj_cite_digits.object_number.to!int >= 0);
}
body {
- assert(is_ != "heading"); // should not be necessary
- assert(obj_cite_digits.on.to!int >= 0); // should not be necessary
+ assert(is_ != "heading");
+ assert(obj_cite_digits.object_number.to!int >= 0);
if (lv7 > State.off) {
p_["lev_markup_number"] = DocStructMarkupHeading.h_text_4;
p_["object_number"] = lv7;
@@ -5846,7 +5917,8 @@ template DocReformDocAbstraction() {
ObjGenericComposite comp_obj_location;
comp_obj_location = comp_obj_location.init;
comp_obj_location.metainfo.is_a = is_;
- comp_obj_location.metainfo.ocn = obj_cite_digits.on;
+ comp_obj_location.metainfo.ocn = obj_cite_digits.object_number;
+ comp_obj_location.metainfo.identifier = obj_cite_digits.identifier;
comp_obj_location.tags.anchor_tag_html = tag_in_seg["seg_lv4"];
comp_obj_location.tags.segment_anchor_tag_epub = tag_in_seg["seg_lv1_to_4"];
comp_obj_location.tags.heading_lev_anchor_tag = lev_anchor_tag;
@@ -5890,7 +5962,7 @@ template DocReformDocAbstraction() {
static assert(is(typeof(lev_markup_number) == string));
static assert(is(typeof(lev_collapsed_number) == string));
static assert(is(typeof(tag_in_seg) == string[string]));
- static assert(is(typeof(obj_cite_digits.on) == int));
+ static assert(is(typeof(obj_cite_digits.object_number) == int));
static assert(is(typeof(cntr_) == int));
static assert(is(typeof(ptr_) == int));
static assert(is(typeof(lv_ancestors_txt) == string[]));
@@ -5898,19 +5970,19 @@ template DocReformDocAbstraction() {
static assert(is(typeof(html_segnames_ptr) == int));
}
assert(is_ == "heading");
- assert((obj_cite_digits.on).to!int >= 0);
+ assert((obj_cite_digits.object_number).to!int >= 0);
assert(
lev_markup_number.match(rgx.levels_numbered),
- ("not a valid heading level: " ~ lev_markup_number ~ " at " ~ obj_cite_digits.on.to!string)
+ ("not a valid heading level: " ~ lev_markup_number ~ " at " ~ obj_cite_digits.object_number.to!string)
);
if (lev_markup_number.match(rgx.levels_numbered)) {
if (lev_markup_number.to!int == 0) {
/+ TODO first hit (of two) with this assertion failure, check, fix & reinstate
- assert(obj_cite_digits.on.to!int == 1,
+ assert(obj_cite_digits.object_number.to!int == 1,
"ERROR header lev markup number is: " ~
lev_markup_number.to!string ~
- " obj_cite_digits.on.to!int should == 1 but is: " ~
- obj_cite_digits.on.to!string ~
+ " obj_cite_digits.object_number.to!int should == 1 but is: " ~
+ obj_cite_digits.object_number.to!string ~
"\n" ~ _text);
+/
}
@@ -6004,8 +6076,9 @@ template DocReformDocAbstraction() {
_comp_obj_heading_.metainfo.is_of_type = "para";
_comp_obj_heading_.metainfo.is_a = "heading";
_comp_obj_heading_.text = _text.to!string.strip;
- _comp_obj_heading_.metainfo.ocn = obj_cite_digits.on;
- _comp_obj_heading_.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string;
+ _comp_obj_heading_.metainfo.ocn = obj_cite_digits.object_number;
+ _comp_obj_heading_.metainfo.identifier = obj_cite_digits.identifier;
+ _comp_obj_heading_.metainfo.object_number_off = obj_cite_digits.off;
// _comp_obj_heading_.metainfo.o_n_book_index = obj_cite_digits.bkidx;
_comp_obj_heading_.metainfo.object_number_type = obj_cite_digits.type;
_comp_obj_heading_.tags.segment_anchor_tag_epub = tag_in_seg["seg_lv1_to_4"];
diff --git a/src/doc_reform/meta/object_setter.d b/src/doc_reform/meta/object_setter.d
index b3325fa..03197da 100644
--- a/src/doc_reform/meta/object_setter.d
+++ b/src/doc_reform/meta/object_setter.d
@@ -39,13 +39,14 @@ template ObjectSetter() {
string object_number_blurb() const @property {
return (o_n_blurb==0) ? "" : o_n_blurb.to!string;
}
- string object_number_off = "";
+ bool object_number_off = false;
bool visible_object_number = false;
// enum ONtype { none, substantive, non_substantive, glossary, bibliography, book_index, blurb, comment }
int object_number_type = 0; // { ocn, non, bkidx }
/+ node +/
string[string][string] node;
int ocn = 0;
+ string identifier = "";
string object_number() const @property {
return (ocn==0) ? "" : ocn.to!string;
}
diff --git a/src/doc_reform/output/sqlite.d b/src/doc_reform/output/sqlite.d
index 2456509..d09b9b8 100644
--- a/src/doc_reform/output/sqlite.d
+++ b/src/doc_reform/output/sqlite.d
@@ -316,11 +316,15 @@ template SQLiteFormatAndLoadObject() {
);
}
} else {
- writeln(
- "WARNING on internal document links, anchor to link not found in document, "
- ~ "anchor: " ~ m.captures[3]
- ~ " document: " ~ doc_matters.src.filename
- );
+ if (!(doc_matters.opt.action.quiet)) {
+ writeln(
+ "WARNING on internal document links, anchor to link <<"
+ ~ m.captures[3]
+ ~ ">> not found in document, "
+ ~ "anchor: " ~ m.captures[3]
+ ~ " document: " ~ doc_matters.src.filename
+ );
+ }
}
}
} else {
diff --git a/src/doc_reform/output/xmls.d b/src/doc_reform/output/xmls.d
index 6154010..b69d1a7 100644
--- a/src/doc_reform/output/xmls.d
+++ b/src/doc_reform/output/xmls.d
@@ -368,13 +368,15 @@ template outputXHTMLs() {
);
}
} else {
- writeln(
- "WARNING on internal document links, anchor to link <<"
- ~ m.captures[3]
- ~ ">> not found in document, "
- ~ "anchor: " ~ m.captures[3]
- ~ " document: " ~ doc_matters.src.filename
- );
+ if (!(doc_matters.opt.action.quiet)) {
+ writeln(
+ "WARNING on internal document links, anchor to link <<"
+ ~ m.captures[3]
+ ~ ">> not found in document, "
+ ~ "anchor: " ~ m.captures[3]
+ ~ " document: " ~ doc_matters.src.filename
+ );
+ }
}
}
}