From cd2dee15516f0537f98bd8ed492ba6024545193c Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 24 Apr 2020 20:00:28 -0400 Subject: footnote/endnote fix --- org/metaverse.org | 23 +++++++++++++---------- src/doc_reform/meta/metadoc_from_src.d | 23 +++++++++++++---------- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/org/metaverse.org b/org/metaverse.org index c822210..b51f4da 100644 --- a/org/metaverse.org +++ b/org/metaverse.org @@ -5469,7 +5469,7 @@ process and use an_object["table_head"] (then empty it) } stage_reset_note_numbers = false; foreach(n; m) { - if (n.hit.to!string.match(rgx.inline_al_delimiter_open_symbol_star)) { // + if (n.hit.to!string.match(rgx.inline_al_delimiter_open_symbol_star)) { flg_notes_star = true; ++n_foot_sp_asterisk; asterisks_ = "*"; @@ -5478,7 +5478,7 @@ process and use an_object["table_head"] (then empty it) rgx.inline_al_delimiter_open_symbol_star, (mkup.en_a_o ~ replicate(asterisks_, n_foot_sp_asterisk) ~ " ") ); - } else if (n.hit.to!string.match(rgx.inline_al_delimiter_open_symbol_plus)) { // + } else if (n.hit.to!string.match(rgx.inline_al_delimiter_open_symbol_plus)) { flg_notes_plus = true; ++n_foot_sp_plus; plus_ = "*"; @@ -5487,14 +5487,16 @@ process and use an_object["table_head"] (then empty it) rgx.inline_al_delimiter_open_symbol_plus, (mkup.en_a_o ~ replicate(plus_, n_foot_sp_plus) ~ " ") ); - } else if (n.hit.to!string.match(rgx.inline_al_delimiter_open_regular)) { // + } else if (n.hit.to!string.matchFirst(rgx.inline_al_delimiter_open_regular)) { + string _tmp_str = n.hit.to!string; flg_notes_reg = true; - ++n_foot_reg; - n_foot=n_foot_reg; - _tmp_txt ~= n.hit.to!string.replaceFirst( - rgx.inline_al_delimiter_open_regular, - (mkup.en_a_o ~ n_foot.to!string ~ " ") - ); + foreach (q; n.hit.to!string.matchAll(rgx.inline_al_delimiter_open_regular)) { + ++n_foot_reg; + n_foot=n_foot_reg; + _tmp_str = replaceFirst!(m => mkup.en_a_o ~ n_foot.to!string ~ " ") + (_tmp_str, rgx.inline_al_delimiter_open_regular); + } + _tmp_txt ~= _tmp_str; } else { _tmp_txt ~= n.hit.to!string; } @@ -5893,7 +5895,8 @@ static struct ObjInlineMarkup { ObjGenericComposite comp_obj_toc; mixin InternalMarkup; static auto mkup = InlineMarkup(); - char[] heading_toc_ = (obj_["substantive"].dup.strip.to!(char[])).replaceAll(rgx.inline_notes_al, ""); + char[] heading_toc_ = (obj_["substantive"].dup.strip.to!(char[])) + .replaceAll(rgx.inline_notes_al, ""); heading_toc_ = _clean_heading_toc_(heading_toc_); auto attrib=""; string toc_txt_, subtoc_txt_; diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index 1be5e0a..f5ff735 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -4399,7 +4399,7 @@ template docAbstraction() { } stage_reset_note_numbers = false; foreach(n; m) { - if (n.hit.to!string.match(rgx.inline_al_delimiter_open_symbol_star)) { // + if (n.hit.to!string.match(rgx.inline_al_delimiter_open_symbol_star)) { flg_notes_star = true; ++n_foot_sp_asterisk; asterisks_ = "*"; @@ -4408,7 +4408,7 @@ template docAbstraction() { rgx.inline_al_delimiter_open_symbol_star, (mkup.en_a_o ~ replicate(asterisks_, n_foot_sp_asterisk) ~ " ") ); - } else if (n.hit.to!string.match(rgx.inline_al_delimiter_open_symbol_plus)) { // + } else if (n.hit.to!string.match(rgx.inline_al_delimiter_open_symbol_plus)) { flg_notes_plus = true; ++n_foot_sp_plus; plus_ = "*"; @@ -4417,14 +4417,16 @@ template docAbstraction() { rgx.inline_al_delimiter_open_symbol_plus, (mkup.en_a_o ~ replicate(plus_, n_foot_sp_plus) ~ " ") ); - } else if (n.hit.to!string.match(rgx.inline_al_delimiter_open_regular)) { // + } else if (n.hit.to!string.matchFirst(rgx.inline_al_delimiter_open_regular)) { + string _tmp_str = n.hit.to!string; flg_notes_reg = true; - ++n_foot_reg; - n_foot=n_foot_reg; - _tmp_txt ~= n.hit.to!string.replaceFirst( - rgx.inline_al_delimiter_open_regular, - (mkup.en_a_o ~ n_foot.to!string ~ " ") - ); + foreach (q; n.hit.to!string.matchAll(rgx.inline_al_delimiter_open_regular)) { + ++n_foot_reg; + n_foot=n_foot_reg; + _tmp_str = replaceFirst!(m => mkup.en_a_o ~ n_foot.to!string ~ " ") + (_tmp_str, rgx.inline_al_delimiter_open_regular); + } + _tmp_txt ~= _tmp_str; } else { _tmp_txt ~= n.hit.to!string; } @@ -4698,7 +4700,8 @@ template docAbstraction() { ObjGenericComposite comp_obj_toc; mixin InternalMarkup; static auto mkup = InlineMarkup(); - char[] heading_toc_ = (obj_["substantive"].dup.strip.to!(char[])).replaceAll(rgx.inline_notes_al, ""); + char[] heading_toc_ = (obj_["substantive"].dup.strip.to!(char[])) + .replaceAll(rgx.inline_notes_al, ""); heading_toc_ = _clean_heading_toc_(heading_toc_); auto attrib=""; string toc_txt_, subtoc_txt_; -- cgit v1.2.3