From 3be1d59280d0614e23f968b928c4d73c4113a466 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 31 Jul 2018 10:37:33 -0400 Subject: 0.26.6 prepare for parallelism, remove __gshared --- src/sdp/meta/metadoc.d | 1 + src/sdp/meta/metadoc_from_src.d | 74 +++++++++++++++++++++++++++++------------ 2 files changed, 54 insertions(+), 21 deletions(-) (limited to 'src/sdp/meta') diff --git a/src/sdp/meta/metadoc.d b/src/sdp/meta/metadoc.d index ff550b5..5821096 100644 --- a/src/sdp/meta/metadoc.d +++ b/src/sdp/meta/metadoc.d @@ -77,6 +77,7 @@ template SiSUabstraction() { _make_and_meta_struct, _opt_action, _manifest, + true, ); static assert(!isTypeTuple!(da)); static assert(da.length==5); diff --git a/src/sdp/meta/metadoc_from_src.d b/src/sdp/meta/metadoc_from_src.d index 8de0711..7c68e16 100644 --- a/src/sdp/meta/metadoc_from_src.d +++ b/src/sdp/meta/metadoc_from_src.d @@ -241,6 +241,7 @@ template SiSUdocAbstraction() { CMM conf_make_meta, Opt opt_action, Mfst manifest_matter, + bool _new_doc ) { static auto rgx = Rgx(); debug(asserts) { @@ -833,10 +834,16 @@ template SiSUdocAbstraction() { an_object["is"] = "heading"; an_object_key="body_nugget"; auto substantive_object_and_anchor_tags_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); + = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, _new_doc); an_object["substantive"] = substantive_object_and_anchor_tags_tuple[sObj.content]; anchor_tags = substantive_object_and_anchor_tags_tuple[sObj.anchor_tags]; - if (an_object["lev_markup_number"].to!int == 4) { + if (_new_doc) { + cnt1 = 1; + cnt2 = 1; + cnt3 = 1; + _new_doc = false; + } + if (an_object["lev_markup_number"].to!int == 4 ) { segment_anchor_tag_that_object_belongs_to = anchor_tags[0]; segment_anchor_tag_that_object_belongs_to_uri = anchor_tags[0] ~ ".fnSuffix"; anchor_tag_ = anchor_tags[0]; @@ -935,7 +942,7 @@ template SiSUdocAbstraction() { an_object["is"], ); auto substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); + = 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]; anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_para = comp_obj_para.init; @@ -2056,6 +2063,12 @@ template SiSUdocAbstraction() { the_bookindex_section["scroll"] ~ the_blurb_section ); + debug(decendants_tuple) { + pairs = pairs.sort(); + foreach (pair; pairs) { // (pair; pairs.sort()) + writeln(pair[0], "..", pair[1]); + } + } foreach (ref obj; the_document_head_section) { if (obj.metainfo.is_a == "heading") { foreach (pair; pairs) { @@ -2754,7 +2767,7 @@ template SiSUdocAbstraction() { } an_object["is"] = "verse"; auto substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); + = 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]; anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_block = comp_obj_block.init; @@ -2811,7 +2824,7 @@ template SiSUdocAbstraction() { an_object["is"] ); auto substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); + = 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]; anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_block = comp_obj_block.init; @@ -2853,7 +2866,7 @@ template SiSUdocAbstraction() { processing.remove("verse"); an_object["is"] = "verse"; auto substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); + = 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]; anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_block = comp_obj_block.init; @@ -2910,7 +2923,7 @@ template SiSUdocAbstraction() { an_object["is"] ); auto substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); + = 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]; anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_block = comp_obj_block.init; @@ -3211,7 +3224,7 @@ template SiSUdocAbstraction() { ); an_object["is"] = "table"; auto substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, "body_nugget", conf_make_meta); + = 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; @@ -3268,7 +3281,7 @@ template SiSUdocAbstraction() { an_object["is"] ); auto substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); + = 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]; anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_block = comp_obj_block.init; @@ -3311,7 +3324,7 @@ template SiSUdocAbstraction() { an_object["is"] ); auto substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); + = 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]; anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_block = comp_obj_block.init; @@ -3354,7 +3367,7 @@ template SiSUdocAbstraction() { an_object["is"] ); auto substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); + = 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.is_of_part = "body"; @@ -3430,7 +3443,7 @@ template SiSUdocAbstraction() { an_object["is"] ); auto substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); + = 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]; anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_code = comp_obj_code.init; @@ -3474,7 +3487,7 @@ template SiSUdocAbstraction() { an_object["is"] ); auto substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); + = 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; @@ -4536,10 +4549,13 @@ template SiSUdocAbstraction() { static auto rgx = Rgx(); static auto munge = ObjInlineMarkupMunge(); string[string] obj_txt; + static string[] anchor_tags_ = []; + static string anchor_tag = ""; auto obj_inline_markup_and_anchor_tags_and_misc(O,K,CMM)( O obj_, K obj_key_, CMM conf_make_meta, + bool _new_doc ) in { debug(asserts) { @@ -4552,7 +4568,9 @@ template SiSUdocAbstraction() { obj_txt["munge"] = (obj_["is"].match(ctRegex!(`verse|code`))) ? obj_txt["munge"] : obj_txt["munge"].strip; - static __gshared string[] anchor_tags_ = []; + if (_new_doc) { + anchor_tags_ = []; + } auto x = munge.init; bool[string] obj_notes_and_links; obj_notes_and_links["notes_reg"] = false; @@ -4561,9 +4579,11 @@ template SiSUdocAbstraction() { obj_notes_and_links["image_no_dimensions"] = false; switch (obj_["is"]) { case "heading": - static __gshared string anchor_tag = ""; - obj_txt["munge"]=_configured_auto_heading_numbering_and_segment_anchor_tags(obj_txt["munge"], obj_, conf_make_meta); - obj_txt["munge"]=_make_segment_anchor_tags_if_none_provided(obj_txt["munge"], obj_["lev"]); + if (_new_doc) { + anchor_tag = ""; + } + obj_txt["munge"]=_configured_auto_heading_numbering_and_segment_anchor_tags(obj_txt["munge"], obj_, conf_make_meta, _new_doc); + obj_txt["munge"]=_make_segment_anchor_tags_if_none_provided(obj_txt["munge"], obj_["lev"], _new_doc); if (auto m = obj_txt["munge"].match(rgx.heading_anchor_tag)) { anchor_tag = m.captures[1]; anchor_tags_ ~= anchor_tag; @@ -4803,17 +4823,22 @@ template SiSUdocAbstraction() { invariant() { } private: + static int[] heading_num = [ 0, 0, 0, 0 ]; + static string heading_number_auto_composite = ""; static string _configured_auto_heading_numbering_and_segment_anchor_tags(M,O,CMM)( M munge_, O obj_, CMM conf_make_meta, + bool _new_doc ) { debug(asserts) { static assert(is(typeof(munge_) == string)); static assert(is(typeof(obj_) == string[string])); } - static __gshared int[] heading_num = [ 0, 0, 0, 0 ]; - static __gshared string heading_number_auto_composite = ""; + if (_new_doc) { + heading_num = [ 0, 0, 0, 0 ]; + heading_number_auto_composite = ""; + } if (conf_make_meta.make.auto_num_top_lv) { if (obj_["lev_markup_number"].to!int == 0) { heading_num[0] = 0; @@ -4907,7 +4932,12 @@ template SiSUdocAbstraction() { } return munge_; } - static string _make_segment_anchor_tags_if_none_provided(M,Lv)(M munge_, Lv lev_) { + static int heading_num_lev1 = 0; + static string _make_segment_anchor_tags_if_none_provided(M,Lv)( + M munge_, + Lv lev_, + bool _new_doc + ) { debug(asserts) { static assert(is(typeof(munge_) == string)); static assert(is(typeof(lev_) == string)); @@ -4924,7 +4954,9 @@ template SiSUdocAbstraction() { "$1~" ~ "s" ~ m.captures[1] ~ " "); } } else if (lev_ == "1") { // (if not successful) manufacture a unique anchor tag for lev=="1" - static __gshared int heading_num_lev1 = 0; + if (_new_doc) { + heading_num_lev1 = 0; + } heading_num_lev1 ++; munge_=(munge_).replaceFirst( rgx.heading_marker_missing_tag, -- cgit v1.2.3