From 8525eb4bf305824d55558705175d4cc9ed5d37c2 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 21 Aug 2021 12:18:02 -0400 Subject: metaverse parallel processing reproducability - html xhtml issue with tags - epub issue with title (skipped) in OEBPS/toc.ncx --- org/metaverse.org | 14 +++++++++----- org/out_xmls.org | 9 +++++---- src/doc_reform/io_out/epub3.d | 4 ++-- src/doc_reform/io_out/html.d | 2 +- src/doc_reform/io_out/xmls.d | 9 +++++---- src/doc_reform/meta/metadoc_from_src.d | 14 +++++++++----- 6 files changed, 31 insertions(+), 21 deletions(-) diff --git a/org/metaverse.org b/org/metaverse.org index 0e1dff0..94b5690 100644 --- a/org/metaverse.org +++ b/org/metaverse.org @@ -713,6 +713,8 @@ scope(exit) { destroy(biblio_arr_json); previous_length = 0; reset_note_numbers = true; + lev_anchor_tag = ""; + anchor_tag = ""; } #+END_SRC @@ -1678,7 +1680,7 @@ if (pith["txt_is"] == eN.txt_is.heading comp_obj_para.attrib.indent_hang = indent["hang_position"]; comp_obj_para.attrib.indent_base = indent["base_position"]; comp_obj_para.attrib.bullet = bullet; - comp_obj_para.tags.anchor_tags = [anchor_tag]; + comp_obj_para.tags.anchor_tags = [anchor_tag]; anchor_tag=""; comp_obj_para.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; comp_obj_para.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_para.has.inline_links = substantive_obj_misc_tuple[sObj.links]; @@ -3238,6 +3240,8 @@ dom_structure_markedup_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; dom_structure_markedup_tags_status_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; dom_structure_collapsed_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; dom_structure_collapsed_tags_status_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; +lev_anchor_tag = ""; +anchor_tag = ""; #+END_SRC *** doc has struct @@ -5978,7 +5982,7 @@ static struct ObjInlineMarkup { static auto rgx = RgxI(); static auto munge = ObjInlineMarkupMunge(); string[string] obj_txt; - static string anchor_tag = ""; + string anchor_tag = ""; #+END_SRC ******* object inline markup and anchor tags :markup:inline: @@ -6351,6 +6355,9 @@ static int heading_num_lev1 = 0; bool _new_doc ) { if (!(munge_.match(rgx.heading_anchor_tag))) { + if (lev_ == "A") { // (_new_doc) + heading_num_lev1 = 0; + } if (munge_.match(rgx.heading_identify_anchor_tag)) { if (auto m = munge_.match(rgx.heading_extract_named_anchor_tag)) { munge_ = munge_.replaceFirst( @@ -6367,9 +6374,6 @@ static int heading_num_lev1 = 0; "$1~" ~ "s" ~ m.captures[1] ~ " "); } } else if (lev_ == "1") { // (if not successful) manufacture a unique anchor tag for lev == "1" - if (_new_doc) { - heading_num_lev1 = 0; - } heading_num_lev1 ++; munge_ = munge_.replaceFirst( rgx.heading_marker_missing_tag, diff --git a/org/out_xmls.org b/org/out_xmls.org index 12cd0dc..1158ff7 100644 --- a/org/out_xmls.org +++ b/org/out_xmls.org @@ -203,10 +203,9 @@ import #+NAME: xhtml_format_objects_4 #+BEGIN_SRC d @safe string _xhtml_anchor_tags(O)(O obj) { - const(string[]) anchor_tags = obj.tags.anchor_tags; string tags=""; - if (anchor_tags.length > 0) { - foreach (tag; anchor_tags) { + if (obj.tags.anchor_tags.length > 0) { + foreach (tag; obj.tags.anchor_tags) { if (!(tag.empty)) { tags ~= ""; } @@ -919,7 +918,9 @@ import ┃", _horizontal_rule, obj.metainfo.identifier, - (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier), + (doc_matters.opt.action.ocn_off) + ? "" : ((obj.metainfo.object_number.empty) + ? "" : obj.metainfo.identifier), obj.metainfo.heading_lev_markup, obj.metainfo.is_a, obj.metainfo.identifier, diff --git a/src/doc_reform/io_out/epub3.d b/src/doc_reform/io_out/epub3.d index aa875ad..1a8d924 100644 --- a/src/doc_reform/io_out/epub3.d +++ b/src/doc_reform/io_out/epub3.d @@ -344,7 +344,7 @@ template outputEPub3() { ┃"); return toc; } - + @system void outputEPub3(D,I)( const D doc_abstraction, I doc_matters, @@ -858,5 +858,5 @@ template outputEPub3() { } } } - + } diff --git a/src/doc_reform/io_out/html.d b/src/doc_reform/io_out/html.d index c6f36a1..ceaf9f9 100644 --- a/src/doc_reform/io_out/html.d +++ b/src/doc_reform/io_out/html.d @@ -560,7 +560,7 @@ template outputHTML() { M doc_matters, ) { { /+ (copy html images) +/ - + auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language); if (!exists(pth_html.image)) { pth_html.image.mkdirRecurse; diff --git a/src/doc_reform/io_out/xmls.d b/src/doc_reform/io_out/xmls.d index e6012fe..703df3d 100644 --- a/src/doc_reform/io_out/xmls.d +++ b/src/doc_reform/io_out/xmls.d @@ -127,10 +127,9 @@ template outputXHTMLs() { return _txt; } @safe string _xhtml_anchor_tags(O)(O obj) { - const(string[]) anchor_tags = obj.tags.anchor_tags; string tags=""; - if (anchor_tags.length > 0) { - foreach (tag; anchor_tags) { + if (obj.tags.anchor_tags.length > 0) { + foreach (tag; obj.tags.anchor_tags) { if (!(tag.empty)) { tags ~= ""; } @@ -746,7 +745,9 @@ template outputXHTMLs() { ┃", _horizontal_rule, obj.metainfo.identifier, - (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier), + (doc_matters.opt.action.ocn_off) + ? "" : ((obj.metainfo.object_number.empty) + ? "" : obj.metainfo.identifier), obj.metainfo.heading_lev_markup, obj.metainfo.is_a, obj.metainfo.identifier, diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index 6f6b383..d306df5 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -450,6 +450,8 @@ template docAbstraction() { destroy(biblio_arr_json); previous_length = 0; reset_note_numbers = true; + lev_anchor_tag = ""; + anchor_tag = ""; } mixin spineNode; auto node_para_int_ = node_metadata_para_int; @@ -1237,7 +1239,7 @@ template docAbstraction() { comp_obj_para.attrib.indent_hang = indent["hang_position"]; comp_obj_para.attrib.indent_base = indent["base_position"]; comp_obj_para.attrib.bullet = bullet; - comp_obj_para.tags.anchor_tags = [anchor_tag]; + comp_obj_para.tags.anchor_tags = [anchor_tag]; anchor_tag=""; comp_obj_para.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; comp_obj_para.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_para.has.inline_links = substantive_obj_misc_tuple[sObj.links]; @@ -2470,6 +2472,8 @@ template docAbstraction() { dom_structure_markedup_tags_status_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; dom_structure_collapsed_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; dom_structure_collapsed_tags_status_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; + lev_anchor_tag = ""; + anchor_tag = ""; @safe auto doc_has() { struct DocHas_ { uint inline_links() { @@ -4696,7 +4700,7 @@ template docAbstraction() { static auto rgx = RgxI(); static auto munge = ObjInlineMarkupMunge(); string[string] obj_txt; - static string anchor_tag = ""; + string anchor_tag = ""; @safe TxtAndAnchorTagPlusHasFootnotesUrlsImages obj_inline_markup_and_anchor_tags_and_misc(CMM)( string[string] obj_, string obj_key_, @@ -5039,6 +5043,9 @@ template docAbstraction() { bool _new_doc ) { if (!(munge_.match(rgx.heading_anchor_tag))) { + if (lev_ == "A") { // (_new_doc) + heading_num_lev1 = 0; + } if (munge_.match(rgx.heading_identify_anchor_tag)) { if (auto m = munge_.match(rgx.heading_extract_named_anchor_tag)) { munge_ = munge_.replaceFirst( @@ -5055,9 +5062,6 @@ template docAbstraction() { "$1~" ~ "s" ~ m.captures[1] ~ " "); } } else if (lev_ == "1") { // (if not successful) manufacture a unique anchor tag for lev == "1" - if (_new_doc) { - heading_num_lev1 = 0; - } heading_num_lev1 ++; munge_ = munge_.replaceFirst( rgx.heading_marker_missing_tag, -- cgit v1.2.3