diff options
-rw-r--r-- | org/default_regex.org | 2 | ||||
-rw-r--r-- | org/metaverse.org | 93 | ||||
-rw-r--r-- | src/doc_reform/io_out/rgx.d | 2 | ||||
-rw-r--r-- | src/doc_reform/meta/metadoc_from_src.d | 88 | ||||
-rw-r--r-- | src/doc_reform/meta/rgx.d | 2 |
5 files changed, 97 insertions, 90 deletions
diff --git a/org/default_regex.org b/org/default_regex.org index 4ddaeca..9ad5539 100644 --- a/org/default_regex.org +++ b/org/default_regex.org @@ -464,7 +464,7 @@ static inline_notes_al_special_char_note = ctRegex!(`【(?P<char>(? static inline_al_delimiter_open_regular = ctRegex!(`【\s`, "m"); static inline_al_delimiter_open_symbol_star = ctRegex!(`【[*]\s`, "m"); static inline_al_delimiter_open_symbol_plus = ctRegex!(`【[+]\s`, "m"); -static inline_text_and_note_al_ = ctRegex!(`(.+?(?:【[*+]*\s+.+?】|$))`, "mg"); +static inline_text_and_note_al_ = ctRegex!(`(.+?(?:【[*+]*\s+.+?】|.+))`, "mg"); #+END_SRC *** inline links diff --git a/org/metaverse.org b/org/metaverse.org index 956b215..63b3450 100644 --- a/org/metaverse.org +++ b/org/metaverse.org @@ -5457,45 +5457,50 @@ process and use an_object["table_head"] (then empty it) if (!(stage_reset_note_numbers) && reset_note_numbers) { stage_reset_note_numbers = true; } + obj_txt_out = ""; if (obj_txt_in.match(rgx.inline_notes_al_gen)) { - if (auto m = obj_txt_in.matchAll(rgx.inline_text_and_note_al_)) { - if (stage_reset_note_numbers) { - n_foot = 0; - n_foot_reg = 0; - n_foot_sp_asterisk = 0; - n_foot_sp_plus = 0; - } - stage_reset_note_numbers = false; - foreach(n; m) { - if (n.hit.to!string.match(rgx.inline_al_delimiter_open_symbol_star)) { - flg_notes_star = true; - ++n_foot_sp_asterisk; - asterisks_ = "*"; - n_foot=n_foot_sp_asterisk; - obj_txt_out ~= n.hit.to!string.replaceFirst( - 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)) { - flg_notes_plus = true; - ++n_foot_sp_plus; - plus_ = "*"; - n_foot=n_foot_sp_plus; - obj_txt_out ~= n.hit.to!string.replaceFirst( - 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)) { - flg_notes_reg = true; - ++n_foot_reg; - n_foot=n_foot_reg; - obj_txt_out ~= n.hit.to!string.replaceFirst( - rgx.inline_al_delimiter_open_regular, - (mkup.en_a_o ~ n_foot.to!string ~ " ") - ); - } else { - obj_txt_out ~= n.hit.to!string; + string[] _tmp_txt; + foreach (x; obj_txt_in.split("\n")) { + if (auto m = x.matchAll(rgx.inline_text_and_note_al_)) { + if (stage_reset_note_numbers) { + n_foot = 0; + n_foot_reg = 0; + n_foot_sp_asterisk = 0; + n_foot_sp_plus = 0; + } + stage_reset_note_numbers = false; + foreach(n; m) { + if (n.hit.to!string.match(rgx.inline_al_delimiter_open_symbol_star)) { // + flg_notes_star = true; + ++n_foot_sp_asterisk; + asterisks_ = "*"; + n_foot=n_foot_sp_asterisk; + _tmp_txt ~= n.hit.to!string.replaceFirst( + 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)) { // + flg_notes_plus = true; + ++n_foot_sp_plus; + plus_ = "*"; + n_foot=n_foot_sp_plus; + _tmp_txt ~= n.hit.to!string.replaceFirst( + 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)) { // + 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 ~ " ") + ); + } else { + _tmp_txt ~= n.hit.to!string; + } } + obj_txt_out = _tmp_txt.join("\n"); } } } else { @@ -5651,13 +5656,13 @@ process and use an_object["table_head"] (then empty it) - font faces (bold, italics, underscore etc.) - footnotes/endnotes - links -- newlines detected and kept? +- drop spaces +- keep newlines? #+NAME: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d @safe auto munge_group(string obj_txt_in) { - obj_txt["munge"]=obj_txt_in; - TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt["munge"]); + TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt_in.split("\n\n").join(" \\\\\n \\\\\n")); return t; } invariant() { @@ -5671,13 +5676,14 @@ process and use an_object["table_head"] (then empty it) - font faces (bold, italics, underscore etc.) - footnotes/endnotes - links +- keep spaces +- keep newlines - newlines detected and kept? #+NAME: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d @safe auto munge_block()(string obj_txt_in) { - obj_txt["munge"]=obj_txt_in; - TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt["munge"]); + TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt_in); return t; } invariant() { @@ -5696,8 +5702,7 @@ process and use an_object["table_head"] (then empty it) #+NAME: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d @safe auto munge_verse()(string obj_txt_in) { - obj_txt["munge"]=obj_txt_in; - TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt["munge"]); + TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt_in); return t; } invariant() { diff --git a/src/doc_reform/io_out/rgx.d b/src/doc_reform/io_out/rgx.d index e98f118..6879b67 100644 --- a/src/doc_reform/io_out/rgx.d +++ b/src/doc_reform/io_out/rgx.d @@ -40,7 +40,7 @@ static template spineRgxOut() { static inline_al_delimiter_open_regular = ctRegex!(`【\s`, "m"); static inline_al_delimiter_open_symbol_star = ctRegex!(`【[*]\s`, "m"); static inline_al_delimiter_open_symbol_plus = ctRegex!(`【[+]\s`, "m"); - static inline_text_and_note_al_ = ctRegex!(`(.+?(?:【[*+]*\s+.+?】|$))`, "mg"); + static inline_text_and_note_al_ = ctRegex!(`(.+?(?:【[*+]*\s+.+?】|.+))`, "mg"); /+ inline markup links +/ static inline_image = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>\d+)h(?P<height>\d+))\s*(?P<post>.*?┝┤.*?├)`, "mg"); static inline_image_without_dimensions = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>0)h(?P<height>0))\s*(?P<post>.*?┝┤.*?├)`, "mg"); diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index b6438a0..532d097 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -4381,45 +4381,50 @@ template docAbstraction() { if (!(stage_reset_note_numbers) && reset_note_numbers) { stage_reset_note_numbers = true; } + obj_txt_out = ""; if (obj_txt_in.match(rgx.inline_notes_al_gen)) { - if (auto m = obj_txt_in.matchAll(rgx.inline_text_and_note_al_)) { - if (stage_reset_note_numbers) { - n_foot = 0; - n_foot_reg = 0; - n_foot_sp_asterisk = 0; - n_foot_sp_plus = 0; - } - stage_reset_note_numbers = false; - foreach(n; m) { - if (n.hit.to!string.match(rgx.inline_al_delimiter_open_symbol_star)) { - flg_notes_star = true; - ++n_foot_sp_asterisk; - asterisks_ = "*"; - n_foot=n_foot_sp_asterisk; - obj_txt_out ~= n.hit.to!string.replaceFirst( - 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)) { - flg_notes_plus = true; - ++n_foot_sp_plus; - plus_ = "*"; - n_foot=n_foot_sp_plus; - obj_txt_out ~= n.hit.to!string.replaceFirst( - 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)) { - flg_notes_reg = true; - ++n_foot_reg; - n_foot=n_foot_reg; - obj_txt_out ~= n.hit.to!string.replaceFirst( - rgx.inline_al_delimiter_open_regular, - (mkup.en_a_o ~ n_foot.to!string ~ " ") - ); - } else { - obj_txt_out ~= n.hit.to!string; + string[] _tmp_txt; + foreach (x; obj_txt_in.split("\n")) { + if (auto m = x.matchAll(rgx.inline_text_and_note_al_)) { + if (stage_reset_note_numbers) { + n_foot = 0; + n_foot_reg = 0; + n_foot_sp_asterisk = 0; + n_foot_sp_plus = 0; + } + stage_reset_note_numbers = false; + foreach(n; m) { + if (n.hit.to!string.match(rgx.inline_al_delimiter_open_symbol_star)) { // + flg_notes_star = true; + ++n_foot_sp_asterisk; + asterisks_ = "*"; + n_foot=n_foot_sp_asterisk; + _tmp_txt ~= n.hit.to!string.replaceFirst( + 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)) { // + flg_notes_plus = true; + ++n_foot_sp_plus; + plus_ = "*"; + n_foot=n_foot_sp_plus; + _tmp_txt ~= n.hit.to!string.replaceFirst( + 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)) { // + 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 ~ " ") + ); + } else { + _tmp_txt ~= n.hit.to!string; + } } + obj_txt_out = _tmp_txt.join("\n"); } } } else { @@ -4535,22 +4540,19 @@ template docAbstraction() { invariant() { } @safe auto munge_group(string obj_txt_in) { - obj_txt["munge"]=obj_txt_in; - TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt["munge"]); + TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt_in.split("\n\n").join(" \\\\\n \\\\\n")); return t; } invariant() { } @safe auto munge_block()(string obj_txt_in) { - obj_txt["munge"]=obj_txt_in; - TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt["munge"]); + TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt_in); return t; } invariant() { } @safe auto munge_verse()(string obj_txt_in) { - obj_txt["munge"]=obj_txt_in; - TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt["munge"]); + TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt_in); return t; } invariant() { diff --git a/src/doc_reform/meta/rgx.d b/src/doc_reform/meta/rgx.d index 7508a67..b777f2e 100644 --- a/src/doc_reform/meta/rgx.d +++ b/src/doc_reform/meta/rgx.d @@ -207,7 +207,7 @@ static template spineRgxIn() { static inline_al_delimiter_open_regular = ctRegex!(`【\s`, "m"); static inline_al_delimiter_open_symbol_star = ctRegex!(`【[*]\s`, "m"); static inline_al_delimiter_open_symbol_plus = ctRegex!(`【[+]\s`, "m"); - static inline_text_and_note_al_ = ctRegex!(`(.+?(?:【[*+]*\s+.+?】|$))`, "mg"); + static inline_text_and_note_al_ = ctRegex!(`(.+?(?:【[*+]*\s+.+?】|.+))`, "mg"); /+ inline markup links +/ static inline_image = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>\d+)h(?P<height>\d+))\s*(?P<post>.*?┝┤.*?├)`, "mg"); static inline_image_without_dimensions = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>0)h(?P<height>0))\s*(?P<post>.*?┝┤.*?├)`, "mg"); |