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 /org | |
parent | inline fontface markup, internal representation (diff) |
inline fontface markup, internal representation, reorganise code
Diffstat (limited to 'org')
-rw-r--r-- | org/default_misc.org | 10 | ||||
-rw-r--r-- | org/meta_abstraction.org | 35 |
2 files changed, 31 insertions, 14 deletions
diff --git a/org/default_misc.org b/org/default_misc.org index d4576a6..a811b91 100644 --- a/org/default_misc.org +++ b/org/default_misc.org @@ -224,8 +224,17 @@ template InternalMarkup() { static struct InlineMarkup { auto en_a_o = "【"; auto en_a_c = "】"; auto en_b_o = "〖"; auto en_b_c = "〗"; + auto ff_o = "┨"; auto ff_c = "┣"; // fontface auto lnk_o = "┥"; auto lnk_c = "┝"; auto url_o = "┤"; auto url_c = "├"; + auto emph = "*"; + auto bold = "!"; + auto italic = "/"; + auto underscore = "_"; + auto superscript = "^"; + auto subscript = ","; + auto mono = "■"; + auto cite = "‖"; auto mark_internal_site_lnk = "¤"; auto nbsp = "░"; auto br_line = "┘"; @@ -239,7 +248,6 @@ template InternalMarkup() { auto tc_o = "┏"; auto tc_c = "┚"; auto tc_p = "┆"; - auto mono = "■"; auto img = "☼"; static string indent_by_spaces_provided(int indent, string _indent_spaces ="░░") { _indent_spaces = replicate(_indent_spaces, indent); diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org index 9721918..bf67dcc 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -414,10 +414,11 @@ static auto ocn_emit(int 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); + 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; } @@ -663,7 +664,7 @@ continue; #+name: abs_in_loop_body_non_code_obj #+BEGIN_SRC d -line = line.inline_markup_faces; +line = line.inline_markup_faces; // by text line (rather than by text object), linebreaks in para problematic #+END_SRC ***** in section (biblio, glossary, blurb) +(block group)+ [+1] :block:active: @@ -1608,7 +1609,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) ? "" : ", " ~ 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 : ""), @@ -2426,6 +2427,9 @@ if (the_document_body_section.length > 1) { 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); @@ -2476,6 +2480,7 @@ if (the_endnotes_section.length > 1) { 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); @@ -2675,6 +2680,9 @@ if (the_bookindex_section.length > 1) { /+ 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); @@ -5000,12 +5008,13 @@ auto font_faces_line(T)( 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; } @@ -6861,7 +6870,7 @@ struct BookIndexReportSection { 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) { @@ -6984,7 +6993,7 @@ struct NotesSection { ) { 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], " ", @@ -6994,12 +7003,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_" + "{" ~ 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_" |