From 5f6caf585c7ccaac0a4310987c85fdcfd3bcff3d Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 29 Jan 2019 17:00:31 -0500 Subject: =?UTF-8?q?format=20delimiter=20s/=C2=B6/=E2=94=8B/g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/doc_reform/meta/metadoc_from_src.d | 10 +-- src/doc_reform/meta/rgx.d | 3 +- src/doc_reform/output/epub3.d | 56 +++++++------- src/doc_reform/output/paths_output.d | 2 +- src/doc_reform/output/rgx.d | 3 +- src/doc_reform/output/sqlite.d | 48 ++++++------ src/doc_reform/output/xmls.d | 130 ++++++++++++++++----------------- 7 files changed, 125 insertions(+), 127 deletions(-) (limited to 'src/doc_reform') diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index 5df5e87..2dfd746 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -712,13 +712,9 @@ template DocReformDocAbstraction() { /+ within block object: block +/ line = line._doc_header_and_make_substitutions_(conf_make_meta); line = line._doc_header_and_make_substitutions_fontface_(conf_make_meta); - if (auto m = line.match(rgx.spaces_line_start)) { + if (auto m = line.match(rgx.spaces_keep)) { line = line - .replaceAll(rgx.spaces_line_start, (m.captures[1]).translate([ ' ' : mkup.nbsp ])); - } - if (auto m = line.match(rgx.spaces_multiple)) { - line = line - .replaceAll(rgx.spaces_multiple, (m.captures[1]).translate([ ' ' : mkup.nbsp ])); + .replaceAll(rgx.spaces_keep, (m.captures[1]).translate([ ' ' : mkup.nbsp ])); } line._block_block_(an_object, obj_type_status); continue; @@ -1743,7 +1739,7 @@ template DocReformDocAbstraction() { obj.stow.link ~= obj.text.matchFirst(rgx.inline_link_stow_uri)[2]; obj.text = obj.text.replaceFirst( rgx.inline_link_stow_uri, - format(q"¶┥%s┝┤%s├¶", "$1", i) + format(q"┋┥%s┝┤%s├┋", "$1", i) ); } } diff --git a/src/doc_reform/meta/rgx.d b/src/doc_reform/meta/rgx.d index dcfc245..df294e8 100644 --- a/src/doc_reform/meta/rgx.d +++ b/src/doc_reform/meta/rgx.d @@ -200,6 +200,7 @@ static template DocReformRgxInit() { static newline = ctRegex!("\n", "mg"); static strip_br = ctRegex!("^
\n|
\n*$"); static space = ctRegex!(`[ ]`, "mg"); + static spaces_keep = ctRegex!(`(?P^[ ]+|[ ]{2,})`, "mg"); // code, verse, block static spaces_line_start = ctRegex!(`^(?P[ ]+)`, "mg"); static spaces_multiple = ctRegex!(`(?P[ ]{2,})`, "mg"); static two_spaces = ctRegex!(`[ ]{2}`, "mg"); @@ -269,7 +270,7 @@ static template DocReformRgxInit() { static inline_seg_link = ctRegex!(`(¤)(?:.+?)\.fnSuffix`, "mg"); static mark_internal_site_lnk = ctRegex!(`¤`, "mg"); static quotation_mark_sql_insert_delimiter = ctRegex!("[']", "mg"); - static quotation_mark_various = ctRegex!(q"¶['‘’“”"`´¨]¶", "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"); diff --git a/src/doc_reform/output/epub3.d b/src/doc_reform/output/epub3.d index f57229b..97d8427 100644 --- a/src/doc_reform/output/epub3.d +++ b/src/doc_reform/output/epub3.d @@ -16,25 +16,25 @@ template outputEPub3() { mixin outputXHTMLs; string epub3_mimetypes() { string o; - o = format(q"¶application/epub+zip¶") ~ "\n"; + o = format(q"┋application/epub+zip┋") ~ "\n"; return o; } string epub3_container_xml() { string o; - o = format(q"¶¶") ~ "\n"; - o ~= format(q"¶┋") ~ "\n"; + o ~= format(q"┋ - ¶") ~ "\n\n"; + ┋") ~ "\n\n"; return o; } string epub3_oebps_content(D,M,P)(D doc_abstraction, M doc_matters, P parts) { auto xhtml_format = outputXHTMLs(); auto pth_epub3 = DocReformPathsEPUB!()(doc_matters.output_path, doc_matters.src.language); string _uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO sort uuid in doc_matters! - string content = format(q"¶ + string content = format(q"┋ - ¶", + ┋", _uuid, xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.title_full), xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.title_main), @@ -86,8 +86,8 @@ template outputEPub3() { // TODO sort jpg & png content ~= " " ~ "" ~ "\n "; foreach (image; doc_matters.srcs.image_list) { - content ~= format(q"¶ - ¶", + content ~= format(q"┋ + ┋", image.baseName.stripExtension, (pth_epub3.doc_oebps_image(doc_matters.src.filename)).chompPrefix("OEBPS/"), image, @@ -213,7 +213,7 @@ template outputEPub3() { auto markup = InlineMarkup(); auto rgx = Rgx(); enum DomTags { none, open, close, close_and_open, open_still, } - string toc = format(q"¶ + string toc = format(q"┋ + o = format(q"┋ @@ -110,7 +110,7 @@ template outputXHTMLs() { - ¶", + ┋", doc_matters.conf_make_meta.meta.title_full, doc_matters.conf_make_meta.meta.creator_author, _publisher, @@ -144,9 +144,9 @@ template outputXHTMLs() { _locations = "

doc-reform

\n

sources / git

\n

www.sisudoc.org

"; } string o; - o = format(q"¶
+ o = format(q"┋
%s -
¶", +
┋", _locations, ); return o; @@ -159,7 +159,7 @@ template outputXHTMLs() { string o; string _form; if (doc_matters.opt.action.workon) { - _form = format(q"¶ + _form = format(q"┋
@@ -171,17 +171,17 @@ template outputXHTMLs() {
- ¶", + ┋", _action, _db, ); } else { - _form = format(q"¶%s¶", + _form = format(q"┋%s┋", "", ); } - o = format(q"¶
%s -
¶", + o = format(q"┋
%s +
┋", _form, ); return o; @@ -192,17 +192,17 @@ template outputXHTMLs() { ) { string _manifest = ""; if (doc_matters.opt.action.workon) { - _manifest = format(q"¶ + _manifest = format(q"┋ [ document manifest ] - ¶", + ┋", ); } string o; - o = format(q"¶ + o = format(q"┋ @@ -224,7 +224,7 @@ template outputXHTMLs() {
%s
- %s%s¶", + %s%s┋", doc_matters.conf_make_meta.meta.title_full, (doc_matters.conf_make_meta.meta.creator_author.empty) ? "" : ", " ~ doc_matters.conf_make_meta.meta.creator_author, @@ -244,27 +244,27 @@ template outputXHTMLs() { auto epub3_seg_head(M)( M doc_matters, ) { - string html_base = format(q"¶ - ¶", + string html_base = format(q"┋ + ┋", ); - string html_simple = format(q"¶ + string html_simple = format(q"┋ ¶", + lang="%s" xml:lang="%s">┋", doc_matters.src.language, doc_matters.src.language, ); - string html_strict = format(q"¶ ¶", + lang="%s" xml:lang="%s">┋", doc_matters.src.language, doc_matters.src.language, ); string o; - o = format(q"¶%s + o = format(q"┋%s %s%s @@ -287,7 +287,7 @@ template outputXHTMLs() { <link rel="stylesheet" href="css/epub.css" type="text/css" id="main-css" /> </head> <body lang="%s"> - <a name="top" id="top"></a>¶", + <a name="top" id="top"></a>┋", html_simple, doc_matters.conf_make_meta.meta.title_full, (doc_matters.conf_make_meta.meta.creator_author.empty) ? "" @@ -311,11 +311,11 @@ template outputXHTMLs() { } auto tail() { string o; - o = format(q"¶ </div> + o = format(q"┋ </div> <a name="bottom" id="bottom"></a> <a name="end" id="end"></a> </body> - </html>¶"); + </html>┋"); return o; } auto inline_images(O,M)( @@ -529,10 +529,10 @@ template outputXHTMLs() { text = font_face(text); auto link = m.captures[3].to!string; lev4_subtoc ~= subtoc.replaceFirst(rgx.inline_link_subtoc, - format(q"¶ <p class="minitoc" indent="h%si%s"> + format(q"┋ <p class="minitoc" indent="h%si%s"> ۰ <a href="%s">%s</a> </p> - ¶", + ┋", indent, indent, link, @@ -552,42 +552,42 @@ template outputXHTMLs() { toc = ""; prev = ""; } else { - toc = format(q"¶<a href="toc.html" target="_top"> + toc = format(q"┋<a href="toc.html" target="_top"> <div class="toc-button menu"> <svg viewbox="0 0 100 100"> <path d="M4,10h24c1.104,0,2-0.896,2-2s-0.896-2-2-2H4C2.896,6,2,6.896,2,8S2.896,10,4,10z M28,14H4c-1.104,0-2,0.896-2,2 s0.896,2,2,2h24c1.104,0,2-0.896,2-2S29.104,14,28,14z M28,22H4c-1.104,0-2,0.896-2,2s0.896,2,2,2h24c1.104,0,2-0.896,2-2 S29.104,22,28,22z"/> </svg> </div> - </a>¶", + </a>┋", ); } if (obj.tags.segname_prev == "") { prev = ""; } else { - prev = format(q"¶<a href="%s.html" target="_top"> + prev = format(q"┋<a href="%s.html" target="_top"> <div class="prev-next-button previous"> <svg viewbox="0 0 100 100"> <path class="arrow" d="M 50,0 L 60,10 L 20,50 L 60,90 L 50,100 L 0,50 Z" transform=" translate(15,0)"> </svg> </div> - </a>¶", + </a>┋", obj.tags.segname_prev, ); } if (obj.tags.segname_next == "") { next = ""; } else { - next = format(q"¶<a href="%s.html" target="_top"> + next = format(q"┋<a href="%s.html" target="_top"> <div class="prev-next-button next"> <svg viewbox="0 0 100 100"> <path class="arrow" d="M 50,0 L 60,10 L 20,50 L 60,90 L 50,100 L 0,50 Z "transform="translate(85,100) rotate(180) "> </svg> </div> - </a>¶", + </a>┋", obj.tags.segname_next, ); } - string _toc_pre_next = format(q"¶ <div class="flex-menu-option"> + string _toc_pre_next = format(q"┋ <div class="flex-menu-option"> <div class="nav-bar"> %s %s @@ -595,19 +595,19 @@ template outputXHTMLs() { </div> </div> </div> - </div>¶", + </div>┋", toc, prev, next, ); - string _pre_next = format(q"¶ <div class="flex-menu-option"> + string _pre_next = format(q"┋ <div class="flex-menu-option"> <div class="nav-bar"> %s %s </div> </div> </div> - </div>¶", + </div>┋", prev, next, ); @@ -643,13 +643,13 @@ template outputXHTMLs() { ? "" : "<a name=\"" ~ obj.tags.heading_lev_anchor_tag ~ "\"></a>"; if (!(obj.metainfo.identifier.empty)) { - o = format(q"¶%s + o = format(q"┋%s <div class="substance"> <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> <h%s class="%s" id="%s"><a name="%s"></a>%s%s %s </h%s> - </div>¶", + </div>┋", _horizontal_rule, obj.metainfo.identifier, (obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier, @@ -663,12 +663,12 @@ template outputXHTMLs() { obj.metainfo.heading_lev_markup, ); } else { - o = format(q"¶%s + o = format(q"┋%s <div class="substance"> <h%s class="%s">%s%s %s </h%s> - </div>¶", + </div>┋", _horizontal_rule, obj.metainfo.heading_lev_markup, obj.metainfo.is_a, @@ -723,12 +723,12 @@ template outputXHTMLs() { _txt = _txt.replaceFirst(rgx.inline_link_anchor, "<a name=\"$1\"></a>"); if (!(obj.metainfo.identifier.empty)) { - o = format(q"¶ <div class="substance"> + o = format(q"┋ <div class="substance"> <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> <p class="%s" indent="h%si%s" id="%s">%s %s </p> - </div>¶", + </div>┋", obj.metainfo.identifier, (obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier, obj.metainfo.is_a, @@ -739,11 +739,11 @@ template outputXHTMLs() { _txt ); } else { - o = format(q"¶ <div class="substance"> + o = format(q"┋ <div class="substance"> <p class="%s" indent="h%si%s">%s %s </p> - </div>¶", + </div>┋", obj.metainfo.is_a, obj.attrib.indent_hang, obj.attrib.indent_base, @@ -792,12 +792,12 @@ template outputXHTMLs() { _txt = font_face(_txt); string o; if (!(obj.metainfo.identifier.empty)) { - o = format(q"¶ <div class="substance"> + o = format(q"┋ <div class="substance"> <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> <p class="%s" id="%s"> %s </p> - </div>¶", + </div>┋", obj.metainfo.identifier, (obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier, obj.metainfo.is_a, @@ -805,11 +805,11 @@ template outputXHTMLs() { _txt ); } else { - o = format(q"¶ <div class="substance"> + o = format(q"┋ <div class="substance"> <p class="%s"> %s </p> - </div>¶", + </div>┋", obj.metainfo.is_a, _txt ); @@ -855,12 +855,12 @@ template outputXHTMLs() { _txt = font_face(_txt); string o; if (!(obj.metainfo.identifier.empty)) { - o = format(q"¶ <div class="substance"> + o = format(q"┋ <div class="substance"> <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> <p class="%s" id="%s"> %s </p> - </div>¶", + </div>┋", obj.metainfo.identifier, (obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier, obj.metainfo.is_a, @@ -868,11 +868,11 @@ template outputXHTMLs() { _txt ); } else { - o = format(q"¶ <div class="substance"> + o = format(q"┋ <div class="substance"> <p class="%s"> %s </p> - </div>¶", + </div>┋", obj.metainfo.is_a, _txt ); @@ -919,10 +919,10 @@ template outputXHTMLs() { _txt = font_face(_txt); string o; if (!(obj.metainfo.identifier.empty)) { - o = format(q"¶ <div class="substance"> + o = format(q"┋ <div class="substance"> <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> <p class="%s" id="%s">%s</p> - </div>¶", + </div>┋", obj.metainfo.identifier, (obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier, obj.metainfo.is_a, @@ -930,9 +930,9 @@ template outputXHTMLs() { _txt.stripRight ); } else { - o = format(q"¶ <div class="substance"> + o = format(q"┋ <div class="substance"> <p class="%s">%s</p> - </div>¶", + </div>┋", obj.metainfo.is_a, _txt.stripRight ); @@ -979,10 +979,10 @@ template outputXHTMLs() { _txt = font_face(_txt); string o; if (!(obj.metainfo.identifier.empty)) { - o = format(q"¶ <div class="substance"> + o = format(q"┋ <div class="substance"> <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> <p class="%s" id="%s">%s</p> - </div>¶", + </div>┋", obj.metainfo.identifier, (obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier, obj.metainfo.is_a, @@ -990,9 +990,9 @@ template outputXHTMLs() { _txt ); } else { - o = format(q"¶ <div class="substance"> + o = format(q"┋ <div class="substance"> <p class="%s">%s</p> - </div>¶", + </div>┋", obj.metainfo.is_a, _txt ); @@ -1075,7 +1075,7 @@ template outputXHTMLs() { _txt = t[0]; string _note = t[1]; string o; - o = format(q"¶ <div class="substance"> + o = format(q"┋ <div class="substance"> <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> <p class="%s" id="%s">%s <table summary="normal text css" width="95%%" border="0" bgcolor="white" cellpadding="2" align="center"> @@ -1083,7 +1083,7 @@ template outputXHTMLs() { </table> %s </p> - </div>¶", + </div>┋", obj.metainfo.object_number, obj.metainfo.object_number, obj.metainfo.is_a, @@ -1104,10 +1104,10 @@ template outputXHTMLs() { assert(obj.metainfo.is_a == "code"); string o; if (!(obj.metainfo.identifier.empty)) { - o = format(q"¶ <div class="substance"> + o = format(q"┋ <div class="substance"> <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> <pre><p class="%s" id="%s">%s</p></pre> - </div>¶", + </div>┋", obj.metainfo.identifier, (obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier, obj.metainfo.is_a, @@ -1115,9 +1115,9 @@ template outputXHTMLs() { _txt ); } else { - o = format(q"¶ <div class="substance"> + o = format(q"┋ <div class="substance"> <pre><p class="%s">%s</p></pre> - </div>¶", + </div>┋", obj.metainfo.is_a, _txt ); -- cgit v1.2.3