diff options
Diffstat (limited to 'src/doc_reform/meta')
-rw-r--r-- | src/doc_reform/meta/metadoc_from_src.d | 43 | ||||
-rw-r--r-- | src/doc_reform/meta/rgx.d | 40 |
2 files changed, 50 insertions, 33 deletions
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<markup>(?P<mod>[*!_^,+#-])\{(?P<text>.+?)\}[*!_^,+#-])`, "mg"); - static inline_emphasis = ctRegex!(`\*\{(?P<text>.+?)\}\*`, "mg"); - static inline_bold = ctRegex!(`!\{(?P<text>.+?)\}!`, "mg"); - static inline_underscore = ctRegex!(`_\{(?P<text>.+?)\}_`, "mg"); - static inline_italics = ctRegex!(`/\{(?P<text>.+?)\}/`, "mg"); - static inline_superscript = ctRegex!(`\^\{(?P<text>.+?)\}\^`, "mg"); - static inline_subscript = ctRegex!(`,\{(?P<text>.+?)\},`, "mg"); - static inline_strike = ctRegex!(`-\{(?P<text>.+?)\}-`, "mg"); - static inline_insert = ctRegex!(`\+\{(?P<text>.+?)\}\+`, "mg"); - static inline_mono = ctRegex!(`#\{(?P<text>.+?)\}#`, "mg"); - static inline_mono_box = ctRegex!(`■\{(?P<text>.+?)\}■`, "mg"); - static inline_cite = ctRegex!(`"\{(?P<text>.+?)\}"`, "mg"); + static inline_mark_faces = ctRegex!(`(?P<markup>(?P<mod>[*!/_^,+#"-])\{(?P<text>.+?)\}[*!/_^,+#"-])`, "mg"); + static inline_mark_faces_to_mod = ctRegex!(`(?P<mod>[*!/_^,+#"-])\{(?P<text>.+?)\}([*!/_^,+#"-])`, "mg"); + static inline_mark_emphasis = ctRegex!(`([*])\{(?P<text>.+?)\}[*]`, "mg"); + static inline_mark_bold = ctRegex!(`([!])\{(?P<text>.+?)\}[!]`, "mg"); + static inline_mark_underscore = ctRegex!(`([_])\{(?P<text>.+?)\}[_]`, "mg"); + static inline_mark_italics = ctRegex!(`([/])\{(?P<text>.+?)\}[/]`, "mg"); + static inline_mark_superscript = ctRegex!(`(\^)\{(?P<text>.+?)\}\^`, "mg"); + static inline_mark_subscript = ctRegex!(`([,])\{(?P<text>.+?)\}[,]`, "mg"); + static inline_mark_strike = ctRegex!(`([-])\{(?P<text>.+?)\}[-]`, "mg"); + static inline_mark_insert = ctRegex!(`([+])\{(?P<text>.+?)\}[+]`, "mg"); + static inline_mark_mono = ctRegex!(`([#])\{(?P<text>.+?)\}[#]`, "mg"); + static inline_mark_cite = ctRegex!(`(["])\{(?P<text>.+?)\}["]`, "mg"); + static inline_mark_fontface_clean = ctRegex!(`[*!_/^,+#■"-]\{|\}[*!_/^,+#■"-]`, "mg"); static inline_faces_line = ctRegex!(`^[*!/_]_ (?P<text>.+?)((?: [\\]{2}|[~]#){0,2}$)`); static inline_emphasis_line = ctRegex!(`^\*_ (?P<text>.+?)(?P<tail>(?: [\\]{2}|[~]#){0,2}$)`); static inline_bold_line = ctRegex!(`^!_ (?P<text>.+?)(?P<tail>(?: [\\]{2}|[~]#){0,2}$)`); static inline_italics_line = ctRegex!(`^/_ (?P<text>.+?)(?P<tail>(?: [\\]{2}|[~]#){0,2}$)`); static inline_underscore_line = ctRegex!(`^__ (?P<text>.+?)(?P<tail>(?: [\\]{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<markup>(?P<mod>[*!_^,+■‖-])┨(?P<text>.+?)┣[*!_^,+■‖-])`, "mg"); + static inline_emphasis = ctRegex!(`[*]┨(?P<text>.+?)┣[*]`, "mg"); + static inline_bold = ctRegex!(`[!]┨(?P<text>.+?)┣[!]`, "mg"); + static inline_underscore = ctRegex!(`[_]┨(?P<text>.+?)┣[_]`, "mg"); + static inline_italics = ctRegex!(`[/]┨(?P<text>.+?)┣[/]`, "mg"); + static inline_superscript = ctRegex!(`\^┨(?P<text>.+?)┣\^`, "mg"); + // static inline_superscript = ctRegex!(`[\^]┨(?P<text>.+?)┣[\^]`, "mg"); + static inline_subscript = ctRegex!(`[,]┨(?P<text>.+?)┣[,]`, "mg"); + static inline_strike = ctRegex!(`[-]┨(?P<text>.+?)┣[-]`, "mg"); + static inline_insert = ctRegex!(`[+]┨(?P<text>.+?)┣[+]`, "mg"); + static inline_mono = ctRegex!(`[■]┨(?P<text>.+?)┣[■]`, "mg"); + static inline_cite = ctRegex!(`[‖]┨(?P<text>.+?)┣[‖]`, "mg"); + static inline_fontface_clean = ctRegex!(`[*!_/^,+■‖-]┨|┣[*!_/^,+■‖-]`, "mg"); /+ table delimiters +/ static table_delimiter_col = ctRegex!("[ ]*[┊][ ]*", "mg"); static table_delimiter_row = ctRegex!("[ ]*\n", "mg"); |