From aba135a5ce2c8a58551a478d064262bda19c9770 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 7 Nov 2018 11:47:37 -0500 Subject: 0.3.1 internal links, anchor tags & segment associations, toc --- org/doc_reform.org | 2 +- org/meta_abstraction.org | 406 +++++++++++++++++++-------------- org/output_sqlite.org | 14 +- org/output_xmls.org | 16 +- src/doc_reform/meta/metadoc_from_src.d | 403 ++++++++++++++++++-------------- src/doc_reform/meta/object_setter.d | 3 +- src/doc_reform/output/sqlite.d | 14 +- src/doc_reform/output/xmls.d | 16 +- views/version.txt | 2 +- 9 files changed, 518 insertions(+), 358 deletions(-) diff --git a/org/doc_reform.org b/org/doc_reform.org index f8dcc63..bbe6a65 100644 --- a/org/doc_reform.org +++ b/org/doc_reform.org @@ -24,7 +24,7 @@ struct Version { int minor; int patch; } -enum ver = Version(0, 3, 0); +enum ver = Version(0, 3, 1); #+END_SRC ** compilation restrictions (supported compilers) diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org index 4d2d85b..92cab2d 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -206,6 +206,7 @@ enum DocStructMarkupHeading { 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; @@ -229,8 +230,9 @@ static auto obj_att = ObjAttributes(); /+ ocn +/ struct OCNset { int digit; - int on; - int off; + int object_number; + bool off; + string identifier; int bkidx; int type; } @@ -536,7 +538,8 @@ comp_obj_heading_.metainfo.is_of_type = "para"; 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; @@ -712,7 +715,8 @@ if there is a glossary section you need to: 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; @@ -733,7 +737,8 @@ if there is a glossary section you need to: 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; @@ -757,7 +762,8 @@ if there is a glossary section you need to: 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"]; @@ -839,7 +845,8 @@ if there is a blurb section you need to: 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; @@ -860,7 +867,8 @@ if there is a blurb section you need to: 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; @@ -884,7 +892,8 @@ if there is a blurb section you need to: 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; @@ -905,7 +914,8 @@ if there is a blurb section you need to: 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"]; @@ -1007,7 +1017,7 @@ if (line.matchFirst(rgx.block_poem_open)) { /+ 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; @@ -1205,7 +1215,7 @@ if ((obj_type_status["heading"] == State.on) /+ 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 @@ -1260,7 +1270,7 @@ if ((obj_type_status["heading"] == State.on) ++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; @@ -1272,7 +1282,7 @@ if ((obj_type_status["heading"] == State.on) 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, @@ -1360,8 +1370,9 @@ if ((obj_type_status["heading"] == State.on) 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"]; @@ -1486,7 +1497,8 @@ if (an_object["glossary_nugget"].length == 0) { 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; @@ -1521,7 +1533,8 @@ if (biblio_ordered.length > 0) { 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; @@ -1540,7 +1553,8 @@ if (biblio_ordered.length > 0) { 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; @@ -1561,7 +1575,8 @@ if (biblio_ordered.length > 0) { 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; @@ -1598,7 +1613,8 @@ foreach (entry; biblio_ordered) { 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; @@ -1683,7 +1699,8 @@ if (an_object["blurb_nugget"].length == 0) { 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 = ""; @@ -1715,14 +1732,15 @@ 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.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", ); @@ -1733,7 +1751,7 @@ if (the_endnotes_section.length > 1) { } 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", ); @@ -1744,7 +1762,7 @@ if (the_glossary_section.length > 1) { } 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", ); @@ -1755,7 +1773,7 @@ if (the_bibliography_section.length > 1){ } 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", ); @@ -1766,7 +1784,7 @@ if (the_bookindex_section.length > 1) { } 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", ); @@ -2294,6 +2312,7 @@ foreach (ref obj; the_document_head_section) { "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) +/ @@ -2352,14 +2371,16 @@ if (the_table_of_contents_section.length > 1) { /+ 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); @@ -2413,8 +2434,9 @@ if (the_endnotes_section.length > 1) { 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) { @@ -2455,8 +2477,9 @@ if (the_glossary_section.length > 1) { 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) { @@ -2480,8 +2503,9 @@ if (the_glossary_section.length > 1) { } 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; } } } @@ -2500,8 +2524,9 @@ if (the_bibliography_section.length > 1) { 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) { @@ -2525,8 +2550,9 @@ if (the_bibliography_section.length > 1) { } 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; } } } @@ -2539,7 +2565,7 @@ if (the_bibliography_section.length > 1) { #+name: abs_post #+BEGIN_SRC d /+ 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) { @@ -2553,8 +2579,9 @@ if (the_bookindex_section.length > 1) { 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]; @@ -2578,7 +2605,8 @@ if (the_bookindex_section.length > 1) { 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; } @@ -2601,8 +2629,9 @@ if (the_blurb_section.length > 1) { 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) { @@ -2627,7 +2656,7 @@ if (the_blurb_section.length > 1) { 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; } } @@ -2748,7 +2777,8 @@ comp_obj_heading_.metainfo.is_of_section = "empty"; 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 = ""; @@ -2994,39 +3024,46 @@ static auto _check_ocn_status_(L,T)( 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); @@ -3125,7 +3162,7 @@ void _start_block_(L,T,N)( /+ 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 @@ -3142,7 +3179,7 @@ void _start_block_(L,T,N)( 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; @@ -3210,7 +3247,7 @@ void _start_block_(L,T,N)( /+ 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 @@ -3227,7 +3264,7 @@ void _start_block_(L,T,N)( 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; @@ -3306,7 +3343,7 @@ void _code_block_(L,O,T)( 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] @@ -3316,14 +3353,14 @@ void _code_block_(L,O,T)( 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] @@ -3333,7 +3370,7 @@ void _code_block_(L,O,T)( 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 @@ -3724,14 +3761,14 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( 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] ); } @@ -3745,8 +3782,9 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( 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; @@ -3762,14 +3800,14 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( 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; @@ -3782,7 +3820,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( debug(poem) { // poem verse writefln( "* %s curly\n%s", - obj_cite_digits.on, + obj_cite_digits.object_number, an_object[an_object_key] ); } @@ -3807,8 +3845,9 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( 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; @@ -3839,7 +3878,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( 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"; @@ -3852,8 +3891,9 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( 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; @@ -3864,7 +3904,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( 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; @@ -3875,7 +3915,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( } 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; @@ -3888,7 +3928,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( debug(poem) { // poem (tic) close writefln( "* %s tic\n%s", - obj_cite_digits.on, + obj_cite_digits.object_number, an_object[an_object_key] ); } @@ -3914,8 +3954,9 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( 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; @@ -4041,7 +4082,7 @@ void _table_closed_make_special_notation_table_(N,CMM)( 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, @@ -4057,8 +4098,9 @@ void _table_closed_make_special_notation_table_(N,CMM)( 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; @@ -4109,7 +4151,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( #+name: abs_functions_block_line_status_empty #+BEGIN_SRC d 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 @@ -4139,8 +4181,9 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( 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; @@ -4163,7 +4206,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( #+name: abs_functions_block_line_status_empty #+BEGIN_SRC d } 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 @@ -4193,8 +4236,9 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( 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; @@ -4217,7 +4261,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( #+name: abs_functions_block_line_status_empty #+BEGIN_SRC d } 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 @@ -4247,8 +4291,9 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( 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; @@ -4295,9 +4340,10 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( 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; @@ -4312,7 +4358,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( #+name: abs_functions_block_line_status_empty #+BEGIN_SRC d } 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 @@ -4342,8 +4388,9 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( 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; @@ -4366,7 +4413,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( #+BEGIN_SRC d } 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 @@ -4391,8 +4438,9 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( = 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; @@ -5133,36 +5181,48 @@ auto table_substantive_munge_special(O,T)( #+name: meta_emitters_ocn #+BEGIN_SRC d 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() { @@ -5825,7 +5885,7 @@ static struct ObjInlineMarkup { "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, ); @@ -5836,7 +5896,8 @@ static struct ObjInlineMarkup { 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"]; @@ -5855,7 +5916,8 @@ static struct ObjInlineMarkup { 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"]; @@ -5870,7 +5932,8 @@ static struct ObjInlineMarkup { 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; @@ -5882,7 +5945,7 @@ static struct ObjInlineMarkup { 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, ); @@ -6497,15 +6560,15 @@ struct BookIndexNuggetHash { 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 ); } } @@ -6523,12 +6586,12 @@ struct BookIndexNuggetHash { ) { 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; @@ -6541,12 +6604,12 @@ struct BookIndexNuggetHash { 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; @@ -6656,7 +6719,7 @@ struct BookIndexReportSection { ) { 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; @@ -6684,7 +6747,8 @@ struct BookIndexReportSection { 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; @@ -6705,7 +6769,8 @@ struct BookIndexReportSection { 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; @@ -6764,7 +6829,8 @@ struct BookIndexReportSection { 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; @@ -6779,7 +6845,8 @@ struct BookIndexReportSection { 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; @@ -6923,7 +6990,8 @@ struct NotesSection { 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; @@ -6943,7 +7011,8 @@ struct NotesSection { 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; @@ -6965,7 +7034,8 @@ struct NotesSection { 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; @@ -6981,8 +7051,9 @@ struct NotesSection { 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; @@ -7172,19 +7243,19 @@ struct NodeStructureMetadata { ) 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; @@ -7201,7 +7272,8 @@ struct NodeStructureMetadata { 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; @@ -7251,7 +7323,7 @@ struct NodeStructureMetadata { 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[])); @@ -7259,19 +7331,19 @@ struct NodeStructureMetadata { 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); +/ } @@ -7365,8 +7437,9 @@ struct NodeStructureMetadata { _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"]; @@ -7751,13 +7824,14 @@ struct DocObj_MetaInfo_ { 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/org/output_sqlite.org b/org/output_sqlite.org index c1f5ecb..3e7938a 100644 --- a/org/output_sqlite.org +++ b/org/output_sqlite.org @@ -565,11 +565,15 @@ auto inline_links(M,O)( ); } } 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/org/output_xmls.org b/org/output_xmls.org index ef8e15e..321889b 100644 --- a/org/output_xmls.org +++ b/org/output_xmls.org @@ -483,13 +483,15 @@ auto inline_links(M,O)( ); } } 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 + ); + } } } } 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 + ); + } } } } diff --git a/views/version.txt b/views/version.txt index 4bed5e2..67546a6 100644 --- a/views/version.txt +++ b/views/version.txt @@ -4,7 +4,7 @@ struct Version { int minor; int patch; } -enum ver = Version(0, 3, 0); +enum ver = Version(0, 3, 1); version (Posix) { version (DigitalMars) { } else version (LDC) { -- cgit v1.2.3