diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2019-02-01 11:55:35 -0500 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2019-05-17 16:59:38 -0400 |
commit | 9f4cf3aaba75a1f71743c96ea079b1fb3dbc0db5 (patch) | |
tree | bcca8e32929e72bc8c6818a644afe4762efa9af4 /src/doc_reform/meta/metadoc_from_src.d | |
parent | inline fontface markup, internal representation (diff) |
inline fontface markup, internal representation, reorganise code
Diffstat (limited to 'src/doc_reform/meta/metadoc_from_src.d')
-rw-r--r-- | src/doc_reform/meta/metadoc_from_src.d | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index 90cc08a..d82c60a 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -235,10 +235,11 @@ template DocReformDocAbstraction() { } 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); + static auto mkup = InlineMarkup(); + line = replaceAll!(m => mkup.mono ~ mkup.ff_o ~ m[2] ~ mkup.ff_c ~ mkup.mono)(line, rgx.inline_mark_mono); + line = replaceAll!(m => mkup.cite ~ mkup.ff_o ~ m[2] ~ mkup.ff_c ~ mkup.cite)(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); + line = replaceAll!(m => m[1] ~ mkup.ff_o ~ m[2] ~ mkup.ff_c ~ m[1])(line, regx); } return line; } @@ -457,7 +458,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; + line = line.inline_markup_faces; // by text line (rather than by text object), linebreaks in para problematic if (line.matchFirst(rgx.heading_biblio) || (obj_type_status["biblio_section"] == State.on && (!(line.matchFirst(rgx.heading_blurb_glossary))) @@ -1225,7 +1226,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) ? "" : ", " ~ mkup.italic ~ mkup.ff_o ~ entry["journal"].str ~ mkup.ff_c ~ mkup.italic), ((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 : ""), @@ -1829,6 +1830,9 @@ template DocReformDocAbstraction() { tag_assoc[(obj.metainfo.identifier)]["seg_lv1_to_4"] = obj.tags.epub_segment_anchor_tag_is; } + if (obj.metainfo.is_a != "code") { + obj.text = obj.text.inline_markup_faces; + } if (obj.metainfo.is_a == "heading") { debug(dom) { writeln(obj.text); @@ -1871,6 +1875,7 @@ template DocReformDocAbstraction() { dom_structure_markedup_tags_status = dom_structure_markedup_tags_status_buffer.dup; dom_structure_collapsed_tags_status = dom_structure_collapsed_tags_status_buffer.dup; foreach (ref obj; the_endnotes_section) { + obj.text = obj.text.inline_markup_faces; if (obj.metainfo.is_a == "heading") { debug(dom) { writeln(obj.text); @@ -2040,6 +2045,9 @@ template DocReformDocAbstraction() { /+ optional only one 1~ level +/ if (the_blurb_section.length > 1) { foreach (ref obj; the_blurb_section) { + if (obj.metainfo.is_a != "code") { + obj.text = obj.text.inline_markup_faces; + } if (obj.metainfo.is_a == "heading") { debug(dom) { writeln(obj.text); @@ -3987,12 +3995,13 @@ template DocReformDocAbstraction() { T textline, ) { static auto rgx = Rgx(); + static auto mkup = InlineMarkup(); 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, format(q"┋%s%s%s%s%s%s┋", mkup.emph, mkup.ff_o, "$1", mkup.ff_c, mkup.emph, "$2")) + .replaceFirst(rgx.inline_bold_line, format(q"┋%s%s%s%s%s%s┋", mkup.bold, mkup.ff_o, "$1", mkup.ff_c, mkup.bold, "$2")) + .replaceFirst(rgx.inline_underscore_line, format(q"┋%s%s%s%s%s%s┋", mkup.underscore, mkup.ff_o, "$1", mkup.ff_c, mkup.underscore, "$2")) + .replaceFirst(rgx.inline_italics_line, format(q"┋%s%s%s%s%s%s┋", mkup.italic, mkup.ff_o, "$1", mkup.ff_c, mkup.italic, "$2")); } return textline; } @@ -5507,7 +5516,7 @@ template DocReformDocAbstraction() { string[dchar] transTable = [' ' : "_"]; foreach (mainkey; mainkeys) { bi_tmp_tags = [""]; - bi_tmp = "!┨" ~ mainkey ~ "┣! "; + bi_tmp = mkup.bold ~ mkup.ff_o ~ mainkey ~ mkup.ff_c ~ mkup.bold ~ " "; buffer.clear(); bi_tmp_tags ~= translate(mainkey, transTable); auto bkidx_lnk(string locs) { @@ -5613,7 +5622,7 @@ template DocReformDocAbstraction() { ) { debug(endnotes_build) { writeln( - "{^┨", m.captures[1], ".┣^}" + "{^", mkup.ff_o, m.captures[1], ".", mkup.ff_c, "^}" ~ mkup.mark_internal_site_lnk, tag_in_seg["seg_lv4"], ".fnSuffix#noteref_\n ", m.captures[1], " ", @@ -5623,12 +5632,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_" + "{" ~ mkup.superscript ~ mkup.ff_o ~ m.captures[1] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}#noteref_" ~ m.captures[1]) ~ " " ~ m.captures[2] ~ "』" ) : (munge.url_links( - "{^┨" ~ m.captures[1] ~ ".┣^}" + "{" ~ mkup.superscript ~ mkup.ff_o ~ m.captures[1] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}" ~ mkup.mark_internal_site_lnk ~ tag_in_seg["seg_lv4"] ~ ".fnSuffix#noteref_" |