aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc_reform/io_out/xmls.d
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2024-04-10 22:24:34 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2024-04-10 23:08:18 -0400
commit90873fabd7451e1dd8c4b39303906e19bdc481f7 (patch)
tree2dbb0e41f3e9c761645c8b37dafe979a01d38d32 /src/doc_reform/io_out/xmls.d
parent0.15.0 (diff)
0.16.0 sisudoc (src/sisudoc sisudoc spine)
- src/sisudoc (replaces src/doc_reform) - sisudoc spine (used more)
Diffstat (limited to 'src/doc_reform/io_out/xmls.d')
-rw-r--r--src/doc_reform/io_out/xmls.d1424
1 files changed, 0 insertions, 1424 deletions
diff --git a/src/doc_reform/io_out/xmls.d b/src/doc_reform/io_out/xmls.d
deleted file mode 100644
index bff6fc1..0000000
--- a/src/doc_reform/io_out/xmls.d
+++ /dev/null
@@ -1,1424 +0,0 @@
-/+
-- Name: Spine, Doc Reform [a part of]
- - Description: documents, structuring, processing, publishing, search
- - static content generator
-
- - Author: Ralph Amissah
- [ralph.amissah@gmail.com]
-
- - Copyright: (C) 2015 - 2024 Ralph Amissah, All Rights Reserved.
-
- - License: AGPL 3 or later:
-
- Spine (SiSU), a framework for document structuring, publishing and
- search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU AFERO General Public License as published by the
- Free Software Foundation, either version 3 of the License, or (at your
- option) any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see [https://www.gnu.org/licenses/].
-
- If you have Internet connection, the latest version of the AGPL should be
- available at these locations:
- [https://www.fsf.org/licensing/licenses/agpl.html]
- [https://www.gnu.org/licenses/agpl.html]
-
- - Spine (by Doc Reform, related to SiSU) uses standard:
- - docReform markup syntax
- - standard SiSU markup syntax with modified headers and minor modifications
- - docReform object numbering
- - standard SiSU object citation numbering & system
-
- - Homepages:
- [https://www.sisudoc.org]
- [https://www.doc-reform.org]
-
- - Git
- [https://git.sisudoc.org/]
-
-+/
-module doc_reform.io_out.xmls;
-@safe:
-template outputXHTMLs() {
- import
- std.file,
- std.outbuffer,
- std.uri,
- std.conv : to;
- import
- doc_reform.io_out,
- doc_reform.io_out.rgx,
- doc_reform.meta.rgx_files,
- doc_reform.io_out.rgx_xhtml,
- doc_reform.io_out.create_zip_file,
- doc_reform.io_out.xmls,
- doc_reform.io_out.xmls_css;
- mixin spineRgxOut;
- mixin spineRgxXHTML;
- struct outputXHTMLs {
- static auto rgx = RgxO();
- static auto rgx_xhtml = RgxXHTML();
- string div_delimit(
- string section,
- return ref string previous_section
- ) {
- string delimit = "";
- string delimit_ = "";
- if (section != previous_section) {
- switch (section) {
- case "head":
- delimit_ ~= "\n<div class=\"doc_title\">\n" ;
- break;
- case "toc":
- delimit_ ~= "\n<div class=\"doc_toc\">\n" ;
- break;
- case "bookindex":
- delimit_ ~= "\n<div class=\"doc_bookindex\">\n" ;
- break;
- default:
- delimit_ ~= "\n<div class=\"doc_" ~ section ~ "\">\n" ;
- break;
- }
- if (previous_section.length > 0) {
- delimit ~= "\n</div>";
- }
- previous_section = section;
- delimit ~= delimit_;
- }
- // you also need to close the last div, introduce a footer?
- return delimit;
- }
- string special_characters_text(string _txt) {
- _txt = _txt
- .replaceAll(rgx_xhtml.ampersand, "&amp;") // "&#38;"
- .replaceAll(rgx_xhtml.quotation, "&quot;") // "&#34;"
- .replaceAll(rgx_xhtml.less_than, "&lt;") // "&#60;"
- .replaceAll(rgx_xhtml.greater_than, "&gt;") // "&#62;"
- .replaceAll(rgx.br_line, "<br />")
- .replaceAll(rgx.br_line_inline, "<br />")
- .replaceAll(rgx.br_line_spaced, "<br />\n<br />")
- .replaceAll(rgx.nbsp_char, " ");
- return _txt;
- }
- string special_characters_date(string _txt) {
- _txt = _txt
- .replaceAll(regex(r"(?:-00)+"), "")
- .replaceAll(rgx.br_line, "<br />")
- .replaceAll(rgx.br_line_inline, "<br />")
- .replaceAll(rgx.br_line_spaced, "<br />\n<br />")
- .replaceAll(rgx.nbsp_char, " ");
- return _txt;
- }
- string special_characters_breaks_indents_bullets(O)(
- const O obj,
- ) {
- string _txt = special_characters_text(obj.text);
- if (obj.metainfo.is_a == "group") {
- _txt = (_txt)
- .replaceAll(rgx.grouped_para_indent_1,
- "&nbsp;&nbsp;")
- .replaceAll(rgx.grouped_para_indent_2,
- "&nbsp;&nbsp;&nbsp;&nbsp;")
- .replaceAll(rgx.grouped_para_indent_3,
- "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
- .replaceAll(rgx.grouped_para_indent_4,
- "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
- .replaceAll(rgx.grouped_para_indent_5,
- "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
- .replaceAll(rgx.grouped_para_indent_6,
- "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
- .replaceAll(rgx.grouped_para_indent_7,
- "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
- .replaceAll(rgx.grouped_para_indent_8,
- "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
- .replaceAll(rgx.grouped_para_indent_9,
- "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
- .replaceAll(rgx.grouped_para_indent_hang, "&nbsp;&nbsp;")
- .replaceAll(rgx.grouped_para_bullet, "●&nbsp;&nbsp;")
- .replaceAll(rgx.grouped_para_bullet_indent_1,
- "&nbsp;&nbsp;●&nbsp;&nbsp;")
- .replaceAll(rgx.grouped_para_bullet_indent_2,
- "&nbsp;&nbsp;&nbsp;&nbsp;●&nbsp;&nbsp;")
- .replaceAll(rgx.grouped_para_bullet_indent_3,
- "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;●&nbsp;&nbsp;")
- .replaceAll(rgx.grouped_para_bullet_indent_4,
- "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;●&nbsp;&nbsp;")
- .replaceAll(rgx.grouped_para_bullet_indent_5,
- "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;●&nbsp;&nbsp;")
- .replaceAll(rgx.grouped_para_bullet_indent_6,
- "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;●&nbsp;&nbsp;")
- .replaceAll(rgx.grouped_para_bullet_indent_7,
- "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;●&nbsp;&nbsp;")
- .replaceAll(rgx.grouped_para_bullet_indent_8,
- "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;●&nbsp;&nbsp;")
- .replaceAll(rgx.grouped_para_bullet_indent_9,
- "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;●&nbsp;&nbsp;");
- }
- if (!(obj.metainfo.is_a == "code")) {
- _txt = (_txt)
- .replaceAll(rgx_xhtml.line_break, "<br />");
- }
- return _txt;
- }
- string font_face(string _txt) {
- _txt = _txt
- .replaceAll(rgx.inline_emphasis, ("<em>$1</em>"))
- .replaceAll(rgx.inline_bold, ("<b>$1</b>"))
- .replaceAll(rgx.inline_underscore, ("<u>$1</u>"))
- .replaceAll(rgx.inline_italics, ("<i>$1</i>"))
- .replaceAll(rgx.inline_superscript, ("<sup>$1</sup>"))
- .replaceAll(rgx.inline_subscript, ("<sub>$1</sub>"))
- .replaceAll(rgx.inline_strike, ("<del>$1</del>"))
- .replaceAll(rgx.inline_insert, ("<ins>$1</ins>"))
- .replaceAll(rgx.inline_mono, ("<tt>$1</tt>"))
- .replaceAll(rgx.inline_cite, ("<cite>$1</cite>"));
- return _txt;
- }
- string _xhtml_anchor_tags(O)(O obj) {
- string tags="";
- if (obj.tags.anchor_tags.length > 0) {
- foreach (tag; obj.tags.anchor_tags) {
- if (!(tag.empty)) {
- tags ~= "<a name=\"" ~ special_characters_text(tag) ~ "\"></a>";
- }
- }
- }
- return tags;
- }
- string header_metadata(M)(
- M doc_matters,
- ) {
- string _publisher="Publisher"; // TODO
- string o;
- o = format(q"┃<!-- spine DocReform header metadata -->
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta name="dc.title" content="%s" />
- <meta name="dc.author" content="%s" />
- <meta name="dc.publisher" content="%s" />
- <meta name="dc.date" content="%s" />
- <meta name="dc.date.created" content="%s" />
- <meta name="dc.date.issued" content="%syear" />
- <meta name="dc.date.available" content="%syear" />
- <meta name="dc.date.valid" content="%syear" />
- <meta name="dc.date.modified" content="%syear" />
- <meta name="dc.language" content="%s" />
- <meta name="dc.rights" content="%s" />
- <meta name="generator" content="%s" />
- <link rel="generator" href="%s" />
- <!-- spine DocReform header metadata -->┃",
- special_characters_text(doc_matters.conf_make_meta.meta.title_full),
- special_characters_text(doc_matters.conf_make_meta.meta.creator_author),
- _publisher,
- special_characters_date(doc_matters.conf_make_meta.meta.date_published),
- special_characters_text(doc_matters.conf_make_meta.meta.date_created),
- special_characters_text(doc_matters.conf_make_meta.meta.date_issued),
- special_characters_text(doc_matters.conf_make_meta.meta.date_available),
- special_characters_text(doc_matters.conf_make_meta.meta.date_valid),
- special_characters_text(doc_matters.conf_make_meta.meta.date_modified),
- doc_matters.src.language,
- special_characters_text(doc_matters.conf_make_meta.meta.rights_copyright),
- doc_matters.opt.action.generated_by ? special_characters_text(doc_matters.generator_program.name_and_version) : "",
- special_characters_text(doc_matters.generator_program.url_home),
- );
- return o;
- }
- string site_info_button(M)(
- M doc_matters,
- ) {
- string _locations;
- if (doc_matters.conf_make_meta.make.home_button_text.length > 0) {
- _locations = (doc_matters.conf_make_meta.make.home_button_text)
- .replaceAll(
- rgx.inline_link,
- ("<p class=\"tiny_left\"><a href=\"$2\" class=\"lnkicon\">$1</a></p>"))
- .replaceAll(
- rgx.br_line, "")
- .replaceAll(
- rgx.br_line_inline, "");
- } else {
- _locations = "<p class=\"icons\"><a href=\"https://www.doc-reform.org\" class=\"lnkicon\">spine</a></p>\n<p class=\"icons\"><a href=\"https://git.sisudoc.org/software/spine/\" class=\"lnkicon\">sources / git</a></p>\n<p class=\"icons\"><a href=\"https://www.sisudoc.org\" class=\"lnkicon\">www.sisudoc.org</a></p>";
- }
- string o;
- o = format(q"┃<div class="flex-menu-option">
- %s
- </div>┃",
- _locations,
- );
- return o;
- }
- string inline_search_form(M)(
- M doc_matters,
- ) {
- string o;
- string _form;
- if (doc_matters.opt.action.html_link_search) {
- o = format(q"┃
- <div class="flex-menu-option">
- <!-- SiSU Spine Search -->
- <form action="%s" target="_top" method="POST" accept-charset="UTF-8" id="searchtxt">
- &nbsp;&nbsp;<font size="2">%s
- <input type="text" name="sf" size="24" maxlength="255">%s
- <input type="hidden" name="sml" value="1000">
- <input type="hidden" name="ec" value="on">
- <input type="hidden" name="url" value="on">
- <input type="hidden" name="rt" value="txt">
- <button type="submit" form="searchtxt" name="fn" value="%s">&nbsp;• ⚏&nbsp;</button>
- </font></form>
- <!-- SiSU Spine Search -->
- </div>
- <div class="flex-menu-option">
- <!-- SiSU Spine Search -->
- <form action="%s" target="_top" method="POST" accept-charset="UTF-8" id="searchidx">
- &nbsp;&nbsp;<font size="2">
- <input type="text" name="sf" size="24" maxlength="255">%s
- <input type="hidden" name="sml" value="1000">
- <input type="hidden" name="ec" value="on">
- <input type="hidden" name="url" value="on">
- <input type="hidden" name="rt" value="idx">
- <button type="submit" form="searchidx" name="fn" value="%s">&nbsp;• ፨&nbsp;</button>
- <button type="submit" form="searchidx">&nbsp;㏈ ፨</button>
- </font></form>
- <!-- SiSU Spine Search -->
- </div>┃",
- doc_matters.conf_make_meta.conf.w_srv_cgi_action,
- (doc_matters.conf_make_meta.conf.w_srv_db_sqlite_filename.empty)
- ? ""
- : "\n <a href=\""
- ~ doc_matters.conf_make_meta.conf.w_srv_cgi_action
- ~ "\">&#x1f50e;&nbsp;</a>",
- (doc_matters.conf_make_meta.conf.w_srv_db_sqlite_filename.empty)
- ? ""
- : "\n <input type=\"hidden\" name=\"db\" value=\""
- ~ doc_matters.conf_make_meta.conf.w_srv_db_sqlite_filename
- ~ "\">",
- doc_matters.src.filename_base,
- doc_matters.conf_make_meta.conf.w_srv_cgi_action,
- (doc_matters.conf_make_meta.conf.w_srv_db_sqlite_filename.empty)
- ? ""
- : "\n <input type=\"hidden\" name=\"db\" value=\""
- ~ doc_matters.conf_make_meta.conf.w_srv_db_sqlite_filename
- ~ "\">",
- doc_matters.src.filename_base,
- );
- } else {
- o = "";
- }
- return o;
- }
- string html_head(M)(
- M doc_matters,
- string type,
- ) {
- string o;
- string metadata_links = ((doc_matters.opt.action.html_link_curate)
- ? format(q"┃<p class="icons"><a href="%s" class="lnkicon">⟰&nbsp;</a>&nbsp;[<a href="%s" class="lnkicon">&nbsp;%s&nbsp;</a><a href="%sepub/%s.%s.epub" class="lnkicon">&nbsp;◆&nbsp;</a>%s%s<a href="%smetadata.%s.html" class="lnkicon">&nbsp;ℹ&nbsp;</a>]&nbsp;&nbsp;<a href="%s../../index.html" class="lnkicon">&nbsp;≅&nbsp;</a>|<a href="%s../../authors.html" class="lnkicon">&nbsp;&#x1F58B;&nbsp;</a>|<a href="%s../../topics.html" class="lnkicon">&nbsp;⌘&nbsp;</a>|</p>┃",
- (doc_matters.opt.action.webserver_url_doc_root.length > 0)
- ? doc_matters.opt.action.webserver_url_doc_root
- : doc_matters.conf_make_meta.conf.w_srv_data_root_url
- , // HOME index.html equivalent _cfg.www_url_doc_root,
- (type == "seg")
- ? "../" ~ doc_matters.src.filename_base ~ ".html"
- : "./" ~ doc_matters.src.filename_base ~ "/toc.html",
- (type == "seg") ? "▤" : "※",
- (type == "seg") ? "../../" : "../",
- doc_matters.src.filename_base,
- doc_matters.src.lng,
- (doc_matters.opt.action.html_link_pdf || doc_matters.opt.action.html_link_pdf_a4)
- ? ("<a href=\""
- ~ ((type == "seg") ? "../../../" : "../../")
- ~ "pdf/"
- ~ doc_matters.src.filename_base
- ~ "."
- ~ doc_matters.src.lng
- ~ ".a4.portrait.pdf\" class=\"lnkicon\">&nbsp;□&nbsp;</a>")
- : "",
- (doc_matters.opt.action.html_link_pdf || doc_matters.opt.action.html_link_pdf_letter)
- ? ("<a href=\""
- ~ ((type == "seg") ? "../../../" : "../../")
- ~ "pdf/"
- ~ doc_matters.src.filename_base
- ~ "."
- ~ doc_matters.src.lng
- ~ ".letter.portrait.pdf\" class=\"lnkicon\">&nbsp;□&nbsp;</a>")
- : "",
- (type == "seg") ? "../" : "",
- doc_matters.src.filename_base,
- (type == "seg") ? "../" : "",
- (type == "seg") ? "../" : "",
- (type == "seg") ? "../" : "",
- )
- : "");
- o = format(q"┃<!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/plain; charset=UTF-8" />
- <title>
- %s%s
- </title>
- <!-- metadata -->
- %s
- <!-- metadata -->
- <link rel="generator" href="https://www.sisudoc.org/" />
- <link rel="shortcut icon" href="%s../../image/dr.ico" />
- <link href="%s" rel="stylesheet" />
- </head>
- <body lang="%s">
- <a name="top" id="top"></a>
- <div class='delimit headband'>
- <div class="flex-menu-bar">
- %s
- <div class="flex-menu-option">
- %s
- </div>%s
- </div>
- </div>┃",
- special_characters_text(doc_matters.conf_make_meta.meta.title_full),
- (doc_matters.conf_make_meta.meta.creator_author.empty) ? ""
- : ", " ~ special_characters_text(doc_matters.conf_make_meta.meta.creator_author),
- header_metadata(doc_matters),
- ((type == "seg") ? "../" : ""),
- ((type == "seg")
- ? "../../../css/html_seg.css"
- : "../../css/html_scroll.css"),
- doc_matters.src.language,
- site_info_button(doc_matters),
- metadata_links,
- inline_search_form(doc_matters),
- );
- return o;
- }
- string epub3_seg_head(M)(
- M doc_matters,
- ) {
- string html_base = format(q"┃<!DOCTYPE html>
- <html>┃",
- );
- string html_simple = format(q"┃<!DOCTYPE html>
- <html
- xmlns="https://www.w3.org/1999/xhtml"
- xmlns:epub="http://www.idpf.org/2007/ops"
- lang="%s" xml:lang="%s">┃",
- doc_matters.src.language,
- doc_matters.src.language,
- );
- string html_strict = format(q"┃<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html xmlns="https://www.w3.org/1999/xhtml"
- xmlns:epub="http://www.idpf.org/2007/ops"
- lang="%s" xml:lang="%s">┃",
- doc_matters.src.language,
- doc_matters.src.language,
- );
- string o;
- o = format(q"┃%s
- <head>
- <title>
- %s%s
- </title>
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <meta name="dc.title" content="%s" />
- <meta name="dc.author" content="%s" />
- <meta name="dc.publisher" content="FIX" />
- <meta name="dc.date" content="%s" />
- <meta name="dc.date.created" content="%s" />
- <meta name="dc.date.issued" content="%s" />
- <meta name="dc.date.available" content="%s" />
- <meta name="dc.date.valid" content="%s" />
- <meta name="dc.date.modified" content="%s" />
- <meta name="dc.language" content="%s" />
- <meta name="dc.rights" content="%s" />
- <meta name="generator" content="%s" />
- <link rel="generator" href="%s" />
- <link rel="shortcut icon" href="../_dr/image/dr.ico" />
- <link rel="stylesheet" href="Styles/epub.css" type="text/css" id="main-css" />
- </head>
- <body lang="%s">
- <a name="top" id="top"></a>┃",
- html_simple,
- special_characters_text(doc_matters.conf_make_meta.meta.title_full),
- (doc_matters.conf_make_meta.meta.creator_author.empty) ? ""
- : ", " ~ special_characters_text(doc_matters.conf_make_meta.meta.creator_author),
- special_characters_text(doc_matters.conf_make_meta.meta.title_full),
- (doc_matters.conf_make_meta.meta.creator_author.empty) ? ""
- : ", " ~ special_characters_text(doc_matters.conf_make_meta.meta.creator_author),
- special_characters_date(doc_matters.conf_make_meta.meta.date_published),
- special_characters_text(doc_matters.conf_make_meta.meta.date_created),
- special_characters_text(doc_matters.conf_make_meta.meta.date_issued),
- special_characters_text(doc_matters.conf_make_meta.meta.date_available),
- special_characters_text(doc_matters.conf_make_meta.meta.date_valid),
- special_characters_text(doc_matters.conf_make_meta.meta.date_modified),
- doc_matters.src.language,
- special_characters_text(doc_matters.conf_make_meta.meta.rights_copyright),
- special_characters_text(doc_matters.generator_program.name_and_version),
- special_characters_text(doc_matters.generator_program.url_home),
- doc_matters.src.language,
- );
- return o;
- }
-string dom_close() {
- string o;
- o = format(q"┃</div>┃");
- return o;
-}
-string tail(M)(M doc_matters) {
- string o;
- o = format(q"┃<hr />
- <div class="rights">
- <p class="small" id="copyright"><a name="copyright"></a>
- <b>Copyright:</b> %s
- </p>
- </div>
- %s
- <div class="rights">
- <p class="small" id="rights"><a name="rights"></a>
- %s
- </p>
- </div>
- <hr />
- <div class="generator">
- <p class="small_center" id="sisu_spine"><a name="sisu_spine"></a>
- <a href="https://sisudoc.org" class="lnkicon">≅ SiSU Spine ፨</a> (object numbering &amp; object search)
- </p>
- <p class="small_center" id="sisu_spine"><a name="sisu_spine"></a>
- (web 1993, object numbering 1997, object search 2002 ...) 2024
- </p>
- </div>
- <a name="bottom" id="bottom"></a>
- <a name="end" id="end"></a>
-</body>
-</html>
-┃",
- special_characters_text(doc_matters.conf_make_meta.meta.rights_copyright),
- ((doc_matters.conf_make_meta.meta.rights_license).empty) ? "" : "<br />",
- ((doc_matters.conf_make_meta.meta.rights_license).empty) ? ""
- : "<b>License:</b> " ~ special_characters_text(doc_matters.conf_make_meta.meta.rights_license)
- );
- return o;
-}
- string inline_images(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- string _xml_type = "seg",
- ) {
- string _img_pth;
- switch (_xml_type) {
- case "epub": _img_pth = "image/"; break;
- case "scroll": _img_pth = format(q"┃%s/image/┃", "../.."); break;
- case "seg": _img_pth = format(q"┃%s/image/┃", "../../.."); break;
- default: break;
- }
- if (_txt.match(rgx.inline_image)) {
- _txt = _txt
- .replaceAll(rgx.inline_image,
- ("$1<img src=\""
- ~ _img_pth
- ~ "$3\" width=\"$4\" height=\"$5\" naturalsizeflag=\"0\" align=\"bottom\" border=\"0\" /> $6"))
- .replaceAll(
- rgx.inline_link_empty,
- ("$1"));
- }
- return _txt;
- }
- string inline_links(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- string _xml_type = "seg",
- ) {
- string seg_lvs;
- if (obj.has.inline_links) {
- if (obj.metainfo.is_a != "code") {
- _txt = replaceAll!(m =>
- m[1] ~ "┤"
- ~ (replaceAll!(n =>
- n["type"] ~ n["path"] ~ (n["file"].encodeComponent)
- )((obj.stow.link[m["num"].to!ulong]).to!string, rgx.uri_identify_components))
- ~ "├"
- )(_txt, rgx.inline_link_number_only);
- }
- if ((_txt.match(rgx.mark_internal_site_lnk))
- && (_xml_type == "scroll")) { // conditions reversed to avoid: gdc compiled program run segfault
- _txt = _txt.replaceAll(
- rgx.inline_seg_link,
- "$1");
- }
- if (_xml_type == "seg" || _xml_type == "epub") {
- seg_lvs = (_xml_type == "epub") ? "seg_lv1to4" : "seg_lv4";
- foreach (m; _txt.match(rgx.inline_link_hash)) {
- if (m.captures["hash"] in doc_matters.has.tag_associations) {
- if (
- m.captures["hash"]
- == doc_matters.has.tag_associations[(m.captures["hash"])][seg_lvs]
- ) {
- _txt = _txt.replaceFirst(
- rgx.inline_link_hash,
- "┥$1┝┤$3" ~ _suffix ~ "├"
- );
- } else {
- _txt = _txt.replaceFirst(
- rgx.inline_link_hash,
- "┥$1┝┤"
- ~ doc_matters.has.tag_associations[(m.captures["hash"])][seg_lvs]
- ~ _suffix ~ "#" ~ "$3"
- ~ "├"
- );
- }
- } else {
- if (doc_matters.opt.action.vox_gt0) {
- writeln(
- "WARNING on internal document links, anchor to link <<"
- ~ m.captures["hash"]
- ~ ">> not found in document, "
- ~ "anchor: " ~ m.captures["hash"]
- ~ " document: " ~ doc_matters.src.filename
- );
- }
- }
- }
- }
- _txt = _txt
- .replaceAll(
- rgx.inline_link_fn_suffix,
- ("$1" ~ _suffix))
- .replaceAll(
- rgx.inline_link,
- ("<a href=\"$2\">$1</a>"))
- .replaceAll(
- rgx.mark_internal_site_lnk,
- "");
- }
- debug(markup_links) {
- if (_txt.match(rgx.inline_link)) {
- writeln(__LINE__,
- " (missed) markup link identified (",
- obj.has.inline_links,
- "): ", obj.metainfo.is_a, ": ",
- obj.text
- );
- }
- }
- debug(markup) {
- if (_txt.match(rgx.inline_link)) {
- writeln(__LINE__,
- " (missed) markup link identified (",
- obj.has.inline_links,
- "): ", obj.metainfo.is_a, ": ",
- obj.text
- );
- }
- }
- return _txt;
- }
- string inline_notes_scroll(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- ) {
- if (obj.has.inline_notes_reg) {
- _txt = font_face(_txt);
- _txt = _txt.replaceAll(
- rgx.inline_notes_al_regular_number_note,
- ("<a href=\"#note_$1\"><note id=\"noteref_$1\">&#160;<sup>$1</sup> </note></a>")
- );
- }
- if (obj.has.inline_notes_star) {
- _txt = font_face(_txt);
- _txt = _txt.replaceAll(
- rgx.inline_notes_al_special_char_note,
- ("<a href=\"#note_$1\"><note id=\"noteref_$1\">&#160;<sup>$1</sup> </note></a>")
- );
- }
- debug(markup_endnotes) {
- if (_txt.match(rgx.inline_notes_al_regular_number_note)) {
- writeln(__LINE__, " (missed) markup endnote: ", obj.metainfo.is_a, ": ", obj.text);
- }
- }
- debug(markup) {
- if (_txt.match(rgx.inline_notes_al_regular_number_note)) {
- writeln(__LINE__, " (missed) markup endnote: ", obj.metainfo.is_a, ": ", obj.text);
- }
- }
- return _txt;
- }
- Tuple!(string, string[]) inline_notes_seg(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- ) {
- string[] _endnotes;
- if (obj.has.inline_notes_star) {
- _txt = font_face(_txt);
- /+ need markup for text, and separated footnote +/
- foreach(m; _txt.matchAll(rgx.inline_notes_al_special_char_note)) {
- _endnotes ~= format(
- "%s%s%s%s\n %s%s%s%s%s %s\n%s",
- "<p class=\"endnote\">",
- "<a href=\"#noteref_",
- m.captures[1],
- "\">",
- "<note id=\"note_",
- m.captures[1],
- "\">&#160;<sup>",
- m.captures[1],
- ".</sup></note></a>",
- m.captures[2],
- "</p>"
- );
- }
- _txt = _txt.replaceAll(
- rgx.inline_notes_al_special_char_note,
- ("<a href=\"#note_$1\"><note id=\"noteref_$1\">&#160;<sup>$1</sup> </note></a>")
- );
- }
- if (obj.has.inline_notes_reg) {
- _txt = font_face(_txt);
- /+ need markup for text, and separated footnote +/
- foreach(m; _txt.matchAll(rgx.inline_notes_al_regular_number_note)) {
- _endnotes ~= format(
- "%s%s%s%s\n %s%s%s%s%s %s\n%s",
- "<p class=\"endnote\">",
- "<a href=\"#noteref_",
- m.captures[1],
- "\">",
- "<note id=\"note_",
- m.captures[1],
- "\">&#160;<sup>",
- m.captures[1],
- ".</sup></note></a>",
- m.captures[2],
- "</p>"
- );
- }
- _txt = _txt.replaceAll(
- rgx.inline_notes_al_regular_number_note,
- ("<a href=\"#note_$1\"><note id=\"noteref_$1\">&#160;<sup>$1</sup> </note></a>")
- );
- } else if (_txt.match(rgx.inline_notes_al_regular_number_note)) {
- debug(markup) {
- writeln(__LINE__, " endnote: ", obj.metainfo.is_a, ": ", obj.text);
- }
- }
- Tuple!(string, string[]) t = tuple(
- _txt,
- _endnotes,
- );
- return t;
- }
- string inline_markup_scroll(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- ) {
- if (obj.metainfo.dummy_heading
- && (obj.metainfo.is_a == "toc" || obj.metainfo.is_a == "heading")) {
- _txt = "";
- } else {
- _txt = inline_images(_txt, obj, doc_matters, _suffix, "scroll");
- _txt = inline_links(_txt, obj, doc_matters, _suffix, "scroll");
- _txt = inline_notes_scroll(_txt, obj, doc_matters);
- }
- return _txt;
- }
- Tuple!(string, string[]) inline_markup_seg(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- string _xml_type = "seg",
- ) {
- if (obj.metainfo.dummy_heading
- && ((_xml_type == "epub"
- && (obj.metainfo.is_a == "toc" || obj.metainfo.is_a == "heading"))
- || obj.metainfo.is_a == "heading")
- ) {
- _txt = "";
- } else {
- _txt = inline_images(_txt, obj, doc_matters, _suffix, _xml_type); // TODO
- _txt = inline_links(_txt, obj, doc_matters, _suffix, _xml_type); // TODO
- }
- Tuple!(string, string[]) t = inline_notes_seg(_txt, obj, doc_matters);
- return t;
- }
- string lev4_heading_subtoc(O,M)(
- const O obj,
- M doc_matters,
- ) {
- char[] lev4_subtoc;
- lev4_subtoc ~= " <div class=\"nav\">\n";
- foreach (subtoc; obj.tags.lev4_subtoc) {
- if (auto m = subtoc.match(rgx.inline_link_subtoc)) {
- auto indent = (m.captures[1].to!int - 3).to!string; // css assumptions based on use of em for left margin & indent
- auto text = m.captures[2].to!string;
- 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">
- ۰ <a href="%s">%s</a>
- </p>
- ┃",
- indent,
- indent,
- link,
- text,
- ));
- }
- }
- lev4_subtoc ~= " </div>\n";
- return lev4_subtoc.to!string;
- }
- auto nav_pre_next_svg(O,M)(
- const O obj,
- M doc_matters,
- ) {
- string prev, next, toc;
- if (obj.tags.segment_anchor_tag_epub == "toc") {
- toc = "";
- prev = "";
- } else {
- 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>┃",
- );
- }
- if (obj.tags.segname_prev == "") {
- prev = "";
- } else {
- 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>┃",
- obj.tags.segname_prev,
- );
- }
- if (obj.tags.segname_next == "") {
- next = "";
- } else {
- 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>┃",
- obj.tags.segname_next,
- );
- }
- string _toc_pre_next = format(q"┃ <div class="nav-bar">
- %s
- %s
- %s
- </div>┃",
- toc,
- prev,
- next,
- );
- string _pre_next = format(q"┃ <div class="nav-bar">
- %s
- %s
- </div>┃",
- prev,
- next,
- );
- struct bar {
- string toc_pre_next() {
- return _toc_pre_next;
- }
- string pre_next() {
- return _pre_next;
- }
- }
- return bar();
- }
- string heading(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _xml_type = "html",
- ) {
- assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter");
- assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb");
- assert(obj.metainfo.is_of_type == "para");
- assert(obj.metainfo.is_a == "heading");
- string tags = _xhtml_anchor_tags(obj);
- string heading_lev_anchor_tag;
- string _horizontal_rule = "<hr />";
- if ((_xml_type != "html")
- || (obj.metainfo.heading_lev_markup == 0 || obj.metainfo.heading_lev_markup > 4)) {
- _horizontal_rule = "";
- }
- _txt = font_face(_txt);
- string o;
- heading_lev_anchor_tag = (obj.tags.heading_lev_anchor_tag.empty)
- ? ""
- : "<a name=\"" ~ obj.tags.heading_lev_anchor_tag ~ "\"></a>";
- if (_txt.empty) {
- o = format(q"┃%s
- ┃",
- _horizontal_rule,
- );
- } else {
- o = "";
- if (obj.metainfo.is_of_section == "toc") {
- o ~= format(q"┃
- <div class="substance">
- <p class="small" id="copyright"><a name="copyright"></a>
- Copyright: %s
- </p>
- <!-- <p class="small" id="rights"><a name="rights"></a>
- %s
- </p> -->
- </div>┃",
- special_characters_text(doc_matters.conf_make_meta.meta.rights_copyright),
- special_characters_text(doc_matters.conf_make_meta.meta.rights_license)
- );
- }
- }
- if (!(obj.metainfo.identifier.empty)) {
- 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>┃",
- _horizontal_rule,
- obj.metainfo.identifier,
- (doc_matters.opt.action.ocn_off)
- ? "" : ((obj.metainfo.object_number.empty)
- ? "" : obj.metainfo.identifier),
- ((_xml_type == "epub" && obj.metainfo.heading_lev_markup == 0) ? 1
- : obj.metainfo.heading_lev_markup),
- obj.metainfo.is_a,
- obj.metainfo.identifier,
- obj.metainfo.identifier,
- tags,
- heading_lev_anchor_tag,
- _txt,
- ((_xml_type == "epub" && obj.metainfo.heading_lev_markup == 0) ? 1
- : obj.metainfo.heading_lev_markup),
- );
- } else {
- o ~= format(q"┃%s
- <div class="substance">
- <h%s class="%s">%s%s
- %s
- </h%s>
- </div>┃",
- _horizontal_rule,
- ((_xml_type == "epub" && obj.metainfo.heading_lev_markup == 0) ? 1
- : obj.metainfo.heading_lev_markup),
- obj.metainfo.is_a,
- tags,
- heading_lev_anchor_tag,
- _txt,
- ((_xml_type == "epub" && obj.metainfo.heading_lev_markup == 0) ? 1
- : obj.metainfo.heading_lev_markup),
- );
- }
- return o;
- }
- string heading_scroll(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- ) {
- _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix);
- string o = heading(_txt, obj, doc_matters);
- return o;
- }
- Tuple!(string, string[]) heading_seg(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- string _xml_type = "html",
- ) {
- Tuple!(string, string[]) t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type);
- _txt = t[0];
- string[] _endnotes = t[1];
- string o = heading(_txt, obj, doc_matters, _xml_type);
- Tuple!(string, string[]) u = tuple(
- o,
- _endnotes,
- );
- return u;
- }
- string para(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- ) {
- assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter");
- assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb");
- assert(obj.metainfo.is_of_type == "para");
- assert(obj.metainfo.is_a == "para" || "toc" || "endnote" || "glossary" || "bibliography" || "bookindex" || "blurb");
- string tags = _xhtml_anchor_tags(obj);
- _txt = font_face(_txt);
- string o;
- _txt = (obj.attrib.bullet) ? ("●&#160;&#160;" ~ _txt) : _txt;
- _txt = _txt.replaceFirst(rgx.inline_link_anchor,
- "<a name=\"$1\"></a>");
- if (!(obj.metainfo.identifier.empty)) {
- 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>┃",
- obj.metainfo.identifier,
- (doc_matters.opt.action.ocn_off)
- ? ""
- : ((obj.metainfo.object_number.empty)
- ? ""
- : obj.metainfo.identifier),
- obj.metainfo.is_a,
- obj.attrib.indent_hang,
- obj.attrib.indent_base,
- obj.metainfo.identifier,
- tags,
- _txt
- );
- } else {
- o = format(q"┃ <div class="substance">
- <p class="%s" indent="h%si%s">%s
- %s
- </p>
- </div>┃",
- obj.metainfo.is_a,
- obj.attrib.indent_hang,
- obj.attrib.indent_base,
- tags,
- _txt
- );
- }
- return o;
- }
- string para_scroll(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- ) {
- if (obj.metainfo.is_a == "toc" && _txt.match(rgx.inline_link_toc_to_backmatter)) {
- _txt = _txt.replaceAll(rgx.inline_link_toc_to_backmatter, "┤#section_$1├");
- }
- _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix);
- string o = para(_txt, obj, doc_matters);
- return o;
- }
- Tuple!(string, string[]) para_seg(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- string _xml_type = "html",
- ) {
- Tuple!(string, string[]) t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type);
- _txt = t[0].to!string;
- string[] _endnotes = t[1];
- string o = para(_txt, obj, doc_matters);
- Tuple!(string, string[]) u = tuple(
- o,
- _endnotes,
- );
- return u;
- }
- string quote(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- ) {
- assert(obj.metainfo.is_of_part == "body");
- assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
- assert(obj.metainfo.is_of_type == "block");
- assert(obj.metainfo.is_a == "quote");
- _txt = font_face(_txt);
- string o;
- if (!(obj.metainfo.identifier.empty)) {
- 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>┃",
- obj.metainfo.identifier,
- (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier),
- obj.metainfo.is_a,
- obj.metainfo.identifier,
- _txt
- );
- } else {
- o = format(q"┃ <div class="substance">
- <p class="%s">
- %s
- </p>
- </div>┃",
- obj.metainfo.is_a,
- _txt
- );
- }
- return o;
- }
- string quote_scroll(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- ) {
- _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix);
- string o = quote(_txt, obj, doc_matters);
- return o;
- }
- Tuple!(string, string[]) quote_seg(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- string _xml_type = "html",
- ) {
- Tuple!(string, string[]) t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type);
- _txt = t[0].to!string;
- string[] _endnotes = t[1];
- string o = quote(_txt, obj, doc_matters);
- Tuple!(string, string[]) u = tuple(
- o,
- _endnotes,
- );
- return u;
- }
- string group(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- ) {
- assert(obj.metainfo.is_of_part == "body");
- assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
- assert(obj.metainfo.is_of_type == "block");
- assert(obj.metainfo.is_a == "group");
- _txt = font_face(_txt);
- string o;
- if (!(obj.metainfo.identifier.empty)) {
- 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>┃",
- obj.metainfo.identifier,
- (doc_matters.opt.action.ocn_off) ? ""
- : ((obj.metainfo.object_number.empty) ? ""
- : obj.metainfo.identifier),
- obj.metainfo.is_a,
- obj.metainfo.identifier,
- _txt
- );
- } else {
- o = format(q"┃ <div class="substance">
- <p class="%s">
- %s
- </p>
- </div>┃",
- obj.metainfo.is_a,
- _txt
- );
- }
- return o;
- }
- string group_scroll(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- string _xml_type = "html",
- ) {
- _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix);
- string o = group(_txt, obj, doc_matters);
- return o;
- }
- Tuple!(string, string[]) group_seg(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- string _xml_type = "html",
- ) {
- Tuple!(string, string[]) t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type);
- _txt = t[0].to!string;
- string[] _endnotes = t[1];
- string o = group(_txt, obj, doc_matters);
- Tuple!(string, string[]) u = tuple(
- o,
- _endnotes,
- );
- return u;
- }
- string block(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- ) {
- assert(obj.metainfo.is_of_part == "body");
- assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
- assert(obj.metainfo.is_of_type == "block");
- assert(obj.metainfo.is_a == "block");
- _txt = font_face(_txt);
- string o;
- if (!(obj.metainfo.identifier.empty)) {
- 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>┃",
- obj.metainfo.identifier,
- (doc_matters.opt.action.ocn_off) ? ""
- : ((obj.metainfo.object_number.empty) ? ""
- : obj.metainfo.identifier),
- obj.metainfo.is_a,
- obj.metainfo.identifier,
- _txt.stripRight
- );
- } else {
- o = format(q"┃ <div class="substance">
- <p class="%s">%s</p>
- </div>┃",
- obj.metainfo.is_a,
- _txt.stripRight
- );
- }
- return o;
- }
- string block_scroll(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- string _xml_type = "html",
- ) {
- _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix);
- string o = block(_txt, obj, doc_matters);
- return o;
- }
- Tuple!(string, string[]) block_seg(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- string _xml_type = "html",
- ) {
- Tuple!(string, string[]) t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type);
- _txt = t[0].to!string;
- string[] _endnotes = t[1];
- string o = block(_txt, obj, doc_matters);
- Tuple!(string, string[]) u = tuple(
- o,
- _endnotes,
- );
- return u;
- }
- string verse(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- ) {
- assert(obj.metainfo.is_of_part == "body");
- assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
- assert(obj.metainfo.is_of_type == "block");
- assert(obj.metainfo.is_a == "verse");
- _txt = font_face(_txt);
- string o;
- if (!(obj.metainfo.identifier.empty)) {
- 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>┃",
- obj.metainfo.identifier,
- (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier),
- obj.metainfo.is_a,
- obj.metainfo.identifier,
- _txt
- );
- } else {
- o = format(q"┃ <div class="substance">
- <p class="%s">%s</p>
- </div>┃",
- obj.metainfo.is_a,
- _txt
- );
- }
- return o;
- }
- string verse_scroll(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- string _xml_type = "html",
- ) {
- _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix);
- string o = verse(_txt, obj, doc_matters);
- return o;
- }
- Tuple!(string, string[]) verse_seg(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- string _xml_type = "html",
- ) {
- Tuple!(string, string[]) t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type);
- _txt = t[0].to!string;
- string[] _endnotes = t[1];
- string o = verse(_txt, obj, doc_matters);
- Tuple!(string, string[]) u = tuple(
- o,
- _endnotes,
- );
- return u;
- }
- Tuple!(string, string) tablarize(O)(
- string _txt,
- const O obj,
- ) {
- string[] _table_rows = (_txt).split(rgx.table_delimiter_row);
- string[] _table_cols;
- string _table;
- string _tablenote;
- foreach(row_idx, row; _table_rows) {
- _table_cols = row.split(rgx.table_delimiter_col);
- _table ~= "<tr>";
- foreach(col_idx, cell; _table_cols) {
- if ((_table_cols.length == 1)
- && (_table_rows.length <= row_idx+2)) {
- _tablenote ~= cell;
- } else {
- string _col_is = (row_idx == 0 && obj.table.heading) ? "th" : "td";
- string _align = ("style=\"text-align:"
- ~ ((obj.table.column_aligns[col_idx] == "l")
- ? "left\"" : "right\""));
- _table ~= "<" ~ _col_is ~ " width=\"" ~ obj.table.column_widths[col_idx].to!string ~ "%\" " ~ _align ~ ">";
- _table ~= cell;
- _table ~= "</" ~ _col_is ~ ">";
- }
- }
- _table ~= "</tr>";
- }
- Tuple!(string, string) t = tuple(
- _table,
- _tablenote,
- );
- return t;
- }
- string table(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- ) {
- assert(obj.metainfo.is_of_part == "body");
- assert(obj.metainfo.is_of_section == "body");
- assert(obj.metainfo.is_of_type == "block");
- assert(obj.metainfo.is_a == "table");
- string tags = _xhtml_anchor_tags(obj);
- _txt = font_face(_txt);
- auto t = tablarize(_txt, obj);
- _txt = t[0];
- string _note = t[1];
- string o;
- 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" cellpadding="2" align="center">
- %s
- </table>
- %s
- </p>
- </div>┃",
- obj.metainfo.object_number,
- (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier),
- obj.metainfo.is_a,
- obj.metainfo.object_number,
- tags,
- _txt,
- _note
- );
- return o;
- }
- string code(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- ) {
- assert(obj.metainfo.is_of_part == "body");
- assert(obj.metainfo.is_of_section == "body");
- assert(obj.metainfo.is_of_type == "block");
- assert(obj.metainfo.is_a == "code");
- string o;
- string codelines(string _txt) {
- string _codelines;
- if (obj.code_block.linenumbers) {
- string[] _block_lines = (_txt).split(rgx.br_linebreaks_newlines);
- _codelines = " <pre class=\"codeline\">\n";
- foreach (k, _line; _block_lines) {
- if (k == 1) {
- _codelines ~= format(q"┃ <span class="tr first-row"><span class="th"></span><codeline>%s</codeline></span>
- ┃",
- _line,
- );
- } else {
- _codelines ~= format(q"┃ <span class="tr"><span class="th"></span><codeline>%s</codeline></span>
- ┃",
- _line,
- );
- }
- }
- _codelines ~= " </pre>";
- } else {
- _codelines = " <pre class=\"codeline\">\n";
- _codelines ~= _txt;
- _codelines ~= " </pre>";
- }
- return _codelines;
- }
- if (!(obj.metainfo.identifier.empty)) {
- 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>┃",
- obj.metainfo.identifier,
- (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier),
- obj.metainfo.is_a,
- obj.metainfo.identifier,
- codelines(_txt)
- );
- } else {
- o = format(q"┃ <div class="substance">
- <p class="%s">%s</p>
- </div>┃",
- obj.metainfo.is_a,
- codelines(_txt)
- );
- }
- return o;
- }
- }
-}