From be384681a55a09f0deb284eb18da63c082240c68 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 14 Aug 2018 10:22:11 -0400 Subject: catches --- org/default_regex.org | 4 +++- org/meta_abstraction.org | 9 ++++++++- org/sdp.org | 7 ++++--- src/sdp/meta/metadoc_from_src.d | 9 ++++++++- src/sdp/meta/rgx.d | 4 +++- src/sdp/sdp.d | 7 ++++--- 6 files changed, 30 insertions(+), 10 deletions(-) diff --git a/org/default_regex.org b/org/default_regex.org index 5278bc9..939aa8a 100644 --- a/org/default_regex.org +++ b/org/default_regex.org @@ -147,9 +147,11 @@ static heading_seg_and_above = ctRegex!(`^:?([A-D1])[~] static heading_marker = ctRegex!(`^:?([A-D1-4])[~]`); static heading_anchor_tag = ctRegex!(`^:?[A-D1-4][~]([a-z0-9_.-]+) `,"i"); static heading_identify_anchor_tag = ctRegex!(`^:?[A-D1-4][~]\s+(?:(?:(?:chapter|article|section|clause)\s+[0-9.]+)|(?:[0-9]+))`,"i"); -static heading_extract_named_anchor_tag = ctRegex!(`^:?[A-D1-4][~]\s+(chapter|article|section|clause)\s+((?:[0-9]+.)*[0-9]+)(?:[.:;, ]|$)`,"i"); +static heading_extract_named_anchor_tag = ctRegex!(`^:?[A-D1-4][~]\s+(chapter|article|section|clause)\s+((?:[0-9]+[.:])*[0-9]+)(?:[.:;, ]|$)`,"i"); static heading_extract_unnamed_anchor_tag = ctRegex!(`^:?[A-D1-4][~]\s+((?:[0-9]+.)*[0-9]+)(?:[.:;, ]|$)`); static heading_marker_missing_tag = ctRegex!(`^:?([A-D1-4])[~] `); +static heading_anchor_tag_plus_colon = ctRegex!(`^:?([A-D1-4][~])([a-z0-9_.:-]+) `,"i"); +static heading_marker_tag_has_colon = ctRegex!(`([:])`); static heading_title = ctRegex!(`^:?[A-D1-4][~][a-z0-9_.-]*[?]?\s+(.+?)$`); static heading_all = ctRegex!(`^:?([A-D1-4])[~]([a-z0-9_.-]*[?]?)\s+(.+?)$`); static heading_backmatter = ctRegex!(`^:?1[~][!](glossary|bibliography|biblio|blurb)\s+`,"i"); diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org index 05f204d..7eaba8c 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -1166,7 +1166,10 @@ if ((obj_type_status["heading"] == State.on) cnt3 = 1; _new_doc = false; } - if (an_object["lev_markup_number"].to!int == 4 ) { + if ( + an_object["lev_markup_number"].to!int == 4 + && anchor_tags.length > 0 + ) { 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]; @@ -6081,6 +6084,10 @@ private: munge_=(munge_).replaceFirst( rgx.heading_marker_missing_tag, "$1~" ~ m.captures[1].toLower ~ "_" ~ m.captures[2] ~ " "); + if (auto n = munge_.match(rgx.heading_anchor_tag_plus_colon)) { + auto tag_remunge_ = n.captures[2].replaceAll(rgx.heading_marker_tag_has_colon, ".."); + munge_=(munge_).replaceFirst(rgx.heading_anchor_tag_plus_colon, n.captures[1] ~ tag_remunge_ ~ " "); + } } else if (auto m = munge_.match(rgx.heading_extract_unnamed_anchor_tag)) { munge_=(munge_).replaceFirst( rgx.heading_marker_missing_tag, diff --git a/org/sdp.org b/org/sdp.org index ea8a4bf..5a0160d 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -82,7 +82,7 @@ void main(string[] args) { <> <> <> - if (_manifests.length > 1) { // _manifests[0] initialized dummy element + if (_manifests.length > 1) { // _manifests[0] initialized dummy element foreach(manifest; parallel(_manifests[1..$])) { if (!empty(manifest.src.filename)) { <> @@ -626,9 +626,10 @@ scope(success) { scope(failure) { debug(checkdoc) { stderr.writefln( - "~ document run failure ~ (%s v%s)\n\t%s", + "~ document run failure ~ (%s v%s)\n\t%s\n%s", __VENDOR__, __VERSION__, - manifest.src.filename + manifest.src.filename, + "------------------------------------------------------------------", ); } } diff --git a/src/sdp/meta/metadoc_from_src.d b/src/sdp/meta/metadoc_from_src.d index 7c68e16..0de709e 100644 --- a/src/sdp/meta/metadoc_from_src.d +++ b/src/sdp/meta/metadoc_from_src.d @@ -843,7 +843,10 @@ template SiSUdocAbstraction() { cnt3 = 1; _new_doc = false; } - if (an_object["lev_markup_number"].to!int == 4 ) { + if ( + an_object["lev_markup_number"].to!int == 4 + && anchor_tags.length > 0 + ) { 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]; @@ -4948,6 +4951,10 @@ template SiSUdocAbstraction() { munge_=(munge_).replaceFirst( rgx.heading_marker_missing_tag, "$1~" ~ m.captures[1].toLower ~ "_" ~ m.captures[2] ~ " "); + if (auto n = munge_.match(rgx.heading_anchor_tag_plus_colon)) { + auto tag_remunge_ = n.captures[2].replaceAll(rgx.heading_marker_tag_has_colon, ".."); + munge_=(munge_).replaceFirst(rgx.heading_anchor_tag_plus_colon, n.captures[1] ~ tag_remunge_ ~ " "); + } } else if (auto m = munge_.match(rgx.heading_extract_unnamed_anchor_tag)) { munge_=(munge_).replaceFirst( rgx.heading_marker_missing_tag, diff --git a/src/sdp/meta/rgx.d b/src/sdp/meta/rgx.d index 071d693..b64f7ba 100644 --- a/src/sdp/meta/rgx.d +++ b/src/sdp/meta/rgx.d @@ -72,9 +72,11 @@ static template SiSUrgxInit() { static heading_marker = ctRegex!(`^:?([A-D1-4])[~]`); static heading_anchor_tag = ctRegex!(`^:?[A-D1-4][~]([a-z0-9_.-]+) `,"i"); static heading_identify_anchor_tag = ctRegex!(`^:?[A-D1-4][~]\s+(?:(?:(?:chapter|article|section|clause)\s+[0-9.]+)|(?:[0-9]+))`,"i"); - static heading_extract_named_anchor_tag = ctRegex!(`^:?[A-D1-4][~]\s+(chapter|article|section|clause)\s+((?:[0-9]+.)*[0-9]+)(?:[.:;, ]|$)`,"i"); + static heading_extract_named_anchor_tag = ctRegex!(`^:?[A-D1-4][~]\s+(chapter|article|section|clause)\s+((?:[0-9]+[.:])*[0-9]+)(?:[.:;, ]|$)`,"i"); static heading_extract_unnamed_anchor_tag = ctRegex!(`^:?[A-D1-4][~]\s+((?:[0-9]+.)*[0-9]+)(?:[.:;, ]|$)`); static heading_marker_missing_tag = ctRegex!(`^:?([A-D1-4])[~] `); + static heading_anchor_tag_plus_colon = ctRegex!(`^:?([A-D1-4][~])([a-z0-9_.:-]+) `,"i"); + static heading_marker_tag_has_colon = ctRegex!(`([:])`); static heading_title = ctRegex!(`^:?[A-D1-4][~][a-z0-9_.-]*[?]?\s+(.+?)$`); static heading_all = ctRegex!(`^:?([A-D1-4])[~]([a-z0-9_.-]*[?]?)\s+(.+?)$`); static heading_backmatter = ctRegex!(`^:?1[~][!](glossary|bibliography|biblio|blurb)\s+`,"i"); diff --git a/src/sdp/sdp.d b/src/sdp/sdp.d index 9d91d10..5a4c2f8 100755 --- a/src/sdp/sdp.d +++ b/src/sdp/sdp.d @@ -403,7 +403,7 @@ void main(string[] args) { writeln("- step0 complete"); } } - if (_manifests.length > 1) { // _manifests[0] initialized dummy element + if (_manifests.length > 1) { // _manifests[0] initialized dummy element foreach(manifest; parallel(_manifests[1..$])) { if (!empty(manifest.src.filename)) { scope(success) { @@ -418,9 +418,10 @@ void main(string[] args) { scope(failure) { debug(checkdoc) { stderr.writefln( - "~ document run failure ~ (%s v%s)\n\t%s", + "~ document run failure ~ (%s v%s)\n\t%s\n%s", __VENDOR__, __VERSION__, - manifest.src.filename + manifest.src.filename, + "------------------------------------------------------------------", ); } } -- cgit v1.2.3