From 68395fa1d5bd40d187e704ff570565e5335ade58 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 31 Jan 2019 14:25:38 -0500 Subject: inline fontface markup, internal representation --- org/default_regex.org | 48 ++++++++++++++++++++++++--------- org/meta_abstraction.org | 49 ++++++++++++++++++++-------------- src/doc_reform/meta/metadoc_from_src.d | 43 +++++++++++++++-------------- src/doc_reform/meta/rgx.d | 40 ++++++++++++++++++--------- src/doc_reform/output/rgx.d | 40 ++++++++++++++++++--------- 5 files changed, 141 insertions(+), 79 deletions(-) diff --git a/org/default_regex.org b/org/default_regex.org index 80e3cde..2af9ed2 100644 --- a/org/default_regex.org +++ b/org/default_regex.org @@ -526,27 +526,49 @@ static quotation_mark_various = ctRegex!(q"┋['‘’ #+name: prgmkup_rgx #+BEGIN_SRC d /+ inline markup font face mod +/ -static inline_faces = ctRegex!(`(?P(?P[*!_^,+#-])\{(?P.+?)\}[*!_^,+#-])`, "mg"); -static inline_emphasis = ctRegex!(`\*\{(?P.+?)\}\*`, "mg"); -static inline_bold = ctRegex!(`!\{(?P.+?)\}!`, "mg"); -static inline_underscore = ctRegex!(`_\{(?P.+?)\}_`, "mg"); -static inline_italics = ctRegex!(`/\{(?P.+?)\}/`, "mg"); -static inline_superscript = ctRegex!(`\^\{(?P.+?)\}\^`, "mg"); -static inline_subscript = ctRegex!(`,\{(?P.+?)\},`, "mg"); -static inline_strike = ctRegex!(`-\{(?P.+?)\}-`, "mg"); -static inline_insert = ctRegex!(`\+\{(?P.+?)\}\+`, "mg"); -static inline_mono = ctRegex!(`#\{(?P.+?)\}#`, "mg"); -static inline_mono_box = ctRegex!(`■\{(?P.+?)\}■`, "mg"); -static inline_cite = ctRegex!(`"\{(?P.+?)\}"`, "mg"); +static inline_mark_faces = ctRegex!(`(?P(?P[*!/_^,+#"-])\{(?P.+?)\}[*!/_^,+#"-])`, "mg"); +static inline_mark_faces_to_mod = ctRegex!(`(?P[*!/_^,+#"-])\{(?P.+?)\}([*!/_^,+#"-])`, "mg"); +static inline_mark_emphasis = ctRegex!(`([*])\{(?P.+?)\}[*]`, "mg"); +static inline_mark_bold = ctRegex!(`([!])\{(?P.+?)\}[!]`, "mg"); +static inline_mark_underscore = ctRegex!(`([_])\{(?P.+?)\}[_]`, "mg"); +static inline_mark_italics = ctRegex!(`([/])\{(?P.+?)\}[/]`, "mg"); +static inline_mark_superscript = ctRegex!(`(\^)\{(?P.+?)\}\^`, "mg"); +static inline_mark_subscript = ctRegex!(`([,])\{(?P.+?)\}[,]`, "mg"); +static inline_mark_strike = ctRegex!(`([-])\{(?P.+?)\}[-]`, "mg"); +static inline_mark_insert = ctRegex!(`([+])\{(?P.+?)\}[+]`, "mg"); +static inline_mark_mono = ctRegex!(`([#])\{(?P.+?)\}[#]`, "mg"); +static inline_mark_cite = ctRegex!(`(["])\{(?P.+?)\}["]`, "mg"); +static inline_mark_fontface_clean = ctRegex!(`[*!_/^,+#■"-]\{|\}[*!_/^,+#■"-]`, "mg"); +#+END_SRC + +#+name: prgmkup_rgx +#+BEGIN_SRC d static inline_faces_line = ctRegex!(`^[*!/_]_ (?P.+?)((?: [\\]{2}|[~]#){0,2}$)`); static inline_emphasis_line = ctRegex!(`^\*_ (?P.+?)(?P(?: [\\]{2}|[~]#){0,2}$)`); static inline_bold_line = ctRegex!(`^!_ (?P.+?)(?P(?: [\\]{2}|[~]#){0,2}$)`); static inline_italics_line = ctRegex!(`^/_ (?P.+?)(?P(?: [\\]{2}|[~]#){0,2}$)`); static inline_underscore_line = ctRegex!(`^__ (?P.+?)(?P(?: [\\]{2}|[~]#){0,2}$)`); -static inline_fontface_clean = ctRegex!(`[*!_/^,+#■"-]\{|\}[*!_/^,+#■"-]`, "mg"); static no_header_rgx = ctRegex!(`^=NULL$`); #+END_SRC +#+name: prgmkup_rgx +#+BEGIN_SRC d +/+ inline markup font face mod +/ +static inline_faces = ctRegex!(`(?P(?P[*!_^,+■‖-])┨(?P.+?)┣[*!_^,+■‖-])`, "mg"); +static inline_emphasis = ctRegex!(`[*]┨(?P.+?)┣[*]`, "mg"); +static inline_bold = ctRegex!(`[!]┨(?P.+?)┣[!]`, "mg"); +static inline_underscore = ctRegex!(`[_]┨(?P.+?)┣[_]`, "mg"); +static inline_italics = ctRegex!(`[/]┨(?P.+?)┣[/]`, "mg"); +static inline_superscript = ctRegex!(`\^┨(?P.+?)┣\^`, "mg"); +// static inline_superscript = ctRegex!(`[\^]┨(?P.+?)┣[\^]`, "mg"); +static inline_subscript = ctRegex!(`[,]┨(?P.+?)┣[,]`, "mg"); +static inline_strike = ctRegex!(`[-]┨(?P.+?)┣[-]`, "mg"); +static inline_insert = ctRegex!(`[+]┨(?P.+?)┣[+]`, "mg"); +static inline_mono = ctRegex!(`[■]┨(?P.+?)┣[■]`, "mg"); +static inline_cite = ctRegex!(`[‖]┨(?P.+?)┣[‖]`, "mg"); +static inline_fontface_clean = ctRegex!(`[*!_/^,+■‖-]┨|┣[*!_/^,+■‖-]`, "mg"); +#+END_SRC + *** table related #+name: prgmkup_rgx diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org index f4a6f62..9721918 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -412,6 +412,15 @@ pure auto obj_dom_set_collapsed_tags(O)( static auto ocn_emit(int ocn_status_flag) { return object_citation_number.ocn_emitter(ocn_status_flag); } +static auto inline_markup_faces(L)(L line) { + static auto rgx = Rgx(); + line = replaceAll!(m => "■┨" ~ m[2] ~ "┣■")(line, rgx.inline_mark_mono); + line = replaceAll!(m => "‖┨" ~ m[2] ~ "┣‖")(line, rgx.inline_mark_cite); + foreach (regx; [rgx.inline_mark_emphasis, rgx.inline_mark_bold, rgx.inline_mark_underscore, rgx.inline_mark_italics, rgx.inline_mark_superscript, rgx.inline_mark_subscript, rgx.inline_mark_strike, rgx.inline_mark_insert]) { + line = replaceAll!(m => m[1] ~ "┨" ~ m[2] ~ "┣"~ m[1])(line, regx); + } + return line; +} /+ book index variables +/ string book_idx_tmp; string[][string][string] bookindex_unordered_hashes; @@ -650,6 +659,13 @@ continue; #+END_SRC **** _non code objects_ (other blocks or regular text) [+4] :non_code: +***** inline fontface markup + +#+name: abs_in_loop_body_non_code_obj +#+BEGIN_SRC d +line = line.inline_markup_faces; +#+END_SRC + ***** in section (biblio, glossary, blurb) +(block group)+ [+1] :block:active: ****** in section: biblio :biblio: @@ -1592,7 +1608,7 @@ foreach (entry; biblio_ordered) { "%s \"%s\"%s%s%s%s%s%s%s%s%s.", ((entry["author"].str.empty) ? entry["editor"].str : entry["author"].str), entry["fulltitle"].str, - ((entry["journal"].str.empty) ? "" : ", /{" ~ entry["journal"].str ~ "}/"), + ((entry["journal"].str.empty) ? "" : ", /┨" ~ entry["journal"].str ~ "┣/"), ((entry["volume"].str.empty) ? "" : ", " ~ entry["volume"].str), ((entry["in"].str.empty) ? "" : ", " ~ entry["in"].str), ((!(entry["author"].str.empty) && (!(entry["editor"].str.empty))) ? entry["editor"].str : ""), @@ -4986,10 +5002,10 @@ auto font_faces_line(T)( static auto rgx = Rgx(); if (textline.match(rgx.inline_faces_line)) { textline = textline - .replaceFirst(rgx.inline_emphasis_line, ("*{$1}*$2")) - .replaceFirst(rgx.inline_bold_line, ("!{$1}!$2")) - .replaceFirst(rgx.inline_underscore_line, ("_{$1}_$2")) - .replaceFirst(rgx.inline_italics_line, ("/{$1}/$2")); + .replaceFirst(rgx.inline_emphasis_line, ("*┨$1┣*$2")) + .replaceFirst(rgx.inline_bold_line, ("!┨$1┣!$2")) + .replaceFirst(rgx.inline_underscore_line, ("_┨$1┣_$2")) + .replaceFirst(rgx.inline_italics_line, ("/┨$1┣/$2")); } return textline; } @@ -5320,8 +5336,6 @@ static struct ObjInlineMarkupMunge { debug(asserts) { static assert(is(typeof(obj_txt_in) == string)); } - static auto mng = InlineMarkup(); - obj_txt_in = obj_txt_in.replaceAll(rgx.inline_mono, (mng.mono ~ "{$1}" ~ mng.mono)); /+ url matched +/ obj_txt_in = obj_txt_in.replaceAll(rgx.inline_notes_al_special, ""); // TODO reinstate when special footnotes are implemented if (obj_txt_in.match(rgx.smid_inline_url_generic)) { @@ -5372,7 +5386,6 @@ static struct ObjInlineMarkupMunge { ); } } - obj_txt_in = obj_txt_in.replaceAll(rgx.inline_mono_box, ("#{$1}#")); return obj_txt_in; } #+END_SRC @@ -5384,7 +5397,6 @@ static struct ObjInlineMarkupMunge { static assert(is(typeof(obj_txt_in) == string)); } static auto mng = InlineMarkup(); - obj_txt_in = obj_txt_in.replaceAll(rgx.inline_mono, (mng.mono ~ "{$1}" ~ mng.mono)); // figure /+ url matched +/ obj_txt_in = obj_txt_in.replaceAll(rgx.inline_notes_al_special, ""); // TODO reinstate when special footnotes are implemented if (obj_txt_in.match(rgx.smid_image_generic)) { /+ images with and without links +/ @@ -5413,7 +5425,6 @@ static struct ObjInlineMarkupMunge { } } } - obj_txt_in = obj_txt_in.replaceAll(rgx.inline_mono_box, ("#{$1}#")); // figure return obj_txt_in; } #+END_SRC @@ -6745,7 +6756,7 @@ struct BookIndexReportSection { } auto mainkeys=bookindex_unordered_hashes.byKey.array.sort().release; foreach (mainkey; mainkeys) { - write("_0_1 !{", mainkey, "}! "); + write("_0_1 !┨", mainkey, "┣! "); foreach (ref_; bookindex_unordered_hashes[mainkey]["_a"]) { auto go = ref_.replaceAll(rgx.book_index_go, "$1"); write(" {", ref_, "}#", go, ", "); @@ -6850,7 +6861,7 @@ struct BookIndexReportSection { string[dchar] transTable = [' ' : "_"]; foreach (mainkey; mainkeys) { bi_tmp_tags = [""]; - bi_tmp = "!{" ~ mainkey ~ "}! "; + bi_tmp = "!┨" ~ mainkey ~ "┣! "; buffer.clear(); bi_tmp_tags ~= translate(mainkey, transTable); auto bkidx_lnk(string locs) { @@ -6967,15 +6978,13 @@ struct NotesSection { previous_count=cntr; static auto mkup = InlineMarkup(); static auto munge = ObjInlineMarkupMunge(); - foreach( - m; + foreach(m; (contents_am[cntr].text).matchAll( - rgx.inline_notes_delimiter_al_regular_number_note - ) + rgx.inline_notes_delimiter_al_regular_number_note) ) { debug(endnotes_build) { writeln( - "{^{", m.captures[1], ".}^}" + "{^┨", m.captures[1], ".┣^}" ~ mkup.mark_internal_site_lnk, tag_in_seg["seg_lv4"], ".fnSuffix#noteref_\n ", m.captures[1], " ", @@ -6985,12 +6994,12 @@ struct NotesSection { object_notes["anchor"] ~= "note_" ~ m.captures[1] ~ "』"; object_notes["notes"] ~= (tag_in_seg["seg_lv4"].empty) ? (munge.url_links( - "{^{" ~ m.captures[1] ~ ".}^}#noteref_" + "{^┨" ~ m.captures[1] ~ ".┣^}#noteref_" ~ m.captures[1]) ~ " " ~ m.captures[2] ~ "』" ) : (munge.url_links( - "{^{" ~ m.captures[1] ~ ".}^}" + "{^┨" ~ m.captures[1] ~ ".┣^}" ~ mkup.mark_internal_site_lnk ~ tag_in_seg["seg_lv4"] ~ ".fnSuffix#noteref_" @@ -7123,7 +7132,7 @@ struct NotesSection { string anchor_tag = "note_" ~ notenumber; comp_obj_endnote_.tags.anchor_tags = [ endnotes_["anchor"][i] ]; comp_obj_endnote_.has.inline_links = true; - comp_obj_endnote_.text = endnote.strip; + comp_obj_endnote_.text = endnote.inline_markup_faces.strip; the_endnotes_section ~= comp_obj_endnote_; } } diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index 2dfd746..90cc08a 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -233,6 +233,15 @@ template DocReformDocAbstraction() { static auto ocn_emit(int ocn_status_flag) { return object_citation_number.ocn_emitter(ocn_status_flag); } + static auto inline_markup_faces(L)(L line) { + static auto rgx = Rgx(); + line = replaceAll!(m => "■┨" ~ m[2] ~ "┣■")(line, rgx.inline_mark_mono); + line = replaceAll!(m => "‖┨" ~ m[2] ~ "┣‖")(line, rgx.inline_mark_cite); + foreach (regx; [rgx.inline_mark_emphasis, rgx.inline_mark_bold, rgx.inline_mark_underscore, rgx.inline_mark_italics, rgx.inline_mark_superscript, rgx.inline_mark_subscript, rgx.inline_mark_strike, rgx.inline_mark_insert]) { + line = replaceAll!(m => m[1] ~ "┨" ~ m[2] ~ "┣"~ m[1])(line, regx); + } + return line; + } /+ book index variables +/ string book_idx_tmp; string[][string][string] bookindex_unordered_hashes; @@ -448,6 +457,7 @@ template DocReformDocAbstraction() { /+ object other than "code block" object (includes regular text paragraph, headings & blocks other than code) +/ /+ heading, glossary, blurb, poem, group, block, quote, table +/ + line = line.inline_markup_faces; if (line.matchFirst(rgx.heading_biblio) || (obj_type_status["biblio_section"] == State.on && (!(line.matchFirst(rgx.heading_blurb_glossary))) @@ -1215,7 +1225,7 @@ template DocReformDocAbstraction() { "%s \"%s\"%s%s%s%s%s%s%s%s%s.", ((entry["author"].str.empty) ? entry["editor"].str : entry["author"].str), entry["fulltitle"].str, - ((entry["journal"].str.empty) ? "" : ", /{" ~ entry["journal"].str ~ "}/"), + ((entry["journal"].str.empty) ? "" : ", /┨" ~ entry["journal"].str ~ "┣/"), ((entry["volume"].str.empty) ? "" : ", " ~ entry["volume"].str), ((entry["in"].str.empty) ? "" : ", " ~ entry["in"].str), ((!(entry["author"].str.empty) && (!(entry["editor"].str.empty))) ? entry["editor"].str : ""), @@ -3979,10 +3989,10 @@ template DocReformDocAbstraction() { static auto rgx = Rgx(); if (textline.match(rgx.inline_faces_line)) { textline = textline - .replaceFirst(rgx.inline_emphasis_line, ("*{$1}*$2")) - .replaceFirst(rgx.inline_bold_line, ("!{$1}!$2")) - .replaceFirst(rgx.inline_underscore_line, ("_{$1}_$2")) - .replaceFirst(rgx.inline_italics_line, ("/{$1}/$2")); + .replaceFirst(rgx.inline_emphasis_line, ("*┨$1┣*$2")) + .replaceFirst(rgx.inline_bold_line, ("!┨$1┣!$2")) + .replaceFirst(rgx.inline_underscore_line, ("_┨$1┣_$2")) + .replaceFirst(rgx.inline_italics_line, ("/┨$1┣/$2")); } return textline; } @@ -4255,8 +4265,6 @@ template DocReformDocAbstraction() { debug(asserts) { static assert(is(typeof(obj_txt_in) == string)); } - static auto mng = InlineMarkup(); - obj_txt_in = obj_txt_in.replaceAll(rgx.inline_mono, (mng.mono ~ "{$1}" ~ mng.mono)); /+ url matched +/ obj_txt_in = obj_txt_in.replaceAll(rgx.inline_notes_al_special, ""); // TODO reinstate when special footnotes are implemented if (obj_txt_in.match(rgx.smid_inline_url_generic)) { @@ -4307,7 +4315,6 @@ template DocReformDocAbstraction() { ); } } - obj_txt_in = obj_txt_in.replaceAll(rgx.inline_mono_box, ("#{$1}#")); return obj_txt_in; } static auto images(Ot)(Ot obj_txt_in) { @@ -4315,7 +4322,6 @@ template DocReformDocAbstraction() { static assert(is(typeof(obj_txt_in) == string)); } static auto mng = InlineMarkup(); - obj_txt_in = obj_txt_in.replaceAll(rgx.inline_mono, (mng.mono ~ "{$1}" ~ mng.mono)); // figure /+ url matched +/ obj_txt_in = obj_txt_in.replaceAll(rgx.inline_notes_al_special, ""); // TODO reinstate when special footnotes are implemented if (obj_txt_in.match(rgx.smid_image_generic)) { /+ images with and without links +/ @@ -4344,7 +4350,6 @@ template DocReformDocAbstraction() { } } } - obj_txt_in = obj_txt_in.replaceAll(rgx.inline_mono_box, ("#{$1}#")); // figure return obj_txt_in; } auto footnotes_endnotes_markup_and_number_or_stars(Ot)(Ot obj_txt_in, bool reset_note_numbers) { @@ -5403,7 +5408,7 @@ template DocReformDocAbstraction() { } auto mainkeys=bookindex_unordered_hashes.byKey.array.sort().release; foreach (mainkey; mainkeys) { - write("_0_1 !{", mainkey, "}! "); + write("_0_1 !┨", mainkey, "┣! "); foreach (ref_; bookindex_unordered_hashes[mainkey]["_a"]) { auto go = ref_.replaceAll(rgx.book_index_go, "$1"); write(" {", ref_, "}#", go, ", "); @@ -5502,7 +5507,7 @@ template DocReformDocAbstraction() { string[dchar] transTable = [' ' : "_"]; foreach (mainkey; mainkeys) { bi_tmp_tags = [""]; - bi_tmp = "!{" ~ mainkey ~ "}! "; + bi_tmp = "!┨" ~ mainkey ~ "┣! "; buffer.clear(); bi_tmp_tags ~= translate(mainkey, transTable); auto bkidx_lnk(string locs) { @@ -5602,15 +5607,13 @@ template DocReformDocAbstraction() { previous_count=cntr; static auto mkup = InlineMarkup(); static auto munge = ObjInlineMarkupMunge(); - foreach( - m; + foreach(m; (contents_am[cntr].text).matchAll( - rgx.inline_notes_delimiter_al_regular_number_note - ) + rgx.inline_notes_delimiter_al_regular_number_note) ) { debug(endnotes_build) { writeln( - "{^{", m.captures[1], ".}^}" + "{^┨", m.captures[1], ".┣^}" ~ mkup.mark_internal_site_lnk, tag_in_seg["seg_lv4"], ".fnSuffix#noteref_\n ", m.captures[1], " ", @@ -5620,12 +5623,12 @@ template DocReformDocAbstraction() { object_notes["anchor"] ~= "note_" ~ m.captures[1] ~ "』"; object_notes["notes"] ~= (tag_in_seg["seg_lv4"].empty) ? (munge.url_links( - "{^{" ~ m.captures[1] ~ ".}^}#noteref_" + "{^┨" ~ m.captures[1] ~ ".┣^}#noteref_" ~ m.captures[1]) ~ " " ~ m.captures[2] ~ "』" ) : (munge.url_links( - "{^{" ~ m.captures[1] ~ ".}^}" + "{^┨" ~ m.captures[1] ~ ".┣^}" ~ mkup.mark_internal_site_lnk ~ tag_in_seg["seg_lv4"] ~ ".fnSuffix#noteref_" @@ -5746,7 +5749,7 @@ template DocReformDocAbstraction() { string anchor_tag = "note_" ~ notenumber; comp_obj_endnote_.tags.anchor_tags = [ endnotes_["anchor"][i] ]; comp_obj_endnote_.has.inline_links = true; - comp_obj_endnote_.text = endnote.strip; + comp_obj_endnote_.text = endnote.inline_markup_faces.strip; the_endnotes_section ~= comp_obj_endnote_; } } diff --git a/src/doc_reform/meta/rgx.d b/src/doc_reform/meta/rgx.d index df294e8..7dd4a89 100644 --- a/src/doc_reform/meta/rgx.d +++ b/src/doc_reform/meta/rgx.d @@ -272,25 +272,39 @@ static template DocReformRgxInit() { static quotation_mark_sql_insert_delimiter = ctRegex!("[']", "mg"); static quotation_mark_various = ctRegex!(q"┋['‘’“”"`´¨]┋", "mg"); /+ inline markup font face mod +/ - static inline_faces = ctRegex!(`(?P(?P[*!_^,+#-])\{(?P.+?)\}[*!_^,+#-])`, "mg"); - static inline_emphasis = ctRegex!(`\*\{(?P.+?)\}\*`, "mg"); - static inline_bold = ctRegex!(`!\{(?P.+?)\}!`, "mg"); - static inline_underscore = ctRegex!(`_\{(?P.+?)\}_`, "mg"); - static inline_italics = ctRegex!(`/\{(?P.+?)\}/`, "mg"); - static inline_superscript = ctRegex!(`\^\{(?P.+?)\}\^`, "mg"); - static inline_subscript = ctRegex!(`,\{(?P.+?)\},`, "mg"); - static inline_strike = ctRegex!(`-\{(?P.+?)\}-`, "mg"); - static inline_insert = ctRegex!(`\+\{(?P.+?)\}\+`, "mg"); - static inline_mono = ctRegex!(`#\{(?P.+?)\}#`, "mg"); - static inline_mono_box = ctRegex!(`■\{(?P.+?)\}■`, "mg"); - static inline_cite = ctRegex!(`"\{(?P.+?)\}"`, "mg"); + static inline_mark_faces = ctRegex!(`(?P(?P[*!/_^,+#"-])\{(?P.+?)\}[*!/_^,+#"-])`, "mg"); + static inline_mark_faces_to_mod = ctRegex!(`(?P[*!/_^,+#"-])\{(?P.+?)\}([*!/_^,+#"-])`, "mg"); + static inline_mark_emphasis = ctRegex!(`([*])\{(?P.+?)\}[*]`, "mg"); + static inline_mark_bold = ctRegex!(`([!])\{(?P.+?)\}[!]`, "mg"); + static inline_mark_underscore = ctRegex!(`([_])\{(?P.+?)\}[_]`, "mg"); + static inline_mark_italics = ctRegex!(`([/])\{(?P.+?)\}[/]`, "mg"); + static inline_mark_superscript = ctRegex!(`(\^)\{(?P.+?)\}\^`, "mg"); + static inline_mark_subscript = ctRegex!(`([,])\{(?P.+?)\}[,]`, "mg"); + static inline_mark_strike = ctRegex!(`([-])\{(?P.+?)\}[-]`, "mg"); + static inline_mark_insert = ctRegex!(`([+])\{(?P.+?)\}[+]`, "mg"); + static inline_mark_mono = ctRegex!(`([#])\{(?P.+?)\}[#]`, "mg"); + static inline_mark_cite = ctRegex!(`(["])\{(?P.+?)\}["]`, "mg"); + static inline_mark_fontface_clean = ctRegex!(`[*!_/^,+#■"-]\{|\}[*!_/^,+#■"-]`, "mg"); static inline_faces_line = ctRegex!(`^[*!/_]_ (?P.+?)((?: [\\]{2}|[~]#){0,2}$)`); static inline_emphasis_line = ctRegex!(`^\*_ (?P.+?)(?P(?: [\\]{2}|[~]#){0,2}$)`); static inline_bold_line = ctRegex!(`^!_ (?P.+?)(?P(?: [\\]{2}|[~]#){0,2}$)`); static inline_italics_line = ctRegex!(`^/_ (?P.+?)(?P(?: [\\]{2}|[~]#){0,2}$)`); static inline_underscore_line = ctRegex!(`^__ (?P.+?)(?P(?: [\\]{2}|[~]#){0,2}$)`); - static inline_fontface_clean = ctRegex!(`[*!_/^,+#■"-]\{|\}[*!_/^,+#■"-]`, "mg"); static no_header_rgx = ctRegex!(`^=NULL$`); + /+ inline markup font face mod +/ + static inline_faces = ctRegex!(`(?P(?P[*!_^,+■‖-])┨(?P.+?)┣[*!_^,+■‖-])`, "mg"); + static inline_emphasis = ctRegex!(`[*]┨(?P.+?)┣[*]`, "mg"); + static inline_bold = ctRegex!(`[!]┨(?P.+?)┣[!]`, "mg"); + static inline_underscore = ctRegex!(`[_]┨(?P.+?)┣[_]`, "mg"); + static inline_italics = ctRegex!(`[/]┨(?P.+?)┣[/]`, "mg"); + static inline_superscript = ctRegex!(`\^┨(?P.+?)┣\^`, "mg"); + // static inline_superscript = ctRegex!(`[\^]┨(?P.+?)┣[\^]`, "mg"); + static inline_subscript = ctRegex!(`[,]┨(?P.+?)┣[,]`, "mg"); + static inline_strike = ctRegex!(`[-]┨(?P.+?)┣[-]`, "mg"); + static inline_insert = ctRegex!(`[+]┨(?P.+?)┣[+]`, "mg"); + static inline_mono = ctRegex!(`[■]┨(?P.+?)┣[■]`, "mg"); + static inline_cite = ctRegex!(`[‖]┨(?P.+?)┣[‖]`, "mg"); + static inline_fontface_clean = ctRegex!(`[*!_/^,+■‖-]┨|┣[*!_/^,+■‖-]`, "mg"); /+ table delimiters +/ static table_delimiter_col = ctRegex!("[ ]*[┊][ ]*", "mg"); static table_delimiter_row = ctRegex!("[ ]*\n", "mg"); diff --git a/src/doc_reform/output/rgx.d b/src/doc_reform/output/rgx.d index 0483f1b..354de00 100644 --- a/src/doc_reform/output/rgx.d +++ b/src/doc_reform/output/rgx.d @@ -80,25 +80,39 @@ static template DocReformOutputRgxInit() { static quotation_mark_sql_insert_delimiter = ctRegex!("[']", "mg"); static quotation_mark_various = ctRegex!(q"┋['‘’“”"`´¨]┋", "mg"); /+ inline markup font face mod +/ - static inline_faces = ctRegex!(`(?P(?P[*!_^,+#-])\{(?P.+?)\}[*!_^,+#-])`, "mg"); - static inline_emphasis = ctRegex!(`\*\{(?P.+?)\}\*`, "mg"); - static inline_bold = ctRegex!(`!\{(?P.+?)\}!`, "mg"); - static inline_underscore = ctRegex!(`_\{(?P.+?)\}_`, "mg"); - static inline_italics = ctRegex!(`/\{(?P.+?)\}/`, "mg"); - static inline_superscript = ctRegex!(`\^\{(?P.+?)\}\^`, "mg"); - static inline_subscript = ctRegex!(`,\{(?P.+?)\},`, "mg"); - static inline_strike = ctRegex!(`-\{(?P.+?)\}-`, "mg"); - static inline_insert = ctRegex!(`\+\{(?P.+?)\}\+`, "mg"); - static inline_mono = ctRegex!(`#\{(?P.+?)\}#`, "mg"); - static inline_mono_box = ctRegex!(`■\{(?P.+?)\}■`, "mg"); - static inline_cite = ctRegex!(`"\{(?P.+?)\}"`, "mg"); + static inline_mark_faces = ctRegex!(`(?P(?P[*!/_^,+#"-])\{(?P.+?)\}[*!/_^,+#"-])`, "mg"); + static inline_mark_faces_to_mod = ctRegex!(`(?P[*!/_^,+#"-])\{(?P.+?)\}([*!/_^,+#"-])`, "mg"); + static inline_mark_emphasis = ctRegex!(`([*])\{(?P.+?)\}[*]`, "mg"); + static inline_mark_bold = ctRegex!(`([!])\{(?P.+?)\}[!]`, "mg"); + static inline_mark_underscore = ctRegex!(`([_])\{(?P.+?)\}[_]`, "mg"); + static inline_mark_italics = ctRegex!(`([/])\{(?P.+?)\}[/]`, "mg"); + static inline_mark_superscript = ctRegex!(`(\^)\{(?P.+?)\}\^`, "mg"); + static inline_mark_subscript = ctRegex!(`([,])\{(?P.+?)\}[,]`, "mg"); + static inline_mark_strike = ctRegex!(`([-])\{(?P.+?)\}[-]`, "mg"); + static inline_mark_insert = ctRegex!(`([+])\{(?P.+?)\}[+]`, "mg"); + static inline_mark_mono = ctRegex!(`([#])\{(?P.+?)\}[#]`, "mg"); + static inline_mark_cite = ctRegex!(`(["])\{(?P.+?)\}["]`, "mg"); + static inline_mark_fontface_clean = ctRegex!(`[*!_/^,+#■"-]\{|\}[*!_/^,+#■"-]`, "mg"); static inline_faces_line = ctRegex!(`^[*!/_]_ (?P.+?)((?: [\\]{2}|[~]#){0,2}$)`); static inline_emphasis_line = ctRegex!(`^\*_ (?P.+?)(?P(?: [\\]{2}|[~]#){0,2}$)`); static inline_bold_line = ctRegex!(`^!_ (?P.+?)(?P(?: [\\]{2}|[~]#){0,2}$)`); static inline_italics_line = ctRegex!(`^/_ (?P.+?)(?P(?: [\\]{2}|[~]#){0,2}$)`); static inline_underscore_line = ctRegex!(`^__ (?P.+?)(?P(?: [\\]{2}|[~]#){0,2}$)`); - static inline_fontface_clean = ctRegex!(`[*!_/^,+#■"-]\{|\}[*!_/^,+#■"-]`, "mg"); static no_header_rgx = ctRegex!(`^=NULL$`); + /+ inline markup font face mod +/ + static inline_faces = ctRegex!(`(?P(?P[*!_^,+■‖-])┨(?P.+?)┣[*!_^,+■‖-])`, "mg"); + static inline_emphasis = ctRegex!(`[*]┨(?P.+?)┣[*]`, "mg"); + static inline_bold = ctRegex!(`[!]┨(?P.+?)┣[!]`, "mg"); + static inline_underscore = ctRegex!(`[_]┨(?P.+?)┣[_]`, "mg"); + static inline_italics = ctRegex!(`[/]┨(?P.+?)┣[/]`, "mg"); + static inline_superscript = ctRegex!(`\^┨(?P.+?)┣\^`, "mg"); + // static inline_superscript = ctRegex!(`[\^]┨(?P.+?)┣[\^]`, "mg"); + static inline_subscript = ctRegex!(`[,]┨(?P.+?)┣[,]`, "mg"); + static inline_strike = ctRegex!(`[-]┨(?P.+?)┣[-]`, "mg"); + static inline_insert = ctRegex!(`[+]┨(?P.+?)┣[+]`, "mg"); + static inline_mono = ctRegex!(`[■]┨(?P.+?)┣[■]`, "mg"); + static inline_cite = ctRegex!(`[‖]┨(?P.+?)┣[‖]`, "mg"); + static inline_fontface_clean = ctRegex!(`[*!_/^,+■‖-]┨|┣[*!_/^,+■‖-]`, "mg"); /+ table delimiters +/ static table_delimiter_col = ctRegex!("[ ]*[┊][ ]*", "mg"); static table_delimiter_row = ctRegex!("[ ]*\n", "mg"); -- cgit v1.2.3