aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sisudoc/io_out
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/sisudoc/io_out
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/sisudoc/io_out')
-rw-r--r--src/sisudoc/io_out/cgi_sqlite_search_form.d1959
-rw-r--r--src/sisudoc/io_out/create_zip_file.d68
-rw-r--r--src/sisudoc/io_out/defaults.d186
-rw-r--r--src/sisudoc/io_out/epub3.d810
-rw-r--r--src/sisudoc/io_out/html.d626
-rw-r--r--src/sisudoc/io_out/html_snippet.d103
-rw-r--r--src/sisudoc/io_out/hub.d238
-rw-r--r--src/sisudoc/io_out/latex.d1771
-rw-r--r--src/sisudoc/io_out/metadata.d609
-rw-r--r--src/sisudoc/io_out/odt.d2162
-rw-r--r--src/sisudoc/io_out/package.d69
-rw-r--r--src/sisudoc/io_out/paths_output.d672
-rw-r--r--src/sisudoc/io_out/rgx.d157
-rw-r--r--src/sisudoc/io_out/rgx_latex.d68
-rw-r--r--src/sisudoc/io_out/rgx_xhtml.d63
-rw-r--r--src/sisudoc/io_out/source_pod.d424
-rw-r--r--src/sisudoc/io_out/sqlite.d1761
-rw-r--r--src/sisudoc/io_out/xmls.d1424
-rw-r--r--src/sisudoc/io_out/xmls_css.d4451
19 files changed, 17621 insertions, 0 deletions
diff --git a/src/sisudoc/io_out/cgi_sqlite_search_form.d b/src/sisudoc/io_out/cgi_sqlite_search_form.d
new file mode 100644
index 0000000..e835b07
--- /dev/null
+++ b/src/sisudoc/io_out/cgi_sqlite_search_form.d
@@ -0,0 +1,1959 @@
+/+
+- 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 - 2022 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.doc_reform.org]
+ [https://www.sisudoc.org]
+
+ - Git
+ [https://git.sisudoc.org/projects/?p=software/spine.git;a=summary]
+
++/
+module doc_reform.io_out.cgi_sqlite_search_form;
+template CGIsearchSQLite() {
+ void CGIsearchSQLite(E,O,M)(E env, O opt_action, M make_and_meta_struct) {
+ import
+ std.file,
+ std.format;
+ import doc_reform.io_out;
+ string _sqlite_db_fn = (opt_action.sqliteDB_filename.empty)
+ ? make_and_meta_struct.conf.w_srv_db_sqlite_filename
+ : opt_action.sqliteDB_filename;
+ string _cgi_search_script = (opt_action.cgi_sqlite_search_filename.empty)
+ ? make_and_meta_struct.conf.w_srv_cgi_search_script
+ : opt_action.cgi_sqlite_search_filename;
+ string _cgi_search_script_raw_fn_d = (opt_action.cgi_sqlite_search_filename_d.empty)
+ ? make_and_meta_struct.conf.w_srv_cgi_search_script_raw_fn_d
+ : opt_action.cgi_sqlite_search_filename_d;
+ string get_doc_collection_subroot(string output_path) {
+ string web_doc_root_path = environment.get("DOCUMENT_ROOT", "/var/www/html");
+ auto m = output_path.matchFirst(regex("^(" ~ web_doc_root_path ~ ")"));
+ return m.post;
+ }
+ string the_cgi_search_form = format(q"≓
+/+ dub.sdl
+ name "spine search"
+ description "spine cgi search"
++/
+import std.format;
+import std.range;
+import std.regex;
+import arsd.cgi;
+import d2sqlite3;
+import std.process : environment;
+void cgi_function_intro(Cgi cgi) {
+ string header;
+ string table;
+ string form;
+ struct Config {
+ string http_request_type;
+ string http_host;
+ // string server_name;
+ string web_doc_root_path;
+ string doc_collection_subroot;
+ string cgi_root;
+ string cgi_script;
+ string data_path_html;
+ string db_path;
+ string query_string;
+ string http_url;
+ string request_method;
+ }
+ auto conf = Config();
+ conf.http_request_type = environment.get("REQUEST_SCHEME", "http");
+ conf.http_host = environment.get("HTTP_HOST", "localhost");
+ // conf.server_name = environment.get("SERVER_NAME", "localhost");
+ conf.web_doc_root_path = environment.get("DOCUMENT_ROOT", "/var/www/html");
+ conf.doc_collection_subroot = "%s"; // (output_path - web_doc_root_path)
+ conf.cgi_root = environment.get("CONTEXT_DOCUMENT_ROOT", "/usr/lib/cgi-bin/");
+ // conf.cgi_script = environment.get("SCRIPT_NAME", "/cgi-bin/spine-search");
+ conf.query_string = environment.get("QUERY_STRING", "");
+ conf.http_url = environment.get("HTTP_REFERER", conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ "?" ~ conf.query_string);
+ conf.db_path = "%s"; // (output_path + /sqlite)
+ conf.request_method = environment.get("REQUEST_METHOD", "POST");
+ struct CGI_val {
+ string db_selected = "";
+ string sql_match_limit = ""; // radio: ( 1000 | 2500 )
+ string sql_match_offset = "";
+ string search_text = "";
+ string results_type = ""; // index
+ bool checked_echo = false;
+ bool checked_stats = false;
+ bool checked_url = false;
+ bool checked_searched = false;
+ bool checked_tip = false;
+ bool checked_sql = false;
+ }
+ auto cv = CGI_val();
+ cv.db_selected = "%s";
+ auto text_fields() {
+ string canned_query_str = environment.get("QUERY_STRING", "");
+ if ("query_string" in cgi.post) {
+ canned_query_str = environment.get("QUERY_STRING", "");
+ }
+ string[string] canned_query;
+ if (conf.request_method == "POST") {
+ } else if (conf.request_method == "GET") {
+ foreach (pair_str; canned_query_str.split("&")) {
+ // cgi.write(pair_str ~ "<br>");
+ string[] pair = pair_str.split("=");
+ canned_query[pair[0]] = pair[1];
+ }
+ // foreach (field, content; canned_query) {
+ // cgi.write(field ~ ": " ~ content ~ "<br>");
+ // }
+ }
+ static struct Rgx {
+ // static canned_query = ctRegex!(`\A(?P<matched>.+)\Z`, "m");
+ static search_text_area = ctRegex!(`\A(?P<matched>.+)\Z`, "m");
+ // static fulltext = ctRegex!(`\A(?P<matched>.+)\Z`, "m");
+ static line = ctRegex!(`^(?P<matched>.+?)(?: ~|$)`, "m");
+ static text = ctRegex!(`(?:^|\s~\s*)text:\s+(?P<matched>.+?)(?: ~|$)`, "m");
+ static author = ctRegex!(`(?:^|\s~\s*)author:\s+(?P<matched>.+)$`, "m");
+ static title = ctRegex!(`(?:^|\s~\s*)title:\s+(?P<matched>.+)$`, "m");
+ static uid = ctRegex!(`(?:^|\s~\s*)uid:\s+(?P<matched>.+)$`, "m");
+ static fn = ctRegex!(`(?:^|\s~\s*)fn:\s+(?P<matched>.+)$`, "m");
+ static keywords = ctRegex!(`(?:^|\s~\s*)keywords:\s+(?P<matched>.+)$`, "m");
+ static topic_register = ctRegex!(`(?:^|\s~\s*)topic_register:\s+(?P<matched>.+)$`, "m");
+ static subject = ctRegex!(`(?:^|\s~\s*)subject:\s+(?P<matched>.+)$`, "m");
+ static description = ctRegex!(`(?:^|\s~\s*)description:\s+(?P<matched>.+)$`, "m");
+ static publisher = ctRegex!(`(?:^|\s~\s*)publisher:\s+(?P<matched>.+)$`, "m");
+ static editor = ctRegex!(`(?:^|\s~\s*)editor:\s+(?P<matched>.+)$`, "m");
+ static contributor = ctRegex!(`(?:^|\s~\s*)contributor:\s+(?P<matched>.+)$`, "m");
+ static date = ctRegex!(`(?:^|\s~\s*)date:\s+(?P<matched>.+)$`, "m");
+ static results_type = ctRegex!(`(?:^|\s~\s*)type:\s+(?P<matched>.+)$`, "m");
+ static format = ctRegex!(`(?:^|\s~\s*)format:\s+(?P<matched>.+)$`, "m");
+ static source = ctRegex!(`(?:^|\s~\s*)source:\s+(?P<matched>.+)$`, "m");
+ static language = ctRegex!(`(?:^|\s~\s*)language:\s+(?P<matched>.+)$`, "m");
+ static relation = ctRegex!(`(?:^|\s~\s*)relation:\s+(?P<matched>.+)$`, "m");
+ static coverage = ctRegex!(`(?:^|\s~\s*)coverage:\s+(?P<matched>.+)$`, "m");
+ static rights = ctRegex!(`(?:^|\s~\s*)rights:\s+(?P<matched>.+)$`, "m");
+ static comment = ctRegex!(`(?:^|\s~\s*)comment:\s+(?P<matched>.+)$`, "m");
+ // static abstract_ = ctRegex!(`(?:^|\s~\s*)abstract:\s+(?P<matched>.+)$`, "m");
+ static src_filename_base = ctRegex!(`^src_filename_base:\s+(?P<matched>.+)$`, "m");
+ }
+ struct searchFields {
+ string canned_query = ""; // GET canned_query == cq
+ string search_text_area = ""; // POST search_text_area == tsa
+ string text = ""; // text == txt
+ string author = ""; // author == au
+ string title = ""; // title == ti
+ string uid = ""; // uid == uid
+ string fn = ""; // fn == fn
+ string keywords = ""; // keywords == kw
+ string topic_register = ""; // topic_register == tr
+ string subject = ""; // subject == su
+ string description = ""; // description == de
+ string publisher = ""; // publisher == pb
+ string editor = ""; // editor == ed
+ string contributor = ""; // contributor == ct
+ string date = ""; // date == dt
+ string format = ""; // format == fmt
+ string source = ""; // source == src sfn
+ string language = ""; // language == lng
+ string relation = ""; // relation == rl
+ string coverage = ""; // coverage == cv
+ string rights = ""; // rights == rgt
+ string comment = ""; // comment == cmt
+ // string abstract = "";
+ string src_filename_base = ""; // src_filename_base == bfn
+ string results_type = ""; // results_type == rt radio
+ string sql_match_limit = ""; // sql_match_limit == sml radio
+ string sql_match_offset = ""; // sql_match_offset == smo
+ string stats = ""; // stats == sts checked
+ string echo = ""; // echo == ec checked
+ string url = ""; // url == url checked
+ string searched = ""; // searched == se checked
+ string sql = ""; // sql == sql checked
+ }
+ auto rgx = Rgx();
+ auto got = searchFields();
+ if (environment.get("REQUEST_METHOD", "POST") == "POST") {
+ if ("sf" in cgi.post) {
+ got.search_text_area = cgi.post["sf"];
+ if (auto m = got.search_text_area.matchFirst(rgx.text)) {
+ got.text = m["matched"];
+ got.canned_query ~= "sf=" ~ m["matched"];
+ } else if (auto m = got.search_text_area.matchFirst(rgx.line)) {
+ if (
+ !(m["matched"].matchFirst(rgx.author))
+ && !(m["matched"].matchFirst(rgx.title))
+ ) {
+ got.text = m["matched"];
+ got.canned_query ~= "sf=" ~ m["matched"];
+ }
+ }
+ if (auto m = got.search_text_area.matchFirst(rgx.author)) {
+ got.author = m["matched"];
+ got.canned_query ~= "&au=" ~ m["matched"];
+ }
+ if (auto m = got.search_text_area.matchFirst(rgx.title)) {
+ got.title = m["matched"];
+ got.canned_query ~= "&ti=" ~ m["matched"];
+ }
+ if (auto m = got.search_text_area.matchFirst(rgx.uid)) {
+ got.uid = m["matched"];
+ got.canned_query ~= "&uid=" ~ m["matched"];
+ }
+ if (auto m = got.search_text_area.matchFirst(rgx.fn)) {
+ got.fn = m["matched"];
+ got.canned_query ~= "&fn=" ~ m["matched"];
+ } else if ("fn" in cgi.post) {
+ got.search_text_area ~= "\nfn: " ~ cgi.post["fn"] ~ "\n";
+ }
+ if (auto m = got.search_text_area.matchFirst(rgx.keywords)) {
+ got.keywords = m["matched"];
+ got.canned_query ~= "&kw=" ~ m["matched"];
+ }
+ if (auto m = got.search_text_area.matchFirst(rgx.topic_register)) {
+ got.topic_register = m["matched"];
+ got.canned_query ~= "&tr=" ~ m["matched"];
+ }
+ if (auto m = got.search_text_area.matchFirst(rgx.subject)) {
+ got.subject = m["matched"];
+ got.canned_query ~= "&su=" ~ m["matched"];
+ }
+ if (auto m = got.search_text_area.matchFirst(rgx.description)) {
+ got.description = m["matched"];
+ got.canned_query ~= "&de=" ~ m["matched"];
+ }
+ if (auto m = got.search_text_area.matchFirst(rgx.publisher)) {
+ got.publisher = m["matched"];
+ got.canned_query ~= "&pb=" ~ m["matched"];
+ }
+ if (auto m = got.search_text_area.matchFirst(rgx.editor)) {
+ got.editor = m["matched"];
+ got.canned_query ~= "&ed=" ~ m["matched"];
+ }
+ if (auto m = got.search_text_area.matchFirst(rgx.contributor)) {
+ got.contributor = m["matched"];
+ got.canned_query ~= "&ct=" ~ m["matched"];
+ }
+ if (auto m = got.search_text_area.matchFirst(rgx.date)) {
+ got.date = m["matched"];
+ got.canned_query ~= "&dt=" ~ m["matched"];
+ }
+ // if (auto m = got.search_text_area.matchFirst(rgx.results_type)) {
+ // got.results_type = m["matched"];
+ // got.canned_query ~= "&rt=" ~ m["matched"];
+ // }
+ if (auto m = got.search_text_area.matchFirst(rgx.format)) {
+ got.format = m["matched"];
+ got.canned_query ~= "&fmt=" ~ m["matched"];
+ }
+ if (auto m = got.search_text_area.matchFirst(rgx.source)) {
+ got.source = m["matched"];
+ got.canned_query ~= "&src=" ~ m["matched"];
+ }
+ if (auto m = got.search_text_area.matchFirst(rgx.language)) {
+ got.language = m["matched"];
+ got.canned_query ~= "&lng=" ~ m["matched"];
+ }
+ if (auto m = got.search_text_area.matchFirst(rgx.relation)) {
+ got.relation = m["matched"];
+ got.canned_query ~= "&rl=" ~ m["matched"];
+ }
+ if (auto m = got.search_text_area.matchFirst(rgx.coverage)) {
+ got.coverage = m["matched"];
+ got.canned_query ~= "&cv=" ~ m["matched"];
+ }
+ if (auto m = got.search_text_area.matchFirst(rgx.rights)) {
+ got.rights = m["matched"];
+ got.canned_query ~= "&rgt=" ~ m["matched"];
+ }
+ if (auto m = got.search_text_area.matchFirst(rgx.comment)) {
+ got.comment = m["matched"];
+ got.canned_query ~= "&cmt=" ~ m["matched"];
+ }
+ // if (auto m = search_text_area.matchFirst(rgx.abstract)) {
+ // got.abstract = m["matched"];
+ // }
+ if (auto m = got.search_text_area.matchFirst(rgx.src_filename_base)) {
+ got.src_filename_base = m["matched"];
+ got.canned_query ~= "&bfn=" ~ m["matched"];
+ }
+ }
+ if ("fn" in cgi.post) {
+ got.fn = cgi.post["fn"];
+ got.canned_query ~= "&fn=" ~ cgi.post["fn"];
+ }
+ if ("rt" in cgi.post) {
+ got.results_type = cgi.post["rt"];
+ got.canned_query ~= "&rt=" ~ cgi.post["rt"];
+ }
+ if ("sts" in cgi.post) {
+ got.stats = cgi.post["sts"];
+ got.canned_query ~= "&sts=" ~ cgi.post["sts"];
+ }
+ if ("ec" in cgi.post) {
+ got.echo = cgi.post["ec"];
+ got.canned_query ~= "&ec=" ~ cgi.post["ec"];
+ }
+ if ("url" in cgi.post) {
+ got.url = cgi.post["url"];
+ got.canned_query ~= "&url=" ~ cgi.post["url"];
+ }
+ if ("se" in cgi.post) {
+ got.searched = cgi.post["se"];
+ got.canned_query ~= "&se=" ~ cgi.post["se"];
+ }
+ if ("sql" in cgi.post) {
+ got.sql = cgi.post["sql"];
+ got.canned_query ~= "&sql=" ~ cgi.post["sql"];
+ }
+ if ("sml" in cgi.post) {
+ got.sql_match_limit = cgi.post["sml"];
+ got.canned_query ~= "&sml=" ~ cgi.post["sml"];
+ }
+ if ("smo" in cgi.post) {
+ got.sql_match_offset = "0"; // cgi.post["smo"];
+ got.canned_query ~= "&smo=0"; // ~ cgi.post["smo"];
+ }
+ got.canned_query = got.canned_query.strip.split(" ").join("%%20");
+ conf.query_string = got.canned_query;
+ // cgi.write("f.canned_query: " ~ got.canned_query ~ "<br>");
+ } else if (environment.get("REQUEST_METHOD", "POST") == "GET") {
+ got.canned_query = environment.get("QUERY_STRING", "");
+ // cgi.write("f.canned_query: " ~ got.canned_query ~ "<br>");
+ got.search_text_area = "";
+ if ("sf" in canned_query && !(canned_query["sf"]).empty) {
+ got.text = canned_query["sf"].split("%%20").join(" ");
+ got.search_text_area ~= "text: " ~ got.text ~ "\n";
+ }
+ if ("au" in canned_query && !(canned_query["au"]).empty) {
+ got.author = canned_query["au"].split("%%20").join(" ");
+ got.search_text_area ~= "author: " ~ got.author ~ "\n";
+ }
+ if ("ti" in canned_query && !(canned_query["ti"]).empty) {
+ got.title = canned_query["ti"].split("%%20").join(" ");
+ got.search_text_area ~= "title: " ~ got.title ~ "\n";
+ }
+ if ("uid" in canned_query && !(canned_query["uid"]).empty) {
+ got.uid = canned_query["uid"].split("%%20").join(" ");
+ got.search_text_area ~= "uid: " ~ got.uid ~ "\n";
+ }
+ if ("fn" in canned_query && !(canned_query["fn"]).empty) {
+ got.fn = canned_query["fn"].split("%%20").join(" ");
+ got.search_text_area ~= "fn: " ~ got.fn ~ "\n";
+ }
+ if ("kw" in canned_query && !(canned_query["kw"]).empty) {
+ got.keywords = canned_query["kw"].split("%%20").join(" ");
+ got.search_text_area ~= "keywords: " ~ got.keywords ~ "\n";
+ }
+ if ("tr" in canned_query && !(canned_query["tr"]).empty) {
+ got.topic_register = canned_query["tr"].split("%%20").join(" ");
+ got.search_text_area ~= "topic_register: " ~ got.topic_register ~ "\n";
+ }
+ if ("su" in canned_query && !(canned_query["su"]).empty) {
+ got.subject = canned_query["su"].split("%%20").join(" ");
+ got.search_text_area ~= "subject: " ~ got.subject ~ "\n";
+ }
+ if ("de" in canned_query && !(canned_query["de"]).empty) {
+ got.description = canned_query["de"].split("%%20").join(" ");
+ got.search_text_area ~= "description: " ~ got.description ~ "\n";
+ }
+ if ("pb" in canned_query && !(canned_query["pb"]).empty) {
+ got.publisher = canned_query["pb"].split("%%20").join(" ");
+ got.search_text_area ~= "publisher: " ~ got.publisher ~ "\n";
+ }
+ if ("ed" in canned_query && !(canned_query["ed"]).empty) {
+ got.editor = canned_query["ed"].split("%%20").join(" ");
+ got.search_text_area ~= "editor: " ~ got.editor ~ "\n";
+ }
+ if ("ct" in canned_query && !(canned_query["ct"]).empty) {
+ got.contributor = canned_query["ct"].split("%%20").join(" ");
+ got.search_text_area ~= "contributor: " ~ got.contributor ~ "\n";
+ }
+ if ("dt" in canned_query && !(canned_query["dt"]).empty) {
+ got.date = canned_query["dt"].split("%%20").join(" ");
+ got.search_text_area ~= "date: " ~ got.date ~ "\n";
+ }
+ if ("rt" in canned_query && !(canned_query["rt"]).empty) {
+ got.results_type = canned_query["rt"].split("%%20").join(" ");
+ // got.search_text_area ~= "results_type: " ~ got.results_type ~ "\n";
+ }
+ if ("fmt" in canned_query && !(canned_query["fmt"]).empty) {
+ got.format = canned_query["fmt"].split("%%20").join(" ");
+ got.search_text_area ~= "format: " ~ got.format ~ "\n";
+ }
+ if ("src" in canned_query && !(canned_query["src"]).empty) {
+ got.source = canned_query["src"].split("%%20").join(" ");
+ got.search_text_area ~= "source: " ~ got.source ~ "\n";
+ }
+ if ("lng" in canned_query && !(canned_query["lng"]).empty) {
+ got.language = canned_query["lng"].split("%%20").join(" ");
+ got.search_text_area ~= "language: " ~ got.language ~ "\n";
+ }
+ if ("rl" in canned_query && !(canned_query["rl"]).empty) {
+ got.relation = canned_query["rl"].split("%%20").join(" ");
+ got.search_text_area ~= "relation: " ~ got.relation ~ "\n";
+ }
+ if ("cv" in canned_query && !(canned_query["cv"]).empty) {
+ got.coverage = canned_query["cv"].split("%%20").join(" ");
+ got.search_text_area ~= "coverage: " ~ got.coverage ~ "\n";
+ }
+ if ("rgt" in canned_query && !(canned_query["rgt"]).empty) {
+ got.rights = canned_query["rgt"].split("%%20").join(" ");
+ got.search_text_area ~= "rights: " ~ got.rights ~ "\n";
+ }
+ if ("cmt" in canned_query && !(canned_query["cmt"]).empty) {
+ got.comment = canned_query["cmt"].split("%%20").join(" ");
+ got.search_text_area ~= "comment: " ~ got.comment ~ "\n";
+ }
+ // if ("abstract" in canned_query && !(canned_query["abstract"]).empty) {
+ // got.abstract = canned_query["abstract"];
+ // }
+ if ("bfn" in canned_query && !(canned_query["bfn"]).empty) { // search_field
+ got.src_filename_base = canned_query["bfn"].split("%%20").join(" ");
+ got.search_text_area ~= "src_filename_base: " ~ got.src_filename_base ~ "\n";
+ }
+ if ("sml" in canned_query && !(canned_query["sml"]).empty) {
+ got.sql_match_limit = canned_query["sml"].split("%%20").join(" ");
+ // got.search_text_area ~= "sql_match_limit: " ~ got.sql_match_limit ~ "\n";
+ }
+ // cgi.write("f.search_text_area: " ~ got.search_text_area ~ "<br>");
+ }
+ return got;
+ }
+ auto tf = text_fields; //
+ struct SQL_select {
+ string the_body = "";
+ string the_range = "";
+ }
+ auto sql_select = SQL_select();
+ string canned_url () {
+ string _url = "";
+ if (environment.get("REQUEST_METHOD", "POST") == "POST") {
+ _url = conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ "?" ~ tf.canned_query;
+ } else if (environment.get("REQUEST_METHOD", "POST") == "GET") {
+ _url = conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ "?" ~ environment.get("QUERY_STRING", "");
+ }
+ return _url;
+ }
+ auto regex_canned_search () {
+ static struct RgxCS {
+ static track_offset = ctRegex!(`(?P<offset_key>[&]smo=)(?P<offset_val>[0-9]+)`);
+ static results_type = ctRegex!(`[&]rt=(?P<results_type>idx|txt)`);
+ static results_type_index = ctRegex!(`[&]rt=idx`);
+ static results_type_text = ctRegex!(`[&]rt=txt`);
+ static fn = ctRegex!(`[&]fn=(?P<fn>[^&]+)`);
+ }
+ return RgxCS();
+ }
+ string show_matched_objects (string fn) {
+ auto rgx = regex_canned_search;
+ string _matched_objects_text = "";
+ string _url = canned_url;
+ string _url_new = "";
+ string _matches_show_text = "&rt=txt";
+ string _matches_show_index = "&rt=idx";
+ string _fn = "&fn=" ~ fn;
+ _url_new = _url;
+ if (_url_new.match(rgx.results_type_index)) {
+ _url_new = _url_new.replace(rgx.results_type_index, _matches_show_text);
+ } else if (_url.match(rgx.results_type_text)) {
+ _url_new = _url_new.replace(rgx.results_type_text, _matches_show_index);
+ } else {
+ if (!(_url.match(rgx.results_type))) {
+ _url_new = _url ~ _matches_show_text;
+ }
+ }
+ if (!(_url_new.match(rgx.fn))) {
+ _url_new = _url_new ~ _fn;
+ }
+ _matched_objects_text =
+ "<font size=\"2\" color=\"#666666\">"
+ ~ "<a href=\""
+ ~ _url_new
+ ~ "\">"
+ ~ "※"
+ ~ "</a></font>";
+ return _matched_objects_text;
+ }
+ string base ; // = "";
+ string tip ; // = "";
+ string search_note ; // = "";
+ uint sql_match_offset_count = 0;
+ string previous_next () {
+ auto rgx = regex_canned_search;
+ string _previous_next = "";
+ int _current_offset_value = 0;
+ string _set_offset_next = "";
+ string _set_offset_previous = "";
+ string _url = canned_url;
+ string _url_previous = "";
+ string _url_next = "";
+ string arrow_previous = "";
+ string arrow_next = "";
+ if (auto m = _url.matchFirst(rgx.track_offset)) {
+ _current_offset_value = m.captures["offset_val"].to!int;
+ _set_offset_next = m.captures["offset_key"] ~ ((m.captures["offset_val"]).to!int + cv.sql_match_limit.to!int).to!string;
+ _url_next = _url.replace(rgx.track_offset, _set_offset_next);
+ if (_current_offset_value < cv.sql_match_limit.to!int) {
+ _url_previous = "";
+ } else {
+ _url_previous = "";
+ _set_offset_previous = m.captures["offset_key"] ~ ((m.captures["offset_val"]).to!int - cv.sql_match_limit.to!int).to!string;
+ _url_previous = _url.replace(rgx.track_offset, _set_offset_previous);
+ }
+ } else {// _current_offset_value = 0;
+ _url_next = _url ~= "&smo=" ~ cv.sql_match_limit.to!string;
+ }
+ if (_url_previous.empty) {
+ arrow_previous = "";
+ } else {
+ arrow_previous =
+ "<font size=\"2\" color=\"#666666\">"
+ ~ "<a href=\""
+ ~ _url_previous
+ ~ "\">"
+ ~ "&lt;&lt prev"
+ ~ "</a> || </font>";
+ }
+ arrow_next =
+ "<font size=\"2\" color=\"#666666\">"
+ ~ "<a href=\""
+ ~ _url_next
+ ~ "\">"
+ ~ "next &gt;&gt"
+ ~ "</a></font>";
+ _previous_next = "<hr>" ~ arrow_previous ~ arrow_next;
+ return _previous_next;
+ }
+ {
+ header = format(q"┃
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>
+ %s
+ </title>
+ <meta name="sourcefile" content="SiSU.sst">
+ <link rel="generator" href="sisudoc.org">
+ <link rel="shortcut icon" href="https://%%s/image_sys/spine.ico">
+ <style media = "all">
+ *{
+ padding : 0px;
+ margin : 2px;
+ }
+ body {
+ height : 100vh;
+ background-color : #%s;
+ }
+ body {
+ color : #%s;
+ background : #%s;
+ background-color : #%s;
+ }
+ a:link {
+ color : #%s;
+ text-decoration : none;
+ }
+ a:visited {
+ color : #%s;
+ text-decoration : none;
+ }
+ a:hover {
+ color : #%s;
+ background-color : #%s;
+ }
+ a.lnkocn:link {
+ color : #%s;
+ text-decoration : none;
+ }
+ a.lnkocn:visited {
+ color : #%s;
+ text-decoration : none;
+ }
+ a.lnkocn:hover {
+ color : #%s;
+ font-size : 15px;
+ }
+ a:hover img {
+ background-color : #%s;
+ }
+ a:active {
+ color : #%s;
+ text-decoration : underline;
+ }
+ .flex-container {
+ display : flex;
+ }
+ div.publication {
+ margin-top : 2px;
+ margin-bottom : 4px;
+ margin-left : 0%%%%;
+ margin-right : 0%%%%;
+ }
+ div.textview_ocn {
+ margin-left : 0%%%%;
+ margin-right : 1%%%%;
+ }
+ div.textview_found {
+ margin-left : 1%%%%;
+ margin-right : 1%%%%;
+ }
+ textarea {
+ color : #%s;
+ background-color : #%s;
+ }
+ span.match {
+ color : #%s;
+ background-color : #%s;
+ }
+ p.norm { }
+ p.center { text-align : center; }
+ p.i1 { padding-left : 1em; }
+ p.i2 { padding-left : 2em; }
+ p.i3 { padding-left : 3em; }
+ p.i4 { padding-left : 4em; }
+ p.i5 { padding-left : 5em; }
+ p.i6 { padding-left : 6em; }
+ p.i7 { padding-left : 7em; }
+ p.i8 { padding-left : 8em; }
+ p.i9 { padding-left : 9em; }
+ /* hanging indent */
+ p[indent="h0i0"] {
+ padding-left : 0em;
+ text-indent : 0em;
+ }
+ p.publication {
+ font-size : 100%%%%;
+ margin-left : 0em;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ margin-right : 6px;
+ text-align : left;
+ }
+ p.ocn_is {
+ font-size : 100%%%%;
+ display : inline-block;
+ }
+ p.matched_ocn {
+ font-size : 90%%%%;
+ margin-left : 2em;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ margin-right : 6px;
+ text-align : left;
+ }
+ p[indent="h0i1"] {
+ padding-left : 1em;
+ text-indent : -1em;
+ }
+ p[indent="h0i2"] {
+ padding-left : 2em;
+ text-indent : -2em;
+ }
+ p[indent="h0i3"] {
+ padding-left : 3em;
+ text-indent : -3em;
+ }
+ p[indent="h0i4"] {
+ padding-left : 4em;
+ text-indent : -4em;
+ }
+ p[indent="h0i5"] {
+ padding-left : 5em;
+ text-indent : -5em;
+ }
+ p[indent="h0i6"] {
+ padding-left : 6em;
+ text-indent : -6em;
+ }
+ p[indent="h0i7"] {
+ padding-left : 7em;
+ text-indent : -7em;
+ }
+ p[indent="h0i8"] {
+ padding-left : 8em;
+ text-indent : -8em;
+ }
+ p[indent="h0i9"] {
+ padding-left : 9em;
+ text-indent : -9em;
+ }
+ p[indent="h1i0"] {
+ padding-left : 0em;
+ text-indent : 1em;
+ }
+ p[indent="h1i1"] {
+ padding-left : 1em;
+ text-indent : 0em;
+ }
+ p[indent="h1i2"] {
+ padding-left : 2em;
+ text-indent : -1em;
+ }
+ p[indent="h1i3"] {
+ padding-left : 3em;
+ text-indent : -2em;
+ }
+ p[indent="h1i4"] {
+ padding-left : 4em;
+ text-indent : -3em;
+ }
+ p[indent="h1i5"] {
+ padding-left : 5em;
+ text-indent : -4em;
+ }
+ p[indent="h1i6"] {
+ padding-left : 6em;
+ text-indent : -5em;
+ }
+ p[indent="h1i7"] {
+ padding-left : 7em;
+ text-indent : -6em;
+ }
+ p[indent="h1i8"] {
+ padding-left : 8em;
+ text-indent : -7em;
+ }
+ p[indent="h1i9"] {
+ padding-left : 9em;
+ text-indent : -8em;
+ }
+ p[indent="h2i0"] {
+ padding-left : 0em;
+ text-indent : 2em;
+ }
+ p[indent="h2i1"] {
+ padding-left : 1em;
+ text-indent : 1em;
+ }
+ p[indent="h2i2"] {
+ padding-left : 2em;
+ text-indent : 0em;
+ }
+ p[indent="h2i3"] {
+ padding-left : 3em;
+ text-indent : -1em;
+ }
+ p[indent="h2i4"] {
+ padding-left : 4em;
+ text-indent : -2em;
+ }
+ p[indent="h2i5"] {
+ padding-left : 5em;
+ text-indent : -3em;
+ }
+ p[indent="h2i6"] {
+ padding-left : 6em;
+ text-indent : -4em;
+ }
+ p[indent="h2i7"] {
+ padding-left : 7em;
+ text-indent : -5em;
+ }
+ p[indent="h2i8"] {
+ padding-left : 8em;
+ text-indent : -6em;
+ }
+ p[indent="h2i9"] {
+ padding-left : 9em;
+ text-indent : -7em;
+ }
+ p[indent="h3i0"] {
+ padding-left : 0em;
+ text-indent : 3em;
+ }
+ p[indent="h3i1"] {
+ padding-left : 1em;
+ text-indent : 2em;
+ }
+ p[indent="h3i2"] {
+ padding-left : 2em;
+ text-indent : 1em;
+ }
+ p[indent="h3i3"] {
+ padding-left : 3em;
+ text-indent : 0em;
+ }
+ p[indent="h3i4"] {
+ padding-left : 4em;
+ text-indent : -1em;
+ }
+ p[indent="h3i5"] {
+ padding-left : 5em;
+ text-indent : -2em;
+ }
+ p[indent="h3i6"] {
+ padding-left : 6em;
+ text-indent : -3em;
+ }
+ p[indent="h3i7"] {
+ padding-left : 7em;
+ text-indent : -4em;
+ }
+ p[indent="h3i8"] {
+ padding-left : 8em;
+ text-indent : -5em;
+ }
+ p[indent="h3i9"] {
+ padding-left : 9em;
+ text-indent : -6em;
+ }
+ p[indent="h4i0"] {
+ padding-left : 0em;
+ text-indent : 4em;
+ }
+ p[indent="h4i1"] {
+ padding-left : 1em;
+ text-indent : 3em;
+ }
+ p[indent="h4i2"] {
+ padding-left : 2em;
+ text-indent : 2em;
+ }
+ p[indent="h4i3"] {
+ padding-left : 3em;
+ text-indent : 1em;
+ }
+ p[indent="h4i4"] {
+ padding-left : 4em;
+ text-indent : 0em;
+ }
+ p[indent="h4i5"] {
+ padding-left : 5em;
+ text-indent : -1em;
+ }
+ p[indent="h4i6"] {
+ padding-left : 6em;
+ text-indent : -2em;
+ }
+ p[indent="h4i7"] {
+ padding-left : 7em;
+ text-indent : -3em;
+ }
+ p[indent="h4i8"] {
+ padding-left : 8em;
+ text-indent : -4em;
+ }
+ p[indent="h4i9"] {
+ padding-left : 9em;
+ text-indent : -5em;
+ }
+ p[indent="h5i0"] {
+ padding-left : 0em;
+ text-indent : 5em;
+ }
+ p[indent="h5i1"] {
+ padding-left : 1em;
+ text-indent : 4em;
+ }
+ p[indent="h5i2"] {
+ padding-left : 2em;
+ text-indent : 3em;
+ }
+ p[indent="h5i3"] {
+ padding-left : 3em;
+ text-indent : 2em;
+ }
+ p[indent="h5i4"] {
+ padding-left : 4em;
+ text-indent : 1em;
+ }
+ p[indent="h5i5"] {
+ padding-left : 5em;
+ text-indent : 0em;
+ }
+ p[indent="h5i6"] {
+ padding-left : 6em;
+ text-indent : -1em;
+ }
+ p[indent="h5i7"] {
+ padding-left : 7em;
+ text-indent : -2em;
+ }
+ p[indent="h5i8"] {
+ padding-left : 8em;
+ text-indent : -3em;
+ }
+ p[indent="h5i9"] {
+ padding-left : 9em;
+ text-indent : -4em;
+ }
+ p[indent="h6i0"] {
+ padding-left : 0em;
+ text-indent : 6em;
+ }
+ p[indent="h6i1"] {
+ padding-left : 1em;
+ text-indent : 5em;
+ }
+ p[indent="h6i2"] {
+ padding-left : 2em;
+ text-indent : 4em;
+ }
+ p[indent="h6i3"] {
+ padding-left : 3em;
+ text-indent : 3em;
+ }
+ p[indent="h6i4"] {
+ padding-left : 4em;
+ text-indent : 2em;
+ }
+ p[indent="h6i5"] {
+ padding-left : 5em;
+ text-indent : 1em;
+ }
+ p[indent="h6i6"] {
+ padding-left : 6em;
+ text-indent : 0em;
+ }
+ p[indent="h6i7"] {
+ padding-left : 7em;
+ text-indent : -1em;
+ }
+ p[indent="h6i8"] {
+ padding-left : 8em;
+ text-indent : -2em;
+ }
+ p[indent="h6i9"] {
+ padding-left : 9em;
+ text-indent : -3em;
+ }
+ p[indent="h7i0"] {
+ padding-left : 0em;
+ text-indent : 7em;
+ }
+ p[indent="h7i1"] {
+ padding-left : 1em;
+ text-indent : 6em;
+ }
+ p[indent="h7i2"] {
+ padding-left : 2em;
+ text-indent : 5em;
+ }
+ p[indent="h7i3"] {
+ padding-left : 3em;
+ text-indent : 4em;
+ }
+ p[indent="h7i4"] {
+ padding-left : 4em;
+ text-indent : 3em;
+ }
+ p[indent="h7i5"] {
+ padding-left : 5em;
+ text-indent : 2em;
+ }
+ p[indent="h7i6"] {
+ padding-left : 6em;
+ text-indent : 1em;
+ }
+ p[indent="h7i7"] {
+ padding-left : 7em;
+ text-indent : 0em;
+ }
+ p[indent="h7i8"] {
+ padding-left : 8em;
+ text-indent : -1em;
+ }
+ p[indent="h7i9"] {
+ padding-left : 9em;
+ text-indent : -2em;
+ }
+ p[indent="h8i0"] {
+ padding-left : 0em;
+ text-indent : 8em;
+ }
+ p[indent="h8i1"] {
+ padding-left : 1em;
+ text-indent : 7em;
+ }
+ p[indent="h8i2"] {
+ padding-left : 2em;
+ text-indent : 6em;
+ }
+ p[indent="h8i3"] {
+ padding-left : 3em;
+ text-indent : 5em;
+ }
+ p[indent="h8i4"] {
+ padding-left : 4em;
+ text-indent : 4em;
+ }
+ p[indent="h8i5"] {
+ padding-left : 5em;
+ text-indent : 3em;
+ }
+ p[indent="h8i6"] {
+ padding-left : 6em;
+ text-indent : 2em;
+ }
+ p[indent="h8i7"] {
+ padding-left : 7em;
+ text-indent : 1em;
+ }
+ p[indent="h8i8"] {
+ padding-left : 8em;
+ text-indent : 0em;
+ }
+ p[indent="h8i9"] {
+ padding-left : 9em;
+ text-indent : -1em;
+ }
+ p[indent="h9i0"] {
+ padding-left : 0em;
+ text-indent : 9em;
+ }
+ p[indent="h9i1"] {
+ padding-left : 1em;
+ text-indent : 8em;
+ }
+ p[indent="h9i2"] {
+ padding-left : 2em;
+ text-indent : 7em;
+ }
+ p[indent="h9i3"] {
+ padding-left : 3em;
+ text-indent : 6em;
+ }
+ p[indent="h9i4"] {
+ padding-left : 4em;
+ text-indent : 5em;
+ }
+ p[indent="h9i5"] {
+ padding-left : 5em;
+ text-indent : 4em;
+ }
+ p[indent="h9i6"] {
+ padding-left : 6em;
+ text-indent : 3em;
+ }
+ p[indent="h9i7"] {
+ padding-left : 7em;
+ text-indent : 2em;
+ }
+ p[indent="h9i8"] {
+ padding-left : 8em;
+ text-indent : 1em;
+ }
+ p[indent="h9i9"] {
+ padding-left : 9em;
+ text-indent : 0em;
+ }
+ p.spaced { white-space : pre; }
+ p.block {
+ white-space : pre;
+ }
+ p.group { }
+ p.alt { }
+ p.verse {
+ white-space : pre;
+ margin-bottom : 6px;
+ }
+ p.caption {
+ text-align : left;
+ font-size : 80%%%%;
+ display : inline;
+ }
+ p.endnote {
+ font-size : 96%%%%;
+ line-height : 120%%%%;
+ text-align : left;
+ margin-right : 15mm;
+ padding-left : 1em;
+ text-indent : -1em;
+ }
+ p.center {
+ text-align : center;
+ }
+ p.bold {
+ font-weight : bold;
+ }
+ p.bold_left {
+ font-weight : bold;
+ text-align : left;
+ }
+ p.centerbold {
+ text-align : center;
+ font-weight : bold;
+ }
+ p.em {
+ font-weight : bold;
+ font-style : normal;
+ background : #FFF3B6;
+ }
+ p.small {
+ font-size : 80%%%%;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ margin-right : 6px;
+ text-align : left;
+ }
+ .tiny, .tiny_left, .tiny_right, .tiny_center {
+ font-size : 10px;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ color : #EEEEEE;
+ margin-right : 6px;
+ text-align : left;
+ }
+ p.tiny { }
+ p.tiny_left {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : left;
+ }
+ p.tiny_right {
+ margin-right : 1em;
+ text-align : right;
+ }
+ p.tiny_center {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : center;
+ }
+ p.book_index_lev1 {
+ line-height : 100%%%%;
+ margin-top : 4px;
+ margin-bottom : 1px;
+ }
+ p.book_index_lev2 {
+ line-height : 100%%%%;
+ text-align : left;
+ margin-left : 3em;
+ margin-top : 1px;
+ margin-bottom : 3px;
+ }
+ tt {
+ font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
+ background-color : #555555;
+ color : #DDDDDD;
+ }
+ pre {
+ width : auto;
+ display : block;
+ clear : both;
+ color : #555555;
+ }
+ pre.codeline {
+ display : table;
+ clear : both;
+ table-layout : fixed;
+ margin-left : 5%%%%;
+ margin-right : 5%%%%;
+ width : 90%%%%;
+ white-space : pre-wrap;
+ border-style : none;
+ border-radius : 5px 5px 5px 5px;
+ box-shadow : 0 2px 5px #AAAAAA inset;
+ margin-bottom : 1em;
+ padding : 0.5em 1em;
+ page-break-inside : avoid;
+ word-wrap : break-word;
+ font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
+ white-space : pre;
+ white-space : pre-wrap;
+ white-space : -moz-pre-wrap;
+ white-space : -o-pre-wrap;
+ background-color : #555555;
+ color : #DDDDDD;
+ font-size : 95%%%%;
+ line-height : 100%%%%;
+ }
+ pre.codeline::before {
+ counter-reset : linenum;
+ }
+ pre.codeline span.tr {
+ display : table-row;
+ counter-increment : linenum;
+ }
+ pre.codeline span.th {
+ display : table-cell;
+ user-select : none;
+ -moz-user-select : none;
+ -webkit-user-select : none;
+ padding : 0.5em 0.5em;
+ }
+ pre.codeline span.th::before {
+ content : counter(linenum) ".";
+ color : #999999;
+ text-align : right;
+ display : block;
+ }
+ pre.codeline span.th {
+ width : 4em;
+ }
+ pre.codeline code {
+ display : table-cell;
+ }
+ p.code {
+ border-style : none;
+ }
+ note { white-space : pre; }
+ em {
+ font-weight : bold;
+ font-style : italic;
+ }
+ p.left,th.left,td.left {
+ text-align : left;
+ }
+ p.small_left,th.small_left,td.small_left {
+ text-align : left;
+ font-size : 80%%%%;
+ }
+ p.right,th.right,td.right {
+ text-align : right;
+ }
+ ul, li {
+ list-style-type : none;
+ list-style : none;
+ padding-left : 20px;
+ font-weight : normal;
+ line-height : 150%%%%;
+ text-align : left;
+ text-indent : 0mm;
+ margin-left : 1em;
+ margin-right : 2em;
+ margin-top : 3px;
+ margin-bottom : 3px;
+ }
+ li {
+ background : (../image_sys/bullet_09.png) no-repeat 0px 6px;
+ }
+ ul { }
+ h0, h1, h2, h3, h4, h5, h6, h7 {
+ font-weight : bold;
+ line-height : 120%%%%;
+ text-align : left;
+ margin-top : 20px;
+ margin-bottom : 10px;
+ }
+ h4.norm, h5.norm, h6.norm, h7.norm {
+ margin-top : 10px;
+ margin-bottom : 0px;
+ }
+ h0 { font-size : 125%%%%; }
+ h1 { font-size : 120%%%%; }
+ h2 { font-size : 115%%%%; }
+ h3 { font-size : 110%%%%; }
+ h4 { font-size : 105%%%%; }
+ h5 { font-size : 100%%%%; }
+ h6 { font-size : 100%%%%; }
+ h7 { font-size : 100%%%%; }
+ h0, h1, h2, h3, h4, h5, h6, h7 {
+ text-shadow : .2em .2em .3em #999999;
+ }
+ h1.i { margin-left : 2em; }
+ h2.i { margin-left : 3em; }
+ h3.i { margin-left : 4em; }
+ h4.i { margin-left : 5em; }
+ h5.i { margin-left : 6em; }
+ h6.i { margin-left : 7em; }
+ h7.i { margin-left : 8em; }
+ h8.i { margin-left : 9em; }
+ h9.i { margin-left : 10em; }
+ .toc {
+ font-weight : normal;
+ margin-top : 6px;
+ margin-bottom : 6px;
+ }
+ h0.toc {
+ margin-left : 1em;
+ font-size : 120%%%%;
+ line-height : 150%%%%;
+ }
+ h1.toc {
+ margin-left : 1em;
+ font-size : 115%%%%;
+ line-height : 150%%%%;
+ }
+ h2.toc {
+ margin-left : 2em;
+ font-size : 110%%%%;
+ line-height : 140%%%%;
+ }
+ h3.toc {
+ margin-left : 3em;
+ font-size : 105%%%%;
+ line-height : 120%%%%;
+ }
+ h4.toc {
+ margin-left : 4em;
+ font-size : 100%%%%;
+ line-height : 120%%%%;
+ }
+ h5.toc {
+ margin-left : 5em;
+ font-size : 95%%%%;
+ line-height : 110%%%%;
+ }
+ h6.toc {
+ margin-left : 6em;
+ font-size : 90%%%%;
+ line-height : 110%%%%;
+ }
+ h7.toc {
+ margin-left : 7em;
+ font-size : 85%%%%;
+ line-height : 100%%%%;
+ }
+ .subtoc {
+ margin-right : 34%%%%;
+ font-weight : normal;
+ }
+ h5.subtoc {
+ margin-left : 2em;
+ font-size : 80%%%%;
+ margin-top : 2px;
+ margin-bottom : 2px;
+ }
+ h6.subtoc {
+ margin-left : 3em;
+ font-size : 75%%%%;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ }
+ h7.subtoc {
+ margin-left : 4em;
+ font-size : 70%%%%;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ }
+ hr {
+ display : block;
+ height : 1px;
+ width : 100%%%%;
+ border : 0;
+ border-top : 1px solid #AAAAAA;
+ border-color : #AAAAAA
+ background-color : #AAAAAA
+ margin-left : 0%%%%;
+ margin-right : 0em;
+ margin-top : 0.5em;
+ margin-bottom : 0.5em;
+ padding : 0;
+ }
+</style>
+</head>
+<body lang="en" xml:lang="en">
+┃",
+ conf.http_host,
+ );
+ }
+ {
+ table = format(q"┃
+<table summary="band" border="0" cellpadding="2" cellspacing="0">
+<tr><td width="20%%%%">
+ <table summary="home button / home information" border="0" cellpadding="2" cellspacing="0">
+ <tr><td align="left">
+ %s
+ </td></tr>
+ </table>
+</td>
+<td>
+</td></tr>
+</table>
+┃");
+ }
+ {
+ string post_value(string field_name, string type="box", string set="on") {
+ string val = "";
+ switch (type) {
+ case "field":
+ val = ((field_name in cgi.post && !(cgi.post[field_name]).empty)
+ ? cgi.post[field_name]
+ : (field_name in cgi.get)
+ ? cgi.get[field_name]
+ : "");
+ val = tf.search_text_area;
+ break;
+ case "box": // generic for checkbox or radio; checkbox set == "on" radio set == "name set"
+ val = ((field_name in cgi.post && !(cgi.post[field_name]).empty)
+ ? (cgi.post[field_name] == set ? "checked" : "off")
+ : (field_name in cgi.get)
+ ? (cgi.get[field_name] == set ? "checked" : "off")
+ : "off");
+ break;
+ case "radio": // used generic bo
+ val = ((field_name in cgi.post && !(cgi.post[field_name]).empty)
+ ? (cgi.post[field_name] == set ? "checked" : "off")
+ : (field_name in cgi.get)
+ ? (cgi.get[field_name] == set ? "checked" : "off")
+ : "checked");
+ break;
+ case "checkbox": // used generic bo
+ val = ((field_name in cgi.post && !(cgi.post[field_name]).empty)
+ ? (cgi.post[field_name] == set ? "checked" : "off")
+ : (field_name in cgi.get)
+ ? (cgi.get[field_name] == set ? "checked" : "off")
+ : "checked");
+ break;
+ default:
+ }
+ return val;
+ }
+ string the_can(string fv) {
+ string show_the_can = post_value("url");
+ string _the_can = "";
+ if (show_the_can == "checked") {
+ tf = text_fields;
+ string method_get_url = conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ "?" ~ environment.get("QUERY_STRING", "");
+ string method_post_url_construct = conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ "?" ~ tf.canned_query;
+ // assert(method_get_url == environment.get("HTTP_REFERER", conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ "?" ~ conf.query_string));
+ if (conf.request_method == "POST") {
+ _the_can =
+ "<font size=\"2\" color=\"#666666\">"
+ ~ "POST:&nbsp;"
+ ~ "<a href=\""
+ ~ method_post_url_construct
+ ~ "\">"
+ ~ method_post_url_construct
+ ~ "</a></font>"
+ ~ "<br>";
+ } else if (conf.request_method == "GET") {
+ _the_can =
+ "<font size=\"2\" color=\"#666666\">"
+ ~ "GET:&nbsp;&nbsp;"
+ ~ "<a href=\""
+ ~ method_get_url
+ ~ "\">"
+ ~ method_get_url
+ ~ "</a></font>";
+ }
+ conf.http_url = conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ tf.canned_query;
+ }
+ return _the_can;
+ }
+ string provide_tip() {
+ string searched_tip = post_value("se");
+ string tip = "";
+ if (searched_tip == "checked") {
+ string search_field = post_value("sf", "field");
+ tf = text_fields;
+ tip = format(q"┃
+<font size="2" color="#666666">
+<b>database:</b> <font size="2" color="#004000">%%s</font>; <b>selected view:</b> <font size="2" color="#004000">index</font>
+<b>search string:</b> %%s %%s %%s %%s %%s %%s<br>
+%%s %%s %%s %%s %%s %%s
+</font>
+┃",
+ cv.db_selected,
+ (tf.text.empty ? "" : "\"text: <font size=\"2\" color=\"#004000\">" ~ tf.text ~ "</font>; "),
+ (tf.title.empty ? "" : "\"title: <font size=\"2\" color=\"#004000\">" ~ tf.title ~ "</font>; "),
+ (tf.author.empty ? "" : "\"author: <font size=\"2\" color=\"#004000\">" ~ tf.author ~ "</font>; "),
+ (tf.date.empty ? "" : "\"date <font size=\"2\" color=\"#004000\">" ~ tf.date ~ "</font>; "),
+ (tf.uid.empty ? "" : "\"uid: <font size=\"2\" color=\"#004000\">" ~ tf.uid ~ "</font>; "),
+ (tf.fn.empty ? "" : "\"fn: <font size=\"2\" color=\"#004000\">" ~ tf.fn ~ "</font>; "),
+ (tf.text.empty ? "" : "text: <font size=\"2\" color=\"#004000\">" ~ tf.text ~ "</font><br>"),
+ (tf.title.empty ? "" : "title: <font size=\"2\" color=\"#004000\">" ~ tf.title ~ "</font><br>"),
+ (tf.author.empty ? "" : "author: <font size=\"2\" color=\"#004000\">" ~ tf.author ~ "</font><br>"),
+ (tf.date.empty ? "" : "date: <font size=\"2\" color=\"#004000\">" ~ tf.date ~ "</font><br>"),
+ (tf.uid.empty ? "" : "\"uid: <font size=\"2\" color=\"#004000\">" ~ tf.uid ~ "</font>; "),
+ (tf.fn.empty ? "" : "\"fn: <font size=\"2\" color=\"#004000\">" ~ tf.fn ~ "</font>; "),
+ );
+ }
+ return tip;
+ }
+ form = format(q"┃
+<form action="%%s" id="SubmitForm" method="post" accept-charset="UTF-8">
+ <table cellpadding="2">
+ <tr><td valign=\"top\">
+ <textarea id="find" name="sf" type="text" rows="6" cols="40" maxlength="256" wrap="virtual">%%s</textarea>
+ </td>
+ <td valign=\"top\">
+ %%s
+ %%s
+ %%s
+ </td></tr></table>
+ <td valign=\"top\"><tr><td>
+ <font size="2" color="#%s">
+ <input type="hidden" name="db" value="%%s">
+ <input type="submit" value="SiSU search">
+ <input type="radio" name="rt" id="results_type_index" value="idx" %%s> index
+ <input type="radio" name="rt" id="results_type_text" value="txt" %%s> text / grep;
+ match limit:
+ <input type="radio" name="sml" id="sql_match_limit_1000" value="1000" %%s> 1,000
+ <input type="radio" name="sml" id="sql_match_limit_2500" value="2500" %%s> 2,500
+ <br>
+ <input type="checkbox" name="ec" %%s> echo query
+ <input type="checkbox" name="url" %%s> search url
+ <input type="checkbox" name="se" %%s> searched
+ <input type="checkbox" name="sql" %%s> sql statement
+ <input type="hidden" name="smo" value="0">
+ <br>
+ </font>
+ </td></tr>
+ </table>
+</form>
+┃",
+ "%s",
+ (post_value("ec") == "checked") ? post_value("sf", "field") : "",
+ provide_tip,
+ search_note,
+ the_can(post_value("sf", "field")),
+ cv.db_selected,
+ post_value("rt", "box", "idx"),
+ post_value("rt", "box", "txt"),
+ post_value("sml", "box", "1000"),
+ post_value("sml", "box", "2500"),
+ post_value("ec"),
+ post_value("url"),
+ post_value("se"),
+ post_value("sql"),
+ );
+ {
+ string set_value(string field_name, string default_val) {
+ string val;
+ if (field_name in cgi.post) {
+ val = cgi.post[field_name];
+ } else if (field_name in cgi.get) {
+ val = cgi.get[field_name];
+ } else { val = default_val; }
+ return val;
+ }
+ bool set_bool(string field_name) {
+ bool val;
+ if (field_name in cgi.post
+ && cgi.post[field_name] == "on") {
+ val = true;
+ } else if (field_name in cgi.get
+ && cgi.get[field_name] == "on") {
+ val = true;
+ } else { val = false; }
+ return val;
+ }
+ cv.db_selected = set_value("selected_db", "%s"); // selected_db_name == db (spine.search.db or whatever)
+ cv.sql_match_limit = set_value("sml", "1000");
+ cv.sql_match_offset = set_value("smo", "0");
+ cv.search_text = set_value("sf", "");
+ cv.results_type = set_value("rt", "idx");
+ cv.checked_echo = set_bool("ec");
+ cv.checked_stats = set_bool("sts");
+ cv.checked_url = set_bool("url");
+ cv.checked_searched = set_bool("se");
+ cv.checked_tip = set_bool("tip");
+ cv.checked_sql = set_bool("sql");
+ tf = text_fields;
+ }
+ }
+ {
+ cgi.write(header);
+ cgi.write(table);
+ cgi.write(form);
+ // cgi.write(previous_next);
+ { // debug environment
+ // foreach (k, d; environment.toAA) {
+ // cgi.write(k ~ ": " ~ d ~ "<br>");
+ // }
+ }
+ { // debug cgi info
+ // cgi.write("db_selected: " ~ cv.db_selected ~ "<br>\n");
+ // cgi.write("search_text: " ~ cv.search_text ~ "<br>\n");
+ // cgi.write("sql_match_limit: " ~ cv.sql_match_limit ~ ";\n");
+ // cgi.write("sql_match_offset: " ~ cv.sql_match_offset ~ ";\n");
+ // cgi.write("results_type: " ~ cv.results_type ~ "<br>\n");
+ // cgi.write("cv.checked_echo: " ~ (cv.checked_echo ? "checked" : "off") ~ "; \n");
+ // cgi.write("cv.checked_stats: " ~ (cv.checked_stats ? "checked" : "off") ~ "; \n");
+ // cgi.write("cv.checked_url: " ~ (cv.checked_url ? "checked" : "off") ~ "; \n");
+ // cgi.write("cv.checked_searched: " ~ (cv.checked_searched ? "checked" : "off") ~ ";<br>\n");
+ // cgi.write("cv.checked_tip: " ~ (cv.checked_tip ? "checked" : "off") ~ "; \n");
+ // cgi.write("cv.checked_sql: " ~ (cv.checked_sql ? "checked" : "off") ~ "<br>\n");
+ }
+ }
+ auto db = Database(conf.db_path ~ cv.db_selected);
+ {
+ uint sql_match_offset_counter(T)(T cv) {
+ sql_match_offset_count += cv.sql_match_limit.to!uint;
+ return sql_match_offset_count;
+ }
+ void sql_search_query() {
+ string highlight_text_matched(string _txt, string search_field) {
+ string _mark_open = "┤";
+ string _mark_close = "├";
+ string _span_match = "<span class=\"match\">";
+ string _span_close = "</span>";
+ string _sf_str = search_field.strip.split("%%20").join(" ").strip;
+ string[] _sf_arr = _sf_str.split(regex(r"\s+AND\s+|\s+OR\s+"));
+ auto rgx_url = regex(r"<a href=[^>]+?>");
+ foreach (_sf; _sf_arr) {
+ auto rgx_matched_text = regex(_sf, "i");
+ auto rgx_marked_pair = regex(r"┤(?P<keep>" ~ _sf ~ ")├", "i");
+ if (auto m = _txt.matchFirst(rgx_url)) {
+ _txt = replaceAll!(m =>
+ _mark_open
+ ~ m.captures[0]
+ ~ _mark_close
+ )(_txt, rgx_matched_text);
+ _txt = replaceAll!(m =>
+ replaceAll!(u =>
+ u["keep"]
+ )(m.hit, rgx_marked_pair)
+ )(_txt, rgx_url);
+ _txt = replaceAll!(m =>
+ _span_match
+ ~ m["keep"]
+ ~ _span_close
+ )(_txt, rgx_marked_pair);
+ } else {
+ _txt = replaceAll!(m =>
+ _span_match
+ ~ m.captures[0]
+ ~ _span_close
+ )(_txt, rgx_matched_text);
+ }
+ }
+ return _txt;
+ }
+ string select_field_like(string db_field, string search_field) {
+ string where_ = "";
+ if (!(search_field.empty)) {
+ string _sf = search_field.strip.split("%%20").join(" ");
+ if (_sf.match(r" OR ")) {
+ _sf = _sf.split(" OR ").join("%%' OR " ~ db_field ~ " LIKE '%%");
+ }
+ if (_sf.match(r" AND ")) {
+ _sf = _sf.split(" AND ").join("%%' AND " ~ db_field ~ " LIKE '%%");
+ }
+ _sf = "( " ~ db_field ~ " LIKE\n '%%" ~ _sf ~ "%%' )";
+ where_ ~= format(q"┃
+ %%s
+┃",
+ _sf
+ );
+ }
+ return where_;
+ }
+ string[] _fields;
+ _fields ~= select_field_like("doc_objects.clean", tf.text);
+ _fields ~= select_field_like("metadata_and_text.title", tf.title);
+ _fields ~= select_field_like("metadata_and_text.creator_author", tf.author);
+ _fields ~= select_field_like("metadata_and_text.uid", tf.uid);
+ _fields ~= select_field_like("metadata_and_text.src_filename_base", tf.fn);
+ _fields ~= select_field_like("metadata_and_text.src_filename_base", tf.src_filename_base);
+ _fields ~= select_field_like("metadata_and_text.language_document_char", tf.language);
+ _fields ~= select_field_like("metadata_and_text.date_published", tf.date);
+ _fields ~= select_field_like("metadata_and_text.classify_keywords", tf.keywords);
+ _fields ~= select_field_like("metadata_and_text.classify_topic_register", tf.topic_register);
+ string[] fields;
+ foreach (f; _fields) {
+ if (!(f.empty)) { fields ~= f; }
+ }
+ string fields_str = "";
+ fields_str ~= fields.join(" AND ");
+ sql_select.the_body ~= format(q"┃
+SELECT
+ metadata_and_text.uid,
+ metadata_and_text.title,
+ metadata_and_text.creator_author_last_first,
+ metadata_and_text.creator_author,
+ metadata_and_text.src_filename_base,
+ metadata_and_text.language_document_char,
+ metadata_and_text.date_published,
+ metadata_and_text.classify_keywords,
+ metadata_and_text.classify_topic_register,
+ doc_objects.body,
+ doc_objects.seg_name,
+ doc_objects.ocn,
+ metadata_and_text.uid
+FROM
+ doc_objects,
+ metadata_and_text
+WHERE (
+ %%s
+ )
+AND
+ doc_objects.uid_metadata_and_text = metadata_and_text.uid
+ORDER BY
+ metadata_and_text.creator_author_last_first,
+ metadata_and_text.date_published DESC,
+ metadata_and_text.title,
+ metadata_and_text.language_document_char,
+ metadata_and_text.src_filename_base,
+ doc_objects.ocn
+LIMIT %%s OFFSET %%s
+;┃",
+ fields_str,
+ cv.sql_match_limit,
+ cv.sql_match_offset,
+ );
+ (cv.checked_sql)
+ ? cgi.write(previous_next
+ ~ "<hr><font size=\"2\" color=\"#666666\">"
+ ~ sql_select.the_body.strip.split("\n ").join(" ").split("\n").join("<br>")
+ ~ "</font>\n"
+ )
+ : "";
+ cgi.write(previous_next);
+ auto select_query_results = db.execute(sql_select.the_body).cached;
+ string _old_uid = "";
+ if (!select_query_results.empty) {
+ string _date_published = "0000";
+ string _close_para = "";
+ string _matched_ocn_open = "";
+ foreach (idx, row; select_query_results) {
+ if (row["uid"].as!string != _old_uid) {
+ _close_para = (idx == 1) ? "" : "</p>";
+ _matched_ocn_open = (idx == 1) ? "" : "<p class=\"matched_ocn\">";
+ _old_uid = row["uid"].as!string;
+ _date_published = (row["date_published"].as!string.match(regex(r"^([0-9]{4})")))
+ ? row["date_published"].as!string : "0000"; // used in regex that breaks if no match
+ auto m = _date_published.match(regex(r"^([0-9]{4})"));
+ string _date = (m.hit == "0000") ? "(year?) " : "(" ~ m.hit ~ ") ";
+ cgi.write(
+ _close_para
+ ~ "<hr><div class=\"publication\">"
+ ~ "<p class=\"publication\"><a href=\""
+ ~ "https://" ~ conf.http_host ~ conf.doc_collection_subroot ~ "/"
+ ~ row["language_document_char"].as!string ~ "/html/"
+ ~ row["src_filename_base"].as!string ~ "/"
+ ~ "toc.html"
+ ~ "\">\""
+ ~ row["title"].as!string ~ "\""
+ ~ "</a> "
+ ~ _date
+ ~ "[" ~ row["language_document_char"].as!string ~ "] "
+ ~ row["creator_author_last_first"].as!string
+ ~ " "
+ ~ show_matched_objects(row["src_filename_base"].as!string)
+ ~ "</p>"
+ ~ "</div>"
+ );
+ }
+ if (cv.results_type == "txt") {
+ if (row["ocn"].as!string != "0") {
+ cgi.write(
+ "<div class=\"flex-container\">"
+ ~ "<div class=\"textview_ocn\" style=\"flex: 0 0 1.2em\">"
+ ~ "<p class=\"ocn_is\"><a href=\""
+ ~ "https://" ~ conf.http_host ~ conf.doc_collection_subroot ~ "/"
+ ~ row["language_document_char"].as!string ~ "/html/"
+ ~ row["src_filename_base"].as!string ~ "/"
+ ~ row["seg_name"].as!string ~ ".html#" ~ row["ocn"].as!string
+ ~ "\">"
+ ~ row["ocn"].as!string
+ ~ "</a>:</p>"
+ ~ "</div>"
+ ~ "<div class=\"textview_found\">"
+ ~ highlight_text_matched(row["body"].as!string, tf.text)
+ ~ "</div>"
+ ~ "</div>"
+ );
+ } else {
+ cgi.write(
+ "<div class=\"flex-container\">"
+ ~ "<div class=\"textview_ocn\" style=\"flex: 0 0 1.2em\">"
+ ~ "<p class=\"ocn_is\"><a href=\""
+ ~ "https://" ~ conf.http_host ~ conf.doc_collection_subroot ~ "/"
+ ~ row["language_document_char"].as!string ~ "/html/"
+ ~ row["src_filename_base"].as!string ~ "/toc.html"
+ ~ "\">"
+ ~ row["ocn"].as!string
+ ~ "</a>:</p>"
+ ~ "</div>"
+ ~ "<div class=\"textview_found\">"
+ ~ highlight_text_matched(row["body"].as!string, tf.text)
+ ~ "</div>"
+ ~ "</div>"
+ );
+ }
+ } else {
+ if (row["ocn"].as!string != "0") {
+ cgi.write(
+ _matched_ocn_open
+ ~ "<a href=\""
+ ~ "https://" ~ conf.http_host ~ conf.doc_collection_subroot ~ "/"
+ ~ row["language_document_char"].as!string ~ "/html/"
+ ~ row["src_filename_base"].as!string ~ "/"
+ ~ row["seg_name"].as!string ~ ".html#" ~ row["ocn"].as!string
+ ~ "\">"
+ ~ row["ocn"].as!string
+ ~ "</a>, "
+ );
+ } else {
+ cgi.write(
+ _matched_ocn_open
+ ~ "<a href=\""
+ ~ "https://" ~ conf.http_host ~ conf.doc_collection_subroot ~ "/"
+ ~ row["language_document_char"].as!string ~ "/html/"
+ ~ row["src_filename_base"].as!string ~ "/toc.html"
+ ~ "\">"
+ ~ row["ocn"].as!string
+ ~ "</a>, "
+ );
+ }
+ _matched_ocn_open = "";
+ }
+ }
+ cgi.write( previous_next);
+
+ } else { // offset_not_beyond_limit = false;
+ cgi.write("select_query_results empty<p>\n");
+ }
+ cgi.write("<br><p class=\"center\"><a href=\"https://sisudoc.org/\" target=\"_top\">
+<label for=\"find\"><b>≅ SiSU spine</b></label>
+</a> <label for=\"find\">(generated) search form</label>
+<br><a href=\"https://git.sisudoc.org/\" target=\"_top\">
+ git</a>
+</p>
+");
+ }
+ sql_search_query;
+ }
+ {
+ db.close;
+ }
+ {
+ string tail = format(q"┃
+</body>
+┃");
+ cgi.write(tail);
+ }
+}
+mixin GenericMain!cgi_function_intro;
+≓",
+ get_doc_collection_subroot(make_and_meta_struct.conf.output_path),
+ make_and_meta_struct.conf.output_path ~ "/sqlite/",
+ _sqlite_db_fn,
+ (opt_action.cgi_search_title.empty)
+ ? make_and_meta_struct.conf.w_srv_cgi_search_form_title
+ : opt_action.cgi_search_title,
+ (opt_action.css_theme_default) ? "FFFFFF" : "000000",
+ (opt_action.css_theme_default) ? "000000" : "CCCCCC",
+ (opt_action.css_theme_default) ? "FFFFFF" : "000000",
+ (opt_action.css_theme_default) ? "FFFFFF" : "000000",
+ (opt_action.css_theme_default) ? "003399" : "FFFFFF",
+ (opt_action.css_theme_default) ? "003399" : "999999",
+ "000000",
+ (opt_action.css_theme_default) ? "F9F9AA" : "555555",
+ (opt_action.css_theme_default) ? "777777" : "BBBBBB",
+ (opt_action.css_theme_default) ? "32CD32" : "9ACD32",
+ (opt_action.css_theme_default) ? "777777" : "BBBBBB",
+ (opt_action.css_theme_default) ? "FFFFFF" : "000000",
+ (opt_action.css_theme_default) ? "003399" : "888888",
+ (opt_action.css_theme_default) ? "000000" : "FFFFFF",
+ (opt_action.css_theme_default) ? "FFFFFF" : "777777",
+ (opt_action.css_theme_default) ? "000000" : "FFFF48",
+ (opt_action.css_theme_default) ? "FFFF48" : "777748",
+ (opt_action.cgi_search_title.empty)
+ ? make_and_meta_struct.conf.w_srv_cgi_search_form_title
+ : opt_action.cgi_search_title,
+ (opt_action.css_theme_default) ? "222222" : "AAAAAA",
+ _cgi_search_script,
+ _sqlite_db_fn,
+).strip;
+ string _cgi_path = (opt_action.output_dir_set.length > 0)
+ ? opt_action.output_dir_set
+ : (make_and_meta_struct.conf.w_srv_data_root_path.length > 0)
+ ? make_and_meta_struct.conf.w_srv_data_root_path
+ : "";
+ auto pth_sqlite_cgi = spinePathsSQLiteCGI!()(_cgi_search_script_raw_fn_d, _cgi_search_script, _cgi_path);
+ { // cgi-bin search form src d
+ try {
+ if (!exists(pth_sqlite_cgi.src)) {
+ pth_sqlite_cgi.src.mkdirRecurse;
+ }
+ if (!exists(pth_sqlite_cgi.cgi_bin)) {
+ pth_sqlite_cgi.cgi_bin.mkdirRecurse;
+ }
+ auto f = File(pth_sqlite_cgi.search_form_path_out, "w");
+ f.write(the_cgi_search_form);
+ // foreach (o; metadata_) {
+ // f.writeln(o);
+ // }
+ } catch (ErrnoException ex) {
+ // Handle error
+ }
+ // if (!(opt_action.quiet)) {
+ // writeln(" ", pth_sqlite_cgi.search_form);
+ // }
+ }
+ string the_dub_sdl = format(q"≓
+name "spine_cgi_sqlite_search"
+description "spine cgi sqlite search"
+authors "Ralph Amissah"
+copyright "Copyright © 2022, Ralph Amissah"
+license "GPL-3.0+"
+dependency "d2sqlite3" version="%s"
+dependency "arsd-official:cgi" version="%s"
+ subConfiguration "arsd-official:cgi" "cgi"
+targetType "executable"
+targetPath "./cgi-bin"
+mainSourceFile "%s"
+configuration "default" {
+ targetType "executable"
+ targetName "%s"
+ postGenerateCommands "notify-send -t 0 'D executable ready' 'spine cgi sqlite search d'"
+}
+≓",
+ "~>0.18.3", // d2sqlite3 dependency version
+ "~>7.2.0", // arsd-official:cgi dependency version
+ "src/" ~ _cgi_search_script_raw_fn_d,
+ _cgi_search_script
+).strip;
+ { // dub.sdl
+ try {
+ auto f = File(pth_sqlite_cgi.dub_sdl_path_out, "w");
+ f.write(the_dub_sdl);
+ // foreach (o; metadata_) {
+ // f.writeln(o);
+ // }
+ } catch (ErrnoException ex) {
+ // Handle error
+ }
+ }
+ // { // get cgi.d
+ // // import std.net.curl, std.stdio;
+ // // char[] cgi_d;
+ // // if (opt_action.allow_downloads) {
+ // // try {
+ // // cgi_d = get!HTTP("https://raw.githubusercontent.com/adamdruppe/arsd/master/cgi.d");
+ // // } catch (ErrnoException ex) {
+ // // // Handle error
+ // // // CurlCode perform(ThrowOnError throwOnError = Yes.throwOnError);
+ // // CurlCode perform(ThrowOnError throwOnError = No.throwOnError);
+ // // }
+ // // if (cgi_d && cgi_d.length > 0) {
+ // // try {
+ // // auto f = File(pth_sqlite_cgi.cgi_d_path_out, "w");
+ // // f.write(cgi_d);
+ // // } catch (ErrnoException ex) {
+ // // // Handle error
+ // // }
+ // // }
+ // // }
+ // }
+ }
+}
diff --git a/src/sisudoc/io_out/create_zip_file.d b/src/sisudoc/io_out/create_zip_file.d
new file mode 100644
index 0000000..36863eb
--- /dev/null
+++ b/src/sisudoc/io_out/create_zip_file.d
@@ -0,0 +1,68 @@
+/+
+- Name: SisuDoc 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 sisudoc.io_out.create_zip_file;
+@safe:
+template createZipFile() {
+ import
+ std.file,
+ std.outbuffer,
+ std.string,
+ std.zip;
+ void createZipFile(
+ string zip_file_name,
+ void[] compressed_zip_data,
+ ) {
+ try {
+ write(zip_file_name, compressed_zip_data);
+ } catch (ZipException ex) {
+ // Handle Errors
+ }
+ }
+}
diff --git a/src/sisudoc/io_out/defaults.d b/src/sisudoc/io_out/defaults.d
new file mode 100644
index 0000000..be7c122
--- /dev/null
+++ b/src/sisudoc/io_out/defaults.d
@@ -0,0 +1,186 @@
+/+
+- Name: SisuDoc 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/]
+
++/
+/++
+ default settings
++/
+module sisudoc.io_out.defaults;
+@safe:
+
+template InternalMarkup() {
+ import std.array;
+ static struct InlineMarkup {
+ string en_a_o = "【"; string en_a_c = "】";
+ string en_b_o = "〖"; string en_b_c = "〗";
+ string quote_o = "“"; string quote_c = "”";
+ string ff_i = "⑆"; string ff_o = "┨"; string ff_c = "┣"; // fontface
+ string lnk_o = "┥"; string lnk_c = "┝";
+ string url_o = "┤"; string url_c = "├";
+ string emph = "*";
+ string bold = "!";
+ string italic = "/";
+ string underscore = "_";
+ string superscript = "^";
+ string subscript = ",";
+ string mono = "■";
+ string cite = "‖";
+ string mark_internal_site_lnk = "¤";
+ string nbsp = "░";
+ string br_line = "┘";
+ string br_line_inline = "┙";
+ string br_line_spaced = "┚";
+ string br_obj = "break_obj";
+ string br_page_line = "┼";
+ string br_page = "┿";
+ string br_page_new = "╂";
+ string tc_s = "┊";
+ string tc_o = "┏";
+ string tc_c = "┚";
+ string tc_p = "┆";
+ string img = "☼";
+ string sep = "␣"; // "~";"␣"; // "~";
+ string uid_sep = ":";
+ string on_o = "「"; string on_c = "」";
+ string mk_bullet = "● ";
+ static string indent_by_spaces_provided(int indent, string _indent_spaces ="░░") {
+ _indent_spaces = replicate(_indent_spaces, indent);
+ return _indent_spaces;
+ }
+ static string repeat_character_by_number_provided(C,N)(C _character ="-", N number=10) {
+ _character = replicate(_character, number);
+ return _character;
+ }
+ }
+}
+template spineLanguageCodes() {
+ /+ language codes +/
+ struct Lang {
+ static string[string][string] codes() {
+ auto _lang_codes = [
+ "am": [ "c": "am", "n": "Amharic", "t": "Amharic", "xlp": "amharic" ],
+ "bg": [ "c": "bg", "n": "Bulgarian", "t": "Български (Bəlgarski)", "xlp": "bulgarian" ],
+ "bn": [ "c": "bn", "n": "Bengali", "t": "Bengali", "xlp": "bengali" ],
+ "br": [ "c": "br", "n": "Breton", "t": "Breton", "xlp": "breton" ],
+ "ca": [ "c": "ca", "n": "Catalan", "t": "catalan", "xlp": "catalan" ],
+ "cs": [ "c": "cs", "n": "Czech", "t": "česky", "xlp": "czech" ],
+ "cy": [ "c": "cy", "n": "Welsh", "t": "Welsh", "xlp": "welsh" ],
+ "da": [ "c": "da", "n": "Danish", "t": "dansk", "xlp": "danish" ],
+ "de": [ "c": "de", "n": "German", "t": "Deutsch", "xlp": "german" ],
+ "el": [ "c": "el", "n": "Greek", "t": "Ελληνικά (Ellinika)", "xlp": "greek" ],
+ "en": [ "c": "en", "n": "English", "t": "English", "xlp": "english" ],
+ "eo": [ "c": "eo", "n": "Esperanto", "t": "Esperanto", "xlp": "esperanto" ],
+ "es": [ "c": "es", "n": "Spanish", "t": "español", "xlp": "spanish" ],
+ "et": [ "c": "et", "n": "Estonian", "t": "Estonian", "xlp": "estonian" ],
+ "eu": [ "c": "eu", "n": "Basque", "t": "basque", "xlp": "basque" ],
+ "fi": [ "c": "fi", "n": "Finnish", "t": "suomi", "xlp": "finnish" ],
+ "fr": [ "c": "fr", "n": "French", "t": "français", "xlp": "french" ],
+ "ga": [ "c": "ga", "n": "Irish", "t": "Irish", "xlp": "irish" ],
+ "gl": [ "c": "gl", "n": "Galician", "t": "Galician", "xlp": "galician" ],
+ "he": [ "c": "he", "n": "Hebrew", "t": "Hebrew", "xlp": "hebrew" ],
+ "hi": [ "c": "hi", "n": "Hindi", "t": "Hindi", "xlp": "hindi" ],
+ "hr": [ "c": "hr", "n": "Croatian", "t": "Croatian", "xlp": "croatian" ],
+ "hy": [ "c": "hy", "n": "Armenian", "t": "Armenian", "xlp": "armenian" ],
+ "ia": [ "c": "ia", "n": "Interlingua", "t": "Interlingua", "xlp": "interlingua" ],
+ "is": [ "c": "is", "n": "Icelandic", "t": "Icelandic", "xlp": "icelandic" ],
+ "it": [ "c": "it", "n": "Italian", "t": "Italiano", "xlp": "italian" ],
+ "ja": [ "c": "ja", "n": "Japanese", "t": "日本語 (Nihongo)", "xlp": "japanese" ],
+ "ko": [ "c": "ko", "n": "Korean", "t": "Korean", "xlp": "korean" ],
+ "la": [ "c": "la", "n": "Latin", "t": "Latin", "xlp": "latin" ],
+ "lo": [ "c": "lo", "n": "Lao", "t": "Lao", "xlp": "lao" ],
+ "lt": [ "c": "lt", "n": "Lithuanian", "t": "Lithuanian", "xlp": "lithuanian" ],
+ "lv": [ "c": "lv", "n": "Latvian", "t": "Latvian", "xlp": "latvian" ],
+ "ml": [ "c": "ml", "n": "Malayalam", "t": "Malayalam", "xlp": "malayalam" ],
+ "mr": [ "c": "mr", "n": "Marathi", "t": "Marathi", "xlp": "marathi" ],
+ "nl": [ "c": "nl", "n": "Dutch", "t": "Nederlands", "xlp": "dutch" ],
+ "no": [ "c": "no", "n": "Norwegian", "t": "norsk", "xlp": "norsk" ],
+ "nn": [ "c": "nn", "n": "Norwegian Nynorsk", "t": "nynorsk", "xlp": "nynorsk" ],
+ "oc": [ "c": "oc", "n": "Occitan", "t": "Occitan", "xlp": "occitan" ],
+ "pl": [ "c": "pl", "n": "Polish", "t": "polski", "xlp": "polish" ],
+ "pt": [ "c": "pt", "n": "Portuguese", "t": "Português", "xlp": "portuges" ],
+ "pt_BR": [ "c": "pt_BR", "n": "Portuguese Brazil", "t": "Brazilian Português", "xlp": "brazilian" ],
+ "ro": [ "c": "ro", "n": "Romanian", "t": "română", "xlp": "romanian" ],
+ "ru": [ "c": "ru", "n": "Russian", "t": "Русский (Russkij)", "xlp": "russian" ],
+ "sa": [ "c": "sa", "n": "Sanskrit", "t": "Sanskrit", "xlp": "sanskrit" ],
+ "se": [ "c": "se", "n": "Sami", "t": "Samin", "xlp": "samin" ],
+ "sk": [ "c": "sk", "n": "Slovak", "t": "slovensky", "xlp": "slovak" ],
+ "sl": [ "c": "sl", "n": "Slovenian", "t": "Slovenian", "xlp": "slovenian" ],
+ "sq": [ "c": "sq", "n": "Albanian", "t": "Albanian", "xlp": "albanian" ],
+ "sr": [ "c": "sr", "n": "Serbian", "t": "Serbian", "xlp": "serbian" ],
+ "sv": [ "c": "sv", "n": "Swedish", "t": "svenska", "xlp": "swedish" ],
+ "ta": [ "c": "ta", "n": "Tamil", "t": "Tamil", "xlp": "tamil" ],
+ "te": [ "c": "te", "n": "Telugu", "t": "Telugu", "xlp": "telugu" ],
+ "th": [ "c": "th", "n": "Thai", "t": "Thai", "xlp": "thai" ],
+ "tk": [ "c": "tk", "n": "Turkmen", "t": "Turkmen", "xlp": "turkmen" ],
+ "tr": [ "c": "tr", "n": "Turkish", "t": "Türkçe", "xlp": "turkish" ],
+ "uk": [ "c": "uk", "n": "Ukranian", "t": "українська (ukrajins\"ka)", "xlp": "ukrainian" ],
+ "ur": [ "c": "ur", "n": "Urdu", "t": "Urdu", "xlp": "urdu" ],
+ "us": [ "c": "en", "n": "English (American)","t": "English", "xlp": "english" ],
+ "vi": [ "c": "vi", "n": "Vietnamese", "t": "Vietnamese", "xlp": "vietnamese" ],
+ "zh": [ "c": "zh", "n": "Chinese", "t": "中文", "xlp": "chinese" ],
+ "en": [ "c": "en", "n": "English", "t": "English", "xlp": "english" ],
+ "xx": [ "c": "xx", "n": "Default", "t": "English", "xlp": "english" ],
+ ];
+ return _lang_codes;
+ }
+ static string[] code_arr_ptr() {
+ string[] _lang_codes = ["am", "bg", "bn", "br", "ca", "cs", "cy", "da", "de", "el", "en", "eo", "es", "et", "eu", "fi", "fr", "ga", "gl", "he", "hi", "hr", "hy", "ia", "is", "it", "ja", "ko", "la", "lo", "lt", "lv", "ml", "mr", "nl", "no", "nn", "oc", "pl", "pt", "pt_BR", "ro", "ru", "sa", "se", "sk", "sl", "sq", "sr", "sv", "ta", "te", "th", "tk", "tr", "uk", "ur", "us", "vi", "zh", "en", "xx",];
+ return _lang_codes;
+ }
+ static string[] code_arr() {
+ string[] _lang_codes = ["am", "bg", "bn", "br", "ca", "cs", "cy", "da", "de", "el", "en", "eo", "es", "et", "eu", "fi", "fr", "ga", "gl", "he", "hi", "hr", "hy", "ia", "is", "it", "ja", "ko", "la", "lo", "lt", "lv", "ml", "mr", "nl", "no", "nn", "oc", "pl", "pt", "pt_BR", "ro", "ru", "sa", "se", "sk", "sl", "sq", "sr", "sv", "ta", "te", "th", "tk", "tr", "uk", "ur", "vi", "zh"];
+ return _lang_codes;
+ }
+ static auto codes_() {
+ return "(" ~ join(code_arr,"|") ~ ")";
+ }
+ static auto codes_regex() {
+ return regex(codes_);
+ }
+ }
+}
diff --git a/src/sisudoc/io_out/epub3.d b/src/sisudoc/io_out/epub3.d
new file mode 100644
index 0000000..b4ff21b
--- /dev/null
+++ b/src/sisudoc/io_out/epub3.d
@@ -0,0 +1,810 @@
+/+
+- Name: SisuDoc 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 sisudoc.io_out.epub3;
+@safe:
+template outputEPub3() {
+ import
+ std.file,
+ std.outbuffer,
+ std.uri,
+ std.zip,
+ std.conv : to;
+ import
+ sisudoc.io_out,
+ sisudoc.io_out.rgx,
+ sisudoc.io_out.rgx_xhtml,
+ sisudoc.io_out.create_zip_file,
+ sisudoc.io_out.xmls,
+ sisudoc.io_out.xmls_css;
+ mixin InternalMarkup;
+ mixin outputXHTMLs;
+ static auto rgx = RgxO();
+ static auto rgx_xhtml = RgxXHTML();
+ 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 epub3_mimetypes() {
+ string o;
+ o = format(q"┃application/epub+zip┃") ~ "\n";
+ return o;
+ }
+ string epub3_container_xml() {
+ string o;
+ o = format(q"┃<?xml version="1.0" encoding="utf-8"?>┃") ~ "\n";
+ o ~= format(q"┃<container version="1.0"
+ xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
+ <rootfiles>
+ <rootfile full-path="OEBPS/content.opf"
+ media-type="application/oebps-package+xml" />
+ </rootfiles>┃") ~ "\n</container>\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 = spinePathsEPUB!()(doc_matters.output_path, doc_matters.src.language);
+ string _uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO sort uuid in doc_matters!
+ string content = format(q"┃<?xml version="1.0" encoding="utf-8"?>
+ <package version="3.0" xmlns="http://www.idpf.org/2007/opf" unique-identifier="uid" prefix="rendition: http://www.idpf.org/vocab/rendition/#">
+ <metadata
+ xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
+ xmlns:dcterms="https://purl.org/dc/terms/"
+ xmlns:dc="https://purl.org/dc/elements/1.1/"
+ unique-identifier="urn:uuid:%s" version="2.0">
+ <dc:title id="title">%s</dc:title>
+ <meta refines="#title" property="title-type">main</meta>
+ <dc:title id="subtitle">%s</dc:title>
+ <meta refines="#subtitle" property="title-type">subtitle</meta>
+ <dc:creator file-as="%s" id="aut">%s</dc:creator>
+ <dc:language>%s</dc:language>
+ <dc:date id="published">%s</dc:date>
+ <dc:rights>Copyright: %s</dc:rights>
+ <dc:identifier scheme="URI">%s</dc:identifier>
+ <dc:identifier id="bookid">urn:uuid:%s</dc:identifier>
+ </metadata>
+ <manifest>
+ <item id="css" href="%s" media-type="text/css"/>
+ <item id="nav" href="toc_nav.xhtml" media-type="application/xhtml+xml" properties="nav" />
+ ┃",
+ _uuid,
+ xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.title_main),
+ (doc_matters.conf_make_meta.meta.title_sub.empty)
+ ? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.title_sub),
+ (doc_matters.conf_make_meta.meta.creator_author.empty)
+ ? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.creator_author),
+ (doc_matters.conf_make_meta.meta.creator_author.empty)
+ ? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.creator_author),
+ doc_matters.src.language, // language, fix (needed in dochead metadata)
+ (doc_matters.conf_make_meta.meta.date_published.empty)
+ ? "" : xhtml_format.special_characters_date(doc_matters.conf_make_meta.meta.date_published),
+ (doc_matters.conf_make_meta.meta.rights_copyright.empty)
+ ? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.rights_copyright),
+ _uuid,
+ _uuid,
+ (pth_epub3.fn_oebps_css).chompPrefix("OEBPS/"),
+ );
+ content ~= parts["manifest_documents"];
+ // TODO sort jpg & png
+ foreach (image; doc_matters.srcs.image_list) {
+ content ~= format(q"┃ <item id="%s" href="%s/%s" media-type="image/%s" />
+ ┃",
+ image.baseName.stripExtension,
+ (pth_epub3.doc_oebps_image).chompPrefix("OEBPS/"),
+ image,
+ image.extension.chompPrefix("."),
+ );
+ }
+ content ~= " " ~ "</manifest>" ~ "\n ";
+ content ~= " " ~ "<spine>" ~ "\n ";
+ content ~= parts["spine"];
+ content ~= " " ~ "</spine>" ~ "\n ";
+ content ~= " " ~ "<guide>" ~ "\n ";
+ content ~= parts["guide"];
+ content ~= " " ~ "</guide>" ~ "\n ";
+ content ~= "" ~ "</package>";
+ debug(epubmanifest) {
+ foreach (section; doc_matters.has.keys_seq.seg) { // TODO
+ foreach (obj; doc_abstraction[section]) {
+ if (obj.metainfo.is_a == "heading") {
+ if (obj.metainfo.heading_lev_markup == 4) {
+ writefln(
+ "%s~ [%s.xhtml] %s",
+ obj.marked_up_level,
+ obj.tags.segment_anchor_tag_epub,
+ obj.text
+ );
+ } else if (obj.metainfo.heading_lev_markup > 4) {
+ writefln(
+ "%s~ [%s.xhtml#%s] %s",
+ obj.marked_up_level,
+ obj.tags.segment_anchor_tag_epub,
+ obj.metainfo.object_number,
+ obj.text
+ );
+ }
+ }
+ }
+ }
+ }
+ return content;
+ }
+ string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) {
+ enum DomTags { none, open, close, close_and_open, open_still, }
+ auto markup = InlineMarkup();
+ static auto rgx = RgxO();
+ static auto rgx_xhtml = RgxXHTML();
+ string toc;
+ bool _new_title_set = false;
+ string toc_head = format(q"┃<html xmlns="https://www.w3.org/1999/xhtml"
+ xmlns:epub="http://www.idpf.org/2007/ops">
+ <head>
+ <title>%s</title>
+ </head>
+ <body>
+ <section epub:type="frontmatter toc">
+ <header>
+ <h1>Contents</h1>
+ </header>
+ <nav epub:type="toc" id="toc">
+ ┃",
+ (doc_matters.conf_make_meta.meta.title_full).special_characters_text,
+ );
+ string _toc_nav_tail = "";
+ // writeln(doc_matters.has.keys_seq.seg); // DEBUG line
+ foreach (sect; doc_matters.has.keys_seq.seg) {
+ foreach (obj; doc_abstraction[sect]) {
+ if ((sect == "head") && (obj.metainfo.is_a == "heading")) {
+ toc = toc_head;
+ }
+ if (sect == "tail") { // skip
+ } else if ((sect != "tail") && (obj.metainfo.is_a == "heading")) {
+ string _txt = obj.text.replaceAll(rgx.inline_notes_al_gen, "").strip;
+ foreach_reverse (n; 0 .. 7) {
+ string k = n.to!string;
+ switch (obj.metainfo.dom_structure_collapsed_tags_status[n]) {
+ case DomTags.none :
+ break;
+ case DomTags.close :
+ toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "</li>" ~ "\n";
+ toc ~= markup.indent_by_spaces_provided(n, " ") ~ "</ol>" ~ "\n";
+ break;
+ case DomTags.close_and_open :
+ toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "</li>" ~ "\n";
+ goto default;
+ case DomTags.open :
+ if (!(_new_title_set)) {
+ toc ~= markup.indent_by_spaces_provided(n, " ") ~ "<ol>" ~ "\n";
+ }
+ goto default;
+ default :
+ if ((obj.metainfo.dom_structure_collapsed_tags_status[n] == DomTags.close_and_open ||
+ obj.metainfo.dom_structure_collapsed_tags_status[n] == DomTags.open
+ )) {
+ if ((sect == "head") && (obj.metainfo.is_a == "heading")) {
+ toc ~= format(q"┃ <li>
+ <a href="_the_title.xhtml">%s</a>
+ </li>┃",
+ obj.text
+ .replaceAll(rgx.inline_notes_al_gen, "")
+ .replaceAll(rgx.br_line_inline, "<br />")
+ .strip,
+ );
+ toc ~= "\n";
+ _new_title_set = true;
+ } else {
+ _new_title_set = false;
+ string _hashtag = "";
+ if ((obj.metainfo.heading_lev_markup <= 4) && (obj.metainfo.ocn == 0)) {
+ _hashtag = "#" ~ obj.metainfo.ocn.to!string;
+ }
+ string _href = "<a href=\""
+ ~ obj.tags.segment_anchor_tag_epub ~ ".xhtml"
+ ~ _hashtag
+ ~ "\">";
+ toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "<li>" ~ "\n"
+ ~ markup.indent_by_spaces_provided((n + 2), " ")
+ ~ _href ~ _txt.special_characters_text ~ "</a>" ~ "\n";
+ }
+ }
+ break;
+ }
+ if (doc_matters.has.keys_seq.seg[doc_matters.has.keys_seq.seg.length - 2] == sect) {
+ // writeln(n, ": ", sect, ": ", _txt, " - ", obj.metainfo.dom_structure_collapsed_tags_status); // DEBUG
+ // read last heading (heading prior to closing) and determine what those instructions imply still need to be done
+ // CLOSE // DomTags { 0 none, 1 open, 2 close, 3 close_and_open, 4 open_still, }
+ if (n == 6) {_toc_nav_tail = "";}
+ switch (obj.metainfo.dom_structure_collapsed_tags_status[n]) {
+ case 0: case 2:
+ // case DomTags.none: case DomTags.close:
+ break;
+ case 1: case 3: case 4:
+ // case DomTags.open: case DomTags.close_and_open: case DomTags.open_still:
+ if (n != 0) {
+ _toc_nav_tail ~= " " ~ markup.indent_by_spaces_provided((n + 1), " ") ~ "</li>" ~ "\n";
+ _toc_nav_tail ~= " " ~ markup.indent_by_spaces_provided(n, " ") ~ "</ol>" ~ "\n";
+ }
+ break;
+ default :
+ break;
+ }
+ if (n == 0) {
+ _toc_nav_tail ~=" </nav>
+ </section>
+ </body>
+ </html>\n";
+ }
+ }
+ }
+ }
+ }
+ }
+ toc ~= _toc_nav_tail;
+ return toc;
+ }
+ @system void outputEPub3(D,I)(
+ const D doc_abstraction,
+ I doc_matters,
+ ) {
+ mixin spineRgxOut;
+ mixin spineRgxXHTML;
+ auto xhtml_format = outputXHTMLs();
+ static auto rgx = RgxO();
+ static auto rgx_xhtml = RgxXHTML();
+ string[] doc;
+ string segment_filename;
+ string[] top_level_headings = ["","","",""];
+ string[string] oepbs_content_parts;
+ string suffix = ".xhtml";
+ struct writeOut { /+ epub specific documents +/
+ /+ fixed output +/
+ string mimetypes;
+ string meta_inf_container_xml;
+ string oebps_toc_nav_xhtml;
+ /+ variable output +/
+ string oebps_content_opf;
+ string[][string] doc_epub3;
+ string[][string] doc_epub3_endnotes;
+ string[] doc_parts;
+ }
+ auto epubWrite = writeOut();
+ foreach (section; doc_matters.has.keys_seq.seg) {
+ foreach (obj; doc_abstraction[section]) {
+ string _txt = xhtml_format.special_characters_breaks_indents_bullets(obj);
+ if (obj.metainfo.is_a == "heading") {
+ assert(section == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
+ switch (obj.metainfo.heading_lev_markup) {
+ case 0: .. case 3:
+ /+ fill buffer, and replace with new levels from 1 to 3 +/
+ switch (obj.metainfo.heading_lev_markup) {
+ case 0:
+ top_level_headings[0] = "";
+ top_level_headings[1] = "";
+ top_level_headings[2] = "";
+ top_level_headings[3] = "";
+ goto default;
+ case 1:
+ top_level_headings[1] = "";
+ top_level_headings[2] = "";
+ top_level_headings[3] = "";
+ goto default;
+ case 2:
+ top_level_headings[2] = "";
+ top_level_headings[3] = "";
+ goto default;
+ case 3:
+ top_level_headings[3] = "";
+ goto default;
+ default:
+ epubWrite.doc_parts ~= obj.tags.segment_anchor_tag_epub;
+ epubWrite.doc_epub3[obj.tags.segment_anchor_tag_epub] ~= xhtml_format.epub3_seg_head(doc_matters);
+ Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[obj.tags.segment_anchor_tag_epub] ~= t[0];
+ epubWrite.doc_epub3_endnotes[obj.tags.segment_anchor_tag_epub] ~= t[1];
+ break;
+ }
+ break;
+ case 4:
+ segment_filename = obj.tags.segment_anchor_tag_epub;
+ epubWrite.doc_epub3[segment_filename] ~= xhtml_format.epub3_seg_head(doc_matters);
+ Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0];
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ case 5: .. case 7:
+ Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0];
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ case 8: .. case 9:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_epub) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup);
+ writeln(__FILE__, ":", __LINE__, ": ", obj.text);
+ }
+ }
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_epub) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup);
+ }
+ }
+ break;
+ }
+ } else {
+ assert(section == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
+ Tuple!(string, string[]) t;
+ switch (obj.metainfo.is_of_part) {
+ case "frontmatter": assert(section == "head" || "toc");
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "toc":
+ t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0];
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_epub) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_epub) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
+ }
+ break;
+ }
+ break;
+ case "body": assert(section == "body");
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "para":
+ t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0];
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_epub) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ case "block":
+ switch (obj.metainfo.is_a) {
+ case "quote":
+ t = xhtml_format.quote_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0].to!string;
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ case "group":
+ t = xhtml_format.group_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0].to!string;
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ case "block":
+ t = xhtml_format.block_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0].to!string;
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ case "poem":
+ break;
+ case "verse":
+ t = xhtml_format.verse_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0].to!string;
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ case "code":
+ epubWrite.doc_epub3[segment_filename] ~= xhtml_format.code(_txt, obj, doc_matters);
+ break;
+ case "table":
+ epubWrite.doc_epub3[segment_filename] ~= xhtml_format.table(_txt, obj, doc_matters);
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= "";
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_epub) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_epub) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
+ }
+ break;
+ }
+ break;
+ case "backmatter":
+ assert(section == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "endnote": assert(section == "endnotes");
+ t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0];
+ break;
+ case "glossary": assert(section == "glossary");
+ t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0];
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ case "bibliography": assert(section == "bibliography");
+ t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0];
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ case "bookindex": assert(section == "bookindex");
+ t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0];
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ case "blurb": assert(section == "blurb");
+ t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0];
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ case "tail": assert(section == "tail");
+ t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0];
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_epub) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_epub) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
+ }
+ break;
+ }
+ break;
+ case "comment":
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_epub) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part);
+ }
+ }
+ break;
+ }
+ }
+ if (obj.metainfo.is_a == "heading") {
+ // assert(obj.text.length > 0); // check assertion
+ if (obj.metainfo.heading_lev_markup <= 4) {
+ oepbs_content_parts["manifest_documents"] ~=
+ format(q"┃<item id="%s.xhtml" href="%s.xhtml" media-type="application/xhtml+xml" />
+ ┃",
+ obj.tags.segment_anchor_tag_epub,
+ obj.tags.segment_anchor_tag_epub,
+ );
+ oepbs_content_parts["spine"] ~=
+ format(q"┃<itemref idref="%s.xhtml" linear="yes" />
+ ┃",
+ obj.tags.segment_anchor_tag_epub,
+ );
+ oepbs_content_parts["guide"] ~=
+ format(q"┃<reference type="%s" href="%s" />
+ ┃",
+ obj.tags.segment_anchor_tag_epub,
+ obj.tags.segment_anchor_tag_epub,
+ );
+ } else if (obj.metainfo.heading_lev_markup > 4) {
+ oepbs_content_parts["manifest_documents"] ~=
+ format(q"┃<item id="%s.xhtml#%s" href="%s.xhtml#%s" media-type="application/xhtml+xml" />
+ ┃",
+ obj.tags.segment_anchor_tag_epub,
+ obj.metainfo.object_number,
+ obj.tags.segment_anchor_tag_epub,
+ obj.metainfo.object_number,
+ );
+ oepbs_content_parts["spine"] ~=
+ format(q"┃<itemref idref="%s.xhtml#%s" linear="yes" />
+ ┃",
+ obj.tags.segment_anchor_tag_epub,
+ obj.metainfo.object_number,
+ );
+ oepbs_content_parts["guide"] ~=
+ format(q"┃<reference type="%s#%s" href="%s#%s" />
+ ┃",
+ obj.tags.segment_anchor_tag_epub,
+ obj.metainfo.object_number,
+ obj.tags.segment_anchor_tag_epub,
+ obj.metainfo.object_number,
+ );
+ }
+ }
+ }
+ }
+ /+ epub specific documents +/
+ epubWrite.mimetypes = epub3_mimetypes;
+ epubWrite.meta_inf_container_xml = epub3_container_xml;
+ epubWrite.oebps_toc_nav_xhtml = doc_abstraction.epub3_oebps_toc_nav_xhtml(doc_matters);
+ epubWrite.oebps_content_opf = doc_abstraction.epub3_oebps_content(doc_matters, oepbs_content_parts);
+ epubWrite.epub3_write_output_files(doc_matters);
+ }
+ @system void epub3_write_output_files(W,M)(
+ W epub_write,
+ M doc_matters,
+ ) {
+ debug(asserts) {
+ static assert(is(typeof(epub_write.doc_epub3) == string[][string]));
+ static assert(is(typeof(epub_write.mimetypes) == string));
+ static assert(is(typeof(epub_write.meta_inf_container_xml) == string));
+ static assert(is(typeof(epub_write.oebps_toc_nav_xhtml) == string));
+ static assert(is(typeof(epub_write.oebps_content_opf) == string));
+ }
+ static auto rgx = RgxO();
+ static auto rgx_xhtml = RgxXHTML();
+ auto pth_epub3 = spinePathsEPUB!()(doc_matters.output_path, doc_matters.src.language);
+ auto xhtml_format = outputXHTMLs();
+ /+ zip file +/
+ auto fn_epub = pth_epub3.epub_file(doc_matters.src.filename);
+ auto zip = new ZipArchive(); // ZipArchive zip = new ZipArchive();
+ /+ zip archive member files +/
+ void EPUBzip()(string contents, string fn) {
+ auto zip_arc_member_file = new ArchiveMember();
+ zip_arc_member_file.name = fn;
+ auto zip_data = new OutBuffer();
+ (doc_matters.opt.action.debug_do_epub)
+ ? zip_data.write(contents.dup)
+ : zip_data.write(contents.dup
+ .replaceAll(rgx.spaces_line_start, "")
+ .replaceAll(rgx.newline, " ")
+ .strip
+ );
+ zip_arc_member_file.expandedData = zip_data.toBytes();
+ zip.addMember(zip_arc_member_file);
+ createZipFile!()(fn_epub, zip.build());
+ }
+ try {
+ if (!exists(pth_epub3.base)) {
+ pth_epub3.base.mkdirRecurse;
+ }
+ if (!exists(pth_epub3.base ~ "/index.html")) {
+ import sisudoc.io_out.html_snippet;
+ mixin htmlSnippet;
+ auto f = File(pth_epub3.base ~"/index.html", "w");
+ f.writeln(format_html_blank_page_guide_home(
+ "../../css/html_scroll.css",
+ (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,
+ "../../index.html",
+ ));
+ }
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_epub) {
+ if (!exists(pth_epub3.dbg_doc_meta_inf(doc_matters.src.filename))) {
+ pth_epub3.dbg_doc_meta_inf(doc_matters.src.filename).mkdirRecurse;
+ }
+ if (!exists(pth_epub3.dbg_doc_oebps_css(doc_matters.src.filename))) {
+ pth_epub3.dbg_doc_oebps_css(doc_matters.src.filename).mkdirRecurse;
+ }
+ if (!exists(pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename))) {
+ pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename).mkdirRecurse;
+ }
+ }
+ }
+ { /+ OEBPS/[segments].xhtml (the document contents) +/
+ foreach (seg_filename; doc_matters.has.segnames_lv_0_to_4) {
+ string fn = pth_epub3.fn_oebps_content_xhtml(seg_filename);
+ auto zip_arc_member_file = new ArchiveMember();
+ zip_arc_member_file.name = fn;
+ auto zip_data = new OutBuffer();
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_epub) {
+ string fn_dbg = pth_epub3.dbg_fn_oebps_content_xhtml(doc_matters.src.filename, seg_filename);
+ auto f = File(fn_dbg, "w");
+ foreach (docseg; epub_write.doc_epub3[seg_filename]) {
+ f.writeln(docseg);
+ }
+ foreach (docseg; epub_write.doc_epub3_endnotes[seg_filename]) {
+ f.writeln(docseg);
+ }
+ f.writeln(xhtml_format.tail(doc_matters));
+ }
+ }
+ foreach (docseg; epub_write.doc_epub3[seg_filename]) {
+ zip_data.write(docseg.dup);
+ }
+ foreach (docseg; epub_write.doc_epub3_endnotes[seg_filename]) {
+ zip_data.write(docseg.dup);
+ }
+ zip_data.write(xhtml_format.tail(doc_matters).dup);
+ zip_arc_member_file.expandedData = zip_data.toBytes();
+ zip.addMember(zip_arc_member_file);
+ /+ create the zip file +/
+ createZipFile!()(fn_epub, zip.build());
+ }
+ }
+ string fn;
+ string fn_dbg;
+ File f;
+ { /+ mimetypes (identify zip file type) +/
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_epub) {
+ fn_dbg = pth_epub3.dbg_fn_mimetypes(doc_matters.src.filename);
+ File(fn_dbg, "w").writeln(epub_write.mimetypes);
+ }
+ }
+ fn = pth_epub3.fn_mimetypes;
+ EPUBzip(epub_write.mimetypes, fn);
+ }
+ { /+ META-INF/container.xml (identify doc root) +/
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_epub) {
+ fn_dbg = pth_epub3.dbg_fn_dmi_container_xml(doc_matters.src.filename);
+ File(fn_dbg, "w").writeln(epub_write.meta_inf_container_xml);
+ }
+ }
+ fn = pth_epub3.fn_dmi_container_xml;
+ EPUBzip(epub_write.meta_inf_container_xml, fn);
+ }
+ { /+ OEBPS/toc_nav.xhtml (navigation toc epub3) +/
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_epub) {
+ fn_dbg = pth_epub3.dbg_fn_oebps_toc_nav_xhtml(doc_matters.src.filename);
+ File(fn_dbg, "w").writeln(epub_write.oebps_toc_nav_xhtml);
+ }
+ }
+ fn = pth_epub3.fn_oebps_toc_nav_xhtml;
+ EPUBzip(epub_write.oebps_toc_nav_xhtml, fn);
+ }
+ { /+ OEBPS/content.opf (doc manifest) +/
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_epub) {
+ fn_dbg = pth_epub3.dbg_fn_oebps_content_opf(doc_matters.src.filename);
+ File(fn_dbg, "w").writeln(epub_write.oebps_content_opf);
+ }
+ }
+ fn = pth_epub3.fn_oebps_content_opf;
+ EPUBzip(epub_write.oebps_content_opf, fn);
+ }
+ { /+ OEBPS/_dr/image (images) +/
+ foreach (image; doc_matters.srcs.image_list) {
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_epub) {
+ if (doc_matters.opt.action.vox_gt2) {
+ writeln(
+ doc_matters.src.image_dir_path, "/", image, " -> ",
+ pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename), "/", image
+ );
+ }
+ if (exists(doc_matters.src.image_dir_path ~ "/" ~ image)) {
+ (doc_matters.src.image_dir_path ~ "/" ~ image)
+ .copy((pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename)) ~ "/" ~ image);
+ }
+ }
+ }
+ auto fn_src = doc_matters.src.image_dir_path ~ "/" ~ image;
+ auto fn_out = pth_epub3.doc_oebps_image ~ "/" ~ image;
+ if (exists(fn_src)) {
+ {
+ auto zip_arc_member_file = new ArchiveMember();
+ zip_arc_member_file.name = fn_out;
+ auto zip_data = new OutBuffer();
+ zip_data.write(cast(char[]) ((fn_src).read));
+ zip_arc_member_file.expandedData = zip_data.toBytes();
+ zip.addMember(zip_arc_member_file);
+ createZipFile!()(fn_epub, zip.build());
+ }
+ }
+ }
+ }
+ { /+ OEBPS/epub.css +/
+ auto css = spineCss(doc_matters);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_epub) {
+ fn_dbg = pth_epub3.dbg_fn_oebps_css(doc_matters.src.filename);
+ File(fn_dbg, "w").writeln(css.epub);
+ }
+ }
+ fn = pth_epub3.fn_oebps_css;
+ auto zip_arc_member_file = new ArchiveMember();
+ zip_arc_member_file.name = fn;
+ auto zip_data = new OutBuffer();
+ zip_data.write(css.epub.dup);
+ zip_arc_member_file.expandedData = zip_data.toBytes();
+ zip.addMember(zip_arc_member_file);
+ createZipFile!()(fn_epub, zip.build());
+ }
+ } catch (ErrnoException ex) {
+ // Handle error
+ }
+ if (doc_matters.opt.action.vox_gt0) {
+ writeln(" ", fn_epub);
+ }
+ debug(epub_archive) {
+ if (exists(fn_epub)) {
+ try {
+ auto zipped = new ZipArchive((fn_epub).read);
+ foreach (filename, member; zipped.directory) {
+ auto data = zipped.expand(member);
+ writeln(filename, " length ", data.length);
+ }
+ } catch (ZipException ex) {
+ // Handle errors
+ }
+ }
+ }
+ }
+}
diff --git a/src/sisudoc/io_out/html.d b/src/sisudoc/io_out/html.d
new file mode 100644
index 0000000..d9aaa58
--- /dev/null
+++ b/src/sisudoc/io_out/html.d
@@ -0,0 +1,626 @@
+/+
+- Name: SisuDoc 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 sisudoc.io_out.html;
+@safe:
+template outputHTML() {
+ import
+ std.file,
+ std.outbuffer,
+ std.uri,
+ std.conv : to;
+ import
+ sisudoc.io_out,
+ sisudoc.io_out.rgx,
+ sisudoc.meta.rgx_files,
+ sisudoc.io_out.rgx_xhtml,
+ sisudoc.io_out.create_zip_file,
+ sisudoc.io_out.xmls,
+ sisudoc.io_out.xmls_css;
+ mixin outputXHTMLs;
+ void scroll(D,M)(
+ const D doc_abstraction,
+ M doc_matters,
+ ) {
+ mixin spineRgxOut;
+ mixin spineRgxXHTML;
+ auto xhtml_format = outputXHTMLs();
+ static auto rgx = RgxO();
+ static auto rgx_xhtml = RgxXHTML();
+ string[] doc_html;
+ string[] doc;
+ string suffix = ".html";
+ string previous_section = "";
+ string delimit = "";
+ foreach (section; doc_matters.has.keys_seq.scroll) {
+ foreach (obj; doc_abstraction[section]) {
+ delimit = xhtml_format.div_delimit(section, previous_section);
+ string _txt = xhtml_format.special_characters_breaks_indents_bullets(obj);
+ switch (obj.metainfo.is_of_part) {
+ case "frontmatter": assert(section == "head" || "toc");
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "heading":
+ doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc_matters, suffix);
+ break;
+ case "toc":
+ doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix);
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_html) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_html) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
+ }
+ break;
+ }
+ break;
+ case "body": assert(section == "body" || "head");
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "heading":
+ doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc_matters, suffix);
+ break;
+ case "para":
+ doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix);
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_html) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ case "block":
+ switch (obj.metainfo.is_a) {
+ case "quote":
+ doc_html ~= xhtml_format.quote_scroll(_txt, obj, doc_matters);
+ break;
+ case "group":
+ doc_html ~= xhtml_format.group_scroll(_txt, obj, doc_matters);
+ break;
+ case "block":
+ doc_html ~= xhtml_format.block_scroll(_txt, obj, doc_matters);
+ break;
+ case "poem":
+ break;
+ case "verse":
+ doc_html ~= xhtml_format.verse_scroll(_txt, obj, doc_matters, suffix);
+ break;
+ case "code":
+ doc_html ~= xhtml_format.code(_txt, obj, doc_matters);
+ break;
+ case "table":
+ doc_html ~= xhtml_format.table(_txt, obj, doc_matters);
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_html) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_html) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
+ }
+ break;
+ }
+ break;
+ case "backmatter":
+ assert(section == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "heading":
+ doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc_matters, suffix);
+ break;
+ case "endnote": assert(section == "endnotes");
+ doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix);
+ break;
+ case "glossary": assert(section == "glossary");
+ doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix);
+ break;
+ case "bibliography": assert(section == "bibliography");
+ doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix);
+ break;
+ case "bookindex": assert(section == "bookindex");
+ doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix);
+ break;
+ case "blurb": assert(section == "blurb");
+ doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix);
+ break;
+ case "tail": assert(section == "tail");
+ doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix);
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_html) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_html) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
+ }
+ break;
+ }
+ break;
+ case "comment":
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_html) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part);
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ writeln(__FILE__, ":", __LINE__, ": ", obj.text);
+ }
+ }
+ break;
+ }
+ }
+ }
+ doc = xhtml_format.html_head(doc_matters, "scroll")
+ ~ doc_html
+ ~ xhtml_format.dom_close
+ ~ xhtml_format.tail(doc_matters);
+ scroll_write_output(doc, doc_matters);
+ }
+ @trusted void scroll_write_output(D,M)(
+ D doc,
+ M doc_matters,
+ ) {
+ debug(asserts) {
+ static assert(is(typeof(doc) == string[]));
+ }
+ auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language);
+ try {
+ if (!exists(pth_html.base)) {
+ pth_html.base.mkdirRecurse;
+ }
+ {
+ auto f = File(pth_html.fn_scroll(doc_matters.src.filename), "w");
+ foreach (o; doc) {
+ f.writeln(o);
+ }
+ }
+ if (!exists(pth_html.base ~ "/index.html")) {
+ import sisudoc.io_out.html_snippet;
+ mixin htmlSnippet;
+ auto f = File(pth_html.base ~"/index.html", "w");
+ f.writeln(format_html_blank_page_guide_home(
+ "../../css/html_scroll.css",
+ (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,
+ "../../index.html",
+ ));
+ }
+ } catch (ErrnoException ex) {
+ // Handle error
+ }
+ if (doc_matters.opt.action.vox_gt0) {
+ writeln(" ", pth_html.fn_scroll(doc_matters.src.filename));
+ }
+ }
+ void seg(D,M)(
+ const D doc_abstraction,
+ M doc_matters,
+ ) {
+ mixin spineRgxOut;
+ mixin spineRgxXHTML;
+ static auto rgx = RgxO();
+ static auto rgx_xhtml = RgxXHTML();
+ auto xhtml_format = outputXHTMLs();
+ string[][string] doc_html;
+ string[][string] doc_html_endnotes;
+ string[] doc;
+ string segment_filename;
+ string[] top_level_headings = ["","","",""];
+ string previous_seg_filename = "";
+ string suffix = ".html";
+ string previous_section = "";
+ string delimit = "";
+ foreach (section; doc_matters.has.keys_seq.seg) {
+ foreach (obj; doc_abstraction[section]) {
+ delimit = xhtml_format.div_delimit(section, previous_section);
+ string _txt = xhtml_format.special_characters_breaks_indents_bullets(obj);
+ if (obj.metainfo.is_a == "heading") {
+ assert(section == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
+ switch (obj.metainfo.heading_lev_markup) {
+ case 0: .. case 3:
+ /+ fill buffer, and replace with new levels from 1 to 3 +/
+ switch (obj.metainfo.heading_lev_markup) {
+ case 0:
+ top_level_headings[0] = "";
+ top_level_headings[1] = "";
+ top_level_headings[2] = "";
+ top_level_headings[3] = "";
+ goto default;
+ case 1:
+ top_level_headings[1] = "";
+ top_level_headings[2] = "";
+ top_level_headings[3] = "";
+ goto default;
+ case 2:
+ top_level_headings[2] = "";
+ top_level_headings[3] = "";
+ goto default;
+ case 3:
+ top_level_headings[3] = "";
+ goto default;
+ default:
+ Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "seg");
+ top_level_headings[obj.metainfo.heading_lev_markup] = t[0];
+ break;
+ }
+ break;
+ case 4:
+ segment_filename = obj.tags.segment_anchor_tag_epub;
+ doc_html[segment_filename] ~= xhtml_format.html_head(doc_matters, "seg");
+ auto navigation_bar = xhtml_format.nav_pre_next_svg(obj, doc_matters);
+ doc_html[segment_filename] ~= navigation_bar.toc_pre_next;
+ previous_seg_filename = segment_filename;
+ foreach (top_level_heading; top_level_headings) {
+ doc_html[segment_filename] ~= top_level_heading;
+ }
+ Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "seg");
+ doc_html[segment_filename] ~= t[0].to!string;
+ doc_html[segment_filename] ~= xhtml_format.lev4_heading_subtoc(obj, doc_matters);
+ doc_html_endnotes[segment_filename] ~= t[1];
+ break;
+ case 5: .. case 7:
+ Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "seg");
+ doc_html[segment_filename] ~= t[0].to!string;
+ doc_html_endnotes[segment_filename] ~= t[1];
+ break;
+ case 8: .. case 9:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_html) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup);
+ writeln(__FILE__, ":", __LINE__, ": ", obj.text);
+ }
+ }
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_html) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup);
+ }
+ }
+ break;
+ }
+ } else {
+ assert(section == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
+ Tuple!(string, string[]) t;
+ switch (obj.metainfo.is_of_part) {
+ case "frontmatter": assert(section == "head" || "toc");
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "toc":
+ t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg");
+ doc_html[segment_filename] ~= t[0].to!string;
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_html) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_html) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ case "body": assert(section == "body");
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "para":
+ t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg");
+ doc_html[segment_filename] ~= t[0].to!string;
+ doc_html_endnotes[segment_filename] ~= t[1];
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_html) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ case "block":
+ switch (obj.metainfo.is_a) {
+ case "quote":
+ t = xhtml_format.quote_seg(_txt, obj, doc_matters, suffix, "seg");
+ goto default;
+ case "group":
+ t = xhtml_format.group_seg(_txt, obj, doc_matters, suffix, "seg");
+ goto default;
+ case "block":
+ t = xhtml_format.block_seg(_txt, obj, doc_matters, suffix, "seg");
+ goto default;
+ case "poem":
+ break;
+ case "verse":
+ t = xhtml_format.verse_seg(_txt, obj, doc_matters, suffix, "seg");
+ goto default;
+ case "code":
+ doc_html[segment_filename] ~= xhtml_format.code(_txt, obj, doc_matters);
+ break;
+ case "table":
+ doc_html[segment_filename] ~= xhtml_format.table(_txt, obj, doc_matters);
+ doc_html_endnotes[segment_filename] ~= "";
+ break;
+ default:
+ if ((obj.metainfo.is_a == "quote"
+ || obj.metainfo.is_a == "group"
+ || obj.metainfo.is_a == "block"
+ || obj.metainfo.is_a == "verse"
+ )) {
+ doc_html[segment_filename] ~= t[0].to!string;
+ doc_html_endnotes[segment_filename] ~= t[1];
+ } else { /+ debug +/
+ if (doc_matters.opt.action.debug_do_html) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_html) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
+ }
+ break;
+ }
+ break;
+ case "backmatter":
+ assert(section == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "endnote": assert(section == "endnotes");
+ t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg");
+ doc_html[segment_filename] ~= t[0];
+ break;
+ case "glossary": assert(section == "glossary");
+ t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg");
+ doc_html[segment_filename] ~= t[0];
+ doc_html_endnotes[segment_filename] ~= t[1];
+ break;
+ case "bibliography": assert(section == "bibliography");
+ t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg");
+ doc_html[segment_filename] ~= t[0];
+ doc_html_endnotes[segment_filename] ~= t[1];
+ break;
+ case "bookindex": assert(section == "bookindex");
+ t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg");
+ doc_html[segment_filename] ~= t[0];
+ doc_html_endnotes[segment_filename] ~= t[1];
+ break;
+ case "blurb": assert(section == "blurb");
+ t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg");
+ doc_html[segment_filename] ~= t[0];
+ doc_html_endnotes[segment_filename] ~= t[1];
+ break;
+ case "tail": assert(section == "tail");
+ t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg");
+ doc_html[segment_filename] ~= t[0];
+ doc_html_endnotes[segment_filename] ~= t[1];
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_html) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_html) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
+ }
+ break;
+ }
+ break;
+ case "comment":
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_html) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part);
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+ seg_write_output(doc_html, doc_html_endnotes, doc_matters);
+ }
+ @trusted void seg_write_output(D,E,M)( // @system?
+ D doc_html,
+ E doc_html_endnotes,
+ M doc_matters,
+ ) {
+ debug(asserts) {
+ static assert(is(typeof(doc_html) == string[][string]));
+ }
+ mixin spineRgxFiles;
+ static auto rgx_files = RgxFiles();
+ auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language);
+ auto xhtml_format = outputXHTMLs();
+ auto m = doc_matters.src.filename.matchFirst(rgx_files.src_fn);
+ try {
+ if (!exists(pth_html.seg(doc_matters.src.filename))) {
+ pth_html.seg(doc_matters.src.filename).mkdirRecurse;
+ }
+ foreach (seg_filename; doc_matters.has.segnames_lv4) {
+ auto f = File(pth_html.fn_seg(doc_matters.src.filename, seg_filename), "w");
+ foreach (docseg; doc_html[seg_filename]) {
+ f.writeln(docseg);
+ }
+ foreach (docseg; doc_html_endnotes[seg_filename]) {
+ f.writeln(docseg);
+ }
+ f.writeln(xhtml_format.tail(doc_matters));
+ }
+ if (!exists(pth_html.fn_seg(doc_matters.src.filename, "index"))) {
+ symlink("./toc.html", (pth_html.fn_seg(doc_matters.src.filename, "index")));
+ }
+ } catch (ErrnoException ex) {
+ // handle error
+ }
+ if (doc_matters.opt.action.vox_gt0) {
+ writeln(" ", pth_html.fn_seg(doc_matters.src.filename, "toc"));
+ }
+ }
+ void css(M)(M doc_matters) {
+ auto css = spineCss(doc_matters);
+ auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language);
+ try {
+ if (!exists(pth_html.css)) {
+ (pth_html.css).mkdirRecurse;
+ }
+ {
+ auto f = File(pth_html.fn_seg_css, "w");
+ f.writeln(css.html_seg);
+ f = File(pth_html.fn_scroll_css, "w");
+ f.writeln(css.html_scroll);
+ }
+ if (!exists(pth_html.css ~ "/index.html")) {
+ import sisudoc.io_out.html_snippet;
+ mixin htmlSnippet;
+ auto f = File(pth_html.css ~"/index.html", "w");
+ f.writeln(format_html_blank_page_guide_home(
+ "./css/html_scroll.css",
+ (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,
+ "../index.html",
+ ));
+ }
+ } catch (ErrnoException ex) {
+ // Handle error
+ }
+ }
+ @trusted void images_cp(M)( // @system
+ M doc_matters,
+ ) {
+ { /+ (copy html images) +/
+ auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language);
+ if (!exists(pth_html.image)) {
+ pth_html.image.mkdirRecurse;
+ }
+ foreach (image; doc_matters.srcs.image_list) {
+ auto fn_src_in = doc_matters.src.image_dir_path ~ "/" ~ image;
+ auto fn_src_out = pth_html.image ~ "/" ~ image;
+ debug(images_html) {
+ writeln(fn_src_in, " -> ", fn_src_out);
+ }
+ if (exists(fn_src_in)) {
+ fn_src_in.copy(fn_src_out);
+ } else {
+ if (doc_matters.opt.action.vox_gt0) {
+ writeln("WARNING image not found: ", fn_src_in);
+ }
+ }
+ }
+ if (!exists(pth_html.image ~ "/index.html")) {
+ import sisudoc.io_out.html_snippet;
+ mixin htmlSnippet;
+ auto f = File(pth_html.image ~"/index.html", "w");
+ f.writeln(format_html_blank_page_guide_home(
+ "../css/html_scroll.css",
+ (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 ,
+ "../index.html",
+ ));
+ }
+ }
+ }
+}
diff --git a/src/sisudoc/io_out/html_snippet.d b/src/sisudoc/io_out/html_snippet.d
new file mode 100644
index 0000000..480246a
--- /dev/null
+++ b/src/sisudoc/io_out/html_snippet.d
@@ -0,0 +1,103 @@
+/+
+- Name: SisuDoc 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 sisudoc.io_out.html_snippet;
+@safe:
+template htmlSnippet() {
+ import
+ std.file,
+ std.outbuffer,
+ std.format,
+ std.uri,
+ std.conv : to;
+ import
+ sisudoc.io_out.rgx,
+ sisudoc.meta.rgx_files,
+ sisudoc.io_out.rgx_xhtml;
+ auto format_html_blank_page_guide_home()(
+ string css_style,
+ string home_url,
+ string collection_home_path
+ ) {
+ auto html_blank_default = format(q"┃<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/plain; charset=UTF-8" />
+ <link href="%s" rel="stylesheet" />
+ </head>
+ <body>
+ <p class="icons">
+ <a href="%s" class="lnkicon">⟰&nbsp;</a>&nbsp;
+ <a href="%s" class="lnkicon">&nbsp;≅&nbsp;</a>
+ </p>
+ </body>
+</html>┃",
+ css_style,
+ home_url,
+ collection_home_path
+ );
+ return html_blank_default;
+ }
+ string special_characters_text(string _txt) {
+ mixin spineRgxOut;
+ mixin spineRgxXHTML;
+ static auto rgx = RgxO();
+ static auto rgx_xhtml = RgxXHTML();
+ _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;
+ }
+}
diff --git a/src/sisudoc/io_out/hub.d b/src/sisudoc/io_out/hub.d
new file mode 100644
index 0000000..b68eb0d
--- /dev/null
+++ b/src/sisudoc/io_out/hub.d
@@ -0,0 +1,238 @@
+/+
+- Name: SisuDoc 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/]
+
++/
+/++
+ output hub<BR>
+ check & generate output types requested
++/
+module sisudoc.io_out.hub;
+@safe:
+template outputHub() {
+ import sisudoc.io_out,
+ sisudoc.io_out.metadata,
+ sisudoc.io_out.xmls,
+ sisudoc.io_out.create_zip_file,
+ sisudoc.io_out.paths_output;
+ @system void outputHub(D,I)(
+ const D doc_abstraction,
+ I doc_matters
+ ) {
+ mixin Msg;
+ auto msg = Msg!()(doc_matters);
+ enum outTask { source_or_pod, sqlite, sqlite_multi, latex, odt, epub, html_scroll, html_seg, html_stuff }
+ void Scheduled(D,I)(int sched, D doc_abstraction, I doc_matters) {
+ auto msg = Msg!()(doc_matters);
+ if (sched == outTask.source_or_pod) {
+ msg.v("spine (doc reform) source processing... ");
+ if (doc_matters.opt.action.pod) {
+ msg.v("spine (doc reform) source pod processing... ");
+ }
+ import sisudoc.io_out.source_pod;
+ spinePod!()(doc_matters);
+ if (doc_matters.opt.action.source) {
+ msg.vv("spine (doc reform) source done");
+ }
+ if (doc_matters.opt.action.pod) {
+ msg.vv("spine (doc reform) source pod done");
+ }
+ }
+ if (sched == outTask.epub) {
+ msg.v("epub3 processing... ");
+ import sisudoc.io_out.epub3;
+ doc_abstraction.outputEPub3!()(doc_matters);
+ msg.vv("epub3 done");
+ }
+ if (sched == outTask.html_stuff) {
+ outputMetadata!()(doc_matters);
+ msg.vv("html metadata done");
+ }
+ if (sched == outTask.html_scroll) {
+ msg.v("html scroll processing... ");
+ import sisudoc.io_out.html;
+ outputHTML!().scroll(doc_abstraction, doc_matters);
+ msg.vv("html scroll done");
+ }
+ if (sched == outTask.html_seg) {
+ msg.v("html seg processing... ");
+ import sisudoc.io_out.html;
+ outputHTML!().seg(doc_abstraction, doc_matters);
+ msg.vv("html seg done");
+ }
+ if (sched == outTask.html_stuff) {
+ import sisudoc.io_out.html;
+ outputHTML!().css(doc_matters);
+ outputHTML!().images_cp(doc_matters);
+ msg.vv("html css & images done");
+ }
+ if (sched == outTask.latex) {
+ msg.v("latex processing... (available for downstream processing & pdf output");
+ import sisudoc.io_out.latex;
+ import std.file;
+ if ((isValidPath(doc_matters.output_path ~ "/latex/sty"))
+ && (!(exists(doc_matters.output_path ~ "/latex/sty")))
+ ) {
+ outputLaTeXstyInit!()(
+ doc_matters.output_path,
+ doc_matters.opt.action.generated_by,
+ doc_matters.generator_program.name_version_and_compiler,
+ doc_matters.generator_program.time_output_generated,
+ );
+ }
+ outputLaTeX!()(doc_abstraction, doc_matters);
+ msg.vv("latex done");
+ }
+ if (sched == outTask.odt) {
+ msg.v("odf:odt processing... ");
+ import sisudoc.io_out.odt;
+ outputODT!()(doc_abstraction, doc_matters);
+ msg.vv("odf:odt done");
+ }
+ if (sched == outTask.sqlite) {
+ msg.v("sqlite processing... ");
+ import sisudoc.io_out.sqlite;
+ doc_abstraction.SQLiteHubDiscreteBuildTablesAndPopulate!()(doc_matters);
+ msg.vv("sqlite done");
+ }
+ }
+ if (doc_matters.opt.action.vox_gt0) {
+ writeln(" ", doc_matters.src.filename_base);
+ }
+ if (!(doc_matters.opt.action.parallelise_subprocesses)) {
+ foreach(schedule; doc_matters.opt.action.output_task_scheduler) {
+ Scheduled!()(schedule, doc_abstraction, doc_matters);
+ }
+ } else {
+ import std.parallelism;
+ foreach(schedule; parallel(doc_matters.opt.action.output_task_scheduler)) {
+ Scheduled!()(schedule, doc_abstraction, doc_matters);
+ }
+ }
+ if (doc_matters.opt.action.sqlite_update) {
+ msg.v("sqlite update processing...");
+ import sisudoc.io_out.sqlite;
+ doc_abstraction.SQLiteHubBuildTablesAndPopulate!()(doc_matters);
+ msg.vv("sqlite update done");
+ } else if (doc_matters.opt.action.sqlite_delete) {
+ msg.v("sqlite delete processing...");
+ import sisudoc.io_out.sqlite;
+ doc_abstraction.SQLiteHubBuildTablesAndPopulate!()(doc_matters);
+ msg.vv("sqlite delete done");
+ }
+ }
+}
+template outputHubInitialize() {
+ import std.file;
+ import sisudoc.io_out,
+ sisudoc.io_out.metadata,
+ sisudoc.io_out.paths_output;
+ string _bespoke_homepage = "./spine-bespoke-output/html/homepage.index.html";
+ @system void outputHubInitialize(O,I)(
+ O opt_action,
+ I program_info
+ ) {
+ if ((opt_action.html || opt_action.html_seg || opt_action.html_scroll)
+ && opt_action.output_dir_set.length > 0
+ && !(opt_action.output_dir_set ~ "/index.html").exists
+ ) {
+ writeln(_bespoke_homepage);
+ if ((_bespoke_homepage).exists) {
+ writeln("copy bespoke html homepage\n", _bespoke_homepage, " -> ", opt_action.output_dir_set, "/index.html");
+ _bespoke_homepage.copy(opt_action.output_dir_set ~ "/index.html");
+ } else {
+ writeln("place bespoke homepage in ", _bespoke_homepage);
+ }
+ }
+ if (
+ opt_action.latex_document_header_sty
+ || (
+ opt_action.latex
+ && opt_action.output_dir_set.length > 0
+ && !(isValidPath(opt_action.output_dir_set ~ "/latex/sty")))
+ ) { // .sty need to be produced only once (if unchanged per output-dir of which there usually will be only one)
+ import sisudoc.io_out.latex;
+ outputLaTeXstyInit!()(
+ opt_action.output_dir_set,
+ opt_action.generated_by,
+ program_info.name_version_and_compiler,
+ program_info.time_output_generated,
+ );
+ writeln(opt_action.latex);
+ }
+ }
+}
+template outputHubOp() {
+ import sisudoc.io_out,
+ sisudoc.io_out.metadata,
+ sisudoc.io_out.xmls,
+ sisudoc.io_out.create_zip_file,
+ sisudoc.io_out.paths_output;
+ @system void outputHubOp(E,O,C)(E env, O opt_action, C config) {
+ if ((opt_action.sqlite_db_drop)) {
+ if ((opt_action.vox_gt1)) {
+ writeln("sqlite drop db...");
+ }
+ import sisudoc.io_out.sqlite;
+ SQLiteDbDrop!()(opt_action, config);
+ if ((opt_action.vox_gt2)) {
+ writeln("sqlite drop db done");
+ }
+ }
+ if ((opt_action.sqlite_db_create)) {
+ if ((opt_action.vox_gt1)) {
+ auto pth_sqlite_db = spinePathsSQLite!()(opt_action.cgi_sqlite_search_filename, opt_action.output_dir_set);
+ writeln("sqlite create table...");
+ }
+ import sisudoc.io_out.sqlite;
+ SQLiteTablesCreate!()(env, opt_action, config);
+ if ((opt_action.vox_gt2)) {
+ writeln("sqlite create table done");
+ }
+ }
+ }
+}
diff --git a/src/sisudoc/io_out/latex.d b/src/sisudoc/io_out/latex.d
new file mode 100644
index 0000000..a6867cb
--- /dev/null
+++ b/src/sisudoc/io_out/latex.d
@@ -0,0 +1,1771 @@
+/+
+- Name: SisuDoc 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 sisudoc.io_out.latex;
+@safe:
+template paperLaTeX() {
+ import
+ std.format,
+ std.conv : to;
+ auto paperLaTeX() {
+ string mm(uint mmi) {
+ string _mm = format(q"┃%smm┃", mmi.to!string);
+ return _mm;
+ }
+ struct PaperType {
+ auto a4() {
+ struct A4 {
+ auto portrait() {
+ struct V {
+ string stylesheet = "spineA4portrait";
+ string papersize = "a4paper";
+ string orient = "portrait";
+ string fontsize = "11pt";
+ const uint w = 170;
+ const uint h = 257;
+ const uint l = 30;
+ const uint r = 20;
+ const uint t = 30;
+ const uint b = 30;
+ string width = mm(w);
+ string height = mm(h);
+ string margin_left = mm(l);
+ string margin_right = mm(r);
+ string margin_top = mm(t);
+ string margin_bottom = mm(b);
+ uint img_px = 450;
+ bool is_portrait = true;
+ }
+ return V();
+ }
+ auto landscape() {
+ struct H {
+ string stylesheet = "spineA4landscape";
+ string papersize = "a4paper";
+ string orient = "landscape";
+ string fontsize = "11pt";
+ const uint w = 238;
+ const uint h = 160;
+ const uint l = 30;
+ const uint r = 20;
+ const uint t = 30;
+ const uint b = 30;
+ string width = mm(w);
+ string height = mm(h);
+ string margin_left = mm(l);
+ string margin_right = mm(r);
+ string margin_top = mm(t);
+ string margin_bottom = mm(b);
+ uint img_px = 300;
+ bool is_portrait = false;
+ }
+ return H();
+ }
+ }
+ return A4();
+ }
+ auto a5() {
+ struct A5 {
+ auto portrait() {
+ struct V {
+ string stylesheet = "spineA5portrait";
+ string papersize = "a5paper";
+ string orient = "portrait";
+ string fontsize = "11pt";
+ const uint w = 112;
+ const uint h = 162;
+ const uint l = 30;
+ const uint r = 20;
+ const uint t = 30;
+ const uint b = 30;
+ string width = mm(w);
+ string height = mm(h);
+ string margin_left = mm(l);
+ string margin_right = mm(r);
+ string margin_top = mm(t);
+ string margin_bottom = mm(b);
+ uint img_px = 280;
+ bool is_portrait = true;
+ }
+ return V();
+ }
+ auto landscape() {
+ struct H {
+ string stylesheet = "spineA5landscape";
+ string papersize = "a5paper";
+ string orient = "landscape";
+ string fontsize = "11pt";
+ const uint w = 152;
+ const uint h = 100;
+ const uint l = 30;
+ const uint r = 20;
+ const uint t = 30;
+ const uint b = 30;
+ string width = mm(w);
+ string height = mm(h);
+ string margin_left = mm(l);
+ string margin_right = mm(r);
+ string margin_top = mm(t);
+ string margin_bottom = mm(b);
+ uint img_px = 190;
+ bool is_portrait = false;
+ }
+ return H();
+ }
+ }
+ return A5();
+ }
+ auto b4() {
+ struct B4 {
+ auto portrait() {
+ struct V {
+ string stylesheet = "spineB4portrait";
+ string papersize = "b4paper";
+ string orient = "portrait";
+ string fontsize = "11pt";
+ const uint w = 140;
+ const uint h = 204;
+ const uint l = 30;
+ const uint r = 20;
+ const uint t = 30;
+ const uint b = 30;
+ string width = mm(w);
+ string height = mm(h);
+ string margin_left = mm(l);
+ string margin_right = mm(r);
+ string margin_top = mm(t);
+ string margin_bottom = mm(b);
+ uint img_px = 356;
+ bool is_portrait = true;
+ }
+ return V();
+ }
+ auto landscape() {
+ struct H {
+ string stylesheet = "spineB4landsape";
+ string papersize = "b4paper";
+ string orient = "landscape";
+ string fontsize = "11pt";
+ const uint w = 200;
+ const uint h = 130;
+ const uint l = 30;
+ const uint r = 20;
+ const uint t = 30;
+ const uint b = 30;
+ string width = mm(w);
+ string height = mm(h);
+ string margin_left = mm(l);
+ string margin_right = mm(r);
+ string margin_top = mm(t);
+ string margin_bottom = mm(b);
+ uint img_px = 260;
+ bool is_portrait = false;
+ }
+ return H();
+ }
+ }
+ return B4();
+ }
+ auto letter() {
+ struct Letter {
+ auto portrait() {
+ struct V {
+ string stylesheet = "spineLetterPortrait";
+ string papersize = "letterpaper";
+ string orient = "portrait";
+ string fontsize = "11pt";
+ const uint w = 166;
+ const uint h = 212;
+ const uint l = 30;
+ const uint r = 20;
+ const uint t = 30;
+ const uint b = 30;
+ string width = mm(w);
+ string height = mm(h);
+ string margin_left = mm(l);
+ string margin_right = mm(r);
+ string margin_top = mm(t);
+ string margin_bottom = mm(b);
+ uint img_px = 468;
+ bool is_portrait = true;
+ }
+ return V();
+ }
+ auto landscape() {
+ struct H {
+ string stylesheet = "spineLetterLandscape";
+ string papersize = "letterpaper";
+ string orient = "landscape";
+ string fontsize = "11pt";
+ const uint w = 226;
+ const uint h = 166;
+ const uint l = 30;
+ const uint r = 20;
+ const uint t = 30;
+ const uint b = 30;
+ string width = mm(w);
+ string height = mm(h);
+ string margin_left = mm(l);
+ string margin_right = mm(r);
+ string margin_top = mm(t);
+ string margin_bottom = mm(b);
+ uint img_px = 290;
+ bool is_portrait = false;
+ }
+ return H();
+ }
+ }
+ return Letter();
+ }
+ auto legal() {
+ struct Legal {
+ auto portrait() {
+ struct V {
+ string stylesheet = "spineLegalPortrait";
+ string papersize = "legalpaper";
+ string orient = "portrait";
+ string fontsize = "11pt";
+ const uint w = 168;
+ const uint h = 286;
+ const uint l = 30;
+ const uint r = 20;
+ const uint t = 30;
+ const uint b = 30;
+ string width = mm(w);
+ string height = mm(h);
+ string margin_left = mm(l);
+ string margin_right = mm(r);
+ string margin_top = mm(t);
+ string margin_bottom = mm(b);
+ uint img_px = 474;
+ bool is_portrait = true;
+ }
+ return V();
+ }
+ auto landscape() {
+ struct H {
+ string stylesheet = "spineLegalLandscape";
+ string papersize = "legalpaper";
+ string orient = "landscape";
+ string fontsize = "11pt";
+ const uint w = 296;
+ const uint h = 166;
+ const uint l = 30;
+ const uint r = 20;
+ const uint t = 30;
+ const uint b = 30;
+ string width = mm(w);
+ string height = mm(h);
+ string margin_left = mm(l);
+ string margin_right = mm(r);
+ string margin_top = mm(t);
+ string margin_bottom = mm(b);
+ uint img_px = 420;
+ bool is_portrait = false;
+ }
+ return H();
+ }
+ }
+ return Legal();
+ }
+ }
+ return PaperType();
+ }
+}
+template outputLaTeX() {
+ import
+ std.digest.sha,
+ std.file,
+ std.outbuffer,
+ std.uri,
+ std.conv : to;
+ import
+ sisudoc.io_out,
+ sisudoc.io_out.rgx,
+ sisudoc.io_out.rgx_latex;
+ mixin spineRgxOut;
+ static auto rgx = RgxO();
+ mixin spineRgxLSC;
+ static auto rgx_sc = RgxLSC();
+ mixin spineLanguageCodes;
+ auto lang = Lang();
+ auto paper = paperLaTeX;
+ string sp_char_ops()(
+ string _txt,
+ ) {
+ string _unescape_sp_char_esc()(string _txt) {
+ _txt = _txt
+ .replaceAll(rgx_sc.latex_special_char_escaped,
+ format(q"┃%s┃", "$1"))
+ .replaceAll(rgx_sc.latex_special_char_escaped_braced,
+ format(q"┃%s┃", "$1"));
+ return _txt;
+ }
+ string _unescape_fontface_esc()(string _txt) {
+ _txt = _txt.replaceAll(rgx_sc.latex_identify_inline_fontface,
+ format(q"┃%s%s┃", "$1", "$2"));
+ return _txt;
+ }
+ _txt = replaceAll!(m => "\\" ~ m[1])(_txt, rgx_sc.latex_special_char_for_escape);
+ _txt = replaceAll!(m => "{\\" ~ m[1] ~ "}")(_txt, rgx_sc.latex_special_char_for_escape_and_braces);
+ _txt = replaceAll!(m => "''")(_txt, rgx.quotes_open_and_close);
+ _txt = replaceAll!(m => "$\\cdot$")(_txt, rgx.middle_dot);
+ _txt = replaceAll!(m => _unescape_sp_char_esc(m[0]))(_txt, rgx_sc.latex_identify_inline_link);
+ _txt = replaceAll!(m => _unescape_fontface_esc(m[0]))(_txt, rgx_sc.latex_identify_inline_fontface);
+ return _txt;
+ }
+ string sp_char_esc(O)(
+ string _txt,
+ const O obj,
+ ) {
+ if (obj.metainfo.is_a != "code") {
+ _txt = _txt.sp_char_ops;
+ }
+ return _txt;
+ }
+ string sp_char_esc_txt()(
+ string _txt,
+ ) {
+ _txt = _txt.sp_char_ops;
+ return _txt;
+ }
+ string marked_linebreaks_newlines()(
+ string _txt,
+ ) {
+ _txt = _txt.split(rgx.br_linebreaks_newlines).join("\\br\n").strip;
+ // _txt = replaceAll!(m => "\\br " ~ m[1])(_txt, rgx.br_linebreaks_newlines);
+ return _txt;
+ }
+ string fontface()(
+ string _txt,
+ ) {
+ _txt = _txt
+ .replaceAll(rgx.inline_emphasis, format(q"┃\begin{bfseries}%s\end{bfseries}┃", "$1"))
+ .replaceAll(rgx.inline_bold, format(q"┃\begin{bfseries}%s\end{bfseries}┃", "$1"))
+ .replaceAll(rgx.inline_italics, format(q"┃\emph{%s}┃", "$1"))
+ .replaceAll(rgx.inline_italics, format(q"┃\uline{%s}┃", "$1"))
+ .replaceAll(rgx.inline_superscript, format(q"┃$$^{%s}$$┃", "$1"))
+ .replaceAll(rgx.inline_subscript, format(q"┃$$_{%s}$$┃", "$1"))
+ .replaceAll(rgx.inline_strike, format(q"┃\sout{%s}┃", "$1"))
+ .replaceAll(rgx.inline_insert, format(q"┃\uline{%s}┃", "$1"))
+ .replaceAll(rgx.inline_mono, format(q"┃\begin{monosp}%s\end{monosp}┃", "$1"))
+ .replaceAll(rgx.inline_italics, format(q"┃``%s''┃", "$1"));
+ return _txt;
+ }
+ string leading_hardspaces()(
+ string _txt,
+ ) {
+ string hardspaces(string _spaces) {
+ _spaces = _spaces
+ .replaceAll(rgx.space, "{\\s}");
+ return _spaces;
+ }
+ _txt = replaceAll!(m => hardspaces(m[0]))(_txt, rgx.spaces_line_start);
+ return _txt;
+ }
+ string nbsp_char()(string _txt) {
+ if (_txt.match(rgx.nbsp_char)) {
+ foreach (m; _txt.matchAll(rgx.nbsp_chars)) {
+ int spaces_ = 0;
+ foreach (n; m[0].matchAll(rgx.nbsp_char)) {
+ spaces_ ++;
+ }
+ _txt = _txt.replaceFirst(rgx.nbsp_chars, "\\spaces{" ~ spaces_.to!string ~ "}");
+ }
+ }
+ return _txt;
+ }
+ string spaces_to_nbsp()(string _txt) {
+ if (_txt.match(rgx.spaces_keep)) {
+ foreach (m; _txt.matchAll(rgx.spaces_keep)) {
+ int spaces_ = 0;
+ foreach (n; m[0].matchAll(rgx.space)) {
+ spaces_ ++;
+ }
+ _txt = _txt.replaceFirst(rgx.spaces_keep, "\\spaces{" ~ spaces_.to!string ~ "}");
+ }
+ }
+ return _txt;
+ }
+ string nbsp_char_to_space()(string _txt) {
+ if (_txt.match(rgx.nbsp_char)) {
+ _txt = _txt.replaceAll(rgx.nbsp_char, " ");
+ }
+ return _txt;
+ }
+ string links_and_images(O,M)(
+ string _txt,
+ const O obj,
+ M doc_matters,
+ ) {
+ if (obj.has.inline_links) { // TODO some images do not have inline links ... image without link
+ string _width_adjust(string _width) {
+ if (_width.to!int > 300) { _width = "300"; } // will need to vary max with papersize & orientation
+ return _width;
+ }
+ string _latex_image_path(string _image_path) {
+ auto pth_latex = spinePathsLaTeX(doc_matters);
+ _image_path = pth_latex.latex_path_stuff ~ "/" ~ _image_path;
+ return _image_path;
+ }
+ string _if_images(string _linked_content) {
+ if (_linked_content.match(rgx.inline_image_info)) {
+ _linked_content = replaceAll!(m =>
+ format(q"┃\includegraphics*[width=%spt]{%s}%s┃",
+ _width_adjust(m[2]), _latex_image_path(m[1]), " \\br\n")
+ )(_linked_content, rgx.inline_image_info);
+ }
+ return _linked_content;
+ }
+ string _check_link(string _link) {
+ _link = _link
+ .replaceFirst(rgx_sc.latex_clean_internal_link, "")
+ .replaceAll(rgx_sc.latex_special_char_for_escape_url, "\\$1");
+ return _link;
+ }
+ if (obj.metainfo.is_a != "code") {
+ _txt = replaceAll!(m =>
+ m[1] ~ "┤" ~ to!string((obj.stow.link[m[2].to!ulong])).encode ~ "├"
+ )(_txt, rgx.inline_link_number_only);
+ _txt = replaceAll!(m =>
+ ((m[1] == m[2]) && (m[2].match(rgx.uri))) // url link (regular link with url)
+ ? format(q"┃\linkurl{%s}{%s}┃", _check_link(m[1]), (_check_link(m[1])).sp_char_esc_txt)
+ : ((m[2].match(rgx.uri)) && (m[1].match(rgx.inline_image_info))) // linked image
+ ? format(q"┃%s\href{%s}%s{%s}┃", "\\br ", _check_link(m[2]), "\n", _if_images(m[1])) // markup for images
+ : (m[2].match(rgx.uri)) // not linked image
+ ? format(q"┃%s\linktext{%s}{%s}┃", "\\br ", _check_link(m[2]), m[1]) // regular link with text
+ : format(q"┃\hyperlink{%s}{%s}┃", _check_link(m[2]), _if_images(m[1])) // internal links, like book index
+ )(_txt, rgx.inline_link);
+ }
+ }
+ return _txt;
+ }
+ string footnotes()(
+ string _txt,
+ ) {
+ if (_txt.match(rgx.inline_notes_al_gen)) {
+ string _tex_note = q"┃\hypertarget{noteref_%s}{}\footnote[%s]{%%
+ \label{note_%s}%s}┃";
+ _txt = _txt.split(rgx.br_linebreaks).join("\\br ").replaceAll(rgx.inline_notes_al_regular_number_note,
+ format(_tex_note,
+ "$1", "$1", "$1",
+ "$2".strip
+ ).strip
+ );
+ }
+ return _txt;
+ }
+ string remove_footnotes()(
+ string _txt,
+ ) {
+ if (_txt.match(rgx.inline_notes_al_gen)) {
+ _txt = replaceAll!(m => "")(_txt, rgx.inline_notes_al_gen);
+ }
+ return _txt;
+ }
+ string para(O)(
+ string _txt,
+ O obj,
+ ) {
+ if (obj.metainfo.is_of_type == "para") {
+ string _tex_para;
+ _tex_para = q"┃\ocn{%s}%s┃";
+ _txt = format(_tex_para,
+ obj.metainfo.object_number,
+ _txt.footnotes
+ ).strip;
+ }
+ return _txt;
+ }
+ string bookindex(O)(
+ string _txt,
+ O obj,
+ ) {
+ if (obj.metainfo.is_of_type == "para"
+ && obj.metainfo.is_a == "bookindex"
+ ) {
+ string _tex_para;
+ _tex_para = q"┃%s┃";
+ _txt = format(_tex_para,
+ _txt.replaceAll(rgx_sc.latex_clean_bookindex_linebreak, "\n") ~ "\n\\brln\n"
+ );
+ }
+ return _txt;
+ }
+ string heading(O,M)(
+ string _txt,
+ O obj,
+ M doc_matters,
+ string paper_size_orientation,
+ string _part = ""
+ ) {
+ struct latexMarks {
+ string pg_break = "\\clearpage\n";
+ }
+ latexMarks manual_breaks(
+ latexMarks _ltx,
+ string test_for_break_level,
+ ) {
+ if ((!(doc_matters.conf_make_meta.make.breaks.empty)
+ && (matchFirst(doc_matters.conf_make_meta.make.breaks, test_for_break_level)))
+ ) { // manually override defaults
+ if ((matchFirst(doc_matters.conf_make_meta.make.breaks, rgx.make_breakpage))
+ && (matchFirst(doc_matters.conf_make_meta.make.breaks, rgx.make_breakcolumn))
+ ) {
+ if (auto m = matchFirst(doc_matters.conf_make_meta.make.breaks, rgx.make_breakpage)) {
+ if (matchFirst(m.captures["breakpage"], test_for_break_level)) {
+ _ltx.pg_break = "\\clearpage\n";
+ } else if (auto n = matchFirst(doc_matters.conf_make_meta.make.breaks, rgx.make_breakcolumn)) {
+ if (matchFirst(n.captures["breakcolumn"], test_for_break_level)) {
+ if ((paper_size_orientation == "a4.landscape")
+ || (paper_size_orientation == "b4.landscape")
+ || (paper_size_orientation == "a5.landscape")
+ || (paper_size_orientation == "letter.landscape")
+ || (paper_size_orientation == "legal.landscape")
+ ) {
+ _ltx.pg_break = "\\\\ \\columnbreak\n"; // "\\\\ \\newpage\n";
+ } else { // portrait
+ _ltx.pg_break = "\\clearpage\n";
+ }
+ }
+ }
+ }
+ } else if (auto m = matchFirst(doc_matters.conf_make_meta.make.breaks, rgx.make_breakpage)) {
+ if (matchFirst(m.captures["breakpage"], test_for_break_level)) {
+ _ltx.pg_break = "\\clearpage\n";
+ }
+ } else if (auto m = matchFirst(doc_matters.conf_make_meta.make.breaks, rgx.make_breakcolumn)) {
+ if (matchFirst(m.captures["breakcolumn"], test_for_break_level)) {
+ if ((paper_size_orientation == "a4.landscape")
+ || (paper_size_orientation == "b4.landscape")
+ || (paper_size_orientation == "a5.landscape")
+ || (paper_size_orientation == "letter.landscape")
+ || (paper_size_orientation == "legal.landscape")
+ ) {
+ _ltx.pg_break = "\\\\ \\columnbreak\n"; // "\\\\ \\newpage\n";
+ } else { // portrait
+ _ltx.pg_break = "\\clearpage\n";
+ }
+ }
+ }
+ } else if (!(doc_matters.conf_make_meta.make.breaks.empty)) {
+ _ltx.pg_break = "";
+ }
+ return _ltx;
+ }
+ if (obj.metainfo.is_a == "heading") {
+ string _tex_para;
+ latexMarks _ltx = latexMarks();
+ string _pg_break;
+ string _sect;
+ string _post;
+ string _title_add;
+ string _columns = "";
+ switch (obj.metainfo.heading_lev_markup) {
+ case 0: // A == TITLE
+ _pg_break = "\\begin{document}\n";
+ goto default;
+ case 1: // B == part: section heading level
+ _pg_break = "\\clearpage\n";
+ goto default;
+ case 2: // C == part: section heading level
+ _pg_break = "\\clearpage\n";
+ goto default;
+ case 3: // D == part: section heading level
+ _pg_break = "\\clearpage\n";
+ goto default;
+ case 4: // 1 == section
+ _columns = (_part != "bookindex")
+ ? "" : "\n\\br\n\\begin{multicols}{2}";
+ if (doc_matters.conf_make_meta.make.doc_type == "article") { // defaults for article
+ _ltx.pg_break = "";
+ } else if (doc_matters.conf_make_meta.make.doc_type == "book") { // defaults for book
+ _ltx.pg_break = "\\clearpage\n";
+ } else {
+ _ltx.pg_break = "\\clearpage\n";
+ }
+ _ltx = manual_breaks(_ltx, "1");
+ _pg_break = _ltx.pg_break;
+ _sect = "section";
+ _post = "";
+ _title_add = format(q"┃
+\markboth{%s}{%s}┃",
+ doc_matters.conf_make_meta.meta.title_full,
+ doc_matters.conf_make_meta.meta.title_full,
+ );
+ goto default;
+ case 5: // 2 == subsection
+ _pg_break = "";
+ // _pg_break = "newpage"; // doubt this is necessary
+ _sect = "subsection";
+ _post = " \\br\n";
+ _title_add = "";
+ goto default;
+ case 6: // 3 == subsubsection
+ _pg_break = "";
+ // _pg_break = "newpage"; // doubt this is necessary
+ _sect = "subsubsection";
+ _post = " \\br\n";
+ _title_add = "";
+ goto default;
+ case 7: // 4 == paragraph
+ _pg_break = "";
+ // _pg_break = "newpage"; // doubt this is necessary
+ _sect = "paragraph";
+ _post = " \\br\n";
+ _title_add = "";
+ goto default;
+ case 8: // 5 == subparagraph
+ _pg_break = "";
+ // _pg_break = "newpage"; // doubt this is necessary
+ _sect = "subparagraph";
+ _post = " \\br\n";
+ _title_add = "";
+ goto default;
+ default:
+ if (obj.metainfo.heading_lev_markup == 0) {
+ _tex_para = q"┃
+\begin{document}
+\thispagestyle{empty}
+\title{%s%s}
+\author{ \textnormal{%s}}
+\date{\begin{tiny}%s\end{tiny}}
+\maketitle
+\addcontentsline{toc}{part}{%s}
+\newpage
+\pagestyle{fancy}
+\pagenumbering{alph}
+\setcounter{page}{1}
+\markboth{%s}{%s}
+\br\linebreak Copyright {\begin{small}{\copyright\end{small}} %s \br\linebreak
+%s
+\clearpage┃";
+ _txt = format(_tex_para,
+ (doc_matters.conf_make_meta.meta.title_main).sp_char_esc_txt,
+ doc_matters.conf_make_meta.meta.title_subtitle.empty ? ""
+ : " \\\\ - \\\\ " ~ (doc_matters.conf_make_meta.meta.title_subtitle).sp_char_esc_txt,
+ (doc_matters.conf_make_meta.meta.creator_author).sp_char_esc_txt,
+ (doc_matters.conf_make_meta.meta.date_published).sp_char_esc_txt,
+ (doc_matters.conf_make_meta.meta.title_main).sp_char_esc_txt,
+ (doc_matters.conf_make_meta.meta.title_main).sp_char_esc_txt,
+ (doc_matters.conf_make_meta.meta.title_full).sp_char_esc_txt,
+ (doc_matters.conf_make_meta.meta.rights_copyright).sp_char_esc_txt.marked_linebreaks_newlines,
+ (doc_matters.conf_make_meta.meta.rights_license).sp_char_esc_txt.marked_linebreaks_newlines,
+ );
+ } else if (obj.metainfo.heading_lev_markup < 4) {
+ if (!(_txt.footnotes.strip == "Endnotes")) {
+ _tex_para = q"┃%s\part*{\ocn{%s}%s}
+\addcontentsline{toc}{part}{%s}
+\markboth{%s}┃";
+ _txt = format(_tex_para,
+ _pg_break,
+ obj.metainfo.object_number,
+ _txt.strip.footnotes,
+ _txt.strip.remove_footnotes,
+ (doc_matters.conf_make_meta.meta.title_main).sp_char_esc_txt,
+ );
+ }
+ } else if (obj.metainfo.heading_lev_markup > 3) {
+ if (obj.metainfo.heading_lev_markup == 4
+ && _txt.match(regex(r"^Table of Contents$"))) {
+ _tex_para = q"┃
+\pagenumbering{arabic}
+\setcounter{page}{1}
+\markboth{ }{ }
+\part*{\ocn{1}%s \newline %s}
+
+\clearpage
+\pagenumbering{roman}
+\setcounter{page}{1}
+\renewcommand{\contentsname}{}
+\tableofcontents
+
+\clearpage
+\pagenumbering{arabic}
+\setcounter{page}{2}
+\clearpage
+\markboth{%s}{%s}
+%% \null
+\clearpage
+\setcounter{page}{2}┃";
+ _txt = format(_tex_para,
+ (doc_matters.conf_make_meta.meta.title_full).sp_char_esc_txt,
+ (doc_matters.conf_make_meta.meta.creator_author).sp_char_esc_txt,
+ (doc_matters.conf_make_meta.meta.title_full).sp_char_esc_txt,
+ (doc_matters.conf_make_meta.meta.title_full).sp_char_esc_txt,
+ );
+ } else if (obj.metainfo.heading_lev_markup == 4
+ && _part == "bookindex"
+ && _txt.match(regex(r"^Index$"))
+ ) {
+ _tex_para = q"┃%s\%s*{\ocn{%s}%s}
+\addcontentsline{toc}{%s}{%s%s}%s%s┃";
+ _txt = format(_tex_para,
+ _pg_break,
+ _sect.strip,
+ obj.metainfo.object_number,
+ _txt.footnotes.strip,
+ _sect,
+ _txt.remove_footnotes.strip,
+ _post,
+ _title_add,
+ _columns,
+ );
+ } else if (obj.metainfo.dummy_heading
+ && obj.metainfo.heading_lev_markup == 4
+ ) { /+ dummy headings completely omitted +/
+ _txt = "";
+ } else {
+ _tex_para = q"┃%s\%s*{\ocn{%s}%s}
+\addcontentsline{toc}{%s}{%s%s}%s┃";
+ _txt = format(_tex_para,
+ _pg_break,
+ _sect.strip,
+ obj.metainfo.object_number,
+ _txt.footnotes.strip,
+ _sect,
+ _txt.remove_footnotes.strip,
+ _post,
+ _title_add,
+ );
+ }
+ }
+ break;
+ }
+ }
+ return _txt.strip;
+ }
+ string group(O,M)(
+ string _txt,
+ O obj,
+ M doc_matters,
+ ) {
+ if (obj.metainfo.is_a == "group") {
+ string _tex_para;
+ _tex_para = q"┃\ocn{%s}\objGroupOpen
+%s
+\objGroupClose
+┃";
+ _txt = format(_tex_para,
+ obj.metainfo.object_number,
+ _txt.footnotes.split(rgx.br_line_spaced).join("\\brl{1}").strip // provides more control (more noise, not as tidy)
+ // _txt.footnotes.split(rgx.br_line_spaced).join("") // this works using a line-space, looks tidy, keep ref.
+ ).strip;
+ }
+ return _txt;
+ }
+ string block(O,M)(
+ string _txt,
+ O obj,
+ M doc_matters,
+ ) {
+ if (obj.metainfo.is_a == "block") {
+ string _tex_para;
+ _tex_para = q"┃\ocn{%s}\objBlockOpen
+%s
+\objBlockClose
+┃";
+ _txt = format(_tex_para,
+ obj.metainfo.object_number,
+ _txt.nbsp_char.footnotes.split(rgx.br_linebreaks_newlines).join("\\br\n").strip
+ ).strip;
+ }
+ return _txt;
+ }
+ string verse(O,M)(
+ string _txt,
+ O obj,
+ M doc_matters,
+ ) {
+ if (obj.metainfo.is_a == "verse") {
+ string _tex_para;
+ _tex_para = q"┃\ocn{%s}\objPoemVerseOpen
+%s
+\objPoemVerseClose
+┃";
+ _txt = format(_tex_para,
+ obj.metainfo.object_number,
+ _txt.spaces_to_nbsp.footnotes.split(rgx.br_linebreaks_newlines).join("\\br\n").strip
+ ).strip;
+ }
+ return _txt;
+ }
+ string codeblock(O,M)(
+ string _txt,
+ O obj,
+ M doc_matters,
+ ) {
+ if (obj.metainfo.is_a == "code") {
+ string _tex_para;
+ _tex_para = q"┃\ocn{%s}\begin{objCodeBlock}\begin{lstlisting}
+%s
+\end{lstlisting}\end{objCodeBlock}
+┃";
+ _txt = format(_tex_para,
+ obj.metainfo.object_number,
+ _txt.nbsp_char_to_space
+ ).strip;
+ }
+ return _txt;
+ }
+ auto 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 ~= "";
+ foreach(col_idx, cell; _table_cols) {
+ if ((_table_cols.length == 1)
+ && (_table_rows.length <= row_idx+2)) { // check row_idx+2 (rather than == ++row_idx)
+ _tablenote ~= cell;
+ } else {
+ // // _table ~= "\\bfseries ";
+ // _table ~= cell;
+ // _table ~= (_table_cols.length > (col_idx + 1)) ? "&" : "";
+ _table ~= format(q"┃%s%s┃",
+ cell,
+ (_table_cols.length > (col_idx + 1)) ? "&" : ""
+ );
+ }
+ }
+ _table ~= "\\\\";
+ }
+ Tuple!(string, string) t = tuple(
+ _table,
+ _tablenote,
+ );
+ return t;
+ }
+ string table(O,M)(
+ string _txt,
+ O obj,
+ M doc_matters,
+ string paper_size_orientation,
+ ) {
+ if (obj.metainfo.is_a == "table") {
+ auto _t = _txt.tablarize(obj);
+ string _table = _t[0];
+ string _t_n = _t[1];
+ uint pw = 0;
+ switch (paper_size_orientation) {
+ case "a4.portrait": pw = (paper.a4.portrait.w - 20); break;
+ case "a4.landscape": pw = (paper.a4.landscape.w - 20); break;
+ case "b4.portrait": pw = (paper.b4.portrait.w - 20); break;
+ case "b4.landscape": pw = (paper.b4.landscape.w - 20); break;
+ case "a5.portrait": pw = (paper.a5.portrait.w - 20); break;
+ case "a5.landscape": pw = (paper.a5.landscape.w - 20); break;
+ case "letter.portrait": pw = (paper.letter.portrait.w - 20); break;
+ case "letter.landscape": pw = (paper.letter.landscape.w - 20); break;
+ case "legal.portrait": pw = (paper.legal.portrait.w - 20); break;
+ case "legal.landscape": pw = (paper.legal.landscape.w - 20); break;
+ default: pw = 0; break;
+ }
+ // auto textwidth = (pw - 24);
+ string _colw = "";
+ foreach (w; obj.table.column_widths) {
+ _colw ~= format(q"┃p{%.0fmm}┃",
+ (w * pw / 100)
+ // (w * (pw - 24)/ 100)
+ // (w * textwidth / 100)
+ );
+ }
+ string _tex_para;
+ _tex_para = q"┃\ocn{%s}\objTableOpen{%s}
+%s
+\objTableClose
+┃";
+ _txt = format(_tex_para,
+ obj.metainfo.object_number,
+ _colw,
+ _table,
+ ).strip;
+ }
+ return _txt;
+ }
+ string bullets_and_indentation(O)(
+ string _txt,
+ O obj,
+ ) {
+ string _tex_para;
+ string _hang; string _indent;
+ int _paper_margin = -10;
+ int _indent_increment = 8; // 5; 10;
+ if (obj.attrib.bullet) {
+ int _bullet_space = 5;
+ _indent = ((obj.attrib.indent_base * _indent_increment) + _paper_margin + _bullet_space).to!string;
+ _txt = format(q"┃\begin{Bullet}{%smm}%s\end{Bullet}┃",
+ _indent,
+ _txt.footnotes
+ ).strip;
+ } else if (
+ obj.attrib.indent_base != 0
+ && obj.attrib.indent_base == obj.attrib.indent_hang
+ ) {
+ _indent = ((obj.attrib.indent_base * _indent_increment) + _paper_margin).to!string;
+ _tex_para = q"┃\begin{ParagraphIndent}{%smm}%s \end{ParagraphIndent}┃";
+ _txt = format(_tex_para,
+ _indent,
+ _txt.footnotes
+ ).strip;
+ } else if (
+ obj.attrib.indent_base != 0
+ || obj.attrib.indent_hang != 0
+ ) {
+ _indent = ((obj.attrib.indent_base * _indent_increment) + _paper_margin).to!string;
+ _hang = (((obj.attrib.indent_hang - obj.attrib.indent_base) * _indent_increment)).to!string;
+ _tex_para = q"┃\begin{ParagraphHang}{%smm}{%smm}%s \end{ParagraphHang}┃";
+ _txt = format(_tex_para,
+ _indent, _hang,
+ _txt.footnotes.split(rgx.br_linebreaks_newlines).join("\\br\n")
+ ).strip;
+ }
+ return _txt;
+ }
+ string latex_head(M)(
+ M doc_matters,
+ string paper_size_orientation,
+ ) {
+ struct paperTypeLatex {
+ string a4_portrait;
+ string a4_landscape;
+ string b4_portrait;
+ string b4_landscape;
+ string a5_portrait;
+ string a5_landscape;
+ string us_letter_portrait;
+ string us_letter_landscape;
+ string us_legal_portrait;
+ string us_legal_landscape;
+ }
+ auto paper_type_latex = paperTypeLatex();
+ string _footer(M)(M doc_matters) {
+ string _ft = "\\lfoot[\\textrm{\\thepage}]";
+ string _ft_1 = format(q"┃{\tiny \href{%s}{%s}}┃", "https://sisudoc.org", "SiSU",);
+ string _ft_2 = format(q"┃
+ \cfoot{\href{%s}{%s}}┃", "https://git.sisudoc.org", "git",);
+ if (doc_matters.conf_make_meta.make.footer.length > 0) {
+ if (doc_matters.conf_make_meta.make.footer.length > 0) {
+ if (doc_matters.conf_make_meta.make.footer[0].matchAll(rgx.inline_link)) {
+ _ft ~= doc_matters.conf_make_meta.make.footer[0]
+ .replace(rgx.inline_link, "{\\tiny \\href{$2}{$1}}");
+ } else {
+ _ft ~= _ft_1;
+ }
+ }
+ if (doc_matters.conf_make_meta.make.footer.length > 1) {
+ if (doc_matters.conf_make_meta.make.footer[1].matchAll(rgx.inline_link)) {
+ _ft ~= doc_matters.conf_make_meta.make.footer[1]
+ .replace(rgx.inline_link, "\n\\cfoot{\\href{$2}{$1}}");
+ } else {
+ _ft ~= _ft_2;
+ }
+ }
+ } else {
+ _ft ~= _ft_1;
+ _ft ~= _ft_2;
+ }
+ return _ft;
+ }
+ struct paperMargins {
+ string portrait;
+ string landscape;
+ }
+ auto margins = paperMargins();
+ struct columnsMulti {
+ string portrait;
+ string landscape;
+ }
+ auto multicol = columnsMulti();
+ multicol.landscape = "";
+ struct colorLinks {
+ string mono;
+ string color;
+ }
+ auto links = colorLinks();
+ links.mono = format(q"┃
+ colorlinks=true,
+ urlcolor=black,
+ filecolor=black,
+ linkcolor=black,
+ citecolor=black,
+┃",
+ );
+ links.color = format(q"┃
+ colorlinks=true,
+ urlcolor=myblue, %% \href{...}{...} external url
+ filecolor=mygreen, %% \href{...} local file
+ linkcolor=myred, %% \href{...} and \pageref{...}
+ citecolor=black,
+┃",
+ );
+ string set_paper(P)(P paper_set,) {
+ string paper_type_description;
+ if (paper_set.is_portrait) {
+ paper_type_description = format(q"┃
+\documentclass[%s,%s,titlepage,makeidx]{scrartcl}
+\usepackage{%s}
+\usepackage[%s,%s]{babel}
+\usepackage[autostyle, english = american]{csquotes}
+%% \MakeOuterQuote{"} %% not required, using '' as quote delimiter
+\selectlanguage{%s}
+\hypersetup{
+ pdftitle={%s},
+ pdfauthor={%s},
+ pdfsubject={%s},
+}
+\usepackage{fancyhdr}
+\lhead[ ]{ }
+\chead[ \fancyplain{} \bfseries \footnotesize \leftmark ]{ \fancyplain{} \bfseries \footnotesize \rightmark }
+\rhead[ ]{ }
+%s
+\rfoot[\tiny \href{}{}]{\textrm{\thepage}}
+ ┃",
+ paper_set.fontsize,
+ paper_set.papersize,
+ "./sty/" ~ paper_set.stylesheet,
+ lang.codes[doc_matters.src.language]["xlp"],
+ "english",
+ lang.codes[doc_matters.src.language]["xlp"],
+ doc_matters.conf_make_meta.meta.title_full.strip,
+ doc_matters.conf_make_meta.meta.creator_author.strip,
+ doc_matters.conf_make_meta.meta.classify_subject.strip,
+ _footer(doc_matters),
+ );
+ } else {
+ paper_type_description = format(q"┃
+\documentclass[%s,%s,landscape,titlepage,twocolumn,makeidx]{scrartcl}
+\usepackage{%s}
+\usepackage[english]{babel}
+%% \usepackage{polyglossia}
+\setmainlanguage{%s}
+\setotherlanguage{%s}
+\selectlanguage{%s}
+\hypersetup{
+ pdftitle={%s},
+ pdfauthor={%s},
+ pdfsubject={%s},
+}
+\usepackage{fancyhdr}
+\lhead[ ]{ }
+\chead[ \fancyplain{} \bfseries \footnotesize \leftmark ]{ \fancyplain{} \bfseries \footnotesize \rightmark }
+\rhead[ ]{ }
+%s
+\rfoot[\tiny \href{}{}]{\textrm{\thepage}}
+ ┃",
+ paper_set.fontsize,
+ paper_set.papersize,
+ "./sty/" ~ paper_set.stylesheet,
+ lang.codes[doc_matters.src.language]["xlp"],
+ "english",
+ lang.codes[doc_matters.src.language]["xlp"],
+ doc_matters.conf_make_meta.meta.title_full.strip,
+ doc_matters.conf_make_meta.meta.creator_author.strip,
+ doc_matters.conf_make_meta.meta.classify_subject.strip,
+ _footer(doc_matters),
+ );
+ }
+ return paper_type_description;
+ }
+ string paper_size_orientation_latex;
+ switch (paper_size_orientation) {
+ case "a4.portrait": paper_size_orientation_latex = set_paper(paper.a4.portrait); break;
+ case "a4.landscape": paper_size_orientation_latex = set_paper(paper.a4.landscape); break;
+ case "b4.portrait": paper_size_orientation_latex = set_paper(paper.b4.portrait); break;
+ case "b4.landscape": paper_size_orientation_latex = set_paper(paper.b4.landscape); break;
+ case "a5.portrait": paper_size_orientation_latex = set_paper(paper.a5.portrait); break;
+ case "a5.landscape": paper_size_orientation_latex = set_paper(paper.a5.landscape); break;
+ case "letter.portrait": paper_size_orientation_latex = set_paper(paper.letter.portrait); break;
+ case "letter.landscape": paper_size_orientation_latex = set_paper(paper.letter.landscape); break;
+ case "legal.portrait": paper_size_orientation_latex = set_paper(paper.legal.portrait); break;
+ case "legal.landscape": paper_size_orientation_latex = set_paper(paper.legal.landscape); break;
+ default: paper_size_orientation_latex = paper_type_latex.a4_portrait;
+ }
+ string links_mono_or_color_set = links.mono.strip;
+ if (
+ (doc_matters.opt.action.latex_color_links)
+ || (paper_size_orientation ==
+ "a4.landscape" ||
+ "a5.landscape" ||
+ "b4.landscape" ||
+ "letter.landscape" ||
+ "legal.landscape")
+ ){
+ links_mono_or_color_set = links.mono.strip;
+ }
+ string _latex_head = format(q"┃%%%% spine LaTeX output%s%s
+%%%% %s %s
+%s
+%s
+ ┃",
+ doc_matters.opt.action.generated_by ? " " ~ doc_matters.generator_program.name_version_and_compiler : "",
+ doc_matters.opt.action.generated_by ? " (generated " ~ doc_matters.generator_program.time_output_generated ~ ")" : "",
+ doc_matters.generator_program.project_name.strip,
+ doc_matters.generator_program.url_home.strip,
+ paper_size_orientation_latex.strip,
+ margins.portrait.strip,
+ );
+ return _latex_head.strip;
+ }
+ string latex_body(D,M)(
+ const D doc_abstraction,
+ M doc_matters,
+ string paper_size_orientation,
+ ) {
+ string _latex_body = "";
+ bool _multicolumns = false;
+ string _txt;
+ foreach (part; doc_matters.has.keys_seq.latex) {
+ foreach (obj; doc_abstraction[part]) {
+ switch (obj.metainfo.is_of_part) {
+ case "frontmatter": assert(part == "head" || "toc");
+ _txt = obj.text
+ .sp_char_esc(obj)
+ .fontface;
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "heading":
+ _txt = _txt.heading(obj, doc_matters, paper_size_orientation);
+ goto default;
+ case "toc":
+ break;
+ default:
+ _latex_body ~= _txt ~ "\n\n";
+ _txt = "";
+ break;
+ }
+ break;
+ default: break;
+ }
+ break;
+ case "body": assert(part == "body" || "head"); // surprise
+ _txt = obj.text
+ .sp_char_esc(obj)
+ .fontface;
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "heading":
+ _txt = _txt.heading(obj, doc_matters, paper_size_orientation);
+ goto default;
+ case "para":
+ _txt = _txt.para(obj)
+ .bullets_and_indentation(obj)
+ .links_and_images(obj, doc_matters);
+ goto default;
+ default:
+ _latex_body ~= _txt ~ "\n\n";
+ _txt = "";
+ break;
+ }
+ break;
+ case "block":
+ switch (obj.metainfo.is_a) {
+ case "quote":
+ goto default; // TODO
+ case "group": /+ (hardspaces not honored) [remove any hardspace marker] +/
+ _txt = _txt.group(obj, doc_matters)
+ .links_and_images(obj, doc_matters);
+ goto default;
+ case "block": /+ (hardspace honored) \hardspace +/
+ _txt = _txt.block(obj, doc_matters)
+ .links_and_images(obj, doc_matters);
+ goto default;
+ case "verse": /+ (hardspace honored) \hardspace +/
+ _txt = _txt.verse(obj, doc_matters)
+ .links_and_images(obj, doc_matters);
+ goto default;
+ case "code": /+ (hardspace honored) \begin{lstlisting} clear hardspace marker +/
+ _txt = _txt.codeblock(obj, doc_matters);
+ goto default;
+ case "table":
+ _txt = _txt.table(obj, doc_matters, paper_size_orientation);
+ goto default; // TODO
+ default:
+ _latex_body ~= _txt ~ "\n\n";
+ _txt = "";
+ break;
+ }
+ break;
+ default: break;
+ }
+ break;
+ case "backmatter":
+ assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
+ _txt = obj.text
+ .sp_char_esc(obj)
+ .fontface;
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ if (part != "bookindex" && _multicolumns) {
+ _multicolumns = false;
+ _latex_body ~= "\n\\end{multicols}\n";
+ }
+ switch (obj.metainfo.is_a) {
+ case "heading":
+ if (part == "bookindex") {
+ _multicolumns = true;
+ }
+ _txt = _txt.heading(obj, doc_matters, paper_size_orientation, part);
+ goto default;
+ case "endnote": assert(part == "endnotes");
+ /* uncomment code to reinstate endnotes in endnote section */
+ // _txt = _txt.para(obj)
+ // .bullets_and_indentation(obj)
+ // .links_and_images(obj, doc_matters);
+ // goto default;
+ break;
+ case "glossary": assert(part == "glossary");
+ _txt = _txt.para(obj)
+ .bullets_and_indentation(obj)
+ .links_and_images(obj, doc_matters);
+ goto default;
+ case "bibliography": assert(part == "bibliography");
+ _txt = _txt.para(obj)
+ .bullets_and_indentation(obj);
+ goto default;
+ case "bookindex": assert(part == "bookindex");
+ /+ two column, special section +/
+ _txt = _txt.bookindex(obj)
+ .links_and_images(obj, doc_matters);
+ goto default;
+ case "blurb": assert(part == "blurb");
+ _txt = _txt.para(obj)
+ .bullets_and_indentation(obj)
+ .links_and_images(obj, doc_matters);
+ goto default;
+ default:
+ _latex_body ~= (part == "bookindex" && obj.metainfo.is_a != "heading")
+ ? _txt : (_txt ~ "\n\n");
+ _txt = "";
+ break;
+ }
+ break;
+ default: break;
+ }
+ break;
+ case "comment":
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_latex
+ && doc_matters.opt.action.vox_gt1) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part);
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ writeln(__FILE__, ":", __LINE__, ": ", obj.text);
+ }
+ }
+ break;
+ }
+ }
+ }
+ if (_multicolumns) {
+ _multicolumns = false;
+ _latex_body ~= "\n\\end{multicols}\n";
+ }
+ return _latex_body;
+ }
+ string latex_tail(M)(
+ M doc_matters,
+ string paper_size_orientation,
+ ) {
+ string _latex_tail = format(q"┃
+
+\end{document}
+ ┃",
+ // doc_matters.conf_make_meta.meta.title_full,
+ // doc_matters.conf_make_meta.meta.creator_author,
+ );
+ return _latex_tail;
+ }
+ void writeOutputLaTeX(T,M)(
+ const T latex_content,
+ M doc_matters,
+ string paper_size_orientation,
+ ) {
+ auto pth_latex = spinePathsLaTeX(doc_matters);
+ try {
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_latex
+ && doc_matters.opt.action.vox_gt1) {
+ writeln(latex_content.head);
+ writeln(latex_content.content);
+ writeln(latex_content.tail);
+ }
+ }
+ if (!exists(pth_latex.latex_path_stuff)) {
+ (pth_latex.latex_path_stuff).mkdirRecurse;
+ }
+ if (doc_matters.opt.action.vox_gt0) {
+ writeln(" ", pth_latex.latex_file_with_path(paper_size_orientation));
+ }
+ {
+ auto f = File(pth_latex.latex_file_with_path(paper_size_orientation), "w");
+ f.writeln(latex_content.head);
+ f.writeln(latex_content.content);
+ f.writeln(latex_content.tail);
+ foreach (image; doc_matters.srcs.image_list) {
+ string fn_src_in = doc_matters.src.image_dir_path ~ "/" ~ image;
+ string fn_src_out_file = pth_latex.latex_path_stuff ~ "/" ~ image;
+ if (exists(fn_src_in)) {
+ fn_src_in.copy(fn_src_out_file);
+ }
+ }
+ }
+ if (!exists(pth_latex.latex_path_stuff ~ "/index.html")) {
+ import sisudoc.io_out.html_snippet;
+ mixin htmlSnippet;
+ auto f = File(pth_latex.latex_path_stuff ~"/index.html", "w");
+ f.writeln(format_html_blank_page_guide_home(
+ "../../css/html_scroll.css",
+ (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
+ ,
+ "../../index.html",
+ ));
+ }
+ // should be in latex init and done just once, doc_matters not passed there though
+ if (!exists(pth_latex.base ~ "/index.html")) {
+ import sisudoc.io_out.html_snippet;
+ mixin htmlSnippet;
+ auto f = File(pth_latex.base ~"/index.html", "w");
+ f.writeln(format_html_blank_page_guide_home(
+ "../css/html_scroll.css",
+ (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,
+ "../index.html",
+ ));
+ }
+ if (!exists(pth_latex.base_sty ~ "/index.html")) {
+ import sisudoc.io_out.html_snippet;
+ mixin htmlSnippet;
+ auto f = File(pth_latex.base_sty ~"/index.html", "w");
+ f.writeln(format_html_blank_page_guide_home(
+ "../../css/html_scroll.css",
+ (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,
+ "../../index.html",
+ ));
+ }
+ } catch (ErrnoException ex) {
+ // handle error
+ }
+ }
+ void outputLaTeX(D,M)(
+ const D doc_abstraction,
+ M doc_matters,
+ ) {
+ struct LaTeX {
+ string head;
+ string content;
+ string tail;
+ }
+ auto latex = LaTeX();
+ foreach (paper_size_orientation; doc_matters.conf_make_meta.conf.set_papersize) {
+ latex.head = latex_head(doc_matters, paper_size_orientation);
+ latex.content = latex_body(doc_abstraction, doc_matters, paper_size_orientation);
+ latex.tail = latex_tail(doc_matters, paper_size_orientation);
+ latex.writeOutputLaTeX(doc_matters, paper_size_orientation);
+ }
+ }
+}
+template outputLaTeXstyInit() {
+ import sisudoc.io_out;
+ auto paper = paperLaTeX;
+ void writeOutputLaTeXstyStatic(
+ string latex_sty,
+ string output_dir,
+ string filename,
+ ) {
+ if ((output_dir.length > 0)
+ && isValidPath(output_dir)
+ ) {
+ auto pth_latex = spinePathsLaTeXsty(output_dir);
+ try {
+ import std.file;
+ if (!exists(pth_latex.base_sty)) {
+ (pth_latex.base_sty).mkdirRecurse;
+ }
+ {
+ auto f = File(pth_latex.latex_document_header_sty(filename), "w");
+ f.writeln(latex_sty);
+ }
+ } catch (ErrnoException ex) {
+ // handle error
+ }
+ }
+ }
+ void outputLaTeXstyInit()(
+ string output_dir,
+ bool generated_by,
+ string name_version_and_compiler,
+ string time_output_generated,
+ ) {
+ string latex_sty = outputLaTeXstyStatic!()(generated_by, name_version_and_compiler, time_output_generated);
+ latex_sty.writeOutputLaTeXstyStatic(output_dir, "spineShared.sty");
+ auto sty_a4p = paper.a4.portrait;
+ auto latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_a4p, generated_by, name_version_and_compiler, time_output_generated);
+ latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_a4p.stylesheet ~ ".sty");
+ auto sty_a4l = paper.a4.landscape;
+ latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_a4l, generated_by, name_version_and_compiler, time_output_generated);
+ latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_a4l.stylesheet ~ ".sty");
+ auto sty_b4p = paper.b4.portrait;
+ latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_b4p, generated_by, name_version_and_compiler, time_output_generated);
+ latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_b4p.stylesheet ~ ".sty");
+ auto sty_b4l = paper.b4.landscape;
+ latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_b4l, generated_by, name_version_and_compiler, time_output_generated);
+ latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_b4l.stylesheet ~ ".sty");
+ auto sty_a5p = paper.a5.portrait;
+ latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_a5p, generated_by, name_version_and_compiler, time_output_generated);
+ latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_a5p.stylesheet ~ ".sty");
+ auto sty_a5l = paper.a5.landscape;
+ latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_a5l, generated_by, name_version_and_compiler, time_output_generated);
+ latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_a5l.stylesheet ~ ".sty");
+ auto sty_letter_p = paper.letter.portrait;
+ latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_letter_p, generated_by, name_version_and_compiler, time_output_generated);
+ latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_letter_p.stylesheet ~ ".sty");
+ auto sty_letter_l = paper.letter.landscape;
+ latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_letter_l, generated_by, name_version_and_compiler, time_output_generated);
+ latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_letter_l.stylesheet ~ ".sty");
+ auto sty_legal_p = paper.legal.portrait;
+ latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_legal_p, generated_by, name_version_and_compiler, time_output_generated);
+ latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_legal_p.stylesheet ~ ".sty");
+ auto sty_legal_l = paper.legal.landscape;
+ latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_legal_l, generated_by, name_version_and_compiler, time_output_generated);
+ latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_legal_l.stylesheet ~ ".sty");
+ }
+}
+template outputLaTeXstyStatic() {
+ import
+ std.format,
+ std.conv : to;
+ string outputLaTeXstyStatic(
+ bool generated_by,
+ string name_version_and_compiler,
+ string time_output_generated,
+ ) {
+ string latex_sty = format(q"┃%%%% spine LaTeX output%s%s
+%% - called by the .sty containing the paper dimensions (size and orientation) to be used
+%% - spineShared.sty used by all spine documents (called indirectly)
+\ProvidesPackage{./sty/spineShared}
+\usepackage{multicol}
+\setlength{\marginparsep}{4mm}
+\setlength{\marginparwidth}{8mm}
+\usepackage[scaled]{dejavu}
+\renewcommand*\familydefault{\sfdefault}
+\usepackage{inconsolata}
+\usepackage[T1]{fontenc}
+\usepackage{newunicodechar}
+%% \usepackage[utf8]{inputenc}
+\usepackage{alltt}
+\usepackage[
+ unicode=true,
+ pdfusetitle,
+ pdfsubject={},
+ pdfkeywords={}, %% keywords list {} {} {},
+ pdftoolbar=true,
+ pdfmenubar=true,
+ pdfwindowui=true,
+ pdffitwindow=false, %% window fit to page when opened
+ pdfstartview={FitH}, %% fits the width of the page to the window
+ pdfnewwindow=true, %% links in new window
+ pdfborder={0 0 1},
+ plainpages=false, %% was true
+ bookmarks=true,
+ bookmarksopen=false,
+ bookmarksnumbered=false,
+ backref=false,
+ breaklinks=false,
+ colorlinks=true,
+ urlcolor=black,
+ filecolor=black,
+ linkcolor=black,
+ citecolor=black, %% links_mono_or_color_set
+]{hyperref}
+\PassOptionsToPackage{hyphens}{url}\usepackage{hyperref}
+\usepackage[usenames]{color}
+\definecolor{myblack}{rgb}{0,0,0}
+\definecolor{myred}{rgb}{0.75,0,0}
+\definecolor{mygreen}{rgb}{0,0.5,0}
+\definecolor{myblue}{rgb}{0,0,0.5}
+\definecolor{mywhite}{rgb}{1,1,1}
+\usepackage{textcomp}
+\usepackage[parfill]{parskip}
+\usepackage[normalem]{ulem}
+\usepackage{soul}
+\usepackage{longtable}
+\usepackage{graphicx}
+\usepackage[tc]{titlepic}
+\usepackage{amssymb}
+\usepackage{amsmath}
+\usepackage[cm]{sfmath}
+\usepackage{underscore}
+\usepackage{listings}
+\setcounter{secnumdepth}{2}
+\setcounter{tocdepth}{4}
+\usepackage{bookmark}
+\usepackage{microtype}
+\makeatletter
+\usepackage[multiple,ragged]{footmisc}
+\setlength\footnotemargin{12pt}
+\usepackage[para]{manyfoot}
+\DeclareNewFootnote{A}
+\makeatother
+\chardef\txtbullet="2022
+\chardef\tilde="7E
+\def\asterisk{{\rm \char42} }
+\definecolor{Light}{gray}{.92}
+\definecolor{listinggray}{gray}{0.9}
+\definecolor{lbcolor}{rgb}{0.9,0.9,0.9}
+\lstset{
+ backgroundcolor=\color{lbcolor},
+ tabsize=4,
+ rulecolor=,
+ language=,
+ basicstyle={\ttfamily\scriptsize},
+ upquote=true,
+ columns=fixed,
+ showstringspaces=false,
+ extendedchars=true,
+ breaklines=true,
+ prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},
+ frame=single,
+ showtabs=false,
+ showspaces=false,
+ showstringspaces=false,
+ identifierstyle=\ttfamily,
+ keywordstyle=\color[rgb]{0,0,1},
+ commentstyle=\color[rgb]{0.133,0.545,0.133},
+ stringstyle=\color[rgb]{0.627,0.126,0.941},
+}
+\DeclareTOCStyleEntry[numwidth+=8pt]{part}{part}
+\DeclareTOCStyleEntry[numwidth+=4pt]{section}{section}
+\DeclareTOCStyleEntry[numwidth+=3pt]{section}{paragraph}
+\DeclareTOCStyleEntry[numwidth+=3pt]{section}{subparagraph}
+\DeclareTOCStyleEntry[numwidth+=3pt]{section}{subsection}
+\DeclareTOCStyleEntries[indent+=4pt]{section}{section,subsection,subsubsection}
+\DeclareTOCStyleEntries[numwidth+=3pt]{section}{paragraph,subparagraph}
+\newenvironment{ParagraphIndent}[1]{%%
+ \begin{list}{}{%%
+ \setlength\topsep{0pt}%%
+ \addtolength{\leftmargin}{#1}
+ \setlength\parsep{0pt plus 1pt}%%
+ }
+ \item[]
+} {\end{list}}
+\newenvironment{ParagraphHang}[2]{%%
+ \begin{list}{}{%%
+ \setlength\topsep{0pt}%%
+ \addtolength{\leftmargin}{#1}
+ \itemindent=#2
+ \setlength\parsep{0pt plus 1pt}%%
+ }
+ \item[]
+} {\end{list}}
+\newenvironment{Bullet}[1]{%%
+ \begin{list}{}{%%
+ \setlength\topsep{0pt}%%
+ \addtolength{\leftmargin}{#1}
+ \itemindent=-1em
+ \setlength\parsep{0pt plus 1pt}%%
+ }
+ \item[]
+ $\txtbullet$\hspace{\enspace}
+} {\end{list}}
+\newcommand{\monosp}[1]{\normaltext\ttfamily\texbackslash#1}
+\newcommand{\br}{\hfill\break}
+\newcommand{\brl}[1]{%%
+ \ifx&#1&%%
+ \hfill\break
+ \else
+ \vspace{#1ex}
+ \fi
+}
+\newcommand{\brln}{\hspace*{\fill}\linebreak}
+\newcommand{\objBlockOpen}{%%
+ \setlength{\parskip}{0.5ex plus0.2ex minus0.1ex}\raggedright
+ \begin{footnotesize}
+}
+\newcommand{\objBlockClose}{%%
+ \end{footnotesize}
+ \setlength{\parskip}{1ex plus0.5ex minus0.2ex}
+}
+\newcommand{\objGroupOpen}{%%
+ \setlength{\parskip}{0.5ex plus0.2ex minus0.1ex}
+ \begin{footnotesize}
+}
+\newcommand{\objGroupClose}{%%
+ \end{footnotesize}
+}
+\newcommand{\objPoemVerseOpen}{%%
+ \setlength{\parskip}{0.1ex plus0.1ex minus0.1ex}
+ \begin{footnotesize}
+
+}
+\newcommand{\objPoemVerseClose}{%%
+
+ \end{footnotesize}
+ \setlength{\parskip}{1ex plus0.5ex minus0.2ex}
+ \linebreak
+}
+\newcommand{\parasep}{%%
+ \smallskip \begin{center}*\hspace{2em}*\hspace{2em}*\end{center} \br
+}
+\newcommand{\spaces}[1]{{\hspace*{#1ex}}}
+\newcommand{\s}{\hspace*{1ex}}
+\newcommand{\hardspace}{\hspace*{1ex}}
+\newcommand{\-}{\hspace*{1ex}}
+\newcommand{\caret}{{\^{~}}}
+\newcommand{\pipe}{{\textbar}}
+\newcommand{\curlyOpen}{{}
+\newcommand{\curlyClose}{}}
+\newcommand{\lt}{{UseTextSymbol{OML}{<}}}
+\newcommand{\gt}{{UseTextSymbol{OML}{>}}}
+\newcommand{\slash}{{/}}
+\newcommand{\underscore}{\_}
+\newcommand{\exclaim}{\Verbatim{!}}
+\newcommand{\linktext}[2]{%%
+ {\href{#1}
+ {\;\ulcorner\,\textup{{#2}}\,\lrcorner}}
+}
+\newcommand{\linkurl}[2]{%%
+ \;{\href{#1}
+ {\;\scriptsize\ttfamily\ulcorner\,\textup{{#2}}\,\lrcorner}}
+}
+\newcommand{\link}[2]{%%
+ {\begin{scriptsize}\color{black}\urlstyle{tt}\href{#1}
+ {\;\ulcorner\,{#2}\,\lrcorner}\end{scriptsize}}
+}
+\newcommand{\objCodeBlock}[1]{\normaltext\raggedright\small\ttfamily\texbackslash#1}
+\newcommand{\objCodeOpen}{%%
+ \normaltext\raggedright\small\ttfamily\texbackslash
+ \begin{lstlisting}
+}
+\newcommand{\objCodeClose}{%%
+ \end{lstlisting}
+}
+\newcommand{\ocn}[1]{%%
+ \setlength{\parindent}{0em}
+ \ifx&#1&%% #1 is empty
+ \hspace{-0.5ex}{\marginpar{\begin{tiny}\end{tiny}}}
+ \else%% #1 is nonempty
+ \hspace{-0.5ex}{\marginpar{\begin{tiny}\hspace{0em}\hypertarget{#1}{#1}\end{tiny}}}
+ \fi
+}
+\newcommand{\ocnhold}[1]{%%
+ \begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{#1}{#1}\end{tiny}}}
+}
+\newcommand{\objCodeBlockHold}[1]{\normaltext\raggedright\small\ttfamily\texbackslash#1}
+\newcommand{\objTableOpen}[1]{%%
+ \setlength{\LTleft}{0pt}
+ \setlength{\LTright}{\fill}
+ \begin{tiny}
+ \begin{longtable}{#1}
+}
+\newcommand{\objTableClose}{%%
+ \end{longtable}
+ \end{tiny}
+}
+%% \tolerance=300
+%% \clubpenalty=300
+%% \widowpenalty=300
+%% \usepackage{atbegshi} %% http://ctan.org/pkg/atbegshi %% (BUG tmp FIX deal with problem, remove first page which is blank)
+%% \AtBeginDocument{\AtBeginShipoutNext{\AtBeginShipoutDiscard}} %% (BUG tmp FIX deal with problem, remove first page which is blank)
+┃",
+ generated_by ? " " ~ name_version_and_compiler : "",
+ generated_by ? " (generated " ~ time_output_generated ~ ")" : "",
+);
+ return latex_sty;
+ }
+}
+template outputLaTeXstyPaperSizeAndOrientation() {
+ import
+ std.format,
+ std.conv : to;
+ auto outputLaTeXstyPaperSizeAndOrientation(P)(
+ P doc_sty_info,
+ bool generated_by,
+ string name_version_and_compiler,
+ string time_output_generated,
+ ) {
+ string latex_sty = format(q"┃%%%% spine LaTeX output%s%s
+%% - called by .tex document to set paper dimensions (size and orientation)
+%% - calls spineShared.sty used/shared by all spine documents
+\ProvidesPackage{./sty/%s}
+\usepackage{geometry}
+\geometry{
+ %s,
+ %s,
+ left=%s,
+ right=%s,
+ top=%s,
+ bottom=%s,
+}
+\usepackage{./sty/spineShared}┃",
+ generated_by ? " " ~ name_version_and_compiler : "",
+ generated_by ? " (generated " ~ time_output_generated ~ ")" : "",
+ doc_sty_info.stylesheet,
+ doc_sty_info.papersize,
+ doc_sty_info.orient,
+ doc_sty_info.margin_left,
+ doc_sty_info.margin_right,
+ doc_sty_info.margin_top,
+ doc_sty_info.margin_bottom,
+);
+ return latex_sty;
+ }
+}
diff --git a/src/sisudoc/io_out/metadata.d b/src/sisudoc/io_out/metadata.d
new file mode 100644
index 0000000..0210212
--- /dev/null
+++ b/src/sisudoc/io_out/metadata.d
@@ -0,0 +1,609 @@
+/+
+- Name: SisuDoc 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 sisudoc.io_out.metadata;
+@safe:
+template outputMetadata() {
+ void outputMetadata(T)( T doc_matters) {
+ 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&nbsp;
+ <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="search">
+ <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">
+ <button type="submit" form="search" name="fn" value="%s">• ፨</button>
+ <button type="submit" form="search">㏈ ፨</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;
+ }
+ import
+ std.file,
+ std.format;
+ import sisudoc.io_out;
+ mixin InternalMarkup;
+ string[] metadata_;
+string theme_dark_0 = format(q"┃
+ body {
+ color : #CCCCCC;
+ background : #000000;
+ background-color : #000000;
+ }
+ a:link {
+ color : #FFFFFF;
+ text-decoration : none;
+ }
+ a:visited {
+ color : #999999;
+ text-decoration : none;
+ }
+ a:hover {
+ color : #000000;
+ background-color : #555555;
+ }
+ a:hover img {
+ background-color : #000000;
+ }
+ a:active {
+ color : #888888;
+ text-decoration : underline;
+ }
+ a.lnkicon:link {
+ text-decoration : none;
+ }
+ a.lnkicon:visited {
+ text-decoration : none;
+ }
+ a.lnkicon:hover {
+ font-size : 160%%;
+ }
+ a:hover img {
+ background-color : #FFFFFF;
+ }
+ input {
+ color : #FFFFFF;
+ background-color : #777777;
+ }
+┃");
+string theme_light_0 = format(q"┃
+ body {
+ color : #000000;
+ background : #FFFFFF;
+ background-color : #FFFFFF;
+ }
+ a:link {
+ color : #003399;
+ text-decoration : none;
+ }
+ a:visited {
+ color : #003399;
+ text-decoration : none;
+ }
+ a:hover {
+ color : #000000;
+ background-color : #f9f9aa;
+ }
+ a:hover img {
+ background-color : #FFFFFF;
+ }
+ a:active {
+ color : #003399;
+ text-decoration : underline;
+ }
+ a.lnkicon:link {
+ text-decoration : none;
+ }
+ a.lnkicon:visited {
+ text-decoration : none;
+ }
+ a.lnkicon:hover {
+ font-size : 160%%;
+ }
+ a:hover img {
+ background-color : #FFFFFF;
+ }
+ input {
+ color : #000000;
+ background-color : #FFFFFF;
+ }
+┃");
+string theme_dark_1 = format(q"┃
+ h1 {
+ color : #FFFFFF;
+ background : #000000;
+ }
+ p.letter {
+ color : #FFFFFF;
+ background : #333333;
+ }
+┃");
+string theme_light_1 = format(q"┃
+ h1 {
+ color : #FFFFFF;
+ background : #1A3A7A;
+ }
+ p.letter {
+ color : #FFFFFF;
+ background : #1A3A7A;
+ }
+┃");
+ metadata_ ~= format(q"┃<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>⌘ Curated metadata - Topics</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<meta name="dc.title" content= "metadata curate, Authors & Topics - information Structuring Universe, Structured information Serialised Units" />
+<meta name="dc.subject" content= "document structuring, ebook, publishing, PDF, LaTeX, XML, ODF, SQL, postgresql, sqlite, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, granular search, digital library" />
+<meta name="generator" content="spine" />
+<link rel="generator" href="https://sisudoc.org" />
+<link href="./css/curate.css" rel="stylesheet">
+<style TYPE="text/css">
+/* spine curate css default stylesheet */%s
+ .norm, .bold {
+ line-height : 150%%;
+ margin-left : 1em;
+ margin-right : 2em;
+ margin-top : 10px;
+ margin-bottom : 0px;
+ text-indent : 0mm;
+ }
+ p, h0, h1, h2, h3, h4, h5, h6, h7 {
+ display : block;
+ font-family : verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman;
+ font-size : 100%%;
+ font-weight : normal;
+ line-height : 150%%;
+ /* text-align : justify; */
+ margin-left : 1em;
+ text-indent : 0mm;
+ margin-top : 2px;
+ margin-bottom : 2px;
+ margin-right : 6px;
+ text-align : left;
+ }
+ h0, h1, h2, h3, h4, h5, h6, h7 { text-shadow: .2em .2em .3em #999999; }
+ h1 {
+ font-size : 120%%;
+ font-weight : bold;
+ color : #FFFFFF;
+ background : #000088;
+ margin-left : 0em;
+ }
+ p.work {
+ font-size : 80%%;
+ margin-left : 5em;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ margin-right : 6px;
+ text-align : left;
+ }
+ p.author {
+ font-size : 100%%;
+ margin-left : 2em;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ margin-right : 6px;
+ text-align : left;
+ }
+ p.publication {
+ font-size : 80%%;
+ margin-left : 4em;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ margin-right : 6px;
+ text-align : left;
+ }
+ p.letter {
+ font-weight : bold;
+ font-size : 60%%;
+ margin-left : 1em;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ margin-right : 6px;
+ text-align : left;
+ }
+ p.icons, .icons_center {
+ font-size : 100%%;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ margin-right : 6px;
+ }
+ p.icons {
+ text-align : left;
+ }
+ p.lev0 {
+ font-size : 120%%;
+ margin-left : 1em;
+ }
+ p.lev1 {
+ font-size : 110%%;
+ margin-left : 2em;
+ }
+ p.lev2 {
+ font-size : 100%%;
+ margin-left : 3em;
+ }
+ p.lev3 {
+ font-size : 90%%;
+ margin-left : 4em;
+ }
+ p.lev4 {
+ font-size : 80%%;
+ margin-left : 5em;
+ }
+ p.lev5 {
+ font-size : 80%%;
+ margin-left : 6em;
+ }%s
+ /* flex */
+ .flex-menu-bar {
+ display : -webkit-flex;
+ display : flex;
+ -webkit-flex-wrap : wrap;
+ -webkit-align-items : center;
+ align-items : center;
+ width : 100%%;
+ margin-left : 0%%;
+ margin-right : 2%%;
+ background-color : inherited;
+ }
+ .flex-menu-option {
+ background-color : inherited;
+ margin-right : 4px;
+ }
+ .flex-list {
+ display : -webkit-flex;
+ display : flex;
+ -webkit-align-items : center;
+ display : block;
+ align-items : center;
+ width : 100%%;
+ background-color : inherited;
+ }
+ .flex-list-item {
+ background-color : inherited;
+ margin : 4px;
+ }
+</style>
+<link rel="shortcut icon" href="../_sisu/image/rb7.ico" />
+</head>
+┃",
+ doc_matters.opt.action.css_theme_default ? theme_light_0 : theme_dark_0,
+ doc_matters.opt.action.css_theme_default ? theme_light_1 : theme_dark_1,
+) ~ "\n";
+ void metadata_write_output(M)(M doc_matters, string[] metadata_) {
+ auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language);
+ try {
+ if (!exists(pth_html.base)) {
+ pth_html.base.mkdirRecurse;
+ }
+ {
+ auto f = File(pth_html.fn_scroll("metadata." ~ doc_matters.src.filename), "w");
+ foreach (o; metadata_) {
+ f.writeln(o);
+ }
+ }
+ if (!exists(pth_html.base ~ "/index.html")) {
+ import sisudoc.io_out.html_snippet;
+ mixin htmlSnippet;
+ auto f = File(pth_html.base ~"/index.html", "w");
+ f.writeln(format_html_blank_page_guide_home(
+ "../../css/html_scroll.css",
+ (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,
+ "../../index.html",
+ ));
+ }
+ } catch (ErrnoException ex) {
+ // Handle error
+ }
+ if (doc_matters.opt.action.vox_gt0) {
+ writeln(" ", pth_html.fn_scroll("metadata." ~ doc_matters.src.filename));
+ }
+ }
+ static auto mkup = InlineMarkup();
+ import sisudoc.io_out.html_snippet;
+ mixin htmlSnippet;
+ if (doc_matters.opt.action.debug_do) {
+ writeln(doc_matters.src.filename_base);
+ writeln("Title: ", doc_matters.conf_make_meta.meta.title_full);
+ writeln(" Author: ", doc_matters.conf_make_meta.meta.creator_author);
+ writeln(" Published: ", doc_matters.conf_make_meta.meta.date_published);
+ writeln(" Copyright: ", doc_matters.conf_make_meta.meta.rights_copyright);
+ writeln(" License: ", special_characters_text(doc_matters.conf_make_meta.meta.rights_license));
+ if (doc_matters.conf_make_meta.meta.classify_topic_register_arr.length > 0) {
+ foreach (topic; doc_matters.conf_make_meta.meta.classify_topic_register_arr.sort!("toUpper(a) < toUpper(b)", SwapStrategy.unstable)) {
+ string[] subject_tree = topic.split(mkup.sep);
+ if (subject_tree.length > 0) { writeln(" ", subject_tree[0]); }
+ if (subject_tree.length > 1) { writeln(" ", subject_tree[1]); }
+ if (subject_tree.length > 2) { writeln(" ", subject_tree[2]); }
+ if (subject_tree.length > 3) { writeln(" ", subject_tree[3]); }
+ if (subject_tree.length > 4) { writeln(" ", subject_tree[4]); }
+ }
+ }
+ }
+ auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language);
+ auto pth_epub = spinePathsEPUB!()(doc_matters.output_path, doc_matters.src.language);
+ auto pth_pdf = spinePathsPDF!()(doc_matters);
+ auto pth_pod = spinePathsPods!()(doc_matters);
+ metadata_ ~= format(q"┃<body lang="en" xml:lang="en">
+ <a name="top" id="top"></a>
+ <a name="up" id="up"></a>
+ <a name="start" id="start"></a>
+ ┃");
+ metadata_ ~= "<div class=\"flex-menu-bar\"><div class=\"flex-menu-option\">";
+ if (doc_matters.opt.action.html_link_curate) {
+ metadata_ ~= format(q"┃<p class="icons">[<a href="%s" class="lnkicon">&nbsp;<b>⟰</b>&nbsp;HOME&nbsp;</a>&nbsp;|&nbsp;<a href="../../index.html" class="lnkicon">&nbsp;≅&nbsp;Collection&nbsp;</a>]&nbsp;&nbsp;[
+ <a href="../../authors.html" class="lnkicon">&nbsp;&#x1F58B;&nbsp;Authors&nbsp;</a> |
+ <a href="../../topics.html" class="lnkicon">&nbsp;⌘&nbsp;Topics&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,
+ );
+ } else {
+ metadata_ ~= format(q"┃<p class="icons">[<a href="../../../index.html" class="lnkicon">&nbsp;≅&nbsp;<b>HOME</b>&nbsp;</a>&nbsp;<a href="../../index.html" class="lnkicon">&nbsp;≅&nbsp;Collection&nbsp;</a>]
+ ┃");
+ }
+ metadata_ ~= "</div>" ~ inline_search_form(doc_matters) ~ "</div><hr />";
+ if (!(doc_matters.conf_make_meta.meta.title_full.empty)) {
+ metadata_ ~= "<p class=\"lev0\">Title: <b><a href=\"" ~ doc_matters.src.filename_base ~ "/toc.html\">" ~ doc_matters.conf_make_meta.meta.title_full ~ "</a></b></p>";
+ } else if (doc_matters.opt.action.debug_do || doc_matters.opt.action.vox_gt2) {
+ writeln("ERROR no Title information provided in document header ", doc_matters.src.filename_base);
+ }
+ if (!(doc_matters.conf_make_meta.meta.creator_author.empty)) {
+ if (doc_matters.opt.action.html_link_curate) {
+ metadata_ ~= "<p class=\"lev1\">Author: <b><a href=\"../../authors.html#" ~ doc_matters.conf_make_meta.meta.creator_author_surname.translate([' ' : "_"]) ~ "\">"
+ ~ doc_matters.conf_make_meta.meta.creator_author ~ "</a></b></p>";
+ } else {
+ metadata_ ~= "<p class=\"lev1\">Author: <b>"
+ ~ doc_matters.conf_make_meta.meta.creator_author ~ "</b></p>";
+ }
+ } else if (doc_matters.opt.action.debug_do || doc_matters.opt.action.vox_gt2) {
+ writeln("ERROR no Author information provided in document header ", doc_matters.src.filename_base);
+ }
+ metadata_ ~= "<p class=\"lev1\">Published: " ~ doc_matters.conf_make_meta.meta.date_published ~ "</p>";
+ if (!(doc_matters.conf_make_meta.meta.rights_copyright.empty)) {
+ metadata_ ~= "<p class=\"lev1\">Copyright: " ~ special_characters_text(doc_matters.conf_make_meta.meta.rights_copyright) ~ "</p>";
+ } else if (doc_matters.opt.action.debug_do || doc_matters.opt.action.vox_gt2) {
+ writeln("WARNING no Copyright information provided in document header ", doc_matters.src.filename_base);
+ }
+ if (!(doc_matters.conf_make_meta.meta.rights_license.empty)) {
+ metadata_ ~= "<p class=\"lev1\">License: " ~ special_characters_text(doc_matters.conf_make_meta.meta.rights_license) ~ "</p>";
+ } else if (doc_matters.opt.action.debug_do || doc_matters.opt.action.vox_gt2) {
+ writeln("WARNING no License information provided in document header ", doc_matters.src.filename_base);
+ }
+ if (!(doc_matters.conf_make_meta.meta.notes_summary.empty)) {
+ metadata_ ~= "<hr /><p class=\"lev0\">Summary:</p><p class=\"lev1\">" ~ special_characters_text(doc_matters.conf_make_meta.meta.notes_summary) ~ "</p>";
+ } else if (doc_matters.opt.action.debug_do) {
+ writeln("WARNING no summary of text provided in document header ", doc_matters.src.filename_base);
+ }
+ metadata_ ~= "<hr /><p class=\"lev1\">source: " ~ doc_matters.src.filename_base ~ "</p>";
+ if (doc_matters.opt.action.html_link_markup_source) {
+ metadata_ ~= "<p class=\"lev1\">●&nbsp;&nbsp;markup source:&nbsp;&nbsp;the&nbsppod&nbsp[<a href=\"../../" ~ pth_pod.internal_base ~ "/" ~ doc_matters.src.filename_base ~ ".zip\" class=\"lnkicon\">"
+ ~ "&nbsp;🫛&nbsp;zipped&nbsp;</a>|&nbsp;"
+ ~ "<a href=\"../../" ~ pth_pod.internal_base ~ "/" ~ doc_matters.src.filename_base ~ "/\" class=\"lnkicon\">"
+ ~ "&nbsp;🫛&nbsp;tree&nbsp;</a>]&nbsp;";
+ }
+ metadata_ ~= "<p class=\"lev1\">●&nbsp;&nbsp;outputs:&nbsp;&nbsp;[&nbsp;html:&nbsp;<a href=\"" ~ doc_matters.src.filename_base ~ ".html\" class=\"lnkicon\">"
+ ~ "&nbsp;▤&nbsp;scroll&nbsp;</a>&nbsp;"
+ ~ "|<a href=\"" ~ doc_matters.src.filename_base ~ "/toc.html\" class=\"lnkicon\">"
+ ~ "&nbsp;※&nbsp;seg&nbsp;</a>]&nbsp;&nbsp;&nbsp;"
+ ~ "[<a href=\"../../" ~ pth_epub.internal_base ~ "/" ~ doc_matters.src.filename_base ~ "." ~ doc_matters.src.language ~ ".epub\" class=\"lnkicon\">"
+ ~ "&nbsp;◆&nbsp;epub&nbsp;</a>]&nbsp;&nbsp;&nbsp;";
+ if ((doc_matters.opt.action.html_link_pdf) || (doc_matters.opt.action.html_link_pdf_a4)) {
+ metadata_ ~= "[&nbsp;pdf:&nbsp;<a href=\"../../pdf/"
+ ~ doc_matters.src.filename_base
+ ~ "." ~ doc_matters.src.language ~ ".a4.portrait.pdf\" class=\"lnkicon\">"
+ ~ "&nbsp;□&nbsp;a4&nbsp;</a>&nbsp"
+ ~ "|<a href=\"../../pdf/"
+ ~ doc_matters.src.filename_base
+ ~ "." ~ doc_matters.src.language ~ ".letter.portrait.pdf\" class=\"lnkicon\">"
+ ~ "&nbsp;□&nbsp;U.S.&nbsp;letter&nbsp;</a>]&nbsp";
+ } else if (doc_matters.opt.action.html_link_pdf_a4) {
+ metadata_ ~= "[<a href=\"../../pdf/"
+ ~ doc_matters.src.filename_base
+ ~ "." ~ doc_matters.src.language ~ ".a4.portrait.pdf\" class=\"lnkicon\">"
+ ~ "&nbsp;□&nbsp;pdf&nbsp;(a4)&nbsp;</a>]&nbsp";
+ } else if (doc_matters.opt.action.html_link_pdf_letter) {
+ metadata_ ~= "[<a href=\"../../pdf/"
+ ~ doc_matters.src.filename_base
+ ~ "." ~ doc_matters.src.language ~ ".letter.portrait.pdf\" class=\"lnkicon\">"
+ ~ "&nbsp;□&nbsp;pdf&nbsp;(U.S.&nbsp;letter)&nbsp;</a>]&nbsp";
+ }
+ metadata_ ~= "</p>";
+ if (doc_matters.conf_make_meta.meta.classify_topic_register_arr.length > 0) {
+ metadata_ ~= "<hr /><p class=\"lev0\">Topics:</p>";
+ string[] _top = ["", "", "", "", ""];
+ foreach (topic; doc_matters.conf_make_meta.meta.classify_topic_register_arr.sort!("toUpper(a) < toUpper(b)", SwapStrategy.unstable)) {
+ string[] subject_tree = topic.split(mkup.sep);
+ if (subject_tree.length > 0) {
+ if (subject_tree[0] != _top[0]) {
+ _top[0] = subject_tree[0];
+ if (doc_matters.opt.action.html_link_curate) {
+ metadata_ ~=
+ "<p class=\"lev1\"><a href=\"../../topics.html#"
+ ~ subject_tree[0].translate([' ' : "_"]) ~ "\">"
+ ~ subject_tree[0]
+ ~ "</a></p>";
+ } else {
+ metadata_ ~=
+ "<p class=\"lev1\">" ~ subject_tree[0] ~ "</p>";
+ }
+ }
+ if (subject_tree.length > 1) {
+ if (subject_tree[1] != _top[1]) {
+ _top[1] = subject_tree[1];
+ _top[2] = ""; _top[3] = ""; _top[4] = "";
+ if (doc_matters.opt.action.html_link_curate) {
+ metadata_ ~=
+ "<p class=\"lev2\"><a href=\"../../topics.html#"
+ ~ subject_tree[0].translate([' ' : "_"]) ~ "."
+ ~ subject_tree[1].translate([' ' : "_"]) ~ "\">"
+ ~ subject_tree[1]
+ ~ "</a></p>";
+ } else {
+ metadata_ ~=
+ "<p class=\"lev2\">" ~ subject_tree[1] ~ "</p>";
+ }
+ }
+ if (subject_tree.length > 2) {
+ if (subject_tree[2] != _top[2]) {
+ _top[2] = subject_tree[2];
+ _top[3] = ""; _top[4] = "";
+ if (doc_matters.opt.action.html_link_curate) {
+ metadata_ ~=
+ "<p class=\"lev3\"><a href=\"../../topics.html#"
+ ~ subject_tree[0].translate([' ' : "_"]) ~ "."
+ ~ subject_tree[1].translate([' ' : "_"]) ~ "."
+ ~ subject_tree[2].translate([' ' : "_"]) ~ "\">"
+ ~ subject_tree[2]
+ ~ "</a></p>";
+ } else {
+ metadata_ ~=
+ "<p class=\"lev3\">" ~ subject_tree[2] ~ "</p>";
+ }
+ }
+ if (subject_tree.length > 3) {
+ if (subject_tree[3] != _top[3]) {
+ _top[3] = subject_tree[3];
+ _top[4] = "";
+ if (doc_matters.opt.action.html_link_curate) {
+ metadata_ ~=
+ "<p class=\"lev4\"><a href=\"../../topics.html#"
+ ~ subject_tree[0].translate([' ' : "_"]) ~ "."
+ ~ subject_tree[1].translate([' ' : "_"]) ~ "."
+ ~ subject_tree[2].translate([' ' : "_"]) ~ "."
+ ~ subject_tree[3].translate([' ' : "_"]) ~ "\">"
+ ~ subject_tree[3]
+ ~ "</a></p>";
+ } else {
+ metadata_ ~=
+ "<p class=\"lev4\">" ~ subject_tree[3] ~ "</p>";
+ }
+ }
+ if (subject_tree.length > 4) {
+ if (subject_tree[4] != _top[4]) {
+ _top[4] = subject_tree[4];
+ if (doc_matters.opt.action.html_link_curate) {
+ metadata_ ~=
+ "<p class=\"lev5\"><a href=\"../../topics.html#"
+ ~ subject_tree[0].translate([' ' : "_"]) ~ "."
+ ~ subject_tree[1].translate([' ' : "_"]) ~ "."
+ ~ subject_tree[2].translate([' ' : "_"]) ~ "."
+ ~ subject_tree[3].translate([' ' : "_"]) ~ "."
+ ~ subject_tree[4].translate([' ' : "_"]) ~ "\">"
+ ~ subject_tree[4]
+ ~ "</a></p>";
+ } else {
+ metadata_ ~=
+ "<p class=\"lev5\">" ~ subject_tree[4] ~ "</p>";
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ } else if (doc_matters.opt.action.debug_do) {
+ writeln("WARNING no topic_register classification of text provided in document header ", doc_matters.src.filename_base);
+ }
+ metadata_write_output(doc_matters, metadata_);
+ }
+}
diff --git a/src/sisudoc/io_out/odt.d b/src/sisudoc/io_out/odt.d
new file mode 100644
index 0000000..d6ac27d
--- /dev/null
+++ b/src/sisudoc/io_out/odt.d
@@ -0,0 +1,2162 @@
+/+
+- Name: SisuDoc 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 sisudoc.io_out.odt;
+@safe:
+template formatODT() {
+ import
+ sisudoc.io_out,
+ sisudoc.io_out.rgx,
+ sisudoc.io_out.rgx_xhtml;
+ import
+ std.digest.sha,
+ std.file,
+ std.outbuffer,
+ std.uri,
+ std.zip,
+ std.conv : to;
+ import
+ sisudoc.io_out.create_zip_file,
+ sisudoc.io_out.xmls,
+ sisudoc.io_out.xmls_css;
+ mixin spineRgxOut;
+ mixin spineRgxXHTML;
+ struct formatODT {
+ static auto rgx = RgxO();
+ static auto rgx_xhtml = RgxXHTML();
+ string _tags(O)(const O obj) {
+ string _tags = "";
+ if (obj.tags.anchor_tags.length > 0) {
+ foreach (tag_; obj.tags.anchor_tags) {
+ if (tag_.length > 0) {
+ _tags ~= format(q"┃<text:span text:style-name="Span_subscript">
+ <text:bookmark-start text:name="%s"/>
+ <text:bookmark-end text:name="%s"/>
+ </text:span>
+ ┃",
+ _special_characters(tag_, obj),
+ _special_characters(tag_, obj),
+ );
+ }
+ }
+ }
+ return _tags;
+ }
+ string _xhtml_anchor_tags(O)(O obj) {
+ const(string[]) anchor_tags = obj.tags.anchor_tags;
+ string tags="";
+ if (anchor_tags.length > 0) {
+ foreach (tag; anchor_tags) {
+ if (!(tag.empty)) {
+ tags ~= "<a name=\"" ~ tag ~ "\"></a>";
+ }
+ }
+ }
+ return tags;
+ }
+ string obj_num(O)(const O obj) { // TODO
+ string _on;
+ _on = (obj.metainfo.object_number.empty)
+ ? ""
+ : (format(q"┃
+ <text:span text:style-name="Span_subscript">「%s」</text:span>┃",
+ obj.metainfo.object_number,
+ ));
+ return _on;
+ }
+ string _footnotes()(string _txt) {
+ static auto rgx = RgxO();
+ static auto rgx_xhtml = RgxXHTML();
+ _txt = _txt.replaceAll(
+ rgx.inline_notes_al_regular_number_note,
+ format(q"┃<text:note text:id="ftn%s" text:note-class="footnote">
+ <text:note-citation>
+ %s
+ </text:note-citation>
+ <text:note-body>
+ <text:p text:style-name="Footnote">
+ %s
+ </text:p>
+ </text:note-body>
+ </text:note>┃",
+ "$1", "$1", "$2",
+ )
+ );
+ return _txt;
+ }
+ string _bullet(O)(const O obj) {
+ string _b = "";
+ if (obj.attrib.bullet) {
+ _b = format(q"┃● ┃",);
+ }
+ return _b;
+ }
+ string _indent(O)(string _txt, const O obj) { // TODO
+ // if (obj.attrib.indent_base > 0 ||
+ // obj.attrib.indent_hang > 0
+ // ) {
+ if (obj.metainfo.is_a == "toc") {
+ _txt = format(q"┃
+ %s<text:h text:style-name="H_%s" text:outline-level="%s">
+ %s%s%s
+ </text:h>┃",
+ (obj.attrib.indent_base < 4)
+ ? "<text:p text:style-name=\"Standard\"/>\n " : "",
+ obj.attrib.indent_base,
+ obj.attrib.indent_base,
+ _tags(obj),
+ _txt,
+ obj_num(obj),
+ );
+ } else if (!empty(obj.metainfo.object_number)) {
+ if (obj.attrib.indent_base == 0 && obj.attrib.indent_hang == 0) {
+ _txt = format(q"┃
+ <text:p text:style-name="P_normal">%s
+ <text:span text:style-name="Span_subscript">
+ <text:bookmark-start text:name="%s"/>
+ <text:bookmark-end text:name="%s"/>
+ </text:span>
+ %s%s%s
+ </text:p>┃",
+ _bullet(obj),
+ obj.metainfo.object_number,
+ obj.metainfo.object_number,
+ _tags(obj),
+ _txt,
+ obj_num(obj),
+ );
+ } else if (obj.attrib.indent_base == obj.attrib.indent_hang) {
+ _txt = format(q"┃
+ <text:p text:style-name="P_indent_%s">%s
+ <text:span text:style-name="Span_subscript">
+ <text:bookmark-start text:name="%s"/>
+ <text:bookmark-end text:name="%s"/>
+ </text:span>
+ %s%s%s
+ </text:p>┃",
+ obj.attrib.indent_base,
+ _bullet(obj),
+ obj.metainfo.object_number,
+ obj.metainfo.object_number,
+ _tags(obj),
+ _txt,
+ obj_num(obj),
+ );
+ } else {
+ _txt = format(q"┃
+ <text:p text:style-name="P_h%s_i%s">%s
+ <text:span text:style-name="Span_subscript">
+ <text:bookmark-start text:name="%s"/>
+ <text:bookmark-end text:name="%s"/>
+ </text:span>
+ %s%s%s
+ </text:p>┃",
+ obj.attrib.indent_base,
+ obj.attrib.indent_hang,
+ _bullet(obj),
+ obj.metainfo.object_number,
+ obj.metainfo.object_number,
+ _tags(obj),
+ _txt,
+ obj_num(obj),
+ );
+ }
+ } else {
+ if (obj.attrib.indent_base == 0 && obj.attrib.indent_hang == 0) { /+ can omit and would explicitly set indent base and hang as 0 each below +/
+ _txt = format(q"┃
+ <text:p text:style-name="P_normal">%s
+ %s%s%s
+ </text:p>┃",
+ _bullet(obj),
+ _tags(obj),
+ _txt,
+ obj_num(obj),
+ );
+ } else if (obj.attrib.indent_base == obj.attrib.indent_hang) {
+ _txt = format(q"┃
+ <text:p text:style-name="P_indent_%s">%s
+ %s%s%s
+ </text:p>┃",
+ obj.attrib.indent_base,
+ _bullet(obj),
+ _tags(obj),
+ _txt,
+ obj_num(obj),
+ );
+ } else {
+ _txt = format(q"┃
+ <text:p text:style-name="P_h%s_i%s">%s
+ %s%s%s
+ </text:p>┃",
+ _bullet(obj),
+ obj.attrib.indent_base,
+ obj.attrib.indent_hang,
+ _tags(obj),
+ _txt,
+ obj_num(obj),
+ );
+ }
+ }
+ return _txt;
+ }
+ string _block_type_delimiters(O)(string[] _block_lines, const O obj) { // TODO
+ string _block = "";
+ foreach (i, _line; _block_lines) {
+ _line = _footnotes(_line);
+ if (i == 0) {
+ _block ~= format(q"┃
+ <text:p text:style-name="P_group">%s
+ <text:span text:style-name="Span_subscript">
+ <text:bookmark-start text:name="%s"/>
+ <text:bookmark-end text:name="%s"/>
+ </text:span>
+ %s
+ </text:p>┃",
+ _bullet(obj),
+ obj.metainfo.object_number,
+ obj.metainfo.object_number,
+ // _tags(obj),
+ _line,
+ );
+ } else {
+ _block ~= format(q"┃
+ <text:p text:style-name="P_group">%s</text:p>┃",
+ _line);
+ }
+ }
+ _block ~= format(q"┃
+ <text:p text:style-name="P_group">
+ <text:span text:style-name="Span_subscript">「%s」</text:span>
+ </text:p>
+ <text:p text:style-name="Standard"/>┃",
+ obj_num(obj));
+ return _block;
+ }
+ string _special_characters(O)(string _txt, const O obj) {
+ _txt = _txt
+ .replaceAll(rgx_xhtml.ampersand, "&amp;")
+ .replaceAll(rgx_xhtml.quotation, "&#34;")
+ .replaceAll(rgx_xhtml.less_than, "&lt;")
+ .replaceAll(rgx_xhtml.greater_than, "&gt;")
+ .replaceAll(rgx.nbsp_char, "&#160;");
+ return _txt;
+ }
+ string _preserve_white_spaces(O)(string _txt, const O obj) {
+ if (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block") {
+ _txt = _txt
+ .replaceAll(rgx.space, "&#160;");
+ }
+ return _txt;
+ }
+ string _font_face(string _txt){
+ _txt = _txt
+ .replaceAll(rgx.inline_strike, "<del>$1</del>")
+ .replaceAll(rgx.inline_insert, "<ins>$1</ins>")
+ .replaceAll(rgx.inline_cite, "<cite>$1</cite>")
+ .replaceAll(rgx.inline_emphasis, format(q"┃<text:span text:style-name="Span_bold">%s</text:span>┃", "$1"))
+ .replaceAll(rgx.inline_bold, format(q"┃<text:span text:style-name="Span_bold">%s</text:span>┃", "$1"))
+ .replaceAll(rgx.inline_italics, format(q"┃<text:span text:style-name="Span_italic">%s</text:span>┃", "$1"))
+ .replaceAll(rgx.inline_underscore, format(q"┃<text:span text:style-name="Span_underscore">%s</text:span>┃", "$1"))
+ .replaceAll(rgx.inline_superscript, format(q"┃<text:span text:style-name="Span_superscript">%s</text:span>┃","$1"))
+ .replaceAll(rgx.inline_subscript, format(q"┃<text:span text:style-name="Span_subscript">%s</text:span>┃", "$1"))
+ .replaceAll(rgx.inline_mono, format(q"┃<text:span text:style-name="Span_monospace">%s</text:span>┃", "$1"));
+ return _txt;
+ }
+ auto _obj_num(O)(O obj) { // NOT USED YET
+ struct objNum {
+ string reference() {
+ return format(q"┃<text:span text:style-name="Span_subscript">
+ <text:bookmark-start text:name="%s"/>
+ <text:bookmark-end text:name="%s"/>
+ </text:span>┃",
+ obj.object_number,
+ obj.object_number,
+ );
+ }
+ string display() {
+ return format(q"┃<text:span text:style-name="Span_subscript">
+ %s%s%s
+ </text:span>┃",
+ on_o,
+ obj.object_number,
+ on_c,
+ );
+ }
+ }
+ return objNum();
+ }
+ string _break_page()() {
+ return format(q"┃
+ <text:p text:style-name="P_normal_page_new"/>
+ ┃",
+ );
+ }
+ string _empty_line_break(O)(string _txt, const O obj) {
+ if (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block") {
+ _txt = _txt
+ .replaceAll(rgx.br_empty_line, "<br />");
+ }
+ return _txt;
+ }
+ string _links(O)(string _txt, const O obj) {
+ if (obj.metainfo.is_a != "code") {
+ if (obj.metainfo.is_a == "toc") {
+ _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)
+ .replaceAll(rgx.inline_link,
+ format(q"┃<text:bookmark-ref text:reference-format="text" text:ref-name="%s">%s</text:bookmark-ref>┃",
+ _special_characters("$3", obj),
+ _special_characters("$1", obj)
+ ));
+ } else {
+ _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)
+ .replaceAll(rgx.inline_link,
+ format(q"┃<text:a xl:type="simple" xl:href="%s">%s</text:a>┃",
+ _special_characters("$2", obj),
+ _special_characters("$1", obj)
+ ));
+ }
+ }
+ debug(links) {
+ if (obj.text.match(rgx.inline_link_number)
+ && _txt.match(rgx.inline_link_number_only)
+ ) {
+ writeln(">> ", _txt);
+ writeln("is_a: ", obj.metainfo.is_a);
+ }
+ }
+ return _txt;
+ }
+ string _images(O)(string _txt, const O obj) {
+ if (_txt.match(rgx.inline_image)) {
+ _txt = _txt
+ .replaceAll(rgx.inline_image,
+ ("$1<draw:frame draw:style-name=\"fr1\" draw:name=\"graphics12\" text:anchor-type=\"as-char\" svg:width=\"$4px\" svg:height=\"$5px\" draw:z-index=\"2\"><draw:image xl:href=\"Pictures/$3\" xl:type=\"simple\" xl:show=\"embed\" xl:actuate=\"onLoad\"/></draw:frame> $6"))
+ .replaceAll(
+ rgx.inline_link_empty,
+ ("$1"));
+ }
+ return _txt;
+ }
+ string markup(O)(const O obj) {
+ /+ markup TODO +/
+ string _txt = obj.text;
+ _txt = _special_characters(_txt, obj); // TODO & why both obj & obj.text, consider also in output_xmls.org
+ if (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block") {
+ _txt = replaceAll!(m => _preserve_white_spaces(m[1], obj))(_txt, rgx.spaces_keep);
+ } // check that this does what you want, keep: leading spaces (indent) & more than single spaces within text
+ // _txt = _preserve_white_spaces(_txt, obj); // (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block")
+ _txt = _font_face(_txt);
+ _txt = _images(_txt, obj); // (obj.metainfo.is_a != "code")
+ _txt = _links(_txt, obj); // (obj.metainfo.is_a != "code")
+ _txt = _empty_line_break(_txt, obj); // (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block")
+ return _txt;
+ }
+ string heading(O,M)(
+ const O obj,
+ const 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 == "heading");
+ string _o_txt_odt = markup(obj);
+ if (obj.metainfo.dummy_heading
+ && (obj.metainfo.is_a == "toc" || obj.metainfo.is_a == "heading")) {
+ _o_txt_odt = "";
+ } else if (obj.metainfo.is_a == "toc") {
+ _o_txt_odt = format(q"┃%s<text:h text:style-name="H_%s" text:outline-level="%s">
+ %s%s%s
+ </text:h>┃",
+ _break_page,
+ obj.metainfo.heading_lev_markup,
+ obj.metainfo.heading_lev_markup,
+ _tags(obj),
+ _o_txt_odt,
+ obj_num(obj),
+ );
+ } else {
+ _o_txt_odt = _footnotes(_o_txt_odt);
+ _o_txt_odt = format(q"┃%s<text:h text:style-name="H_%s" text:outline-level="%s">
+ <text:span text:style-name="Span_subscript">
+ <text:bookmark-start text:name="%s"/>
+ <text:bookmark-end text:name="%s"/>
+ </text:span>
+ %s%s%s
+ </text:h>┃",
+ _break_page,
+ obj.metainfo.heading_lev_markup,
+ obj.metainfo.heading_lev_markup,
+ obj.metainfo.object_number,
+ obj.metainfo.object_number,
+ _tags(obj),
+ _o_txt_odt,
+ obj_num(obj),
+ );
+ }
+ return _o_txt_odt;
+ }
+ string para(O,M)(
+ const O obj,
+ const 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 _o_txt_odt;
+ if (obj.metainfo.dummy_heading
+ && (obj.metainfo.is_a == "toc" || obj.metainfo.is_a == "heading")) {
+ _o_txt_odt = "";
+ } else {
+ _o_txt_odt = markup(obj);
+ _o_txt_odt = _footnotes(_o_txt_odt);
+ _o_txt_odt = _indent(_o_txt_odt, obj); // final setting?
+ }
+ return _o_txt_odt;
+ }
+ string quote(O,M)(
+ const O obj,
+ const 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");
+ string _o_txt_odt = markup(obj);
+ _o_txt_odt = _footnotes(_o_txt_odt); // decide
+ return _o_txt_odt;
+ }
+ string group(O,M)(
+ const O obj,
+ const 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");
+ string _o_txt_odt = markup(obj);
+ /+ TODO
+ - split lines
+ - only double newlines (paragraph delimiter), (not line breaks, single new lines)
+ - no hard space indentation
+ +/
+ string[] _block_lines = (_o_txt_odt).split(rgx.br_linebreaks_newlines);
+ _o_txt_odt = _block_type_delimiters(_block_lines, obj);
+ return _o_txt_odt;
+ }
+ string block(O,M)(
+ const O obj,
+ const 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");
+ string _o_txt_odt = markup(obj);
+ string[] _block_lines = (_o_txt_odt).split(rgx.br_linebreaks_newlines);
+ _o_txt_odt = _block_type_delimiters(_block_lines, obj);
+ return _o_txt_odt;
+ }
+ string verse(O,M)(
+ const O obj,
+ const 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");
+ string _o_txt_odt = markup(obj);
+ string[] _block_lines = (_o_txt_odt).split(rgx.br_linebreaks_newlines);
+ _o_txt_odt = _block_type_delimiters(_block_lines, obj);
+ return _o_txt_odt;
+ }
+ string code(O,M)(
+ const O obj,
+ const 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_txt_odt = markup(obj);
+ /+ TODO
+ - split lines
+ - each line including empty lines
+ - hard space indentation
+ - "^[ ]" &#160;
+ - count number only at beginning of line and replace each
+ +/
+ string[] _block_lines = (_o_txt_odt).split(rgx.br_linebreaks_newlines);
+ string _block = "";
+ foreach (i, _line; _block_lines) {
+ if (i == 1) {
+ _block ~= format(q"┃
+ <text:p text:style-name="P_code">
+ <text:span text:style-name="Span_subscript">
+ <text:bookmark-start text:name="%s"/>
+ <text:bookmark-end text:name="%s"/>
+ </text:span>
+ %s
+ </text:p>┃",
+ obj.metainfo.object_number,
+ obj.metainfo.object_number,
+ _line,
+ );
+ } else {
+ _block ~= format(q"┃
+ <text:p text:style-name="P_code">%s</text:p>┃",
+ _line);
+ }
+ }
+ _block ~= format(q"┃
+ <text:p text:style-name="P_group">
+ <text:span text:style-name="Span_subscript">「%s」</text:span>
+ </text:p>
+ <text:p text:style-name="Standard"/>┃",
+ obj_num(obj));
+ _o_txt_odt = _block;
+ return _o_txt_odt;
+ }
+ Tuple!(string, string) tablarize(O)(
+ const O obj,
+ string _txt,
+ ) {
+ 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 ~= "<table:table-row>";
+ foreach(col_idx, cell; _table_cols) {
+ if ((_table_cols.length == 1)
+ && (_table_rows.length <= row_idx+2)) { // check row_idx+2 (rather than == ++row_idx)
+ _tablenote ~= cell;
+ } else {
+ _table ~= format(q"┃<table:table-cell office:value-type="string">
+ <text:p text:style-name="%s">
+ %s
+ </text:p>
+ </table:table-cell>┃",
+ (row_idx == 0 && obj.table.heading) ? "Table_Heading" : "P_table_cell",
+ cell,
+ );
+ }
+ }
+ _table ~= "</table:table-row>";
+ }
+ Tuple!(string, string) t = tuple(
+ _table,
+ _tablenote,
+ );
+ return t;
+ }
+ int _table_number = 0;
+ string table(O,M)(
+ const O obj,
+ const 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 _o_txt_odt = markup(obj);
+ Tuple!(string, string) t = tablarize(obj, _o_txt_odt);
+ string _note = t[1];
+ _o_txt_odt = format(q"┃
+ <table:table table:name="Table%s" table:style-name="Table1">
+ <text:span text:style-name="Span_subscript">
+ <text:bookmark-start text:name="%s"/>
+ <text:bookmark-end text:name="%s"/>
+ </text:span>
+ <table:table-column table:style-name="Table1.D" table:number-columns-repeated="%s"/>
+ %s
+ </table:table>
+ <text:p text:style-name="P_group">
+ <text:span text:style-name="Span_subscript">「%s」</text:span>
+ </text:p>┃",
+ _table_number++,
+ obj.metainfo.object_number,
+ obj.metainfo.object_number,
+ obj.table.number_of_columns,
+ t[0],
+ obj.metainfo.object_number,
+ // _note,
+ );
+ return _o_txt_odt;
+ }
+ }
+}
+template outputODT() {
+ import
+ sisudoc.io_out,
+ sisudoc.io_out.rgx,
+ sisudoc.io_out.rgx_xhtml;
+ import
+ std.digest.sha,
+ std.file,
+ std.outbuffer,
+ std.uri,
+ std.zip,
+ std.conv : to;
+ import
+ sisudoc.io_out.create_zip_file,
+ sisudoc.io_out.xmls,
+ sisudoc.io_out.xmls_css;
+ mixin InternalMarkup;
+ mixin spineRgxOut;
+ mixin spineRgxXHTML;
+ static auto rgx = RgxO();
+ static auto rgx_xhtml = RgxXHTML();
+ // mixin outputXmlODT;
+ string odt_head(I)(I doc_matters) {
+ string _has_tables = format(q"┃
+ <style:style style:name="Table1" style:family="table">
+ <style:table-properties style:width="16.999cm" table:align="margins"/>
+ </style:style>
+ <style:style style:name="Table1.A" style:family="table-column">
+ <style:table-column-properties style:column-width="16.999cm" style:rel-column-width="65535*"/>
+ </style:style>
+ <style:style style:name="Table1.B" style:family="table-column">
+ <style:table-column-properties style:column-width="8.499cm" style:rel-column-width="32767*"/>
+ </style:style>
+ <style:style style:name="Table1.C" style:family="table-column">
+ <style:table-column-properties style:column-width="5.666cm" style:rel-column-width="21845*"/>
+ </style:style>
+ <style:style style:name="Table1.D" style:family="table-column">
+ <style:table-column-properties style:column-width="4.349cm" style:rel-column-width="16383*"/>
+ </style:style>
+ <style:style style:name="Table1.E" style:family="table-column">
+ <style:table-column-properties style:column-width="3.399cm" style:rel-column-width="13107*"/>
+ </style:style>
+ <style:style style:name="Table1.F" style:family="table-column">
+ <style:table-column-properties style:column-width="2.833cm" style:rel-column-width="10922*"/>
+ </style:style>
+ <style:style style:name="Table1.G" style:family="table-column">
+ <style:table-column-properties style:column-width="2.428cm" style:rel-column-width="9362*"/>
+ </style:style>
+ <style:style style:name="Table1.H" style:family="table-column">
+ <style:table-column-properties style:column-width="2.124cm" style:rel-column-width="8191*"/>
+ </style:style>
+ <style:style style:name="Table2" style:family="table">
+ <style:table-properties style:width="16.999cm" table:align="margins"/>
+ </style:style>
+ <style:style style:name="Table2.A" style:family="table-column">
+ <style:table-column-properties style:column-width="16.999cm" style:rel-column-width="65535*"/>
+ </style:style>
+ <style:style style:name="Table2.B" style:family="table-column">
+ <style:table-column-properties style:column-width="8.499cm" style:rel-column-width="32767*"/>
+ </style:style>
+ <style:style style:name="Table2.C" style:family="table-column">
+ <style:table-column-properties style:column-width="5.666cm" style:rel-column-width="21845*"/>
+ </style:style>
+ <style:style style:name="Table2.D" style:family="table-column">
+ <style:table-column-properties style:column-width="4.349cm" style:rel-column-width="16383*"/>
+ </style:style>
+ <style:style style:name="Table2.E" style:family="table-column">
+ <style:table-column-properties style:column-width="3.999cm" style:rel-column-width="13107*"/>
+ </style:style>
+ <style:style style:name="Table2.F" style:family="table-column">
+ <style:table-column-properties style:column-width="2.833cm" style:rel-column-width="10922*"/>
+ </style:style>
+ <style:style style:name="Table2.G" style:family="table-column">
+ <style:table-column-properties style:column-width="2.428cm" style:rel-column-width="9362*"/>
+ </style:style>
+ <style:style style:name="Table2.H" style:family="table-column">
+ <style:table-column-properties style:column-width="2.124cm" style:rel-column-width="8191*"/>
+ </style:style>
+ <style:style style:name="Table2.I" style:family="table-column">
+ <style:table-column-properties style:column-width="1.8887cm" style:rel-column-width="7281*"/>
+ </style:style>
+ <style:style style:name="Table2.J" style:family="table-column">
+ <style:table-column-properties style:column-width="1.6999cm" style:rel-column-width="6553*"/>
+ </style:style>
+ <style:style style:name="Table2.K" style:family="table-column">
+ <style:table-column-properties style:column-width="1.5453cm" style:rel-column-width="5957*"/>
+ </style:style>
+ <style:style style:name="Table2.L" style:family="table-column">
+ <style:table-column-properties style:column-width="1.416cm" style:rel-column-width="5461*"/>
+ </style:style>
+ <style:style style:name="Table2.M" style:family="table-column">
+ <style:table-column-properties style:column-width="1.307" style:rel-column-width="5041*"/>
+ </style:style>
+ <style:style style:name="Table2.N" style:family="table-column">
+ <style:table-column-properties style:column-width="1.214cm" style:rel-column-width="4681*"/>
+ </style:style>
+ ┃",);
+ string _odt_head = format(q"┃<?xml version="1.0" encoding="UTF-8"?>
+ <office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xl="https://www.w3.org/1999/xlink" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="https://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="https://openoffice.org/2004/office" xmlns:ooow="https://openoffice.org/2004/writer" xmlns:oooc="https://openoffice.org/2004/calc" xmlns:dom="https://www.w3.org/2001/xml-events" xmlns:xforms="https://www.w3.org/2002/xforms" xmlns:xsd="https://www.w3.org/2001/XMLSchema" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="https://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="https://www.w3.org/1999/xhtml" xmlns:grddl="https://www.w3.org/2003/g/data-view#" xmlns:tableooo="https://openoffice.org/2009/table" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="https://www.w3.org/TR/css3-text/" office:version="1.2">
+ <office:scripts/>
+ <office:font-face-decls>
+ <style:font-face style:name="DejaVu Sans Mono" svg:font-family="'DejaVu Sans Mono'" style:font-adornments="Book" style:font-family-generic="modern" style:font-pitch="fixed"/>
+ <style:font-face style:name="Inconsolata" svg:font-family="Inconsolata" style:font-adornments="Regular" style:font-pitch="fixed"/>
+ <style:font-face style:name="Liberation Mono" svg:font-family="'Liberation Mono'" style:font-adornments="Regular" style:font-family-generic="modern" style:font-pitch="fixed"/>
+ <style:font-face style:name="DejaVu Sans" svg:font-family="'DejaVu Sans'" style:font-adornments="ExtraLight" style:font-family-generic="swiss" style:font-pitch="variable"/>
+ <style:font-face style:name="Nimbus Sans L" svg:font-family="'Nimbus Sans L'" style:font-pitch="variable"/>
+ <style:font-face style:name="Tahoma" svg:font-family="Tahoma, Lucidasans, 'Lucida Sans', 'Arial Unicode MS'" style:font-pitch="variable"/>
+ <style:font-face style:name="Nimbus Roman No9 L" svg:font-family="'Nimbus Roman No9 L'" style:font-family-generic="roman" style:font-pitch="variable"/>
+ <style:font-face style:name="Bitstream Vera Sans" svg:font-family="'Bitstream Vera Sans'" style:font-family-generic="swiss" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:automatic-styles>
+ %s
+ <style:style style:name="P_table_cell" style:family="paragraph" style:parent-style-name="Table_Contents">
+ <style:paragraph-properties fo:text-align="justify" style:justify-single-word="false"/>
+ </style:style>
+ </office:automatic-styles>
+ <office:body>
+ <office:text text:use-soft-page-breaks="true">
+ <office:forms form:automatic-focus="false" form:apply-design-mode="false"/>
+ <text:sequence-decls>
+ <text:sequence-decl text:display-outline-level="0" text:name="Illustration"/>
+ <text:sequence-decl text:display-outline-level="0" text:name="Table"/>
+ <text:sequence-decl text:display-outline-level="0" text:name="Text"/>
+ <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
+ </text:sequence-decls>
+ ┃",
+ (doc_matters.has.tables > 0) ? _has_tables : "",
+ );
+ return _odt_head;
+ }
+ string odt_body(D,I)(
+ const D doc_abstraction,
+ I doc_matters,
+ ) {
+ mixin formatODT;
+ auto odt_format = formatODT();
+ string delimit = "";
+ string doc_odt = "";
+ string _txt = "";
+ foreach (part; doc_matters.has.keys_seq.scroll) {
+ foreach (obj; doc_abstraction[part]) {
+ switch (obj.metainfo.is_of_part) {
+ case "frontmatter": assert(part == "head" || "toc");
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "heading":
+ _txt = delimit ~ odt_format.heading(obj, doc_matters);
+ goto default;
+ case "toc":
+ _txt = odt_format.para(obj, doc_matters);
+ goto default;
+ default:
+ doc_odt ~= _txt;
+ _txt = "";
+ break;
+ }
+ break;
+ default: break;
+ }
+ break;
+ case "body": assert(part == "body" || "head"); // surprise
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "heading":
+ _txt = delimit ~ odt_format.heading(obj, doc_matters);
+ goto default;
+ case "para":
+ _txt = odt_format.para(obj, doc_matters);
+ goto default;
+ default:
+ doc_odt ~= _txt;
+ _txt = "";
+ break;
+ }
+ break;
+ case "block":
+ switch (obj.metainfo.is_a) {
+ case "quote":
+ _txt = odt_format.quote(obj, doc_matters);
+ goto default;
+ case "group":
+ _txt = odt_format.group(obj, doc_matters);
+ goto default;
+ case "block":
+ _txt = odt_format.block(obj, doc_matters);
+ goto default;
+ case "verse":
+ _txt = odt_format.verse(obj, doc_matters);
+ goto default;
+ case "code":
+ _txt = odt_format.code(obj, doc_matters);
+ goto default;
+ case "table":
+ _txt = odt_format.table(obj, doc_matters);
+ goto default;
+ default:
+ doc_odt ~= _txt;
+ _txt = "";
+ break;
+ }
+ break;
+ default: break;
+ }
+ break;
+ case "backmatter":
+ assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "heading":
+ _txt = delimit ~ odt_format.heading(obj, doc_matters);
+ goto default;
+ case "endnote": assert(part == "endnotes");
+ _txt = odt_format.para(obj, doc_matters);
+ goto default;
+ case "glossary": assert(part == "glossary");
+ _txt = odt_format.para(obj, doc_matters);
+ goto default;
+ case "bibliography": assert(part == "bibliography");
+ _txt = odt_format.para(obj, doc_matters);
+ goto default;
+ case "bookindex": assert(part == "bookindex");
+ _txt = odt_format.para(obj, doc_matters);
+ goto default;
+ case "blurb": assert(part == "blurb");
+ _txt = odt_format.para(obj, doc_matters);
+ goto default;
+ default:
+ doc_odt ~= _txt;
+ _txt = "";
+ break;
+ }
+ break;
+ default: break;
+ }
+ break;
+ case "comment":
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.vox_gt1) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part);
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ writeln(__FILE__, ":", __LINE__, ": ", obj.text);
+ }
+ }
+ break;
+ }
+ }
+ }
+ return doc_odt;
+ }
+
+ string odt_tail() {
+ string _odt_tail = format(q"┃<text:p text:style-name="P_normal">spine: &lt;<text:a xl:type="simple" xl:href="https://www.sisudoc.org">www.sisudoc.org</text:a>&gt; and &lt;<text:a xl:type="simple" xl:href="https://www.sisudoc.org">www.sisudoc.org</text:a>&gt;</text:p>
+ </office:text></office:body></office:document-content>┃",);
+ return _odt_tail;
+ }
+ string content_xml(D,I)(
+ const D doc_abstraction,
+ I doc_matters,
+ ) {
+ string _content_xml;
+ string break_line = (doc_matters.opt.action.debug_do) ? "\n" : "";
+ string odt_break_page = format(q"┃<text:p text:style-name="P_normal_page_new"/>┃",);
+ string br_pg = format(q"┃<text:p text:style-name="P_normal_page_new"/>┃",);
+ _content_xml ~= odt_head(doc_matters);
+ _content_xml ~= odt_body(doc_abstraction, doc_matters);
+ _content_xml ~= odt_tail;
+ return _content_xml;
+ }
+ string manifest_xml(M)(
+ auto ref M doc_matters,
+ ) {
+ string _bullet = format(q"┃<manifest:file-entry manifest:media-type="" manifest:full-path="Pictures/bullet_09.png"/>┃");
+ string[] _images = [ _bullet ];
+ foreach (image; doc_matters.srcs.image_list) {
+ _images ~= format(q"┃ <manifest:file-entry manifest:media-type="" manifest:full-path="Pictures/%s"/>┃", image);
+ }
+ string _manifest_xml = format(q"┃<?xml version="1.0" encoding="UTF-8"?>
+ <manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0" manifest:version="1.2">
+ <manifest:file-entry manifest:media-type="application/vnd.oasis.opendocument.text" manifest:version="1.2" manifest:full-path="/"/>
+ <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="styles.xml"/>
+ <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="content.xml"/>
+ %s
+ <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="meta.xml"/>
+ <manifest:file-entry manifest:media-type="application/rdf+xml" manifest:full-path="manifest.rdf"/>
+ <manifest:file-entry manifest:media-type="application/binary" manifest:full-path="layout-cache"/>
+ <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="settings.xml"/>
+ </manifest:manifest>
+ ┃",
+ _images.join("\n"),
+ );
+ return _manifest_xml;
+ }
+ void images_cp(M)(
+ auto ref M doc_matters,
+ ) {
+ { /+ (copy odt images) +/
+ import sisudoc.io_out.paths_output;
+ auto pth_odt = spinePathsODT!()(doc_matters);
+ foreach (image; doc_matters.srcs.image_list) {
+ auto fn_src_in = doc_matters.src.image_dir_path ~ "/" ~ image;
+ auto fn_src_out_file = pth_odt.image_dir("fs") ~ "/" ~ image;
+ auto fn_src_out_zip = pth_odt.image_dir("zip") ~ "/" ~ image;
+ if (exists(fn_src_in)) {
+ if (doc_matters.opt.action.debug_do) {
+ if (doc_matters.opt.action.debug_do) {
+ fn_src_in.copy(fn_src_out_file);
+ }
+ }
+ }
+ }
+ }
+ // return 0;
+ }
+ string meta_xml(M)(
+ auto ref M doc_matters,
+ ) {
+ /+ (meta_xml includes output time-stamp) +/
+ string _meta_xml = format(q"┃<?xml version="1.0" encoding="UTF-8"?>
+ <office:document-meta xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xl="https://www.w3.org/1999/xlink" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:ooo="https://openoffice.org/2004/office" xmlns:grddl="https://www.w3.org/2003/g/data-view#" office:version="1.2">
+ <office:meta>
+ <meta:generator>%s</meta:generator>
+ <meta:creation-date>%s</meta:creation-date>
+ <dc:date>%s</dc:date>
+ <dc:language>en-US</dc:language>
+ </office:meta>
+ </office:document-meta>
+ ┃",
+ doc_matters.generator_program.name_and_version,
+ doc_matters.generated_time,
+ doc_matters.generated_time,
+ );
+ return _meta_xml;
+ }
+ void dirtree(I)(
+ I doc_matters,
+ ) {
+ import sisudoc.io_out.paths_output;
+ auto pth_odt = spinePathsODT!()(doc_matters);
+ if (doc_matters.opt.action.debug_do) { /+ (dir tree) +/
+ if (!exists(pth_odt.meta_inf_dir("fs"))) {
+ pth_odt.meta_inf_dir("fs").mkdirRecurse;
+ }
+ if (!exists(pth_odt.image_dir("fs"))) {
+ pth_odt.image_dir("fs").mkdirRecurse;
+ }
+ }
+ if (!exists(pth_odt.base_pth)) {
+ pth_odt.base_pth.mkdirRecurse;
+ }
+ if (!exists(pth_odt.base_pth ~ "/index.html")) {
+ import sisudoc.io_out.html_snippet;
+ mixin htmlSnippet;
+ auto f = File(pth_odt.base_pth ~"/index.html", "w");
+ f.writeln(format_html_blank_page_guide_home(
+ "../../css/html_scroll.css",
+ "https://sisudoc.org",
+ "../../index.html",
+ ));
+ }
+ // return 0;
+ }
+ string mimetype() {
+ string mimetype_ = format(q"┃application/vnd.oasis.opendocument.text┃");
+ return mimetype_;
+ }
+ string manifest_rdf() {
+ string _manifest_rdf = format(q"┃<?xml version="1.0" encoding="utf-8"?>
+ <rdf:RDF xmlns:rdf="https://www.w3.org/1999/02/22-rdf-syntax-ns#">
+ <rdf:Description rdf:about="styles.xml">
+ <rdf:type rdf:resource="https://docs.oasis-open.org/ns/office/1.2/meta/odf#StylesFile"/>
+ </rdf:Description>
+ <rdf:Description rdf:about="">
+ <ns0:hasPart xmlns:ns0="https://docs.oasis-open.org/ns/office/1.2/meta/pkg#" rdf:resource="styles.xml"/>
+ </rdf:Description>
+ <rdf:Description rdf:about="content.xml">
+ <rdf:type rdf:resource="https://docs.oasis-open.org/ns/office/1.2/meta/odf#ContentFile"/>
+ </rdf:Description>
+ <rdf:Description rdf:about="">
+ <ns0:hasPart xmlns:ns0="https://docs.oasis-open.org/ns/office/1.2/meta/pkg#" rdf:resource="content.xml"/>
+ </rdf:Description>
+ <rdf:Description rdf:about="">
+ <rdf:type rdf:resource="https://docs.oasis-open.org/ns/office/1.2/meta/pkg#Document"/>
+ </rdf:Description>
+ </rdf:RDF>
+ ┃");
+ return _manifest_rdf;
+ }
+ string settings_xml() {
+ string _settings_xml = format(q"┃<?xml version="1.0" encoding="UTF-8"?>
+ <office:document-settings xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xl="https://www.w3.org/1999/xlink" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="https://openoffice.org/2004/office" office:version="1.2">
+ <office:settings>
+ <config:config-item-set config:name="ooo:view-settings">
+ <config:config-item config:name="ViewAreaTop" config:type="int">0</config:config-item>
+ <config:config-item config:name="ViewAreaLeft" config:type="int">0</config:config-item>
+ <config:config-item config:name="ViewAreaWidth" config:type="int">0</config:config-item>
+ <config:config-item config:name="ViewAreaHeight" config:type="int">0</config:config-item>
+ <config:config-item config:name="ShowRedlineChanges" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="InBrowseMode" config:type="boolean">false</config:config-item>
+ <config:config-item-map-indexed config:name="Views">
+ <config:config-item-map-entry>
+ <config:config-item config:name="ViewId" config:type="string">view2</config:config-item>
+ <config:config-item config:name="ViewLeft" config:type="int">0</config:config-item>
+ <config:config-item config:name="ViewTop" config:type="int">0</config:config-item>
+ <config:config-item config:name="VisibleLeft" config:type="int">0</config:config-item>
+ <config:config-item config:name="VisibleTop" config:type="int">0</config:config-item>
+ <config:config-item config:name="VisibleRight" config:type="int">0</config:config-item>
+ <config:config-item config:name="VisibleBottom" config:type="int">0</config:config-item>
+ <config:config-item config:name="ZoomType" config:type="short">0</config:config-item>
+ <config:config-item config:name="ViewLayoutColumns" config:type="short">2</config:config-item>
+ <config:config-item config:name="ViewLayoutBookMode" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="ZoomFactor" config:type="short">100</config:config-item>
+ <config:config-item config:name="IsSelectedFrame" config:type="boolean">false</config:config-item>
+ </config:config-item-map-entry>
+ </config:config-item-map-indexed>
+ </config:config-item-set>
+ <config:config-item-set config:name="ooo:configuration-settings">
+ <config:config-item config:name="ChartAutoUpdate" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="IsLabelDocument" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="MathBaselineAlignment" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="OutlineLevelYieldsNumbering" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrintLeftPages" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="DoNotJustifyLinesWithManualBreak" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="AlignTabStopPosition" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrintTextPlaceholder" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="UseOldNumbering" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="CurrentDatabaseCommand" config:type="string"/>
+ <config:config-item config:name="ProtectForm" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintBlackFonts" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintProspectRTL" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="SmallCapsPercentage66" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrintControls" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="CharacterCompressionType" config:type="short">0</config:config-item>
+ <config:config-item config:name="PrintHiddenText" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="UseFormerTextWrapping" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="IsKernAsianPunctuation" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintProspect" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintEmptyPages" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="UseFormerObjectPositioning" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ConsiderTextWrapOnObjPos" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="TableRowKeep" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintReversed" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="TabsRelativeToIndent" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrintRightPages" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrintPaperFromSetup" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="AddFrameOffsets" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="AddParaSpacingToTableCells" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="UpdateFromTemplate" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="AddExternalLeading" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrintSingleJobs" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrinterIndependentLayout" config:type="string">high-resolution</config:config-item>
+ <config:config-item config:name="LinkUpdateMode" config:type="short">1</config:config-item>
+ <config:config-item config:name="PrintAnnotationMode" config:type="short">0</config:config-item>
+ <config:config-item config:name="UseOldPrinterMetrics" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="RedlineProtectionKey" config:type="base64Binary"/>
+ <config:config-item config:name="PrinterSetup" config:type="base64Binary"/>
+ <config:config-item config:name="IgnoreFirstLineIndentInNumbering" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="CollapseEmptyCellPara" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrinterName" config:type="string"/>
+ <config:config-item config:name="InvertBorderSpacing" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintPageBackground" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="DoNotCaptureDrawObjsOnPage" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ApplyUserData" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="TabAtLeftIndentForParagraphsInList" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="UnxForceZeroExtLeading" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="SaveVersionOnClose" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintFaxName" config:type="string"/>
+ <config:config-item config:name="AddParaTableSpacing" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrintDrawings" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="LoadReadonly" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintGraphics" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="FieldAutoUpdate" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="AllowPrintJobCancel" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="UseFormerLineSpacing" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="SaveGlobalDocumentLinks" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="CurrentDatabaseDataSource" config:type="string"/>
+ <config:config-item config:name="IgnoreTabsAndBlanksForLineCalculation" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="CurrentDatabaseCommandType" config:type="int">0</config:config-item>
+ <config:config-item config:name="DoNotResetParaAttrsForNumFont" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ClipAsCharacterAnchoredWriterFlyFrames" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintTables" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="AddParaTableSpacingAtStart" config:type="boolean">true</config:config-item>
+ </config:config-item-set>
+ </office:settings>
+ </office:document-settings>
+ ┃");
+ return _settings_xml;
+ }
+ string styles_xml() {
+ string _styles_xml = format(q"┃<?xml version="1.0" encoding="UTF-8"?>
+ <office:document-styles xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xl="https://www.w3.org/1999/xlink" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="https://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="https://openoffice.org/2004/office" xmlns:ooow="https://openoffice.org/2004/writer" xmlns:oooc="https://openoffice.org/2004/calc" xmlns:dom="https://www.w3.org/2001/xml-events" xmlns:rpt="https://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="https://www.w3.org/1999/xhtml" xmlns:grddl="https://www.w3.org/2003/g/data-view#" xmlns:tableooo="https://openoffice.org/2009/table" xmlns:css3t="https://www.w3.org/TR/css3-text/" office:version="1.2">
+ <office:font-face-decls>
+ <style:font-face style:name="DejaVu Sans Mono" svg:font-family="'DejaVu Sans Mono'" style:font-adornments="Book" style:font-family-generic="modern" style:font-pitch="fixed"/>
+ <style:font-face style:name="Nimbus Sans L" svg:font-family="'Nimbus Sans L'" style:font-pitch="variable"/>
+ <style:font-face style:name="Tahoma" svg:font-family="Tahoma, Lucidasans, 'Lucida Sans', 'Arial Unicode MS'" style:font-pitch="variable"/>
+ <style:font-face style:name="Nimbus Roman No9 L" svg:font-family="'Nimbus Roman No9 L'" style:font-family-generic="roman" style:font-pitch="variable"/>
+ <style:font-face style:name="Bitstream Vera Sans" svg:font-family="'Bitstream Vera Sans'" style:font-family-generic="swiss" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+ <style:default-style style:family="graphic">
+ <style:graphic-properties fo:wrap-option="wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/>
+ <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false">
+ <style:tab-stops/>
+ </style:paragraph-properties>
+ <style:text-properties style:use-window-font-color="true" fo:font-size="12pt" fo:language="en" fo:country="US" style:font-size-asian="12pt" style:language-asian="zxx" style:country-asian="none" style:font-size-complex="12pt" style:language-complex="zxx" style:country-complex="none"/>
+ </style:default-style>
+ <style:default-style style:family="paragraph">
+ <style:paragraph-properties fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/>
+ <style:text-properties style:use-window-font-color="true" style:font-name="Nimbus Roman No9 L" fo:font-size="12pt" fo:language="en" fo:country="US" style:font-name-asian="Nimbus Sans L" style:font-size-asian="12pt" style:language-asian="zxx" style:country-asian="none" style:font-name-complex="Nimbus Sans L" style:font-size-complex="12pt" style:language-complex="zxx" style:country-complex="none" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/>
+ </style:default-style>
+ <style:default-style style:family="table">
+ <style:table-properties table:border-model="collapsing"/>
+ </style:default-style>
+ <style:default-style style:family="table-row">
+ <style:table-row-properties fo:keep-together="auto"/>
+ </style:default-style>
+ <style:style style:name="Standard" style:family="paragraph" style:class="text"/>
+ <style:style style:name="Text_body" style:display-name="Text body" style:family="paragraph" style:class="text">
+ <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.212cm"/>
+ </style:style>
+ <style:style style:name="P_page_break" style:family="paragraph" style:parent-style-name="Standard">
+ <style:paragraph-properties fo:break-before="page"/>
+ </style:style>
+ <style:style style:name="P_normal" style:family="paragraph" style:parent-style-name="Standard">
+ <style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%%" fo:text-align="justify" style:justify-single-word="false"/>
+ </style:style>
+ <style:style style:name="P_normal_page_new" style:family="paragraph" style:parent-style-name="Standard">
+ <style:paragraph-properties fo:break-after="page"/>
+ </style:style>
+ <style:style style:name="P_indent_0" style:display-name="Paragraph indent 0" style:family="paragraph" style:parent-style-name="Standard">
+ <style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%%" fo:text-align="justify" style:justify-single-word="false"/>
+ </style:style>
+ <style:style style:name="P_indent_1" style:display-name="Paragraph indent 1" style:family="paragraph" style:parent-style-name="Standard">
+ <style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%%" fo:margin-left="1cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/>
+ </style:style>
+ <style:style style:name="P_indent_2" style:display-name="Paragraph indent 2" style:family="paragraph" style:parent-style-name="Standard">
+ <style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%%" fo:margin-left="2cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/>
+ </style:style>
+ <style:style style:name="P_indent_3" style:display-name="Paragraph indent 3" style:family="paragraph" style:parent-style-name="Standard">
+ <style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%%" fo:margin-left="3cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/>
+ </style:style>
+ <style:style style:name="P_indent_4" style:display-name="Paragraph indent 4" style:family="paragraph" style:parent-style-name="Standard">
+ <style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%%" fo:margin-left="4cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/>
+ </style:style>
+ <style:style style:name="P_indent_5" style:display-name="Paragraph indent 5" style:family="paragraph" style:parent-style-name="Standard">
+ <style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%%" fo:margin-left="5cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/>
+ </style:style>
+ <style:style style:name="P_indent_6" style:display-name="Paragraph indent 6" style:family="paragraph" style:parent-style-name="Standard">
+ <style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%%" fo:margin-left="6cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/>
+ </style:style>
+ <style:style style:name="P_indent_7" style:display-name="Paragraph indent 7" style:family="paragraph" style:parent-style-name="Standard">
+ <style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%%" fo:margin-left="7cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/>
+ </style:style>
+ <style:style style:name="P_indent_8" style:display-name="Paragraph indent 8" style:family="paragraph" style:parent-style-name="Standard">
+ <style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%%" fo:margin-left="8cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/>
+ </style:style>
+ <style:style style:name="P_indent_9" style:display-name="Paragraph indent 9" style:family="paragraph" style:parent-style-name="Standard">
+ <style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%%" fo:margin-left="9cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/>
+ </style:style>
+ <style:style style:name="P_h0_i0" style:display-name="Hang 0 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h0_i1" style:display-name="Hang 0 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="-1cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h0_i2" style:display-name="Hang 0 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="-2cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h0_i3" style:display-name="Hang 0 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="-3cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h0_i4" style:display-name="Hang 0 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="-4cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h0_i5" style:display-name="Hang 0 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="-5cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h0_i6" style:display-name="Hang 0 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="-6cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h0_i7" style:display-name="Hang 0 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="-7cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h0_i8" style:display-name="Hang 0 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="-8cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h0_i9" style:display-name="Hang 0 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="-9cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h1_i0" style:display-name="Hang 1 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="1cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h1_i1" style:display-name="Hang 1 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h1_i2" style:display-name="Hang 1 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="-1cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h1_i3" style:display-name="Hang 1 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="-2cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h1_i4" style:display-name="Hang 1 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="-3cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h1_i5" style:display-name="Hang 1 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="-4cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h1_i6" style:display-name="Hang 1 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="-5cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h1_i7" style:display-name="Hang 1 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="-6cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h1_i8" style:display-name="Hang 1 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="-7cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h1_i9" style:display-name="Hang 1 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="-8cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h2_i0" style:display-name="Hang 2 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="2cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h2_i1" style:display-name="Hang 2 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="1cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h2_i2" style:display-name="Hang 2 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h2_i3" style:display-name="Hang 2 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="-1cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h2_i4" style:display-name="Hang 2 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="-2cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h2_i5" style:display-name="Hang 2 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="-3cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h2_i6" style:display-name="Hang 2 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="-4cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h2_i7" style:display-name="Hang 2 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="-5cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h2_i8" style:display-name="Hang 2 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="-6cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h2_i9" style:display-name="Hang 2 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="-7cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h3_i0" style:display-name="Hang 3 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="3cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h3_i1" style:display-name="Hang 3 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="2cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h3_i2" style:display-name="Hang 3 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="1cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h3_i3" style:display-name="Hang 3 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h3_i4" style:display-name="Hang 3 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="-1cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h3_i5" style:display-name="Hang 3 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="-2cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h3_i6" style:display-name="Hang 3 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="-3cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h3_i7" style:display-name="Hang 3 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="-4cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h3_i8" style:display-name="Hang 3 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="-5cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h3_i9" style:display-name="Hang 3 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="-6cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h4_i0" style:display-name="Hang 4 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="4cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h4_i1" style:display-name="Hang 4 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="3cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h4_i2" style:display-name="Hang 4 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="2cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h4_i3" style:display-name="Hang 4 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="1cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h4_i4" style:display-name="Hang 4 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h4_i5" style:display-name="Hang 4 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="-1cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h4_i6" style:display-name="Hang 4 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="-2cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h4_i7" style:display-name="Hang 4 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="-3cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h4_i8" style:display-name="Hang 4 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="-4cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h4_i9" style:display-name="Hang 4 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="-5cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h5_i0" style:display-name="Hang 5 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="5cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h5_i1" style:display-name="Hang 5 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="4cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h5_i2" style:display-name="Hang 5 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="3cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h5_i3" style:display-name="Hang 5 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="2cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h5_i4" style:display-name="Hang 5 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="1cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h5_i5" style:display-name="Hang 5 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h5_i6" style:display-name="Hang 5 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="-1cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h5_i7" style:display-name="Hang 5 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="-2cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h5_i8" style:display-name="Hang 5 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="-3cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h5_i9" style:display-name="Hang 5 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="-4cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h6_i0" style:display-name="Hang 6 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="6cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h6_i1" style:display-name="Hang 6 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="5cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h6_i2" style:display-name="Hang 6 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="4cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h6_i3" style:display-name="Hang 6 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="3cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h6_i4" style:display-name="Hang 6 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="2cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h6_i5" style:display-name="Hang 6 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="1cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h6_i6" style:display-name="Hang 6 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h6_i7" style:display-name="Hang 6 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="-1cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h6_i8" style:display-name="Hang 6 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="-2cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h6_i9" style:display-name="Hang 6 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="-3cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h7_i0" style:display-name="Hang 7 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="7cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h7_i1" style:display-name="Hang 7 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="6cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h7_i2" style:display-name="Hang 7 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="5cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h7_i3" style:display-name="Hang 7 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="4cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h7_i4" style:display-name="Hang 7 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="3cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h7_i5" style:display-name="Hang 7 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="2cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h7_i6" style:display-name="Hang 7 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="1cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h7_i7" style:display-name="Hang 7 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h7_i8" style:display-name="Hang 7 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="-1cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h7_i9" style:display-name="Hang 7 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="-2cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h8_i0" style:display-name="Hang 8 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="8cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h8_i1" style:display-name="Hang 8 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="7cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h8_i2" style:display-name="Hang 8 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="6cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h8_i3" style:display-name="Hang 8 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="5cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h8_i4" style:display-name="Hang 8 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="4cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h8_i5" style:display-name="Hang 8 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="3cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h8_i6" style:display-name="Hang 8 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="2cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h8_i7" style:display-name="Hang 8 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="1cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h8_i8" style:display-name="Hang 8 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h8_i9" style:display-name="Hang 8 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="-1cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h9_i0" style:display-name="Hang 9 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="9cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h9_i1" style:display-name="Hang 9 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="8cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h9_i2" style:display-name="Hang 9 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="7cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h9_i3" style:display-name="Hang 9 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="6cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h9_i4" style:display-name="Hang 9 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="5cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h9_i5" style:display-name="Hang 9 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="4cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h9_i6" style:display-name="Hang 9 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="3cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h9_i7" style:display-name="Hang 9 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="2cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h9_i8" style:display-name="Hang 9 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="1cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="P_h9_i9" style:display-name="Hang 9 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false">
+ <style:tab-stops>
+ <style:tab-stop style:position="0cm"/>
+ </style:tab-stops>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="Span_bold" style:family="text">
+ <style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold"/>
+ </style:style>
+ <style:style style:name="Span_italic" style:family="text">
+ <style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic"/>
+ </style:style>
+ <style:style style:name="Span_underscore" style:family="text">
+ <style:text-properties style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color"/>
+ </style:style>
+ <style:style style:name="Span_superscript" style:family="text">
+ <style:text-properties style:text-position="super 58%%"/>
+ </style:style>
+ <style:style style:name="Span_subscript" style:family="text">
+ <style:text-properties style:text-position="sub 58%%"/>
+ </style:style>
+ <style:style style:name="Span_monospace" style:family="text">
+ <style:text-properties style:font-name="DejaVu Sans Mono" fo:font-size="10pt" fo:font-weight="normal" fo:background-color="#e6e6e6"/>
+ </style:style>
+ <style:style style:name="Heading" style:family="paragraph" style:next-style-name="Text_body" style:class="text">
+ <style:paragraph-properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" fo:keep-with-next="always"/>
+ <style:text-properties style:font-name="Bitstream Vera Sans" fo:font-size="14pt" style:font-size-asian="14pt" style:font-name-complex="Tahoma" style:font-size-complex="14pt"/>
+ </style:style>
+ <style:style style:name="H_1" style:display-name="Heading 1" style:family="paragraph" style:next-style-name="Text_body" style:default-outline-level="1" style:class="text">
+ <style:text-properties fo:font-size="120%%" fo:font-weight="bold" style:font-size-asian="120%%" style:font-weight-asian="bold" style:font-size-complex="115%%" style:font-weight-complex="bold"/>
+ </style:style>
+ <style:style style:name="H_2" style:display-name="Heading 2" style:family="paragraph" style:next-style-name="Text_body" style:default-outline-level="2" style:class="text">
+ <style:text-properties fo:font-size="115%%" fo:font-weight="bold" style:font-size-asian="115%%" style:font-weight-asian="bold" style:font-size-complex="115%%" style:font-weight-complex="bold"/>
+ </style:style>
+ <style:style style:name="H_3" style:display-name="Heading 3" style:family="paragraph" style:next-style-name="Text_body" style:default-outline-level="3" style:class="text">
+ <style:text-properties fo:font-size="110%%" fo:font-weight="bold" style:font-size-asian="110%%" style:font-weight-asian="bold" style:font-size-complex="115%%" style:font-weight-complex="bold"/>
+ </style:style>
+ <style:style style:name="H_4" style:display-name="Heading 4" style:family="paragraph" style:next-style-name="Text_body" style:default-outline-level="4" style:class="text">
+ <style:text-properties fo:font-size="12pt" fo:font-style="italic" fo:font-weight="bold" style:font-size-asian="12pt" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-size-complex="12pt" style:font-style-complex="italic" style:font-weight-complex="bold"/>
+ </style:style>
+ <style:style style:name="H_5" style:display-name="Heading 5" style:family="paragraph" style:next-style-name="Text_body" style:default-outline-level="5" style:class="text">
+ <style:text-properties fo:font-size="90%%" fo:font-style="italic" fo:font-weight="bold" style:font-size-asian="90%%" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-size-complex="90%%" style:font-style-complex="italic" style:font-weight-complex="bold"/>
+ </style:style>
+ <style:style style:name="H_6" style:display-name="Heading 6" style:family="paragraph" style:next-style-name="Text_body" style:default-outline-level="6" style:class="text">
+ <style:text-properties fo:font-size="80%%" fo:font-style="italic" fo:font-weight="bold" style:font-size-asian="80%%" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-size-complex="80%%" style:font-style-complex="italic" style:font-weight-complex="bold"/>
+ </style:style>
+ <style:style style:name="P_group" style:family="paragraph" style:parent-style-name="Standard">
+ <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm" fo:line-height="100%%" fo:text-align="justify" style:justify-single-word="false"/>
+ </style:style>
+ <style:style style:name="P_code" style:family="paragraph" style:parent-style-name="Standard">
+ <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm" fo:line-height="100%%" fo:text-align="start" style:justify-single-word="false"/>
+ <style:text-properties style:font-name="DejaVu Sans Mono" fo:font-size="9pt" fo:font-weight="normal" fo:background-color="#e6e6e6"/>
+ </style:style>
+ <style:style style:name="Footnote" style:family="paragraph" style:class="extra">
+ <style:paragraph-properties fo:margin-left="0.499cm" fo:margin-right="0cm" fo:text-indent="-0.499cm" style:auto-text-indent="false" text:number-lines="false" text:line-number="0"/>
+ <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>
+ </style:style>
+ <style:style style:name="Table_Contents" style:display-name="Table Contents" style:family="paragraph" style:parent-style-name="Standard" style:class="extra">
+ <style:paragraph-properties text:number-lines="false" text:line-number="0"/>
+ </style:style>
+ <style:style style:name="Footnote_symbol" style:display-name="Footnote Symbol" style:family="text"/>
+ <style:style style:name="Footnote_anchor" style:display-name="Footnote Anchor" style:family="text">
+ <style:text-properties style:text-position="super 58%%"/>
+ </style:style>
+ <style:style style:name="Internet_link" style:display-name="Internet link" style:family="text">
+ <style:text-properties fo:color="#000080" fo:language="zxx" fo:country="none" style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color" style:language-asian="zxx" style:country-asian="none" style:language-complex="zxx" style:country-complex="none"/>
+ </style:style>
+ <style:style style:name="Graphics" style:family="graphic">
+ <style:graphic-properties text:anchor-type="paragraph" svg:x="0cm" svg:y="0cm" style:wrap="dynamic" style:number-wrapped-paragraphs="no-limit" style:wrap-contour="false" style:vertical-pos="top" style:vertical-rel="paragraph" style:horizontal-pos="center" style:horizontal-rel="paragraph"/>
+ </style:style>
+ <text:outline-style style:name="Outline">
+ <text:outline-level-style text:level="1" style:num-format="">
+ <style:list-level-properties text:min-label-distance="0.381cm"/>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="2" style:num-format="">
+ <style:list-level-properties text:min-label-distance="0.381cm"/>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="3" style:num-format="">
+ <style:list-level-properties text:min-label-distance="0.381cm"/>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="4" style:num-format="">
+ <style:list-level-properties text:min-label-distance="0.381cm"/>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="5" style:num-format="">
+ <style:list-level-properties text:min-label-distance="0.381cm"/>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="6" style:num-format="">
+ <style:list-level-properties text:min-label-distance="0.381cm"/>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="7" style:num-format="">
+ <style:list-level-properties text:min-label-distance="0.381cm"/>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="8" style:num-format="">
+ <style:list-level-properties text:min-label-distance="0.381cm"/>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="9" style:num-format="">
+ <style:list-level-properties text:min-label-distance="0.381cm"/>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="10" style:num-format="">
+ <style:list-level-properties text:min-label-distance="0.381cm"/>
+ </text:outline-level-style>
+ </text:outline-style>
+ <text:notes-configuration text:note-class="footnote" text:citation-style-name="Footnote_symbol" text:citation-body-style-name="Footnote_anchor" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/>
+ <text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0"/>
+ <text:linenumbering-configuration text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5"/>
+ <style:style style:name="fr1" style:family="graphic" style:parent-style-name="Graphics">
+ <style:graphic-properties style:wrap="none" style:horizontal-pos="left" style:horizontal-rel="paragraph" style:mirror="none" fo:clip="rect(0cm 0cm 0cm 0cm)" draw:luminance="0%%" draw:contrast="0%%" draw:red="0%%" draw:green="0%%" draw:blue="0%%" draw:gamma="100%%" draw:color-inversion="false" draw:image-opacity="100%%" draw:color-mode="standard"/>
+ </style:style>
+ <style:style style:name="gr1" style:family="graphic">
+ <style:graphic-properties draw:stroke="none" draw:fill="none" draw:textarea-horizontal-align="center" draw:textarea-vertical-align="middle" draw:color-mode="standard" draw:luminance="0%%" draw:contrast="0%%" draw:gamma="100%%" draw:red="0%%" draw:green="0%%" draw:blue="0%%" fo:clip="rect(0cm 0cm 0cm 0cm)" draw:image-opacity="100%%" style:mirror="none" style:run-through="background" style:wrap="none" style:vertical-pos="top" style:vertical-rel="baseline" style:horizontal-pos="left" style:horizontal-rel="paragraph" draw:wrap-influence-on-position="once-concurrent" style:flow-with-text="false"/>
+ </style:style>
+ <style:style style:name="gr2" style:family="graphic">
+ <style:graphic-properties draw:stroke="none" draw:fill="none" draw:textarea-horizontal-align="center" draw:textarea-vertical-align="middle" draw:color-mode="standard" draw:luminance="0%%" draw:contrast="0%%" draw:gamma="100%%" draw:red="0%%" draw:green="0%%" draw:blue="0%%" fo:clip="rect(0cm 0cm 0cm 0cm)" draw:image-opacity="100%%" style:mirror="none" style:run-through="background" style:wrap="none" style:vertical-pos="middle" style:vertical-rel="baseline" style:horizontal-pos="left" style:horizontal-rel="paragraph" draw:wrap-influence-on-position="once-concurrent" style:flow-with-text="false"/>
+ </style:style>
+ </office:styles>
+ <office:automatic-styles>
+ <style:page-layout style:name="Mpm1">
+ <style:page-layout-properties fo:page-width="20.999cm" fo:page-height="29.699cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm">
+ <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="none" style:adjustment="left" style:rel-width="25%%" style:color="#000000"/>
+ </style:page-layout-properties>
+ <style:header-style/>
+ <style:footer-style/>
+ </style:page-layout>
+ </office:automatic-styles>
+ <office:master-styles>
+ <style:master-page style:name="Standard" style:page-layout-name="Mpm1"/>
+ </office:master-styles>
+ </office:document-styles>
+ ┃");
+ return _styles_xml;
+ }
+ @trusted void writeOutputODT(W,I)(
+ const W odt_content,
+ I doc_matters,
+ ) {
+ auto pth_odt = spinePathsODT!()(doc_matters);
+ auto fn_odt = pth_odt.odt_file;
+ auto zip = new ZipArchive(); // ZipArchive zip = new ZipArchive();
+ void ODTzip()(string contents, string fn) {
+ auto zip_arc_member_file = new ArchiveMember();
+ zip_arc_member_file.name = fn;
+ auto zip_data = new OutBuffer();
+ (doc_matters.opt.action.debug_do)
+ ? zip_data.write(contents.dup)
+ : zip_data.write(contents.dup
+ .replaceAll(rgx.spaces_line_start, "")
+ .replaceAll(rgx.newline, "")
+ .strip
+ );
+ zip_arc_member_file.expandedData = zip_data.toBytes();
+ zip.addMember(zip_arc_member_file);
+ createZipFile!()(fn_odt, zip.build());
+ }
+ try {
+ if (!exists(pth_odt.base_pth)) { // check
+ pth_odt.base_pth.mkdirRecurse;
+ }
+ {
+ string fn;
+ File f;
+ { fn = pth_odt.mimetype("zip");
+ ODTzip(odt_content.mimetype, fn);
+ }
+ { fn = pth_odt.manifest_rdf("zip");
+ ODTzip(odt_content.manifest_rdf, fn);
+ }
+ { fn = pth_odt.settings_xml("zip");
+ ODTzip(odt_content.settings_xml, fn);
+ }
+ { fn = pth_odt.styles_xml("zip");
+ ODTzip(odt_content.styles_xml, fn);
+ }
+ { fn = pth_odt.content_xml("zip");
+ ODTzip(odt_content.content_xml, fn);
+ }
+ { fn = pth_odt.manifest_xml("zip");
+ ODTzip(odt_content.manifest_xml, fn);
+ }
+ { fn = pth_odt.meta_xml("zip");
+ ODTzip(odt_content.meta_xml, fn);
+ }
+ { /+ (images) +/
+ foreach (image; doc_matters.srcs.image_list) {
+ auto fn_src = doc_matters.src.image_dir_path ~ "/" ~ image;
+ auto fn_out = pth_odt.image_dir("zip") ~ "/" ~ image;
+ if (exists(fn_src)) {
+ {
+ auto zip_arc_member_file = new ArchiveMember();
+ zip_arc_member_file.name = fn_out;
+ auto zip_data = new OutBuffer();
+ zip_data.write(cast(char[]) ((fn_src).read)); // trusted?
+ zip_arc_member_file.expandedData = zip_data.toBytes();
+ zip.addMember(zip_arc_member_file);
+ createZipFile!()(fn_odt, zip.build());
+ }
+ }
+ }
+ }
+ if (doc_matters.opt.action.vox_gt0) {
+ writeln(" ", pth_odt.odt_file);
+ }
+ }
+ if (!exists(pth_odt.base_pth ~ "/index.html")) {
+ import sisudoc.io_out.html_snippet;
+ mixin htmlSnippet;
+ auto f = File(pth_odt.base_pth ~"/index.html", "w");
+ f.writeln(format_html_blank_page_guide_home(
+ "../../css/html_scroll.css",
+ (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,
+ "../../index.html",
+ ));
+ }
+ } catch (ErrnoException ex) {
+ // Handle error
+ }
+ if (doc_matters.opt.action.debug_do) {
+ pth_odt.mimetype("fs"); /+ (mimetype) +/
+ pth_odt.manifest_rdf("fs"); /+ (manifest.rdf) +/
+ pth_odt.settings_xml("fs"); /+ (settings.xml) +/
+ pth_odt.styles_xml("fs"); /+ (styles_xml) +/
+
+ pth_odt.content_xml("fs");
+ pth_odt.manifest_xml("fs");
+ pth_odt.meta_xml("fs");
+ }
+ }
+ void outputODT(D,I)(
+ const D doc_abstraction,
+ I doc_matters,
+ ) {
+ struct ODT {
+ /+ fixed output +/
+ string mimetype;
+ string manifest_rdf;
+ string settings_xml;
+ string styles_xml;
+ /+ variable output +/
+ string content_xml; // substantive content
+ string manifest_xml; // image list changes
+ string meta_xml; // time stamp
+ }
+ // auto pth_odt = spinePathsODT!()(doc_matters);
+ auto odt = ODT();
+ odt.mimetype = mimetype;
+ odt.manifest_rdf = manifest_rdf;
+ odt.settings_xml = settings_xml;
+ odt.styles_xml = styles_xml;
+ odt.content_xml = content_xml(doc_abstraction, doc_matters);
+ odt.manifest_xml = manifest_xml(doc_matters);
+ odt.meta_xml = meta_xml(doc_matters);
+ odt.writeOutputODT(doc_matters);
+ dirtree(doc_matters);
+ images_cp(doc_matters); // copy images
+ }
+}
diff --git a/src/sisudoc/io_out/package.d b/src/sisudoc/io_out/package.d
new file mode 100644
index 0000000..5c73cb9
--- /dev/null
+++ b/src/sisudoc/io_out/package.d
@@ -0,0 +1,69 @@
+/+
+- Name: SisuDoc 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 sisudoc.io_out;
+public import
+ std.algorithm,
+ std.array,
+ std.container,
+ std.exception,
+ std.path,
+ std.process,
+ std.range,
+ std.regex,
+ std.stdio,
+ std.string,
+ std.typecons,
+ // std.uni,
+ std.utf;
+public import
+ sisudoc.share.defaults,
+ sisudoc.io_in.paths_source,
+ sisudoc.io_out.defaults,
+ sisudoc.io_out.paths_output;
diff --git a/src/sisudoc/io_out/paths_output.d b/src/sisudoc/io_out/paths_output.d
new file mode 100644
index 0000000..f134f41
--- /dev/null
+++ b/src/sisudoc/io_out/paths_output.d
@@ -0,0 +1,672 @@
+/+
+- Name: SisuDoc 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/]
+
++/
+/++
+ default settings
++/
+module sisudoc.io_out.paths_output;
+@safe:
+import
+ std.array,
+ std.path,
+ std.regex,
+ std.stdio;
+import
+ sisudoc.meta.rgx_files;
+template spineOutPaths() {
+ auto spineOutPaths()(
+ string output_pth_root,
+ string lng = "",
+ ) {
+ struct _PathsStruct {
+ string output_root() {
+ return (output_pth_root.length > 0)
+ ? output_pth_root : "";
+ }
+ string output_base() {
+ return ((output_root.chainPath(lng)).asNormalizedPath).array;
+ }
+ string internal_base() {
+ return lng.asNormalizedPath.array;
+ }
+ }
+ return _PathsStruct();
+ }
+}
+template spineOutPathSQLite() {
+ auto spineOutPathSQLite(Po)(
+ Po output_pth_root,
+ ) {
+ struct _PathsStruct {
+ string output_root() {
+ return (output_pth_root.length > 0)
+ ? output_pth_root : "";
+ }
+ string output_base() {
+ return ((output_root).asNormalizedPath).array;
+ }
+ }
+ return _PathsStruct();
+ }
+}
+template spineOutPathSQLiteCGI() {
+ auto spineOutPathSQLiteCGI(Po)(
+ Po output_pth_root,
+ ) {
+ struct _PathsStruct {
+ string output_root() {
+ return (output_pth_root.length > 0)
+ ? output_pth_root : "";
+ }
+ string output_base() {
+ return ((output_root).asNormalizedPath).array;
+ }
+ }
+ return _PathsStruct();
+ }
+}
+template spineOutPathsFnPd() {
+ /+ TODO stuff to work out here +/
+ auto spineOutPathsFnPd(Fn,Pn)(
+ Fn fn_src_pth,
+ Pn pod_name_with_path
+ ) {
+ struct _PathsStruct {
+ string base_filename() {
+ return fn_src_pth.baseName.stripExtension;
+ }
+ string base_pod_and_filename() { // TODO
+ /+
+ - if pod,
+ - pod_name
+ - file_name
+ - if pod_name == file_name
+ - file_name
+ - else if pod_name != file_name
+ - pod_name.file_name
+ +/
+ string _fn_src = fn_src_pth.baseName.stripExtension;
+ string _output_base_name;
+ if (!(pod_name_with_path.empty)) {
+ if (pod_name_with_path == _fn_src) {
+ _output_base_name = _fn_src;
+ } else {
+ _output_base_name = pod_name_with_path ~ "." ~ _fn_src;
+ }
+ } else {
+ _output_base_name = _fn_src;
+ }
+ return _output_base_name;
+ }
+ }
+ return _PathsStruct();
+ }
+}
+
+template spineDocRootTreeHTML() {
+ auto spineDocRootTreeHTML()(string lng) {
+ auto lng_pth = spineOutPaths!()("", lng);
+ string base_dir = "html";
+ string suffix = ".html";
+ struct _PathsStruct {
+ string base_filename(string fn_src) {
+ return fn_src.baseName.stripExtension;
+ }
+ string base_filename_scroll(string fn_src) {
+ return base_filename(fn_src);
+ }
+ string base_filename_seg(string fn_src) {
+ return base_filename(fn_src);
+ }
+ string doc_root() {
+ return ((lng_pth.output_root).asNormalizedPath).array;
+ }
+ string base() {
+ return (((lng).chainPath(base_dir)).asNormalizedPath).array;
+ }
+ string image() {
+ return (("image").asNormalizedPath).array;
+ }
+ string css() {
+ return (("css").asNormalizedPath).array;
+ }
+ string fn_seg_css() {
+ return ((css.chainPath("html_seg.css")).asNormalizedPath).array;
+ }
+ string fn_scroll_css() {
+ return ((css.chainPath("html_scroll.css")).asNormalizedPath).array;
+ }
+ string seg(string fn_src) {
+ return ((base.chainPath(base_filename_seg(fn_src))).asNormalizedPath).array;
+ }
+ string fn_metadata(string fn_src) {
+ return ((base.chainPath("metadata." ~ base_filename_scroll(fn_src) ~ suffix)).asNormalizedPath).array;
+ }
+ string fn_scroll(string fn_src) {
+ return ((base.chainPath(base_filename_scroll(fn_src) ~ suffix)).asNormalizedPath).array;
+ }
+ string fn_seg(string fn_src, string seg_filename) {
+ return ((seg(fn_src).chainPath(seg_filename ~ suffix)).asNormalizedPath).array;
+ }
+ string tail_seg(string fn_src) {
+ return lng ~ "/html/" ~ base_filename_seg(fn_src);
+ }
+ string tail_fn_scroll(string fn_src) {
+ return lng ~ "/html/" ~ base_filename_scroll(fn_src) ~ suffix;
+ }
+ string tail_fn_seg(string fn_src, string seg_filename) {
+ return lng ~ "/html/" ~ seg(fn_src) ~ "/" ~ seg_filename ~ suffix;
+ }
+ }
+ return _PathsStruct();
+ }
+}
+template spinePathsHTML() {
+ auto spinePathsHTML()(
+ string output_path_root,
+ string lng,
+ ) {
+ auto doc_tree = spineDocRootTreeHTML!()(lng);
+ string base_dir = "html";
+ string suffix = ".html";
+ struct _PathsStruct {
+ string doc_root() {
+ return ((output_path_root.chainPath(doc_tree.doc_root)).asNormalizedPath).array;
+ }
+ string curate(string fn_curate) {
+ return doc_root ~ "/" ~ fn_curate;
+ }
+ string internal_base() {
+ return ((doc_tree.base).asNormalizedPath).array;
+ }
+ string base() {
+ return ((output_path_root.chainPath(doc_tree.base)).asNormalizedPath).array;
+ }
+ string image() {
+ return ((output_path_root.chainPath(doc_tree.image)).asNormalizedPath).array;
+ }
+ string css() {
+ return ((output_path_root.chainPath(doc_tree.css)).asNormalizedPath).array;
+ }
+ string fn_seg_css() {
+ return ((output_path_root.chainPath(doc_tree.fn_seg_css)).asNormalizedPath).array;
+ }
+ string fn_scroll_css() {
+ return ((output_path_root.chainPath(doc_tree.fn_scroll_css)).asNormalizedPath).array;
+ }
+ string seg(string fn_src) {
+ return ((output_path_root.chainPath(doc_tree.seg(fn_src))).asNormalizedPath).array;
+ }
+ string fn_metadata(string fn_src) {
+ return ((output_path_root.chainPath(doc_tree.fn_metadata(fn_src))).asNormalizedPath).array;
+ }
+ string fn_scroll(string fn_src) {
+ return ((output_path_root.chainPath(doc_tree.fn_scroll(fn_src))).asNormalizedPath).array;
+ }
+ string fn_seg(string fn_src, string seg_filename) {
+ return ((output_path_root.chainPath(doc_tree.fn_seg(fn_src, seg_filename))).asNormalizedPath).array;
+ }
+ string tail_seg(string fn_src) {
+ return doc_tree.tail_seg(fn_src);
+ }
+ string tail_fn_scroll(string fn_src) {
+ return doc_tree.tail_fn_scroll(fn_src);
+ }
+ string tail_fn_seg(string fn_src, string seg_filename) {
+ return doc_tree.tail_fn_seg(fn_src, seg_filename);
+ }
+ }
+ return _PathsStruct();
+ }
+}
+template spineUrlsHTML() {
+ import std.format;
+ auto spineUrlsHTML()(
+ string url_doc_root,
+ string lng,
+ ) {
+ auto doc_tree = spineDocRootTreeHTML!()(lng);
+ string base_dir = "html";
+ string suffix = ".html";
+ struct _PathsStruct {
+ string doc_root() {
+ return url_doc_root ~ ((doc_tree.doc_root).asNormalizedPath).array;
+ }
+ string curate(string fn_curate) {
+ return format(q"┃%s/%s┃",
+ doc_root,
+ fn_curate,
+ );
+ }
+ string base() {
+ return format(q"┃%s/%s┃",
+ url_doc_root,
+ ((doc_tree.base).asNormalizedPath).array,
+ );
+ }
+ string image() {
+ return format(q"┃%s/%s┃",
+ url_doc_root,
+ ((doc_tree.image).asNormalizedPath).array,
+ );
+ }
+ string css() {
+ return format(q"┃%s/%s┃",
+ url_doc_root,
+ ((doc_tree.css).asNormalizedPath).array,
+ );
+ }
+ string fn_seg_css() {
+ return format(q"┃%s/%s┃",
+ url_doc_root,
+ ((doc_tree.fn_seg_css).asNormalizedPath).array,
+ );
+ }
+ string fn_scroll_css() {
+ return format(q"┃%s/%s┃",
+ url_doc_root,
+ ((doc_tree.fn_scroll_css).asNormalizedPath).array,
+ );
+ }
+ string seg(string fn_src) {
+ return format(q"┃%s/%s┃",
+ url_doc_root,
+ ((doc_tree.seg(fn_src)).asNormalizedPath).array,
+ );
+ }
+ string fn_metadata(string fn_src) {
+ return format(q"┃%s/%s┃",
+ url_doc_root,
+ ((doc_tree.fn_metadata(fn_src)).asNormalizedPath).array,
+ );
+ }
+ string fn_scroll(string fn_src) {
+ return format(q"┃%s/%s┃",
+ url_doc_root,
+ ((doc_tree.fn_scroll(fn_src)).asNormalizedPath).array,
+ );
+ }
+ string fn_seg(string fn_src, string seg_filename) {
+ return format(q"┃%s/%s┃",
+ url_doc_root,
+ ((doc_tree.fn_seg(fn_src, seg_filename)).asNormalizedPath).array,
+ );
+ }
+ string fn_scroll_obj_num(string fn_src, string obj_num) {
+ return format(q"┃%s/%s#%s┃",
+ url_doc_root,
+ ((doc_tree.fn_scroll(fn_src)).asNormalizedPath).array,
+ obj_num,
+ );
+ }
+ string fn_seg_obj_num(string fn_src, string seg_filename, string obj_num) {
+ return format(q"┃%s/%s#%s┃",
+ url_doc_root,
+ ((doc_tree.fn_seg(fn_src, seg_filename)).asNormalizedPath).array,
+ obj_num,
+ );
+ }
+ string tail_seg(string fn_src) {
+ return doc_tree.tail_seg(fn_src);
+ }
+ string tail_fn_scroll(string fn_src) {
+ return doc_tree.tail_fn_scroll(fn_src);
+ }
+ string tail_fn_seg(string fn_src, string seg_filename) {
+ return doc_tree.tail_fn_seg(fn_src, seg_filename);
+ }
+ }
+ return _PathsStruct();
+ }
+}
+template spinePathsEPUB() {
+ auto spinePathsEPUB()(
+ string output_pth_root,
+ string lng,
+ ) {
+ auto out_pth = spineOutPaths!()(output_pth_root, lng);
+ string base_dir = "epub";
+ struct _PathsStruct {
+ string internal_base() {
+ return (((out_pth.internal_base).chainPath(base_dir)).asNormalizedPath).array;
+ }
+ string base() {
+ return (((out_pth.output_base).chainPath(base_dir)).asNormalizedPath).array;
+ }
+ string base_filename(string fn_src) {
+ return fn_src.baseName.stripExtension;
+ }
+ string base_filename_epub(string fn_src) {
+ return base_filename(fn_src) ~ "." ~ lng;
+ }
+ string doc_meta_inf() {
+ return (("META-INF").asNormalizedPath).array;
+ }
+ string doc_oebps() {
+ return (("OEBPS").asNormalizedPath).array;
+ }
+ string doc_oebps_css() {
+ return ((doc_oebps.chainPath("Styles")).asNormalizedPath).array;
+ }
+ string doc_oebps_image() {
+ return ((doc_oebps.chainPath("image")).asNormalizedPath).array;
+ }
+ string epub_file(string fn_src) {
+ return ((base.chainPath(base_filename_epub(fn_src) ~ ".epub")).asNormalizedPath).array;
+ }
+ string dirtop() {
+ return "".chainPath("").array;
+ }
+ string fn_mimetypes() {
+ return ((dirtop.chainPath("mimetype")).asNormalizedPath).array;
+ }
+ string fn_dmi_container_xml() {
+ return ((doc_meta_inf.chainPath("container.xml")).asNormalizedPath).array;
+ }
+ string fn_oebps_toc_nav_xhtml() {
+ return ((doc_oebps.chainPath("toc_nav.xhtml")).asNormalizedPath).array;
+ }
+ string fn_oebps_toc_ncx() {
+ return ((doc_oebps.chainPath("toc.ncx")).asNormalizedPath).array;
+ }
+ string fn_oebps_content_opf() {
+ return ((doc_oebps.chainPath("content.opf")).asNormalizedPath).array;
+ }
+ string fn_oebps_content_xhtml(string seg_filename) {
+ return ((doc_oebps.chainPath(seg_filename ~ ".xhtml")).asNormalizedPath).array;
+ }
+ string fn_oebps_css() {
+ return ((doc_oebps_css.chainPath("epub.css")).asNormalizedPath).array;
+ }
+ /+ debug +/
+ string dbg_docdir(string fn_src) {
+ return base.chainPath(base_filename(fn_src)).array;
+ }
+ string dbg_docdir_oebps(string fn_src) {
+ return dbg_docdir(fn_src).chainPath("OEBPS").array;
+ }
+ string dbg_doc_meta_inf(string fn_src) {
+ return dbg_docdir(fn_src).chainPath("META-INF").array;
+ }
+ string dbg_doc_oebps(string fn_src) {
+ return dbg_docdir(fn_src).chainPath("OEBPS").array;
+ }
+ string dbg_doc_oebps_css(string fn_src) {
+ return dbg_doc_oebps(fn_src).chainPath("Styles").array;
+ }
+ string dbg_doc_oebps_image(string fn_src) {
+ return dbg_doc_oebps(fn_src).chainPath("image").array;
+ }
+ string dbg_fn_mimetypes(string fn_src) {
+ return dbg_docdir(fn_src).chainPath("mimetype").array;
+ }
+ string dbg_fn_dmi_container_xml(string fn_src) {
+ return dbg_doc_meta_inf(fn_src).chainPath("container.xml").array;
+ }
+ string dbg_fn_oebps_toc_nav_xhtml(string fn_src) {
+ return dbg_docdir_oebps(fn_src).chainPath("toc_nav.xhtml").array;
+ }
+ string dbg_fn_oebps_toc_ncx(string fn_src) {
+ return dbg_docdir_oebps(fn_src).chainPath("toc.ncx").array;
+ }
+ string dbg_fn_oebps_content_opf(string fn_src) {
+ return dbg_docdir_oebps(fn_src).chainPath("content.opf").array;
+ }
+ string dbg_fn_oebps_content_xhtml(string fn_src, string seg_filename) {
+ return dbg_docdir_oebps(fn_src).chainPath(seg_filename ~ ".xhtml").array;
+ }
+ string dbg_fn_oebps_css(string fn_src) {
+ return dbg_doc_oebps_css(fn_src).chainPath("epub.css").array;
+ }
+ }
+ return _PathsStruct();
+ }
+}
+template spinePathsODT() {
+ import std.conv;
+ auto spinePathsODT(M)(
+ M doc_matters,
+ ) {
+ auto out_pth = spineOutPaths!()( doc_matters.output_path, doc_matters.src.language);
+ string base_dir = "odf";
+ struct _PathsStruct {
+ string base_pth() { // dir will contain odt document file (also debug file tree)
+ return (((out_pth.output_base).chainPath(base_dir)).asNormalizedPath).array;
+ }
+ string odt_file() {
+ return ((base_pth.chainPath(doc_matters.src.doc_uid_out ~ ".odt")).asNormalizedPath).array;
+ }
+ string dirtop(string type) {
+ return (type == "zip")
+ ? "" // ".chainPath("").array
+ : ((base_pth.chainPath(doc_matters.src.doc_uid_out)).asNormalizedPath).array.to!string;
+ }
+ string mimetype(string type="fs") {
+ assert(type == "zip" || "fs");
+ return ((dirtop(type).chainPath("mimetype")).asNormalizedPath).array;
+ }
+ string manifest_rdf(string type="fs") {
+ assert(type == "zip" || "fs");
+ return ((dirtop(type).chainPath("manifest.rdf")).asNormalizedPath).array;
+ }
+ string settings_xml(string type="fs") {
+ assert(type == "zip" || "fs");
+ return ((dirtop(type).chainPath("settings.xml")).asNormalizedPath).array;
+ }
+ string styles_xml(string type="fs") {
+ assert(type == "zip" || "fs");
+ return ((dirtop(type).chainPath("styles.xml")).asNormalizedPath).array;
+ }
+ string image_dir(string type="fs") {
+ assert(type == "zip" || "fs");
+ return ((dirtop(type).chainPath("Pictures")).asNormalizedPath).array;
+ }
+ string image(string image_fn_src, string type="fs") {
+ assert(type == "zip" || "fs");
+ return ((image_dir(type).chainPath(image_fn_src)).asNormalizedPath).array;
+ }
+ string content_xml(string type="fs") {
+ assert(type == "zip" || "fs");
+ return ((dirtop(type).chainPath("content.xml")).asNormalizedPath).array;
+ }
+ string meta_inf_dir(string type="fs") {
+ assert(type == "zip" || "fs");
+ return ((dirtop(type).chainPath("META-INF")).asNormalizedPath).array;
+ }
+ string manifest_xml(string type="fs") {
+ assert(type == "zip" || "fs");
+ return ((meta_inf_dir(type).chainPath("manifest.xml")).asNormalizedPath).array;
+ }
+ string meta_xml(string type="fs") {
+ assert(type == "zip" || "fs");
+ return ((dirtop(type).chainPath("meta.xml")).asNormalizedPath).array;
+ }
+ }
+ return _PathsStruct();
+ }
+}
+template spinePathsPDF() {
+ auto spinePathsPDF(M)(
+ M doc_matters,
+ ) {
+ struct _PathsStruct {
+ string base_filename(string fn_src) {
+ return fn_src.baseName.stripExtension;
+ }
+ auto out_pth() {
+ string output_dir = doc_matters.output_path ~ "/pdf";
+ return spineOutPaths!()(output_dir);
+ }
+ string base() {
+ return (((out_pth.output_root).chainPath("pdf")).asNormalizedPath).array;
+ }
+ string pdf_path_stuff() {
+ return ((base.chainPath(base_filename(doc_matters.src.filename))).asNormalizedPath).array;
+ }
+ }
+ return _PathsStruct();
+ }
+}
+template spinePathsLaTeX() {
+ auto spinePathsLaTeX(M)(
+ M doc_matters,
+ ) {
+ struct _PathsStruct {
+ string base_filename(string fn_src) {
+ return fn_src.baseName.stripExtension;
+ }
+ auto out_pth() {
+ return spineOutPaths!()(doc_matters.output_path, doc_matters.src.language);
+ }
+ string base() {
+ return (((out_pth.output_root).chainPath("latex")).asNormalizedPath).array;
+ }
+ string base_sty() {
+ return (((out_pth.output_root).chainPath("latex").chainPath("sty")).asNormalizedPath).array;
+ }
+ string latex_path_stuff() {
+ return ((base.chainPath(base_filename(doc_matters.src.filename))).asNormalizedPath).array;
+ }
+ string latex_file_with_path(string paper_size_orientation) {
+ return ((base.chainPath(base_filename(doc_matters.src.filename)
+ ~ "." ~ doc_matters.src.language
+ ~ "." ~ paper_size_orientation
+ ~ ".tex")
+ ).asNormalizedPath).array;
+ }
+ string latex_sty_with_path(string paper_size_orientation) { // spineA4portrait.sty
+ return ((base_sty.chainPath("spine"
+ ~ paper_size_orientation
+ ~ ".sty")
+ ).asNormalizedPath).array;
+ }
+ string latex_sty_with_path_static() { // spineShared.sty
+ return ((base_sty.chainPath("spineShared.sty")).asNormalizedPath).array;
+ }
+ string images() {
+ string image_dir = "image";
+ return (((base).chainPath(image_dir)).asNormalizedPath).array;
+ }
+ }
+ return _PathsStruct();
+ }
+}
+template spinePathsLaTeXsty() {
+ auto spinePathsLaTeXsty(string output_dir) {
+ struct _PathsStruct {
+ auto out_pth() {
+ return spineOutPaths!()(output_dir);
+ }
+ string base() {
+ return (((out_pth.output_root).chainPath("latex")).asNormalizedPath).array;
+ }
+ string base_sty() {
+ return (((out_pth.output_root).chainPath("latex").chainPath("sty")).asNormalizedPath).array;
+ }
+ string latex_sty_with_path(string paper_size_orientation) { // spineA4portrait.sty
+ return ((base_sty.chainPath("spine"
+ ~ paper_size_orientation
+ ~ ".sty")
+ ).asNormalizedPath).array;
+ }
+ string latex_sty_with_path_static() { // spineShared.sty
+ return ((base_sty.chainPath("spineShared.sty")).asNormalizedPath).array;
+ }
+ string latex_document_header_sty(string filename) { // spineShared.sty
+ return ((base_sty.chainPath(filename)).asNormalizedPath).array;
+ }
+ }
+ return _PathsStruct();
+ }
+}
+template spinePathsSQLiteDiscrete() {
+ auto spinePathsSQLiteDiscrete()(
+ string output_pth_root,
+ string lng,
+ ) {
+ struct _PathsStruct {
+ string base_filename(string fn_src) {
+ return fn_src.baseName.stripExtension;
+ }
+ string base() {
+ auto out_pth = spineOutPaths!()(output_pth_root, lng);
+ string base_dir = "sqlite";
+ return (((out_pth.output_base).chainPath(base_dir)).asNormalizedPath).array;
+ }
+ string seg(string fn_src) {
+ return ((base.chainPath(base_filename(fn_src))).asNormalizedPath).array;
+ }
+ string sqlite_file(string fn_src) {
+ return ((base.chainPath(base_filename(fn_src) ~ ".sql.db")).asNormalizedPath).array;
+ }
+ }
+ return _PathsStruct();
+ }
+}
+template spinePathsSQLite() {
+ auto spinePathsSQLite()(
+ string db_name,
+ string output_pth_root,
+ ) {
+ struct _PathsStruct {
+ string base_filename(string fn_src) {
+ return fn_src.baseName.stripExtension;
+ }
+ string base() {
+ auto out_pth = spineOutPathSQLite!()(output_pth_root); // decide whether to have separate files for each language
+ string base_dir = "";
+ return (((out_pth.output_root).chainPath(base_dir)).asNormalizedPath).array;
+ }
+ string sqlite_file() {
+ return (base.chainPath(db_name).asNormalizedPath).array;
+ }
+ }
+ return _PathsStruct();
+ }
+}
diff --git a/src/sisudoc/io_out/rgx.d b/src/sisudoc/io_out/rgx.d
new file mode 100644
index 0000000..474a120
--- /dev/null
+++ b/src/sisudoc/io_out/rgx.d
@@ -0,0 +1,157 @@
+/+
+- Name: SisuDoc 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/]
+
++/
+/++
+ regex: regular expressions used in sisu document parser
++/
+module sisudoc.io_out.rgx;
+@safe:
+static template spineRgxOut() {
+ static struct RgxO {
+ static make_breakpage = ctRegex!(`new=(?P<breakpage>.+?)(?:;|$)`);
+ static make_breakcolumn = ctRegex!(`break=(?P<breakcolumn>.+?)(?:;|$)`,);
+ static newline = ctRegex!("\n", "mg");
+ static space = ctRegex!(`[ ]`, "mg");
+ static spaces_keep = ctRegex!(`(?P<keep_spaces>^[ ]+|[ ]{2,})`, "mg"); // code, verse, block
+ static spaces_line_start = ctRegex!(`^(?P<opening_spaces>[ ]+)`, "mg");
+ static nbsp_char = ctRegex!(`░`, "mg");
+ static nbsp_chars = ctRegex!(`[░]+`, "mg");
+ static middle_dot = ctRegex!(`·`, "mg");
+ static src_pth_sst_or_ssm = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.](?P<extension>ss[tm]))$`);
+ static src_pth_pod_sst_or_ssm = ctRegex!(`^(?P<podpath>[/]?(?:[a-zA-Z0-9._-]+/)*)media/text/[a-z]{2}/(?P<filename>[a-zA-Z0-9][a-zA-Z0-9._-]*?[.]ss[tm])$`);
+ static src_pth_contents = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9][a-zA-Z0-9._-]*)/pod[.]manifest$`);
+ static src_pth_zip = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]zip)$`);
+ static src_pth_types = ctRegex!(`^(?P<path>[/]?[a-zA-Z0-9._-]+/)*(?P<gotfile>(?P<filename>[a-zA-Z0-9._-]+[.]ss[tm])|(?P<filelist>[a-zA-Z0-9._-]+/pod[.]manifest)|(?P<filezip>[a-zA-Z0-9._-]+[.]zip))$`);
+ static src_fn = ctRegex!(`^([/]?(?:[a-zA-Z0-9._-]+/)*)(?P<fn_src>(?P<fn_base>[a-zA-Z0-9._-]+)[.](?P<fn_src_suffix>ss[tm]))$`);
+ static src_fn_master = ctRegex!(`^(?P<path>/?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]ssm)$`);
+ static src_fn_find_inserts = ctRegex!(`^(?P<path>/?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]ss[im])$`);
+ static insert_src_fn_ssi_or_sst = ctRegex!(`^<<\s*(?P<path>[a-zA-Z0-9._-]+/)*(?P<filename>[a-zA-Z0-9._-]+[.]ss[ti])$`);
+ static src_base_parent_dir_name = ctRegex!(`[/](?P<dir>(?:[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure
+ static src_formalised_file_path_parts = ctRegex!(`(?P<pth>(?:[/a-zA-Z0-9._-]+?)(?P<dir>[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure
+ /+ line breaks +/
+ static br_empty_line = ctRegex!(`\n[ ]*\n`, "mg");
+ static br_linebreaks_newlines = ctRegex!(`[\n┘┙]`, "mg");
+ static br_linebreaks = ctRegex!(`[┘┙]`, "mg");
+ static br_line = ctRegex!(`┘`, "mg");
+ static br_line_inline = ctRegex!(`┙`, "mg");
+ static br_line_spaced = ctRegex!(`┚`, "mg");
+ /+ quotation marks +/
+ static quotes_open_and_close = ctRegex!(`[“”]`, "mg");
+ /+ inline markup footnotes endnotes +/
+ static inline_notes_al = ctRegex!(`【(?:[*+]\s+|\s*)(.+?)】`, "mg");
+ static inline_notes_al_special = ctRegex!(`【(?:[*+]\s+)(.+?)】`, "mg"); // TODO remove match when special footnotes are implemented
+ static inline_notes_al_gen = ctRegex!(`【.+?】`, "m");
+ static inline_notes_al_gen_text = ctRegex!(`【(?P<text>.+?)】`, "m");
+ static inline_notes_al_all_note = ctRegex!(`【(?P<num>\d+|(?:[*]|[+])+)\s+(?P<note>.+?)\s*】`, "mg");
+ static inline_notes_al_regular_number_note = ctRegex!(`【(?P<num>\d+)\s+(?P<note>.+?)\s*】`, "mg");
+ static inline_notes_al_special_char_note = ctRegex!(`【(?P<char>(?:[*]|[+])+)\s+(?P<note>.+?)】`, "mg");
+ static inline_al_delimiter_open_regular = ctRegex!(`【\s`, "m");
+ static inline_al_delimiter_open_symbol_star = ctRegex!(`【[*]\s`, "m");
+ static inline_al_delimiter_open_symbol_plus = ctRegex!(`【[+]\s`, "m");
+ static inline_text_and_note_al_ = ctRegex!(`(.+?(?:【[*+]*\s+.+?】|.+))`, "mg");
+ /+ inline markup links +/
+ static inline_image = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>\d+)h(?P<height>\d+))\s*(?P<post>.*?┝┤.*?├)`, "mg");
+ static inline_image_without_dimensions = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>0)h(?P<height>0))\s*(?P<post>.*?┝┤.*?├)`, "mg");
+ static inline_image_info = ctRegex!(`☼?(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>\d+)h(?P<height>\d+)`, "mg");
+ static inline_link_anchor = ctRegex!(`┃(?P<anchor>\S+?)┃`, "mg"); // TODO *~text_link_anchor
+ static inline_link = ctRegex!(`┥(?P<text>.+?)┝┤(?P<link>#?(\S+?))├`, "mg");
+ static inline_link_empty = ctRegex!(`┥(?P<text>.+?)┝┤├`, "mg");
+ static inline_link_number = ctRegex!(`┥(?P<text>.+?)┝┤(?P<num>[0-9]+)├`, "mg"); // not used
+ static inline_link_number_only = ctRegex!(`(?P<linked_text>┥.+?┝)┤(?P<num>[0-9]+)├`, "mg");
+ static inline_link_stow_uri = ctRegex!(`┥(?P<text>.+?)┝┤(?P<link>[^ 0-9#┥┝┤├][^ 0-9┥┝┤├]+)├`, "mg"); // will not stow (stowed links) or object number internal links
+ static inline_link_hash = ctRegex!(`┥(?P<text>.+?)┝┤(?P<link>#(?P<hash>\S+?))├`, "mg");
+ static inline_link_seg_and_hash = ctRegex!(`┥(?P<text>.+?)┝┤(?P<link>(?P<seg>[^/#├]*)#(?P<hash>.+?))├`, "mg");
+ static inline_link_clean = ctRegex!(`┤(?:.+?)├|[┥┝]`, "mg");
+ static inline_link_toc_to_backmatter = ctRegex!(`┤#(?P<link>endnotes|bibliography|bookindex|glossary|blurb)├`, "mg");
+ static url = ctRegex!(`https?://`, "mg");
+ static uri = ctRegex!(`(?:https?|git)://`, "mg");
+ static uri_identify_components = ctRegex!(`(?P<type>(?:https?|git)://)(?P<path>\S+?/)(?P<file>[^/]+)$`, "mg");
+ static inline_link_subtoc = ctRegex!(`^(?P<level>[5-7])~ ┥(?P<text>.+?)┝┤(?P<link>.+?)├`, "mg");
+ static inline_link_fn_suffix = ctRegex!(`¤(.+?)(\.fnSuffix)`, "mg");
+ static inline_seg_link = ctRegex!(`(¤)(?:.+?)\.fnSuffix`, "mg");
+ static mark_internal_site_lnk = ctRegex!(`¤`, "mg");
+ static quotation_mark_sql_insert_delimiter = ctRegex!("[']", "mg");
+ /+ inline markup font face mod +/
+ 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_cite = ctRegex!(`⑆[‖]┨(?P<text>.+?)┣[‖]`, "mg");
+ /+ table delimiters +/
+ static table_delimiter_col = ctRegex!("[ ]*[┊][ ]*", "mg");
+ static table_delimiter_row = ctRegex!("[ ]*\n", "mg");
+ /+ paragraph operators +/
+ static grouped_para_indent_1 = ctRegex!(`^_1[ ]`, "m");
+ static grouped_para_indent_2 = ctRegex!(`^_2[ ]`, "m");
+ static grouped_para_indent_3 = ctRegex!(`^_3[ ]`, "m");
+ static grouped_para_indent_4 = ctRegex!(`^_4[ ]`, "m");
+ static grouped_para_indent_5 = ctRegex!(`^_5[ ]`, "m");
+ static grouped_para_indent_6 = ctRegex!(`^_6[ ]`, "m");
+ static grouped_para_indent_7 = ctRegex!(`^_7[ ]`, "m");
+ static grouped_para_indent_8 = ctRegex!(`^_8[ ]`, "m");
+ static grouped_para_indent_9 = ctRegex!(`^_9[ ]`, "m");
+ static grouped_para_bullet = ctRegex!(`^_[*] `, "m");
+ static grouped_para_bullet_indent_1 = ctRegex!(`^_1[*] `, "m");
+ static grouped_para_bullet_indent_2 = ctRegex!(`^_2[*] `, "m");
+ static grouped_para_bullet_indent_3 = ctRegex!(`^_3[*] `, "m");
+ static grouped_para_bullet_indent_4 = ctRegex!(`^_4[*] `, "m");
+ static grouped_para_bullet_indent_5 = ctRegex!(`^_5[*] `, "m");
+ static grouped_para_bullet_indent_6 = ctRegex!(`^_6[*] `, "m");
+ static grouped_para_bullet_indent_7 = ctRegex!(`^_7[*] `, "m");
+ static grouped_para_bullet_indent_8 = ctRegex!(`^_8[*] `, "m");
+ static grouped_para_bullet_indent_9 = ctRegex!(`^_9[*] `, "m");
+ static grouped_para_bullet_indent = ctRegex!(`^_(?P<indent>[1-9])[*] `, "m");
+ static grouped_para_indent_hang = ctRegex!(`^_(?P<hang>[0-9])_(?P<indent>[0-9])[ ]`, "m");
+ }
+}
diff --git a/src/sisudoc/io_out/rgx_latex.d b/src/sisudoc/io_out/rgx_latex.d
new file mode 100644
index 0000000..826455c
--- /dev/null
+++ b/src/sisudoc/io_out/rgx_latex.d
@@ -0,0 +1,68 @@
+/+
+- Name: SisuDoc 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/]
+
++/
+/++
+ regex: regular expressions used in sisu document parser
++/
+module sisudoc.io_out.rgx_latex;
+@safe:
+static template spineRgxLSC() {
+ static struct RgxLSC {
+ static latex_special_char = ctRegex!(`([%${}_#&\\])`);
+ static latex_special_char_for_escape = ctRegex!(`([%${}_#\\])`);
+ static latex_special_char_for_escape_and_braces = ctRegex!(`([&])`);
+ static latex_special_char_for_escape_url = ctRegex!(`([%])`);
+ static latex_special_char_escaped = ctRegex!(`\\([%${}_#\\])`);
+ static latex_special_char_escaped_braced = ctRegex!(`[{]\\([&])[}]`);
+ static latex_identify_inline_link = ctRegex!(`┥.+?┝┤\S+?├`, "mg");
+ static latex_identify_inline_fontface = ctRegex!(`\\([_#$]┨.+?┣)\\([_#$])`, "mg");
+ static latex_clean_internal_link = ctRegex!(`^(?:#|¤\S+?#)`, "m");
+ static latex_clean_bookindex_linebreak = ctRegex!(`\s*\\\\\\\\\s*`, "m");
+ }
+}
diff --git a/src/sisudoc/io_out/rgx_xhtml.d b/src/sisudoc/io_out/rgx_xhtml.d
new file mode 100644
index 0000000..1c33b0e
--- /dev/null
+++ b/src/sisudoc/io_out/rgx_xhtml.d
@@ -0,0 +1,63 @@
+/+
+- Name: SisuDoc 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/]
+
++/
+/++
+ regex: regular expressions used in sisu document parser
++/
+module sisudoc.io_out.rgx_xhtml;
+@safe:
+static template spineRgxXHTML() {
+ static struct RgxXHTML {
+ static ampersand = ctRegex!(`[&]`, "m"); // &amp;
+ static quotation = ctRegex!(`["]`, "m"); // &quot;
+ static less_than = ctRegex!(`[<]`, "m"); // &lt;
+ static greater_than = ctRegex!(`[>]`, "m"); // &gt;
+ static line_break = ctRegex!(` [\\]{2}`, "m"); // <br />
+ }
+}
diff --git a/src/sisudoc/io_out/source_pod.d b/src/sisudoc/io_out/source_pod.d
new file mode 100644
index 0000000..97e31af
--- /dev/null
+++ b/src/sisudoc/io_out/source_pod.d
@@ -0,0 +1,424 @@
+/+
+- Name: SisuDoc 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 sisudoc.io_out.source_pod;
+@system: // is not @safe: use: @system: or @trusted:
+template spinePod() {
+ import
+ sisudoc.meta.rgx_files,
+ sisudoc.io_out;
+ import
+ std.digest.sha,
+ std.file,
+ std.outbuffer,
+ std.zip,
+ std.conv : to;
+ import
+ sisudoc.io_out.create_zip_file,
+ sisudoc.io_out.xmls;
+ void spinePod(T)(T doc_matters) {
+ debug(asserts) {
+ // static assert(is(typeof(doc_matters) == tuple));
+ }
+ mixin spineRgxFiles;
+ string pwd = doc_matters.env.pwd;
+ auto src_path_info = doc_matters.src_path_info;
+ auto pth_dr_doc_src = doc_matters.src_path_info;
+ auto pths_pod = spinePathsPods!()(doc_matters);
+ mixin spineLanguageCodes;
+ auto lang = Lang();
+ static auto rgx_files = RgxFiles();
+ assert (doc_matters.src.filename.match(rgx_files.src_fn));
+ @system auto pod_archive(Z)(
+ string _source_type,
+ string _data_in,
+ string _pth_out,
+ Z zip
+ ) {
+ auto zip_arc_member_file = new ArchiveMember();
+ zip_arc_member_file.name = _pth_out;
+ auto zip_data = new OutBuffer();
+ switch (_source_type) {
+ case "file_path_bin":
+ zip_data.write(cast(char[]) ((_data_in).read));
+ goto default;
+ case "file_path_text":
+ zip_data.write((_data_in).readText);
+ goto default;
+ case "string":
+ zip_data.write(_data_in);
+ goto default;
+ default:
+ zip_arc_member_file.expandedData = zip_data.toBytes();
+ zip.addMember(zip_arc_member_file);
+ }
+ return zip;
+ }
+ try {
+ /+ create directory structure +/
+ if (!exists(pths_pod.pod_dir_())) {
+ // used both by pod zipped (& pod filesystem (unzipped) which makes its own recursive dirs)
+ pths_pod.pod_dir_().mkdirRecurse;
+ }
+ if (doc_matters.opt.action.source_or_pod) {
+ if (doc_matters.opt.action.vox_gt0) {
+ writeln(" ", pths_pod.fn_pod_filelist(doc_matters.src.filename).filesystem_open_zpod);
+ }
+ if (!exists(pths_pod.text_root(doc_matters.src.filename).filesystem_open_zpod)) {
+ pths_pod.text_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse;
+ }
+ if (!exists(pths_pod.conf_root(doc_matters.src.filename).filesystem_open_zpod)) {
+ pths_pod.conf_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse;
+ }
+ if (!exists(pths_pod.media_root(doc_matters.src.filename).filesystem_open_zpod)) {
+ pths_pod.media_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse;
+ }
+ if (!exists(pths_pod.css(doc_matters.src.filename).filesystem_open_zpod)) {
+ pths_pod.css(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse;
+ }
+ if (!exists(pths_pod.image_root(doc_matters.src.filename).filesystem_open_zpod)) {
+ pths_pod.image_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse;
+ }
+ if (!exists(pths_pod.doc_lng(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod)) {
+ pths_pod.doc_lng(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod.mkdirRecurse;
+ }
+ }
+ if (!exists(pths_pod.pod_dir_() ~ "/index.html")) {
+ import sisudoc.io_out.html_snippet;
+ mixin htmlSnippet;
+ auto f = File(pths_pod.pod_dir_() ~"/index.html", "w");
+ f.writeln(format_html_blank_page_guide_home(
+ "../../css/html_scroll.css",
+ (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,
+ "../../index.html",
+ ));
+ }
+ if (doc_matters.opt.action.debug_do_pod
+ && doc_matters.opt.action.vox_gt1) {
+ writeln(__LINE__, ": ",
+ doc_matters.src.filename, " -> ",
+ pths_pod.fn_doc(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod
+ );
+ }
+ auto zip = new ZipArchive();
+ auto fn_pod = pths_pod.pod_filename(doc_matters.src.filename).zpod;
+ { /+ bundle images +/
+ foreach (image; doc_matters.srcs.image_list) {
+ debug(podimages) {
+ writeln(
+ pth_dr_doc_src.image_root.to!string, "/", image, " -> ",
+ pths_pod.image_root(doc_matters.src.filename).zpod, "/", image
+ );
+ }
+ auto fn_src_in = doc_matters.src.image_dir_path ~ "/" ~ image;
+ auto fn_src_out_pod_zip_base
+ = pths_pod.image_root(doc_matters.src.filename).zpod.to!string
+ ~ "/" ~ image;
+ auto fn_src_out_filesystem
+ = pths_pod.image_root(doc_matters.src.filename).filesystem_open_zpod.to!string
+ ~ "/" ~ image;
+ if (exists(fn_src_in)) {
+ debug(io) {
+ writeln("(io debug) src out found: ", fn_src_in);
+ }
+ if (doc_matters.opt.action.source_or_pod) {
+ fn_src_in.copy(fn_src_out_filesystem);
+ }
+ if (doc_matters.opt.action.pod) {
+ zip = pod_archive("file_path_bin", fn_src_in, fn_src_out_pod_zip_base, zip);
+ }
+ } else {
+ if (doc_matters.opt.action.debug_do_pod
+ && doc_matters.opt.action.vox_gt1) {
+ writeln("WARNING (io) src out NOT found (image): ", fn_src_in);
+ }
+ }
+ }
+ } { /+ bundle dr_document_make +/
+ auto fn_src_in = ((doc_matters.src.is_pod)
+ ? doc_matters.src.conf_dir_path
+ : pth_dr_doc_src.conf_root).to!string
+ ~ "/" ~ "dr_document_make";
+ auto fn_src_out_pod_zip_base
+ = pths_pod.conf_root(doc_matters.src.filename).zpod.to!string ~ "/" ~ "dr_document_make";
+ auto fn_src_out_filesystem
+ = pths_pod.conf_root(doc_matters.src.filename).filesystem_open_zpod.to!string
+ ~ "/" ~ "dr_document_make";
+ if (exists(fn_src_in)) {
+ debug(io) {
+ writeln("(io debug) src out found: ", fn_src_in);
+ }
+ if (doc_matters.opt.action.source_or_pod) {
+ fn_src_in.copy(fn_src_out_filesystem);
+ }
+ if (doc_matters.opt.action.pod) {
+ zip = pod_archive("file_path_text", fn_src_in, fn_src_out_pod_zip_base, zip);
+ }
+ } else {
+ if (doc_matters.opt.action.debug_do_pod
+ && doc_matters.opt.action.vox_gt1) {
+ writeln("WARNING (io) src out NOT found (document make): ", fn_src_in);
+ }
+ }
+ } { /+ pod manifest +/
+ auto fn_src_in = doc_matters.src.file_with_absolute_path.to!string;
+ auto fn_src_out_pod_zip_base
+ = pths_pod.pod_manifest(doc_matters.src.filename).zpod.to!string;
+ auto fn_src_out_filesystem
+ = pths_pod.pod_manifest(doc_matters.src.filename).filesystem_open_zpod.to!string; // needed without root path
+ auto fn_src_out_inside_pod
+ = pths_pod.pod_manifest(doc_matters.src.filename).zpod.to!string; // needed without root path
+ string[] filelist_src_out_pod_arr;
+ string[] filelist_src_zpod_arr;
+ if (exists(fn_src_in)) {
+ debug(io) {
+ writeln("(io debug) src in found: ", fn_src_in);
+ }
+ filelist_src_out_pod_arr ~= fn_src_out_pod_zip_base;
+ filelist_src_zpod_arr ~= fn_src_out_inside_pod;
+ {
+ import dyaml;
+ auto pod_filelist_yaml_string
+ = File(pths_pod.fn_pod_filelist(doc_matters.src.filename).filesystem_open_zpod, "w");
+ Node _pmy;
+ string _pm = "doc:\n filename: " ~ doc_matters.src.filename ~ "\n language: " ~ doc_matters.pod.manifest_list_of_languages.to!string ~ "\n";
+ if (doc_matters.opt.action.debug_do_pod
+ && doc_matters.opt.action.vox_gt1) {
+ try {
+ _pmy = Loader.fromString(_pm).load();
+ } catch (ErrnoException ex) {
+ } catch (Throwable) {
+ writeln("ERROR failed to read config file content, not parsed as yaml");
+ }
+ writeln("pod filename: ", _pmy["doc"]["filename"].get!string);
+ writeln("pod languages: ", doc_matters.pod.manifest_list_of_languages.to!string);
+ writeln("pod languages: ", doc_matters.src.language);
+ // foreach(string _l; _pmy["doc"]["language"]) {
+ // writeln("language: ", _l);
+ // }
+ }
+ if (doc_matters.opt.action.source_or_pod) {
+ pod_filelist_yaml_string.writeln(_pm);
+ }
+ if (doc_matters.opt.action.pod) {
+ zip = pod_archive("string", _pm, fn_src_out_pod_zip_base, zip);
+ }
+ }
+ }
+ } { /+ bundle primary file (.ssm/.sst) +/
+ auto fn_src_in = doc_matters.src.file_with_absolute_path.to!string;
+ auto fn_src_out_pod_zip_base
+ = pths_pod.fn_doc(doc_matters.src.filename, doc_matters.src.language).zpod.to!string;
+ auto fn_src_out_filesystem
+ = pths_pod.fn_doc(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod.to!string; // needed without root path:
+ auto fn_src_out_inside_pod
+ = pths_pod.fn_doc(doc_matters.src.filename, doc_matters.src.language).zpod.to!string; // needed without root path:
+ string[] filelist_src_out_pod_arr;
+ string[] filelist_src_zpod_arr;
+ if (exists(fn_src_in)) {
+ debug(io) {
+ writeln("(io debug) src in found: ", fn_src_in);
+ }
+ filelist_src_out_pod_arr ~= fn_src_out_pod_zip_base;
+ filelist_src_zpod_arr ~= fn_src_out_inside_pod;
+ string _pod_to_markup_file = doc_matters.src.pod_name ~ "/" ~ "media/text/" ~ doc_matters.src.language ~ "/" ~ doc_matters.src.filename;
+ if (doc_matters.opt.action.source_or_pod) {
+ fn_src_in.copy(fn_src_out_filesystem);
+ }
+ if (doc_matters.opt.action.pod) {
+ auto _rgx = regex(r"(?P<path_to_pod>\S+?)(?P<podname>[a-z_-]+)/(?P<from_root>media/text/)(?P<language>\S+?)/(?P<filename>\S+?\.ss[mt])");
+ if (auto _x = fn_src_in.match(_rgx)){
+ if (doc_matters.src.lng == doc_matters.pod.manifest_list_of_languages[$-1]) {
+ string _path_to_pod = _x.captures["path_to_pod"];
+ string _podname = _x.captures["podname"];
+ string _root_to_lang = _x.captures["from_root"];
+ string _language = _x.captures["language"];
+ string _filename = _x.captures["filename"];
+ foreach (_lang; doc_matters.pod.manifest_list_of_languages) {
+ string _pth_mkup_src_in = _path_to_pod ~ _podname ~ "/" ~ _root_to_lang ~ _lang ~ "/" ~ _filename;
+ string _pth_mkup_src_out = "pod/" ~ _root_to_lang ~ _lang ~ "/" ~ _filename;
+ zip = pod_archive("file_path_text", _pth_mkup_src_in, _pth_mkup_src_out, zip);
+ }
+ }
+ } else {
+ zip = pod_archive("file_path_text", fn_src_in, fn_src_out_pod_zip_base, zip);
+ }
+ }
+ } else {
+ if (doc_matters.opt.action.debug_do_pod
+ && doc_matters.opt.action.vox_gt1) {
+ writeln("WARNING (io) src in NOT found (markup source): ", fn_src_in);
+ }
+ }
+ } { /+ bundle insert files (.ssi) +/
+ if (doc_matters.srcs.file_insert_list.length > 0) {
+ auto _rgx = regex(r"(?P<path_to_pod>\S+?)(?P<podname>[a-z_-]+)/(?P<from_root>media/text/)(?P<language>\S+?)/(?P<filename>\S+?\.ss[i])");
+ foreach (insert_file; doc_matters.srcs.file_insert_list) {
+ debug(pod) {
+ writeln(
+ insert_file, " -> ",
+ pths_pod.fn_doc_insert(
+ doc_matters.src.filename,
+ insert_file,
+ doc_matters.src.language,
+ ).zpod
+ );
+ }
+ if (auto _x = insert_file.match(_rgx)){
+ if (doc_matters.src.lng == doc_matters.pod.manifest_list_of_languages[$-1]) {
+ string _path_to_pod = _x.captures["path_to_pod"];
+ string _podname = _x.captures["podname"];
+ string _root_to_lang = _x.captures["from_root"];
+ string _language = _x.captures["language"];
+ string _filename = _x.captures["filename"];
+ foreach (_lang; doc_matters.pod.manifest_list_of_languages) {
+ string _pth_mkup_src_in = _path_to_pod ~ _podname ~ "/" ~ _root_to_lang ~ _lang ~ "/" ~ _filename;
+ string _pth_mkup_src_out = "pod/" ~ _root_to_lang ~ _lang ~ "/" ~ _filename;
+ if (exists(_pth_mkup_src_in)) {
+ if (doc_matters.opt.action.source_or_pod) {
+ auto fn_src_out_filesystem // you need to change language sources
+ = pths_pod.fn_doc_insert(
+ doc_matters.src.filename, // doc_matters.src.filename
+ _pth_mkup_src_in, // insert_file
+ _lang,
+ ).filesystem_open_zpod.to!string;
+ _pth_mkup_src_in.copy(fn_src_out_filesystem); // check why here, thought dealt with elsewhere
+ }
+ if (doc_matters.opt.action.pod) {
+ zip = pod_archive("file_path_text", _pth_mkup_src_in, _pth_mkup_src_out, zip);
+ }
+ } else {
+ if (doc_matters.opt.action.debug_do_pod
+ && doc_matters.opt.action.vox_gt1) {
+ writeln("WARNING (io) src out NOT found (insert file): ", _pth_mkup_src_in);
+ }
+ }
+ }
+ }
+ } else {
+ auto fn_src_in = insert_file;
+ auto fn_src_out_pod_zip_base
+ = pths_pod.fn_doc_insert(
+ doc_matters.src.filename,
+ insert_file,
+ doc_matters.src.language,
+ ).zpod.to!string;
+ auto fn_src_out_filesystem
+ = pths_pod.fn_doc_insert(
+ doc_matters.src.filename,
+ insert_file,
+ doc_matters.src.language,
+ ).filesystem_open_zpod.to!string;
+ if (exists(fn_src_in)) {
+ debug(io) {
+ writeln("(io debug) src out found: ", fn_src_in);
+ }
+ if (doc_matters.opt.action.source_or_pod) {
+ fn_src_in.copy(fn_src_out_filesystem);
+ }
+ if (doc_matters.opt.action.pod) {
+ zip = pod_archive("file_path_text", fn_src_in, fn_src_out_pod_zip_base, zip);
+ }
+ } else {
+ if (doc_matters.opt.action.debug_do_pod
+ && doc_matters.opt.action.vox_gt1) {
+ writeln("WARNING (io) src out NOT found (insert file): ", fn_src_in);
+ }
+ }
+ }
+ }
+ }
+ } {
+ auto fn_src_in = doc_matters.src.filename;
+ if (doc_matters.opt.action.pod) {
+ if (exists(doc_matters.src.file_with_absolute_path)) {
+ createZipFile!()(fn_pod, zip.build());
+ } else {
+ writeln("WARNING check missing source file(s): ", doc_matters.opt.action.pod);
+ }
+ if (!(exists(fn_pod))) {
+ writeln("WARNING failed to create pod zip archive: ", fn_pod);
+ }
+ }
+ }
+ if (exists(fn_pod)) {
+ try {
+ if (doc_matters.opt.action.vox_gt0
+ && doc_matters.opt.action.pod) {
+ auto data = (cast(byte[]) (fn_pod).read);
+ if (doc_matters.opt.action.vox_gt1) {
+ writeln(" ", doc_matters.src.filename, " > ");
+ }
+ if (doc_matters.opt.action.pod) {
+ writefln("%s\n. %-(%02x%)::%s . %s.zip", fn_pod, data.sha256Of, data.length, doc_matters.src.filename_base);
+ }
+ }
+ if (doc_matters.opt.action.debug_do_pod) {
+ try {
+ auto zipped = new ZipArchive((fn_pod).read);
+ foreach (filename, member; zipped.directory) {
+ auto data = zipped.expand(member);
+ writeln(". ", ((data).sha256Of).toHexString, "::", data.length, " . ", filename);
+ }
+ } catch (ZipException ex) {
+ // Handle errors
+ }
+ }
+ } catch (ErrnoException ex) {
+ // Handle errors
+ }
+ }
+ // source pod zip
+ } catch (ErrnoException ex) {
+ // Handle error
+ }
+ }
+}
diff --git a/src/sisudoc/io_out/sqlite.d b/src/sisudoc/io_out/sqlite.d
new file mode 100644
index 0000000..bee9cad
--- /dev/null
+++ b/src/sisudoc/io_out/sqlite.d
@@ -0,0 +1,1761 @@
+/+
+- Name: SisuDoc 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 sisudoc.io_out.sqlite;
+import
+ sisudoc.io_out,
+ sisudoc.io_out.rgx,
+ sisudoc.io_out.rgx_xhtml;
+import
+ std.file,
+ std.uri;
+import std.conv : to;
+import std.typecons : Nullable;
+import d2sqlite3;
+mixin spineRgxOut;
+mixin spineRgxXHTML;
+mixin InternalMarkup;
+static auto rgx = RgxO();
+static auto rgx_xhtml = RgxXHTML();
+static auto mkup = InlineMarkup();
+long _metadata_tid_lastrowid;
+template SQLiteHubBuildTablesAndPopulate() {
+ void SQLiteHubBuildTablesAndPopulate(D,M)(
+ const D doc_abstraction,
+ M doc_matters,
+ ) {
+ auto pth_sqlite = spinePathsSQLite!()(doc_matters.sqlite.filename, doc_matters.sqlite.path);
+ if ((isValidPath(pth_sqlite.base) && exists(pth_sqlite.base) != 0 && pth_sqlite.base.isDir)) {
+ } else {
+ try {
+ pth_sqlite.base.mkdirRecurse;
+ } catch (FileException ex) { }
+ }
+ template SQLiteDbStatementComposite() {
+ void SQLiteDbStatementComposite(Db,D,M)(
+ Db db,
+ const D doc_abstraction,
+ M doc_matters,
+ ) {
+ string _db_statement;
+ if ((doc_matters.opt.action.sqlite_db_create)) {
+ auto pth_sqlite = spinePathsSQLite!()(doc_matters.sqlite.filename, doc_matters.sqlite.path);
+ if ((isValidPath(pth_sqlite.base) && exists(pth_sqlite.base) != 0 && pth_sqlite.base.isDir)) {
+ } else {
+ try {
+ pth_sqlite.base.mkdirRecurse;
+ } catch (FileException ex) { }
+ }
+ _db_statement ~= SQLiteTablesReCreate!()();
+ SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "TABLE RE-CREATE");
+ _db_statement = [];
+ }
+ if (doc_matters.opt.action.sqlite_delete) {
+ _db_statement ~= SQLiteDeleteDocument!()(doc_matters);
+ SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "DELETE Document");
+ _db_statement = [];
+ }
+ if (doc_matters.opt.action.sqlite_update) {
+ _db_statement ~= SQLiteDeleteDocument!()(doc_matters);
+ SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "DELETE Document");
+ _db_statement = [];
+ _db_statement ~= SQLiteInsertMetadata!()(doc_matters);
+ SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "INSERT MetaData");
+ _db_statement = [];
+ /+ get tid (lastrowid or max) for use in doc_objects table +/
+ _db_statement ~= doc_abstraction.SQLiteInsertDocObjectsLoop!()(doc_matters);
+ SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "INSERT DocObjects");
+ _db_statement = [];
+ _db_statement ~= SQLiteInsertMetadataTopics!()(doc_matters);
+ SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "INSERT MetaDataTopics");
+ _db_statement = [];
+ }
+ db.close;
+ if (doc_matters.opt.action.vox_gt0) {
+ writeln(" ", pth_sqlite.sqlite_file);
+ }
+ }
+ }
+ try {
+ auto db = Database(pth_sqlite.sqlite_file);
+ SQLiteDbStatementComposite!()(db, doc_abstraction, doc_matters);
+ }
+ catch (FileException e) {
+ writeln("Failed (FileException): ", e.msg, " ", pth_sqlite.sqlite_file);
+ writeln(e.file, " line: ", e.line);
+ import core.runtime;
+ core.runtime.Runtime.terminate();
+ }
+ catch (ErrnoException e) {
+ writeln("Failed (ErrnoException): ", e.msg, " ", pth_sqlite.sqlite_file);
+ writeln(e.file, " line: ", e.line);
+ import core.runtime;
+ core.runtime.Runtime.terminate();
+ }
+ catch (Exception e) {
+ writeln("Failed (Exception): ", e.msg, " ", pth_sqlite.sqlite_file);
+ writeln(e.file, " line: ", e.line);
+ import core.runtime;
+ core.runtime.Runtime.terminate();
+ }
+ catch (Throwable) {
+ writeln("Failed (Trowable): ", pth_sqlite.sqlite_file);
+ import core.runtime;
+ core.runtime.Runtime.terminate();
+ }
+ }
+}
+template SQLiteHubDiscreteBuildTablesAndPopulate() {
+ void SQLiteHubDiscreteBuildTablesAndPopulate(D,M)(
+ const D doc_abstraction,
+ M doc_matters,
+ ) {
+ auto url_html = spineUrlsHTML!()(doc_matters.conf_make_meta.conf.w_srv_data_root_url_html, doc_matters.src.language);
+ auto pth_sqlite = spinePathsSQLiteDiscrete!()(doc_matters.output_path, doc_matters.src.language); // doc_matters.db_path
+ if ((isValidPath(pth_sqlite.base) && exists(pth_sqlite.base) != 0 && pth_sqlite.base.isDir)) {
+ } else {
+ try {
+ pth_sqlite.base.mkdirRecurse;
+ } catch (FileException ex) { }
+ }
+ auto db = Database(pth_sqlite.sqlite_file(doc_matters.src.filename));
+ template SQLiteDiscreteDbStatementComposite() {
+ void SQLiteDiscreteDbStatementComposite(Db,D,M)(
+ Db db,
+ const D doc_abstraction,
+ M doc_matters,
+ ) {
+ try {
+ {
+ string _db_statement;
+ _db_statement ~= SQLiteTablesReCreate!()();
+ _db_statement ~= SQLiteInsertMetadata!()(doc_matters);
+ _db_statement ~= SQLiteInsertMetadataTopics!()(doc_matters);
+ _db_statement ~= doc_abstraction.SQLiteInsertDocObjectsLoop!()(doc_matters);
+ SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "table CREATE Tables, INSERT DocObjects");
+ }
+ db.close;
+ }
+ catch (FileException e) {
+ writeln("Failed (FileException): ", e.msg);
+ writeln(e.file, " line: ", e.line);
+ import core.runtime;
+ core.runtime.Runtime.terminate();
+ }
+ catch (ErrnoException e) {
+ writeln("Failed (ErrnoException): ", e.msg);
+ writeln(e.file, " line: ", e.line);
+ import core.runtime;
+ core.runtime.Runtime.terminate();
+ }
+ catch (Exception e) {
+ writeln("Failed (Exception): ", e.msg);
+ writeln(e.file, " line: ", e.line);
+ import core.runtime;
+ core.runtime.Runtime.terminate();
+ }
+ catch (Throwable) {
+ import core.runtime;
+ core.runtime.Runtime.terminate();
+ }
+ if (doc_matters.opt.action.vox_gt0) {
+ writeln(" ", pth_sqlite.sqlite_file(doc_matters.src.filename));
+ }
+ }
+ }
+ SQLiteDiscreteDbStatementComposite!()(db, doc_abstraction, doc_matters);
+ }
+}
+template SQLiteDbRun() {
+ void SQLiteDbRun(Db,St,O)(
+ Db db,
+ St db_statement,
+ O opt_action,
+ string note,
+ ) {
+ debug(sql_statement) {
+ writeln(db_statement);
+ }
+ try {
+ db.run(
+ "\nBEGIN TRANSACTION;\n" ~
+ db_statement ~
+ "\nCOMMIT TRANSACTION;\n"
+ );
+ } catch (ErrnoException ex) {
+ writeln("ERROR SQLite : ", ex);
+ } catch (Exception ex) {
+ writeln("ERROR SQLite : ", ex);
+ }
+ { /+ debug +/
+ if (opt_action.debug_do_sqlite) {
+ writeln(note);
+ if (opt_action.vox_gt2) {
+ writeln(db_statement);
+ }
+ }
+ }
+ }
+}
+template SQLinsertDelimiter() {
+ string SQLinsertDelimiter(string _txt) {
+ _txt = _txt
+ .replaceAll(rgx.quotation_mark_sql_insert_delimiter, "$0$0");
+ return _txt;
+ }
+}
+template SQLiteFormatAndLoadObject() {
+ auto SQLiteFormatAndLoadObject(M)(
+ M doc_matters,
+ ) {
+ mixin spineRgxOut;
+ mixin spineRgxXHTML;
+ struct sqlite_format_and_load_objects {
+ string generic_munge_sanitize_text_for_search(
+ string _txt,
+ ) {
+ string _notes;
+ string _urls;
+ if (_txt.matchFirst(rgx.inline_notes_al_gen)) {
+ foreach (m; _txt.matchAll(rgx.inline_notes_al_gen_text)) {
+ _notes ~= "\n" ~ m["text"];
+ }
+ _txt = _txt.replaceAll(rgx.inline_notes_al_gen, "");
+ }
+ if (_txt.matchFirst(rgx.inline_link)) {
+ foreach (m; _txt.matchAll(rgx.inline_link)) {
+ if (m["link"].match(rgx.url)) {
+ _urls ~= "\n" ~ m["link"];
+ }
+ }
+ _txt = _txt.replaceAll(rgx.inline_link_clean, "");
+ }
+ if (_notes.length > 0) {
+ _txt ~= _notes;
+ }
+ if (_urls.length > 0) {
+ _txt ~= _urls;
+ }
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_sqlite) {
+ writeln(_txt, "\n");
+ }
+ }
+ debug(sql_text_clean) {
+ writeln(_txt);
+ }
+ return _txt;
+ }
+ string munge_html(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ string _html_special_characters(string _txt){
+ _txt = _txt
+ .replaceAll(rgx_xhtml.ampersand, "&#38;")
+ .replaceAll(rgx_xhtml.quotation, "&#34;")
+ .replaceAll(rgx_xhtml.less_than, "&#60;")
+ .replaceAll(rgx_xhtml.greater_than, "&#62;")
+ .replaceAll(rgx.nbsp_char, " ")
+ .replaceAll(rgx.br_line_inline, "<br />")
+ .replaceAll(rgx.br_line, "<br />")
+ .replaceAll(rgx.br_line_spaced, "<br /><br />")
+ .replaceAll(rgx_xhtml.line_break, "<br />");
+ return _txt;
+ }
+ string _html_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 _notes;
+ string _urls;
+ string _txt = _html_font_face(_html_special_characters(obj.text));
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_sqlite) {
+ writeln(_txt, "\n");
+ }
+ }
+ return _txt;
+ }
+ string html_special_characters(string _txt){
+ _txt = _txt
+ .replaceAll(rgx_xhtml.ampersand, "&#38;")
+ .replaceAll(rgx_xhtml.quotation, "&#34;")
+ .replaceAll(rgx_xhtml.less_than, "&#60;")
+ .replaceAll(rgx_xhtml.greater_than, "&#62;")
+ .replaceAll(rgx.nbsp_char, " ")
+ .replaceAll(rgx.br_line_inline, "<br />")
+ .replaceAll(rgx.br_line, "<br />")
+ .replaceAll(rgx.br_line_spaced, "<br /><br />")
+ .replaceAll(rgx_xhtml.line_break, "<br />");
+ return _txt;
+ }
+ string html_special_characters_code(string _txt){
+ _txt = _txt
+ .replaceAll(rgx_xhtml.ampersand, "&#38;")
+ .replaceAll(rgx_xhtml.quotation, "&#34;")
+ .replaceAll(rgx_xhtml.less_than, "&#60;")
+ .replaceAll(rgx_xhtml.greater_than, "&#62;")
+ .replaceAll(rgx.nbsp_char, " ");
+ return _txt;
+ }
+ string html_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 inline_grouped_text_bullets_indents(M,O)(
+ M doc_matters,
+ const O obj,
+ string _txt,
+ string _suffix = ".html",
+ string _xml_type = "seg",
+ ) {
+ static auto rgx = RgxO();
+ static auto rgx_xhtml = RgxXHTML();
+ 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;");
+ }
+ return _txt;
+ }
+ string inline_images(M,O)(
+ M doc_matters,
+ const O obj,
+ string _txt,
+ string _suffix = ".html",
+ string _xml_type = "seg",
+ ) {
+ string _img_pth;
+ if (_xml_type == "epub") {
+ _img_pth = "image/";
+ } else if (_xml_type == "scroll") {
+ _img_pth = "../../image/";
+ } else if (_xml_type == "seg") {
+ _img_pth = "../../../image/";
+ }
+ if (_txt.match(rgx.inline_image)) {
+ _txt = _txt.replaceAll( // TODO bug where image dimensions (w or h) not given & consequently set to 0; should not be used (calculate earlier, abstraction)
+ rgx.inline_image,
+ ("$1<img src=\""
+ ~ _img_pth
+ ~ "$3\" width=\"$4\" height=\"$5\" naturalsizeflag=\"0\" align=\"bottom\" border=\"0\" /> $6"));
+ }
+ return _txt;
+ }
+ string inline_links(M,O)(
+ M doc_matters,
+ const O obj,
+ string _txt,
+ string _xml_type = "seg",
+ ) {
+ if (obj.has.inline_links) {
+ if (obj.metainfo.is_a != "code") {
+ _txt = replaceAll!(m =>
+ m["linked_text"] ~ "┤" ~ to!string((obj.stow.link[m["num"].to!ulong])).encode ~ "├"
+ )(_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");
+ }
+ auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language);
+ if (_xml_type == "seg") {
+ foreach (m; _txt.matchAll(rgx.inline_link_seg_and_hash)) {
+ if (m.captures["hash"] in doc_matters.has.tag_associations) {
+ if (m.captures["hash"] == doc_matters.has.tag_associations[(m.captures["hash"])]["seg_lv4"]) {
+ _txt = _txt.replaceFirst(
+ rgx.inline_link_seg_and_hash,
+ "┥$1┝┤"
+ ~ doc_matters.conf_make_meta.conf.w_srv_data_root_url_html
+ ~ "/"
+ ~ pth_html.tail_fn_seg(doc_matters.src.filename, "$2.html")
+ ~ "├"
+ );
+ } else {
+ _txt = _txt.replaceFirst(
+ rgx.inline_link_seg_and_hash,
+ "┥$1┝┤"
+ ~ doc_matters.conf_make_meta.conf.w_srv_data_root_url_html
+ ~ "/"
+ ~ doc_matters.src.filename_base
+ ~ "/"
+ ~ doc_matters.has.tag_associations[(m.captures["hash"])]["seg_lv4"]
+ ~ ".html"
+ ~ "#" ~ m.captures["hash"]
+ ~ "├"
+ );
+ }
+ } 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
+ );
+ }
+ }
+ }
+ } else {
+ if (auto m = _txt.match(rgx.inline_link_seg_and_hash)) {
+ _txt = _txt.replaceFirst(
+ rgx.inline_link_seg_and_hash,
+ "┥$1┝┤"
+ ~ doc_matters.conf_make_meta.conf.w_srv_data_root_url_html
+ ~ "/"
+ ~ pth_html.tail_fn_scroll(doc_matters.src.filename)
+ ~ "#" ~ m.captures["hash"]
+ ~ "├"
+ );
+ }
+ }
+ _txt = _txt
+ .replaceAll(
+ rgx.inline_link_fn_suffix,
+ ("$1.html"))
+ .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
+ );
+ }
+ // if (obj.metainfo.is_a == "bookindex") { // DEBUG LINE
+ // if (_txt.match(regex(r"<a href"))) {
+ // writeln(__LINE__, " ",
+ // doc_matters.conf_make_meta.conf.w_srv_data_root_url_html,
+ // "/",
+ // doc_matters.src.filename_base,
+ // "\n",
+ // _txt
+ // );
+ // }
+ // }
+ }
+ 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(M,O)(
+ M doc_matters,
+ const O obj,
+ string _txt,
+ ) {
+ if (obj.has.inline_notes_reg) {
+ string[] _endnotes;
+ foreach(m; _txt.matchAll(rgx.inline_notes_al_regular_number_note)) {
+ _endnotes ~= "<p class=\"endnote\">"
+ ~ "<sup>" ~ m.captures["num"] ~ ".</sup>"
+ ~ m.captures["note"]
+ ~ "</p>";
+ }
+ _txt = replaceAll!(m =>
+ ("&#160;" ~ "<sup>" ~ m["num"] ~ "</sup>"))
+ (_txt, rgx.inline_notes_al_regular_number_note)
+ ~ _endnotes.join("\n");
+ }
+ 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;
+ }
+ string xml_type="seg"; /+ set html document type to be linked to here (seg|scroll) +/
+ string inline_markup(M,O)(
+ M doc_matters,
+ const O obj,
+ string _txt,
+ ) {
+ if (obj.metainfo.is_a == "group") {
+ _txt = inline_grouped_text_bullets_indents(doc_matters, obj, _txt, xml_type);
+ }
+ _txt = inline_images(doc_matters, obj, _txt, xml_type);
+ _txt = inline_links(doc_matters, obj, _txt, xml_type);
+ _txt = inline_notes_scroll(doc_matters, obj, _txt);
+ return _txt;
+ }
+ string html_heading(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ 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 _txt = munge_html(doc_matters, obj);
+ _txt = inline_markup(doc_matters, obj, _txt);
+ string o = format(q"┃<p class="%s"><b>
+ %s
+ </b></p>┃",
+ obj.metainfo.is_a,
+ _txt,
+ );
+ return o;
+ }
+ string html_para(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ 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 _txt = munge_html(doc_matters, obj);
+ _txt = (obj.attrib.bullet) ? ("●&#160;&#160;" ~ _txt) : _txt;
+ _txt = inline_markup(doc_matters, obj, _txt);
+ string o = format(q"┃<p class="%s" indent="h%si%s">
+ %s
+ </p>┃",
+ obj.metainfo.is_a,
+ obj.attrib.indent_hang,
+ obj.attrib.indent_base,
+ _txt
+ );
+ return o;
+ }
+ string html_quote(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ 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");
+ string _txt = munge_html(doc_matters, obj);
+ string o = format(q"┃<p class="%s">
+ %s
+ </p>┃",
+ obj.metainfo.is_a,
+ _txt
+ );
+ return o;
+ }
+ string html_group(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ 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");
+ string _txt = munge_html(doc_matters, obj);
+ _txt = inline_markup(doc_matters, obj, _txt);
+ string o = format(q"┃<p class="%s">
+ %s
+ </p>┃",
+ obj.metainfo.is_a,
+ _txt
+ );
+ return o;
+ }
+ string html_block(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ 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");
+ string _txt = munge_html(doc_matters, obj);
+ _txt = inline_markup(doc_matters, obj, _txt);
+ string o = format(q"┃
+ <p class="%s">%s</p>┃",
+ obj.metainfo.is_a,
+ _txt.stripRight
+ );
+ return o;
+ }
+ string html_verse(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ 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");
+ string _txt = munge_html(doc_matters, obj);
+ string o = format(q"┃<p class="%s">%s</p>┃",
+ obj.metainfo.is_a,
+ _txt
+ );
+ return o;
+ }
+ string html_code(O)(
+ const O obj,
+ ) {
+ 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 _txt = html_special_characters_code(obj.text);
+ string o = format(q"┃<p class="%s">%s</p>┃",
+ obj.metainfo.is_a,
+ _txt
+ );
+ return o;
+ }
+ string html_table(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ 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");
+ Tuple!(string, string) _tablarize(O)(
+ const O obj,
+ string _txt,
+ ) {
+ 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)) { // check row_idx+2 (rather than == ++row_idx)
+ _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 _txt = munge_html(doc_matters, obj);
+ Tuple!(string, string) t = _tablarize(obj, _txt);
+ _txt = t[0];
+ string _note = t[1];
+ string o = format(q"┃<p class="%s">
+ <table summary="normal text css" width="95%%" border="0" cellpadding="2" align="center">
+ %s
+ </table>
+ %s
+ </p>┃",
+ obj.metainfo.is_a,
+ _txt,
+ _note
+ );
+ return o;
+ }
+ string sqlite_load_string(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ string o;
+ return o;
+ }
+ string sqlite_statement(O)(
+ const O obj,
+ string _txt,
+ string _html,
+ ) {
+ void _sql_exe(O)(
+ string _sql,
+ ) {
+ writeln(_html);
+ writeln(_sql);
+ }
+ string _sql;
+ return _sql;
+ }
+ string[string] heading(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ string[string] obj_txt = [
+ "text": generic_munge_sanitize_text_for_search(obj.text),
+ "html": html_heading(doc_matters, obj)
+ ];
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_sqlite) {
+ debug(sql_txt) {
+ writeln(obj_txt["text"]);
+ }
+ debug(sql_html) {
+ writeln(obj_txt["html"]);
+ }
+ } else {
+ // load sql
+ }
+ }
+ return obj_txt;
+ }
+ string[string] para(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ string[string] obj_txt = [
+ "text": generic_munge_sanitize_text_for_search(obj.text),
+ "html": html_para(doc_matters, obj)
+ ];
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_sqlite) {
+ debug(sql_txt) {
+ writeln(obj_txt["text"]);
+ }
+ debug(sql_html) {
+ writeln(obj_txt["html"]);
+ }
+ } else {
+ // load sql
+ }
+ }
+ return obj_txt;
+ }
+ string[string] quote(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ string[string] obj_txt = [
+ "text": generic_munge_sanitize_text_for_search(obj.text),
+ "html": html_quote(doc_matters, obj)
+ ];
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_sqlite) {
+ debug(sql_txt) {
+ writeln(obj_txt["text"]);
+ }
+ debug(sql_html) {
+ writeln(obj_txt["html"]);
+ }
+ } else {
+ // load sql
+ }
+ }
+ return obj_txt;
+ }
+ string[string] group(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ string[string] obj_txt = [
+ "text": generic_munge_sanitize_text_for_search(obj.text),
+ "html": html_group(doc_matters, obj)
+ ];
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_sqlite) {
+ debug(sql_txt) {
+ writeln(obj_txt["text"]);
+ }
+ debug(sql_html) {
+ writeln(obj_txt["html"]);
+ }
+ } else {
+ // load sql
+ }
+ }
+ return obj_txt;
+ }
+ string[string] block(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ string[string] obj_txt = [
+ "text": generic_munge_sanitize_text_for_search(obj.text),
+ "html": html_block(doc_matters, obj)
+ ];
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_sqlite) {
+ debug(sql_txt) {
+ writeln(obj_txt["text"]);
+ }
+ debug(sql_html) {
+ writeln(obj_txt["html"]);
+ }
+ } else {
+ // load sql
+ }
+ }
+ return obj_txt;
+ }
+ string[string] verse(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ string[string] obj_txt = [
+ "text": generic_munge_sanitize_text_for_search(obj.text),
+ "html": html_verse(doc_matters, obj)
+ ];
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_sqlite) {
+ debug(sql_txt) {
+ writeln(obj_txt["text"]);
+ }
+ debug(sql_html) {
+ writeln(obj_txt["html"]);
+ }
+ } else {
+ // load sql
+ }
+ }
+ return obj_txt;
+ }
+ string[string] code(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ string[string] obj_txt = [
+ "text": generic_munge_sanitize_text_for_search(obj.text),
+ "html": html_code(obj)
+ ];
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_sqlite) {
+ debug(sql_txt) {
+ writeln(obj_txt["text"]);
+ }
+ debug(sql_html) {
+ writeln(obj_txt["html"]);
+ }
+ } else {
+ // load sql
+ }
+ }
+ return obj_txt;
+ }
+ string[string] table(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ string[string] obj_txt = [
+ "text": generic_munge_sanitize_text_for_search(obj.text),
+ "html": html_table(doc_matters, obj)
+ ];
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_sqlite) {
+ debug(sql_txt) {
+ writeln(obj_txt["text"]);
+ }
+ debug(sql_html) {
+ writeln(obj_txt["html"]);
+ }
+ } else {
+ // load sql
+ }
+ }
+ return obj_txt;
+ }
+ }
+ return sqlite_format_and_load_objects();
+ }
+}
+template SQLiteTablesReCreate() {
+ string SQLiteTablesReCreate()() {
+ string _sql_instruct;
+ _sql_instruct = format(q"┃
+ DROP INDEX IF EXISTS idx_ocn;
+ DROP INDEX IF EXISTS idx_uid;
+ DROP INDEX IF EXISTS idx_digest_clean;
+ DROP INDEX IF EXISTS idx_digest_all;
+ DROP INDEX IF EXISTS idx_clean;
+ DROP INDEX IF EXISTS idx_title;
+ DROP INDEX IF EXISTS idx_author;
+ DROP INDEX IF EXISTS src_filename_base;
+ DROP INDEX IF EXISTS idx_language_document_char;
+ DROP INDEX IF EXISTS idx_classify_topic_register;
+ DROP INDEX IF EXISTS idx_topic_list;
+ DROP TABLE IF EXISTS metadata_and_text;
+ DROP TABLE IF EXISTS topic_register;
+ DROP TABLE IF EXISTS doc_objects;
+ DROP TABLE IF EXISTS urls;
+ CREATE TABLE IF NOT EXISTS metadata_and_text (
+ uid VARCHAR(256) UNIQUE, -- filename, language char, pod/txt (decide on delimiter [,;:/])
+ src_composite_id_per_txt VARCHAR(256) NOT NULL, -- UNIQUE, z pod name if any + src filename + language code
+ src_composite_id_per_pod VARCHAR(256) NOT NULL, -- z pod name if any + src filename
+ title VARCHAR(800) NOT NULL,
+ title_main VARCHAR(400) NOT NULL,
+ title_sub VARCHAR(400) NULL,
+ title_short VARCHAR(400) NULL,
+ title_edition VARCHAR(10) NULL,
+ title_language VARCHAR(100) NULL,
+ title_language_char VARCHAR(6) NULL,
+ creator_author VARCHAR(600) NOT NULL,
+ creator_author_last_first VARCHAR(600) NOT NULL,
+ creator_author_email VARCHAR(100) NULL,
+ creator_author_hon VARCHAR(100) NULL,
+ creator_author_nationality VARCHAR(100) NULL,
+ creator_editor VARCHAR(600) NULL,
+ creator_contributor VARCHAR(600) NULL,
+ creator_illustrator VARCHAR(600) NULL,
+ creator_photographer VARCHAR(600) NULL,
+ creator_translator VARCHAR(600) NULL,
+ creator_prepared_by VARCHAR(600) NULL,
+ creator_digitized_by VARCHAR(600) NULL,
+ creator_audio VARCHAR(600) NULL,
+ creator_video VARCHAR(600) NULL,
+ language_document VARCHAR(100) NULL,
+ language_document_char VARCHAR(6) NOT NULL,
+ language_original VARCHAR(100) NULL,
+ language_original_char VARCHAR(6) NULL,
+ date_added_to_site VARCHAR(10) NULL,
+ date_available VARCHAR(10) NULL,
+ date_created VARCHAR(10) NULL,
+ date_issued VARCHAR(10) NULL,
+ date_modified VARCHAR(10) NULL,
+ date_published VARCHAR(10) NULL,
+ date_valid VARCHAR(10) NULL,
+ date_translated VARCHAR(10) NULL,
+ date_original_publication VARCHAR(10) NULL,
+ date_generated VARCHAR(10) NULL,
+ original_title VARCHAR(800) NULL,
+ original_publisher VARCHAR(600) NULL,
+ original_language VARCHAR(100) NULL,
+ original_language_char VARCHAR(6) NULL,
+ original_source VARCHAR(600) NULL,
+ original_institution VARCHAR(600) NULL,
+ original_nationality VARCHAR(100) NULL,
+ rights_copyright VARCHAR(2500) NULL,
+ rights_copyright_audio VARCHAR(2500) NULL,
+ rights_copyright_cover VARCHAR(2500) NULL,
+ rights_copyright_illustrations VARCHAR(2500) NULL,
+ rights_copyright_photographs VARCHAR(2500) NULL,
+ rights_copyright_text VARCHAR(2500) NULL,
+ rights_copyright_translation VARCHAR(2500) NULL,
+ rights_copyright_video VARCHAR(2500) NULL,
+ rights_license VARCHAR(2500) NULL,
+ identifier_oclc VARCHAR(30) NULL,
+ identifier_isbn VARCHAR(16) NULL,
+ classify_topic_register VARCHAR(2500) NULL,
+ classify_subject VARCHAR(600) NULL,
+ classify_loc VARCHAR(30) NULL,
+ classify_dewey VARCHAR(30) NULL,
+ classify_keywords VARCHAR(600) NULL,
+ notes_abstract TEXT NULL,
+ notes_description TEXT NULL,
+ notes_comment TEXT NULL,
+ notes_coverage VARCHAR(200) NULL,
+ notes_relation VARCHAR(200) NULL,
+ notes_history VARCHAR(600) NULL,
+ notes_type VARCHAR(600) NULL,
+ notes_format VARCHAR(600) NULL,
+ notes_prefix TEXT NULL,
+ notes_prefix_a TEXT NULL,
+ notes_prefix_b TEXT NULL,
+ notes_suffix TEXT NULL,
+ publisher VARCHAR(600) NULL,
+ src_filename_base VARCHAR(256) NOT NULL,
+ src_filename_suffix VARCHAR(6) NOT NULL,
+ src_fingerprint VARCHAR(256) NULL,
+ src_filesize VARCHAR(10) NULL,
+ src_wordcount VARCHAR(10) NULL,
+ pod_name VARCHAR(256) NULL, -- zipped pod, work to be done here
+ pod_fingerprint VARCHAR(256) NULL, -- zipped pod, work to be done here
+ pod_size VARCHAR(10) NULL, -- zipped pod, work to be done here
+ site_url_doc_root VARCHAR(256) NULL, -- url path to doc root
+ site_url_html_toc VARCHAR(256) NULL,
+ site_url_html_scroll VARCHAR(256) NULL,
+ site_url_epub VARCHAR(256) NULL,
+ links TEXT NULL
+ );
+ CREATE TABLE IF NOT EXISTS topic_register (
+ -- tid BIGINT PRIMARY KEY,
+ uid_metadata_and_text VARCHAR(256) REFERENCES metadata_and_text(uid) ON DELETE CASCADE,
+ -- src_composite_id_per_txt VARCHAR(256) NOT NULL, - UNIQUE, - z pod name if any + src filename + language code
+ -- src_composite_id_per_pod VARCHAR(256) NOT NULL, - z pod name if any + src filename
+ topic_register VARCHAR(250) NOT NULL,
+ site_url_doc_root VARCHAR(256) NULL, -- url path to doc root
+ site_url_html_toc VARCHAR(256) NULL,
+ site_url_html_scroll VARCHAR(256) NULL
+ );
+ CREATE TABLE IF NOT EXISTS doc_objects (
+ lid BIGINT PRIMARY KEY,
+ uid_metadata_and_text VARCHAR(256) REFERENCES metadata_and_text(uid) ON DELETE CASCADE,
+ ocn SMALLINT,
+ obj_id VARCHAR(6) NULL,
+ clean TEXT NULL,
+ body TEXT NULL,
+ seg VARCHAR(256) NULL,
+ lev_an VARCHAR(1),
+ is_of_type VARCHAR(16),
+ is_a VARCHAR(16),
+ lev SMALLINT NULL,
+ node VARCHAR(16) NULL,
+ parent VARCHAR(16) NULL,
+ last_descendant VARCHAR(16) NULL, -- headings only
+ digest_clean CHAR(256),
+ digest_all CHAR(256),
+ seg_name CHAR(256),
+ types CHAR(1) NULL
+ );
+ CREATE INDEX IF NOT EXISTS idx_ocn ON doc_objects(ocn);
+ CREATE INDEX IF NOT EXISTS idx_digest_clean ON doc_objects(digest_clean);
+ CREATE INDEX IF NOT EXISTS idx_digest_all ON doc_objects(digest_all);
+ CREATE INDEX IF NOT EXISTS idx_clean ON doc_objects(clean);
+ CREATE INDEX IF NOT EXISTS idx_title ON metadata_and_text(title);
+ CREATE INDEX IF NOT EXISTS idx_author ON metadata_and_text(creator_author_last_first);
+ CREATE INDEX IF NOT EXISTS idx_uid ON metadata_and_text(uid);
+ CREATE INDEX IF NOT EXISTS idx_filename ON metadata_and_text(src_filename_base);
+ CREATE INDEX IF NOT EXISTS idx_language ON metadata_and_text(language_document_char);
+ CREATE INDEX IF NOT EXISTS idx_topics ON metadata_and_text(classify_topic_register);
+ CREATE INDEX IF NOT EXISTS idx_topic_list ON topic_register(topic_register);
+ ┃",);
+ return _sql_instruct;
+ }
+}
+template SQLiteDeleteDocument() {
+ string SQLiteDeleteDocument(M)(
+ M doc_matters,
+ ) {
+ string _uid = doc_matters.src.doc_uid;
+ string _delete_uid = format(q"┃
+ DELETE FROM metadata_and_text
+ WHERE uid = '%s';
+ DELETE FROM doc_objects
+ WHERE uid_metadata_and_text = '%s';
+ ┃",
+ _uid,
+ _uid,
+ );
+ return _delete_uid;
+ }
+}
+template SQLiteInsertMetadata() {
+ string SQLiteInsertMetadata(M)(
+ M doc_matters,
+ ) {
+ string _uid = SQLinsertDelimiter!()(doc_matters.src.doc_uid);
+ string _insert_metadata = format(q"┃
+ INSERT INTO metadata_and_text (
+ uid,
+ src_filename_base,
+ src_filename_suffix,
+ src_composite_id_per_txt,
+ src_composite_id_per_pod,
+ title,
+ title_main,
+ title_sub,
+ title_short,
+ title_edition,
+ title_language,
+ creator_author,
+ creator_author_last_first,
+ creator_author_email,
+ creator_illustrator,
+ creator_translator,
+ language_document,
+ language_document_char,
+ date_added_to_site,
+ date_available,
+ date_created,
+ date_issued,
+ date_modified,
+ date_published,
+ date_valid,
+ rights_copyright,
+ rights_copyright_audio,
+ rights_copyright_cover,
+ rights_copyright_illustrations,
+ rights_copyright_photographs,
+ rights_copyright_text,
+ rights_copyright_translation,
+ rights_copyright_video,
+ rights_license,
+ identifier_oclc,
+ identifier_isbn,
+ classify_dewey,
+ classify_keywords,
+ classify_loc,
+ classify_subject,
+ classify_topic_register,
+ original_title,
+ original_publisher,
+ original_language,
+ original_language_char,
+ original_source,
+ notes_abstract,
+ notes_description,
+ publisher,
+ site_url_doc_root
+ )
+ VALUES (
+ '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s'
+ );
+ ┃",
+ _uid,
+ SQLinsertDelimiter!()(doc_matters.src.filename_base),
+ SQLinsertDelimiter!()(doc_matters.src.filename_extension),
+ SQLinsertDelimiter!()(doc_matters.src.docname_composite_unique_per_src_doc),
+ SQLinsertDelimiter!()(doc_matters.src.docname_composite_unique_per_src_pod),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_full),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_main),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_subtitle),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_short),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_edition),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_language),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.creator_author),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.creator_author_surname_fn),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.creator_author_email),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.creator_illustrator),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.creator_translator),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.language_document),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.language_document_char),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_added_to_site),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_available),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_created),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_issued),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_modified),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_published),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_valid),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_audio),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_cover),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_illustrations),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_photographs),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_text),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_translation),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_video),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_license),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.identifier_oclc),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.identifier_isbn),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_dewey),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_keywords),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_loc),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_subject),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_topic_register),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.notes_abstract),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.notes_description),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_title),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_publisher),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_language),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_language_char),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_source),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.publisher),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.conf.w_srv_data_root_url_html)
+ );
+ return _insert_metadata;
+ }
+}
+template SQLiteInsertMetadataTopics() {
+ string SQLiteInsertMetadataTopics(M)(
+ M doc_matters,
+ ) {
+ string _uid = SQLinsertDelimiter!()(doc_matters.src.doc_uid);
+ string[] _insert_topics;
+ foreach (topic_line; doc_matters.conf_make_meta.meta.classify_topic_register_expanded_arr) {
+ // writeln(topic_line);
+ _insert_topics ~= format(q"┃
+ INSERT INTO topic_register (
+ uid_metadata_and_text,
+ topic_register
+ )
+ VALUES (
+ '%s',
+ '%s'
+ );
+ ┃",
+ _uid,
+ SQLinsertDelimiter!()(topic_line)
+ );
+ }
+ return _insert_topics.join.to!(char[]).toUTF8;
+ }
+}
+template SQLiteInsertDocObjectsLoop() {
+ string SQLiteInsertDocObjectsLoop(D,M)(
+ const D doc_abstraction,
+ M doc_matters,
+ ) {
+ string _uid = SQLinsertDelimiter!()(doc_matters.src.doc_uid);
+ auto url_html = spineUrlsHTML!()(doc_matters.conf_make_meta.conf.w_srv_data_root_url_html, doc_matters.src.language);
+ string insertDocObjectsRow(O)(O obj) {
+ string _insert_doc_objects_row = format(q"┃
+ INSERT INTO doc_objects (
+ uid_metadata_and_text,
+ ocn,
+ obj_id,
+ clean,
+ body,
+ lev,
+ is_of_type,
+ is_a,
+ seg_name
+ )
+ VALUES (
+ '%s', %s, '%s', '%s', '%s', %s, '%s', '%s', '%s'
+ );
+ ┃",
+ _uid,
+ obj.metainfo.ocn,
+ obj.metainfo.identifier,
+ SQLinsertDelimiter!()(obj_txt["text"]),
+ SQLinsertDelimiter!()(obj_txt["html"]),
+ obj.metainfo.heading_lev_markup,
+ obj.metainfo.is_of_type,
+ obj.metainfo.is_a,
+ obj.tags.html_segment_anchor_tag_is
+ );
+ return _insert_doc_objects_row;
+ }
+ auto format_and_sqlite_load = SQLiteFormatAndLoadObject!()(doc_matters);
+ string[string] obj_txt;
+ string doc_text;
+ string[] _insert_doc_objects;
+ foreach (part; doc_matters.has.keys_seq.sql) {
+ foreach (obj; doc_abstraction[part]) {
+ switch (obj.metainfo.is_of_part) {
+ case "frontmatter": assert(part == "head", part);
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "heading":
+ obj_txt = format_and_sqlite_load.heading(doc_matters, obj);
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_sqlite) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_sqlite) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
+ }
+ break;
+ }
+ break;
+ case "body": // assert(part == "body", part);
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "heading":
+ debug (asserts) {
+ if (part != "body") {
+ writeln(__LINE__, ": ", obj.text);
+ }
+ }
+ obj_txt = format_and_sqlite_load.heading(doc_matters, obj);
+ break;
+ case "para":
+ obj_txt = format_and_sqlite_load.para(doc_matters, obj);
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_sqlite) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ case "block":
+ switch (obj.metainfo.is_a) {
+ case "quote":
+ obj_txt = format_and_sqlite_load.quote(doc_matters, obj);
+ break;
+ case "group":
+ obj_txt = format_and_sqlite_load.group(doc_matters, obj);
+ break;
+ case "block":
+ obj_txt = format_and_sqlite_load.block(doc_matters, obj);
+ break;
+ case "poem": // double check on keeping both poem & verse
+ break;
+ case "verse":
+ obj_txt = format_and_sqlite_load.verse(doc_matters, obj);
+ break;
+ case "code":
+ obj_txt = format_and_sqlite_load.code(doc_matters, obj);
+ break;
+ case "table":
+ obj_txt = format_and_sqlite_load.table(doc_matters, obj);
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_sqlite) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_sqlite) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
+ }
+ break;
+ }
+ break;
+ case "backmatter":
+ assert(part == "glossary" || "bibliography" || "bookindex" || "blurb" || "tail", part);
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "heading":
+ obj_txt = format_and_sqlite_load.heading(doc_matters, obj);
+ break;
+ case "glossary": assert(part == "glossary", part);
+ obj_txt = format_and_sqlite_load.para(doc_matters, obj);
+ break;
+ case "bibliography": assert(part == "bibliography", part);
+ obj_txt = format_and_sqlite_load.para(doc_matters, obj);
+ break;
+ case "bookindex": assert(part == "bookindex", part);
+ obj_txt = format_and_sqlite_load.para(doc_matters, obj);
+ break;
+ case "blurb": assert(part == "blurb", part);
+ obj_txt = format_and_sqlite_load.para(doc_matters, obj);
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_sqlite) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_sqlite) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
+ }
+ break;
+ }
+ break;
+ case "comment":
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do_sqlite) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); // check where empty value could come from
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ writeln(__FILE__, ":", __LINE__, ": ", obj.text); // check where empty value could come from
+ }
+ }
+ break;
+ }
+ if (obj.metainfo.is_a == "heading") {
+ if (doc_matters.opt.action.show_sqlite) {
+ if (obj.metainfo.heading_lev_markup == 0) {
+ writeln(doc_matters.src.filename);
+ }
+ writeln(
+ "markup: ", obj.metainfo.heading_lev_markup,
+ "> ", obj.metainfo.dom_structure_markedup_tags_status,
+ "; collapsed: ", obj.metainfo.heading_lev_collapsed,
+ "> ", obj.metainfo.dom_structure_collapsed_tags_status,
+ "; ocn: ", obj.metainfo.ocn,
+ " node: ", obj.metainfo.node,
+ "; parent: ", obj.metainfo.parent_lev_markup,
+ "; ocn: ", obj.metainfo.parent_ocn,
+ "; ",
+ );
+ }
+ }
+ if (!(obj.metainfo.is_a == "comment")) {
+ _insert_doc_objects ~= insertDocObjectsRow(obj);
+ }
+ } // loop closes
+ }
+ return _insert_doc_objects.join.to!(char[]).toUTF8;
+ }
+}
+template SQLiteTablesCreate() {
+ void SQLiteTablesCreate(E,O,C)(E env, O opt_action, C config) {
+ import d2sqlite3;
+ template SQLiteTablesReCreate() {
+ string SQLiteTablesReCreate()() {
+ string _sql_instruct;
+ _sql_instruct = format(q"┃
+ DROP INDEX IF EXISTS idx_ocn;
+ DROP INDEX IF EXISTS idx_uid;
+ DROP INDEX IF EXISTS idx_digest_clean;
+ DROP INDEX IF EXISTS idx_digest_all;
+ DROP INDEX IF EXISTS idx_clean;
+ DROP INDEX IF EXISTS idx_title;
+ DROP INDEX IF EXISTS idx_author;
+ DROP INDEX IF EXISTS src_filename_base;
+ DROP INDEX IF EXISTS idx_language_document_char;
+ DROP INDEX IF EXISTS idx_classify_topic_register;
+ DROP INDEX IF EXISTS idx_topic_list;
+ DROP TABLE IF EXISTS metadata_and_text;
+ DROP TABLE IF EXISTS topic_register;
+ DROP TABLE IF EXISTS doc_objects;
+ DROP TABLE IF EXISTS urls;
+ CREATE TABLE IF NOT EXISTS metadata_and_text (
+ uid VARCHAR(256) UNIQUE, -- filename, language char, pod/txt (decide on delimiter [,;:/])
+ src_composite_id_per_txt VARCHAR(256) NOT NULL, -- UNIQUE, z pod name if any + src filename + language code
+ src_composite_id_per_pod VARCHAR(256) NOT NULL, -- z pod name if any + src filename
+ title VARCHAR(800) NOT NULL,
+ title_main VARCHAR(400) NOT NULL,
+ title_sub VARCHAR(400) NULL,
+ title_short VARCHAR(400) NULL,
+ title_edition VARCHAR(10) NULL,
+ title_language VARCHAR(100) NULL,
+ title_language_char VARCHAR(6) NULL,
+ creator_author VARCHAR(600) NOT NULL,
+ creator_author_last_first VARCHAR(600) NOT NULL,
+ creator_author_email VARCHAR(100) NULL,
+ creator_author_hon VARCHAR(100) NULL,
+ creator_author_nationality VARCHAR(100) NULL,
+ creator_editor VARCHAR(600) NULL,
+ creator_contributor VARCHAR(600) NULL,
+ creator_illustrator VARCHAR(600) NULL,
+ creator_photographer VARCHAR(600) NULL,
+ creator_translator VARCHAR(600) NULL,
+ creator_prepared_by VARCHAR(600) NULL,
+ creator_digitized_by VARCHAR(600) NULL,
+ creator_audio VARCHAR(600) NULL,
+ creator_video VARCHAR(600) NULL,
+ language_document VARCHAR(100) NULL,
+ language_document_char VARCHAR(6) NOT NULL,
+ language_original VARCHAR(100) NULL,
+ language_original_char VARCHAR(6) NULL,
+ date_added_to_site VARCHAR(10) NULL,
+ date_available VARCHAR(10) NULL,
+ date_created VARCHAR(10) NULL,
+ date_issued VARCHAR(10) NULL,
+ date_modified VARCHAR(10) NULL,
+ date_published VARCHAR(10) NULL,
+ date_valid VARCHAR(10) NULL,
+ date_translated VARCHAR(10) NULL,
+ date_original_publication VARCHAR(10) NULL,
+ date_generated VARCHAR(10) NULL,
+ original_title VARCHAR(800) NULL,
+ original_publisher VARCHAR(600) NULL,
+ original_language VARCHAR(100) NULL,
+ original_language_char VARCHAR(6) NULL,
+ original_source VARCHAR(600) NULL,
+ original_institution VARCHAR(600) NULL,
+ original_nationality VARCHAR(100) NULL,
+ rights_copyright VARCHAR(2500) NULL,
+ rights_copyright_audio VARCHAR(2500) NULL,
+ rights_copyright_cover VARCHAR(2500) NULL,
+ rights_copyright_illustrations VARCHAR(2500) NULL,
+ rights_copyright_photographs VARCHAR(2500) NULL,
+ rights_copyright_text VARCHAR(2500) NULL,
+ rights_copyright_translation VARCHAR(2500) NULL,
+ rights_copyright_video VARCHAR(2500) NULL,
+ rights_license VARCHAR(2500) NULL,
+ identifier_oclc VARCHAR(30) NULL,
+ identifier_isbn VARCHAR(16) NULL,
+ classify_topic_register VARCHAR(2500) NULL,
+ classify_subject VARCHAR(600) NULL,
+ classify_loc VARCHAR(30) NULL,
+ classify_dewey VARCHAR(30) NULL,
+ classify_keywords VARCHAR(600) NULL,
+ notes_abstract TEXT NULL,
+ notes_description TEXT NULL,
+ notes_comment TEXT NULL,
+ notes_coverage VARCHAR(200) NULL,
+ notes_relation VARCHAR(200) NULL,
+ notes_history VARCHAR(600) NULL,
+ notes_type VARCHAR(600) NULL,
+ notes_format VARCHAR(600) NULL,
+ notes_prefix TEXT NULL,
+ notes_prefix_a TEXT NULL,
+ notes_prefix_b TEXT NULL,
+ notes_suffix TEXT NULL,
+ publisher VARCHAR(600) NULL,
+ src_filename_base VARCHAR(256) NOT NULL,
+ src_filename_suffix VARCHAR(6) NOT NULL,
+ src_fingerprint VARCHAR(256) NULL,
+ src_filesize VARCHAR(10) NULL,
+ src_wordcount VARCHAR(10) NULL,
+ pod_name VARCHAR(256) NULL, -- zipped pod, work to be done here
+ pod_fingerprint VARCHAR(256) NULL, -- zipped pod, work to be done here
+ pod_size VARCHAR(10) NULL, -- zipped pod, work to be done here
+ site_url_doc_root VARCHAR(256) NULL, -- url path to doc root
+ site_url_html_toc VARCHAR(256) NULL,
+ site_url_html_scroll VARCHAR(256) NULL,
+ site_url_epub VARCHAR(256) NULL,
+ links TEXT NULL
+ );
+ CREATE TABLE IF NOT EXISTS topic_register (
+ -- tid BIGINT PRIMARY KEY,
+ uid_metadata_and_text VARCHAR(256) REFERENCES metadata_and_text(uid) ON DELETE CASCADE,
+ -- src_composite_id_per_txt VARCHAR(256) NOT NULL, - UNIQUE, - z pod name if any + src filename + language code
+ -- src_composite_id_per_pod VARCHAR(256) NOT NULL, - z pod name if any + src filename
+ topic_register VARCHAR(250) NOT NULL,
+ site_url_doc_root VARCHAR(256) NULL, -- url path to doc root
+ site_url_html_toc VARCHAR(256) NULL,
+ site_url_html_scroll VARCHAR(256) NULL
+ );
+ CREATE TABLE IF NOT EXISTS doc_objects (
+ lid BIGINT PRIMARY KEY,
+ uid_metadata_and_text VARCHAR(256) REFERENCES metadata_and_text(uid) ON DELETE CASCADE,
+ ocn SMALLINT,
+ obj_id VARCHAR(6) NULL,
+ clean TEXT NULL,
+ body TEXT NULL,
+ seg VARCHAR(256) NULL,
+ lev_an VARCHAR(1),
+ is_of_type VARCHAR(16),
+ is_a VARCHAR(16),
+ lev SMALLINT NULL,
+ node VARCHAR(16) NULL,
+ parent VARCHAR(16) NULL,
+ last_descendant VARCHAR(16) NULL, -- headings only
+ digest_clean CHAR(256),
+ digest_all CHAR(256),
+ seg_name CHAR(256),
+ types CHAR(1) NULL
+ );
+ CREATE INDEX IF NOT EXISTS idx_ocn ON doc_objects(ocn);
+ CREATE INDEX IF NOT EXISTS idx_digest_clean ON doc_objects(digest_clean);
+ CREATE INDEX IF NOT EXISTS idx_digest_all ON doc_objects(digest_all);
+ CREATE INDEX IF NOT EXISTS idx_clean ON doc_objects(clean);
+ CREATE INDEX IF NOT EXISTS idx_title ON metadata_and_text(title);
+ CREATE INDEX IF NOT EXISTS idx_author ON metadata_and_text(creator_author_last_first);
+ CREATE INDEX IF NOT EXISTS idx_uid ON metadata_and_text(uid);
+ CREATE INDEX IF NOT EXISTS idx_filename ON metadata_and_text(src_filename_base);
+ CREATE INDEX IF NOT EXISTS idx_language ON metadata_and_text(language_document_char);
+ CREATE INDEX IF NOT EXISTS idx_topics ON metadata_and_text(classify_topic_register);
+ CREATE INDEX IF NOT EXISTS idx_topic_list ON topic_register(topic_register);
+ ┃",);
+ return _sql_instruct;
+ }
+ }
+ try {
+ if (opt_action.sqlite_db_create) {
+ string _db_statement;
+ string db_filename = (opt_action.sqliteDB_filename.length > 0)
+ ? opt_action.sqliteDB_filename
+ : (config.conf.w_srv_db_sqlite_filename.length > 0)
+ ? config.conf.w_srv_db_sqlite_filename
+ : "";
+ string db_path = (opt_action.sqliteDB_path.length > 0)
+ ? opt_action.sqliteDB_path
+ : (config.conf.w_srv_db_sqlite_path.length > 0)
+ ? config.conf.w_srv_db_sqlite_path
+ : "";
+ if (db_filename.length > 0 && db_path.length > 0) {
+ if (opt_action.vox_gt2) {
+ writeln("db name: ", db_filename);
+ writeln("db path: ", db_path);
+ writeln("db name & path: ", db_path, "/", db_filename);
+ }
+ if (opt_action.vox_gt1) {
+ writeln("attempting to create db: ", db_path, "/", db_filename);
+ }
+ auto pth_sqlite = spinePathsSQLite!()(db_filename, db_path);
+ if ((isValidPath(pth_sqlite.base) && exists(pth_sqlite.base) != 0 && pth_sqlite.base.isDir)) {
+ } else {
+ try {
+ pth_sqlite.base.mkdirRecurse;
+ } catch (FileException ex) { }
+ }
+ auto db = Database(pth_sqlite.sqlite_file);
+ {
+ _db_statement ~= SQLiteTablesReCreate!()();
+ }
+ SQLiteDbRun!()(db, _db_statement, opt_action, "TABLE RE-CREATE");
+ } else {
+ writeln("must provide db name & output root path either on the command line or in configuration file");
+ writeln("db name: ", db_filename);
+ writeln("db path: ", db_path);
+ }
+ }
+ }
+ catch (FileException e) {
+ writeln("Failed (FileException): ", e.msg);
+ writeln(e.file, " line: ", e.line);
+ import core.runtime;
+ core.runtime.Runtime.terminate();
+ }
+ catch (ErrnoException e) {
+ writeln("Failed (ErrnoException): ", e.msg);
+ writeln(e.file, " line: ", e.line);
+ import core.runtime;
+ core.runtime.Runtime.terminate();
+ }
+ catch (Exception e) {
+ writeln("Failed (Exception): ", e.msg);
+ writeln(e.file, " line: ", e.line);
+ import core.runtime;
+ core.runtime.Runtime.terminate();
+ }
+ catch (Throwable) {
+ import core.runtime;
+ core.runtime.Runtime.terminate();
+ }
+ }
+}
+template SQLiteDbDrop() {
+ void SQLiteDbDrop(O,C)(O opt_action, C config) {
+ writeln("db drop");
+ if ((opt_action.sqlite_db_drop)) {
+ string db_filename = (opt_action.sqliteDB_filename.length > 0)
+ ? opt_action.sqliteDB_filename
+ : (config.conf.w_srv_db_sqlite_filename.length > 0)
+ ? config.conf.w_srv_db_sqlite_filename
+ : "";
+ string db_path = (opt_action.sqliteDB_path.length > 0) //
+ ? opt_action.sqliteDB_path
+ : (config.conf.w_srv_db_sqlite_path.length > 0)
+ ? config.conf.w_srv_db_sqlite_path
+ : "";
+ if (db_filename.length > 0 && db_path.length > 0) {
+ auto pth_sqlite = spinePathsSQLite!()(db_filename, db_path);
+ writeln("remove(", pth_sqlite.sqlite_file, ")");
+ try {
+ remove(pth_sqlite.sqlite_file);
+ } catch (FileException ex) {
+ // handle error
+ }
+ } else {
+ writeln("must provide db name & output root path either on the command line or in configuration file");
+ writeln("db name: ", db_filename);
+ writeln("db path: ", db_path);
+ }
+ }
+ }
+}
diff --git a/src/sisudoc/io_out/xmls.d b/src/sisudoc/io_out/xmls.d
new file mode 100644
index 0000000..c268bb7
--- /dev/null
+++ b/src/sisudoc/io_out/xmls.d
@@ -0,0 +1,1424 @@
+/+
+- Name: SisuDoc 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 sisudoc.io_out.xmls;
+@safe:
+template outputXHTMLs() {
+ import
+ std.file,
+ std.outbuffer,
+ std.uri,
+ std.conv : to;
+ import
+ sisudoc.io_out,
+ sisudoc.io_out.rgx,
+ sisudoc.meta.rgx_files,
+ sisudoc.io_out.rgx_xhtml,
+ sisudoc.io_out.create_zip_file,
+ sisudoc.io_out.xmls,
+ sisudoc.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;
+ }
+ }
+}
diff --git a/src/sisudoc/io_out/xmls_css.d b/src/sisudoc/io_out/xmls_css.d
new file mode 100644
index 0000000..e9f38e6
--- /dev/null
+++ b/src/sisudoc/io_out/xmls_css.d
@@ -0,0 +1,4451 @@
+/+
+- Name: SisuDoc 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/]
+
++/
+/++
+ default css settings
++/
+module sisudoc.io_out.xmls_css;
+@safe:
+template spineCss() {
+ import std.format;
+ auto spineCss(M)(M doc_matters) {
+ string _css_indent = format(q"┃
+/* indent */
+p.norm { }
+p.i1 { padding-left : 1em; }
+p.i2 { padding-left : 2em; }
+p.i3 { padding-left : 3em; }
+p.i4 { padding-left : 4em; }
+p.i5 { padding-left : 5em; }
+p.i6 { padding-left : 6em; }
+p.i7 { padding-left : 7em; }
+p.i8 { padding-left : 8em; }
+p.i9 { padding-left : 9em; }
+/* hanging indent */
+p[indent="h0i0"] {
+ padding-left : 0em;
+ text-indent : 0em;
+}
+p[indent="h0i1"] {
+ padding-left : 1em;
+ text-indent : -1em;
+}
+p[indent="h0i2"] {
+ padding-left : 2em;
+ text-indent : -2em;
+}
+p[indent="h0i3"] {
+ padding-left : 3em;
+ text-indent : -3em;
+}
+p[indent="h0i4"] {
+ padding-left : 4em;
+ text-indent : -4em;
+}
+p[indent="h0i5"] {
+ padding-left : 5em;
+ text-indent : -5em;
+}
+p[indent="h0i6"] {
+ padding-left : 6em;
+ text-indent : -6em;
+}
+p[indent="h0i7"] {
+ padding-left : 7em;
+ text-indent : -7em;
+}
+p[indent="h0i8"] {
+ padding-left : 8em;
+ text-indent : -8em;
+}
+p[indent="h0i9"] {
+ padding-left : 9em;
+ text-indent : -9em;
+}
+p[indent="h1i0"] {
+ padding-left : 0em;
+ text-indent : 1em;
+}
+p[indent="h1i1"] {
+ padding-left : 1em;
+ text-indent : 0em;
+}
+p[indent="h1i2"] {
+ padding-left : 2em;
+ text-indent : -1em;
+}
+p[indent="h1i3"] {
+ padding-left : 3em;
+ text-indent : -2em;
+}
+p[indent="h1i4"] {
+ padding-left : 4em;
+ text-indent : -3em;
+}
+p[indent="h1i5"] {
+ padding-left : 5em;
+ text-indent : -4em;
+}
+p[indent="h1i6"] {
+ padding-left : 6em;
+ text-indent : -5em;
+}
+p[indent="h1i7"] {
+ padding-left : 7em;
+ text-indent : -6em;
+}
+p[indent="h1i8"] {
+ padding-left : 8em;
+ text-indent : -7em;
+}
+p[indent="h1i9"] {
+ padding-left : 9em;
+ text-indent : -8em;
+}
+p[indent="h2i0"] {
+ padding-left : 0em;
+ text-indent : 2em;
+}
+p[indent="h2i1"] {
+ padding-left : 1em;
+ text-indent : 1em;
+}
+p[indent="h2i2"] {
+ padding-left : 2em;
+ text-indent : 0em;
+}
+p[indent="h2i3"] {
+ padding-left : 3em;
+ text-indent : -1em;
+}
+p[indent="h2i4"] {
+ padding-left : 4em;
+ text-indent : -2em;
+}
+p[indent="h2i5"] {
+ padding-left : 5em;
+ text-indent : -3em;
+}
+p[indent="h2i6"] {
+ padding-left : 6em;
+ text-indent : -4em;
+}
+p[indent="h2i7"] {
+ padding-left : 7em;
+ text-indent : -5em;
+}
+p[indent="h2i8"] {
+ padding-left : 8em;
+ text-indent : -6em;
+}
+p[indent="h2i9"] {
+ padding-left : 9em;
+ text-indent : -7em;
+}
+p[indent="h3i0"] {
+ padding-left : 0em;
+ text-indent : 3em;
+}
+p[indent="h3i1"] {
+ padding-left : 1em;
+ text-indent : 2em;
+}
+p[indent="h3i2"] {
+ padding-left : 2em;
+ text-indent : 1em;
+}
+p[indent="h3i3"] {
+ padding-left : 3em;
+ text-indent : 0em;
+}
+p[indent="h3i4"] {
+ padding-left : 4em;
+ text-indent : -1em;
+}
+p[indent="h3i5"] {
+ padding-left : 5em;
+ text-indent : -2em;
+}
+p[indent="h3i6"] {
+ padding-left : 6em;
+ text-indent : -3em;
+}
+p[indent="h3i7"] {
+ padding-left : 7em;
+ text-indent : -4em;
+}
+p[indent="h3i8"] {
+ padding-left : 8em;
+ text-indent : -5em;
+}
+p[indent="h3i9"] {
+ padding-left : 9em;
+ text-indent : -6em;
+}
+p[indent="h4i0"] {
+ padding-left : 0em;
+ text-indent : 4em;
+}
+p[indent="h4i1"] {
+ padding-left : 1em;
+ text-indent : 3em;
+}
+p[indent="h4i2"] {
+ padding-left : 2em;
+ text-indent : 2em;
+}
+p[indent="h4i3"] {
+ padding-left : 3em;
+ text-indent : 1em;
+}
+p[indent="h4i4"] {
+ padding-left : 4em;
+ text-indent : 0em;
+}
+p[indent="h4i5"] {
+ padding-left : 5em;
+ text-indent : -1em;
+}
+p[indent="h4i6"] {
+ padding-left : 6em;
+ text-indent : -2em;
+}
+p[indent="h4i7"] {
+ padding-left : 7em;
+ text-indent : -3em;
+}
+p[indent="h4i8"] {
+ padding-left : 8em;
+ text-indent : -4em;
+}
+p[indent="h4i9"] {
+ padding-left : 9em;
+ text-indent : -5em;
+}
+p[indent="h5i0"] {
+ padding-left : 0em;
+ text-indent : 5em;
+}
+p[indent="h5i1"] {
+ padding-left : 1em;
+ text-indent : 4em;
+}
+p[indent="h5i2"] {
+ padding-left : 2em;
+ text-indent : 3em;
+}
+p[indent="h5i3"] {
+ padding-left : 3em;
+ text-indent : 2em;
+}
+p[indent="h5i4"] {
+ padding-left : 4em;
+ text-indent : 1em;
+}
+p[indent="h5i5"] {
+ padding-left : 5em;
+ text-indent : 0em;
+}
+p[indent="h5i6"] {
+ padding-left : 6em;
+ text-indent : -1em;
+}
+p[indent="h5i7"] {
+ padding-left : 7em;
+ text-indent : -2em;
+}
+p[indent="h5i8"] {
+ padding-left : 8em;
+ text-indent : -3em;
+}
+p[indent="h5i9"] {
+ padding-left : 9em;
+ text-indent : -4em;
+}
+p[indent="h6i0"] {
+ padding-left : 0em;
+ text-indent : 6em;
+}
+p[indent="h6i1"] {
+ padding-left : 1em;
+ text-indent : 5em;
+}
+p[indent="h6i2"] {
+ padding-left : 2em;
+ text-indent : 4em;
+}
+p[indent="h6i3"] {
+ padding-left : 3em;
+ text-indent : 3em;
+}
+p[indent="h6i4"] {
+ padding-left : 4em;
+ text-indent : 2em;
+}
+p[indent="h6i5"] {
+ padding-left : 5em;
+ text-indent : 1em;
+}
+p[indent="h6i6"] {
+ padding-left : 6em;
+ text-indent : 0em;
+}
+p[indent="h6i7"] {
+ padding-left : 7em;
+ text-indent : -1em;
+}
+p[indent="h6i8"] {
+ padding-left : 8em;
+ text-indent : -2em;
+}
+p[indent="h6i9"] {
+ padding-left : 9em;
+ text-indent : -3em;
+}
+p[indent="h7i0"] {
+ padding-left : 0em;
+ text-indent : 7em;
+}
+p[indent="h7i1"] {
+ padding-left : 1em;
+ text-indent : 6em;
+}
+p[indent="h7i2"] {
+ padding-left : 2em;
+ text-indent : 5em;
+}
+p[indent="h7i3"] {
+ padding-left : 3em;
+ text-indent : 4em;
+}
+p[indent="h7i4"] {
+ padding-left : 4em;
+ text-indent : 3em;
+}
+p[indent="h7i5"] {
+ padding-left : 5em;
+ text-indent : 2em;
+}
+p[indent="h7i6"] {
+ padding-left : 6em;
+ text-indent : 1em;
+}
+p[indent="h7i7"] {
+ padding-left : 7em;
+ text-indent : 0em;
+}
+p[indent="h7i8"] {
+ padding-left : 8em;
+ text-indent : -1em;
+}
+p[indent="h7i9"] {
+ padding-left : 9em;
+ text-indent : -2em;
+}
+p[indent="h8i0"] {
+ padding-left : 0em;
+ text-indent : 8em;
+}
+p[indent="h8i1"] {
+ padding-left : 1em;
+ text-indent : 7em;
+}
+p[indent="h8i2"] {
+ padding-left : 2em;
+ text-indent : 6em;
+}
+p[indent="h8i3"] {
+ padding-left : 3em;
+ text-indent : 5em;
+}
+p[indent="h8i4"] {
+ padding-left : 4em;
+ text-indent : 4em;
+}
+p[indent="h8i5"] {
+ padding-left : 5em;
+ text-indent : 3em;
+}
+p[indent="h8i6"] {
+ padding-left : 6em;
+ text-indent : 2em;
+}
+p[indent="h8i7"] {
+ padding-left : 7em;
+ text-indent : 1em;
+}
+p[indent="h8i8"] {
+ padding-left : 8em;
+ text-indent : 0em;
+}
+p[indent="h8i9"] {
+ padding-left : 9em;
+ text-indent : -1em;
+}
+p[indent="h9i0"] {
+ padding-left : 0em;
+ text-indent : 9em;
+}
+p[indent="h9i1"] {
+ padding-left : 1em;
+ text-indent : 8em;
+}
+p[indent="h9i2"] {
+ padding-left : 2em;
+ text-indent : 7em;
+}
+p[indent="h9i3"] {
+ padding-left : 3em;
+ text-indent : 6em;
+}
+p[indent="h9i4"] {
+ padding-left : 4em;
+ text-indent : 5em;
+}
+p[indent="h9i5"] {
+ padding-left : 5em;
+ text-indent : 4em;
+}
+p[indent="h9i6"] {
+ padding-left : 6em;
+ text-indent : 3em;
+}
+p[indent="h9i7"] {
+ padding-left : 7em;
+ text-indent : 2em;
+}
+p[indent="h9i8"] {
+ padding-left : 8em;
+ text-indent : 1em;
+}
+p[indent="h9i9"] {
+ padding-left : 9em;
+ text-indent : 0em;
+}
+┃");
+string _color_ocn_light = (doc_matters.opt.action.ocn_hidden) ? "#FFFFFF" : "#777777";
+string _color_ocn_dark = (doc_matters.opt.action.ocn_hidden) ? "#000000" : "#BBBBBB";
+ string _css_light_html_seg = format(q"┃
+html {
+ font-size : 62.5%%;
+}
+*{
+ padding : 0px;
+ margin : 0px;
+}
+body {
+ height : 100vh;
+ font-size : 1.6rem;
+ background-color : #FFFFFF;
+ color : #000000;
+ background : #FFFFFF;
+ background-color : #FFFFFF;
+}
+a:link {
+ color : #003399;
+ text-decoration : none;
+}
+a:visited {
+ color : #003399;
+ text-decoration : none;
+}
+a:hover {
+ color : #000000;
+ background-color : #F9F9AA;
+}
+a.lnkocn:link {
+ color : %s;
+ text-decoration : none;
+}
+a.lnkocn:visited {
+ color : #32CD32;
+ text-decoration : none;
+}
+a.lnkocn:hover {
+ color : #777777;
+ font-size : 1.8rem;
+}
+a.lnkicon:link {
+ text-decoration : none;
+}
+a.lnkicon:visited {
+ text-decoration : none;
+}
+a.lnkicon:hover {
+ font-size : 160%%;
+}
+a:hover img {
+ background-color : #FFFFFF;
+}
+a:active {
+ color : #003399;
+ text-decoration : underline;
+}
+input {
+ color : #000000;
+ background-color : #FFFFFF;
+}
+div {
+ margin-left : 0;
+ margin-right : 0;
+}
+div.p {
+ margin-left : 5%%;
+ margin-right : 1%%;
+}
+div.substance {
+ width : 100%%;
+ background-color : #FFFFFF;
+}
+div.ocn {
+ width : 5%%;
+ float : right;
+ top : 0;
+ background-color : #FFFFFF;
+}
+div.endnote {
+ width : 95%%;
+ background-color : #FFFFFF;
+}
+div.toc {
+ position : absolute;
+ float : left;
+ margin : 0;
+ padding : 0;
+ padding-top : 0.5em;
+ border : 0;
+ width : 13em;
+ background-color : #EEEEEE;
+ margin-right : 1em;
+}
+div.summary {
+ margin : 0;
+ padding : 0;
+ border-left : 13em solid #EEEEEE;
+ padding-left : 1em;
+ background-color : #EEEEEE;
+}
+div.content, div.main_column {
+ margin : 0;
+ padding : 0;
+ border-left : 13em solid #FFFFFF;
+ padding-left : 1em;
+ padding-right : 1em;
+}
+div.content0, div.main_column0 {
+ margin : 0;
+ padding : 0;
+ border-left : 0%% solid #FFFFFF;
+ padding-left : 5%%;
+}
+div.scroll {
+ margin : 0;
+ padding : 0;
+ padding-left : 1em;
+ padding-right : 1em;
+}
+div.content:after {
+ content : ' ';
+ clear : both;
+ display : block;
+ height : 0;
+ overflow : hidden;
+}
+div.footer {
+ clear : left;
+ padding : 0.5em;
+ font-size : 1.4rem;
+ margin : 0;
+}
+div.toc ul {
+ list-style : none;
+ padding : 0;
+ margin : 0;
+}
+div.toc li ul a, li ul span.currentlink
+{
+ font-weight : normal;
+ font-size : 1.5rem;
+ padding-left : 2em;
+ background-color : #EEEEEE;
+}
+div.toc a, span.currentlink{
+ display : block;
+ text-decoration : none;
+ padding-left : 0.5em;
+ color : #0000aa;
+}
+hr {
+ width : 90%%;
+ margin-left : 5%%;
+ margin-right : 2em;
+ margin-top : 1.8em;
+ margin-bottom : 1.8em;
+}
+span.currentlink {
+ text-decoration : none;
+ background-color : #AAAAAA;
+}
+div.toc a:visited {
+ color : #0000aa;
+}
+div.toc a:hover {
+ color : #000000;
+ background-color : #F9F9AA;
+}
+nav#toc ol {
+ list-style-type : none;
+}
+.norm, .bold, .verse, .group, .block, .alt {
+ line-height : 133%%;
+ margin-top : 12px;
+ margin-bottom : 0px;
+ padding-left : 0em;
+ text-indent : 0em;
+}
+p, h0, h1, h2, h3, h4, h5, h6, h7, ul, li {
+ display : block;
+ font-family : verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman;
+ margin-left : 5%%;
+ margin-right : 2em;
+}
+p {
+ font-size : 1.6rem;
+ font-weight : normal;
+ line-height : 133%%;
+ text-align : justify;
+ text-indent : 0mm;
+ margin-top : 0.8em;
+ margin-bottom : 0.8em;
+}
+img {
+ max-width : 100%%;
+ height : auto;
+}
+pre {
+ width : auto;
+ display : block;
+ clear : both;
+ color : #555555;
+}
+pre.codeline {
+ display : table;
+ clear : both;
+ table-layout : fixed;
+ margin-left : 5%%;
+ margin-right : 5%%;
+ width : 90%%;
+ white-space : pre-wrap;
+ border-style : none;
+ border-radius : 5px 5px 5px 5px;
+ box-shadow : 0 2px 5px #AAAAAA inset;
+ margin-bottom : 1em;
+ padding : 0.5em 1em;
+ page-break-inside : avoid;
+ word-wrap : break-word;
+ font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
+ white-space : pre;
+ white-space : pre-wrap;
+ white-space : -moz-pre-wrap;
+ white-space : -o-pre-wrap;
+ background-color : #EEEEEE;
+ color : #000000;
+ font-size : 1.5rem;
+ line-height : 100%%;
+}
+pre.codeline::before {
+ counter-reset : linenum;
+}
+pre.codeline span.tr {
+ display : table-row;
+ counter-increment : linenum;
+}
+pre.codeline span.th {
+ display : table-cell;
+ user-select : none;
+ -moz-user-select : none;
+ -webkit-user-select : none;
+ padding : 0.5em 0.5em;
+ /* background-color : #666666; */
+}
+pre.codeline span.th::before {
+ content : counter(linenum) ".";
+ color : #999999;
+ text-align : right;
+ display : block;
+}
+pre.codeline span.th {
+ width : 4em;
+}
+pre.codeline code {
+ display : table-cell;
+}
+p.code {
+ border-style : none;
+}
+p.spaced { white-space : pre; }
+p.block {
+ white-space : pre;
+}
+p.group { }
+p.alt { }
+p.verse {
+ white-space : pre;
+ margin-bottom : 6px;
+}
+p.caption {
+ text-align : left;
+ font-size : 1.4rem;
+ display : inline;
+}
+p.endnote {
+ font-size : 1.55rem;
+ line-height : 120%%;
+ text-align : left;
+ margin-right : 15mm;
+ padding-left : 1em;
+ text-indent : -1em;
+}
+p.center {
+ text-align : center;
+}
+p.bold {
+ font-weight : bold;
+}
+p.bold_left {
+ font-weight : bold;
+ text-align : left;
+}
+p.centerbold {
+ text-align : center;
+ font-weight : bold;
+}
+p.em {
+ font-weight : bold;
+ font-style : normal;
+ background : #FFF3B6;
+}
+.small, .small_center {
+ font-size : 1.4rem;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ margin-right : 6px;
+}
+p.small {
+ text-align : left;
+}
+p.small_center {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : center;
+}
+.tiny, .tiny_left, .tiny_right, .tiny_center {
+ font-size : 1.2rem;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ color : #777777;
+ margin-right : 6px;
+ text-align : left;
+}
+p.tiny { }
+p.tiny_left {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : left;
+}
+p.tiny_right {
+ margin-right : 1em;
+ text-align : right;
+}
+p.tiny_center {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : center;
+}
+p.icons, .icons_center {
+ font-size : 100%%;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ margin-right : 6px;
+}
+p.icons {
+ text-align : left;
+}
+p.concordance_word {
+ line-height : 150%%;
+ font-weight : bold;
+ display : inline;
+ margin-top : 4px;
+ margin-bottom : 1px;
+}
+p.concordance_count {
+ font-size : 1.4rem;
+ color : #777777;
+ display : inline;
+ margin-left : 0em;
+}
+p.concordance_object {
+ font-size : 1.4rem;
+ line-height : 120%%;
+ text-align : left;
+ margin-left : 3em;
+ margin-top : 1px;
+ margin-bottom : 3px;
+}
+p.book_index_lev1 {
+ line-height : 100%%;
+ margin-top : 4px;
+ margin-bottom : 1px;
+}
+p.book_index_lev2 {
+ line-height : 100%%;
+ text-align : left;
+ margin-left : 3em;
+ margin-top : 1px;
+ margin-bottom : 3px;
+}
+tt {
+ font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
+ background-color : #EEEEEE;
+ color : #000000;
+}
+%s
+note { white-space : pre; }
+label.ocn {
+ width : 2%%;
+ float : right;
+ top : 0;
+ font-size : 1.4rem;
+ margin-top : 0px;
+ margin-bottom : 6px;
+ margin-right : 6px;
+ text-align : right;
+ color : %s;
+ -khtml-user-select : none;
+ -moz-user-select : none;
+ -ms-user-select : none;
+ -o-user-select : none;
+ -webkit-user-select : none;
+ user-select : none;
+}
+table {
+ display : block;
+ margin-left : 5%%;
+ margin-right : 2em;
+ background-color : inherit;
+}
+tr { }
+th,td {
+ vertical-align : top;
+ text-align : left;
+}
+th {
+ font-weight : bold;
+}
+em {
+ font-weight : bold;
+ font-style : italic;
+}
+p.left,th.left,td.left {
+ text-align : left;
+}
+p.small_left,th.small_left,td.small_left {
+ text-align : left;
+ font-size : 1.4rem;
+}
+p.right,th.right,td.right {
+ text-align : right;
+}
+ul, li {
+ list-style-type : none;
+ list-style : none;
+ padding-left : 20px;
+ font-weight : normal;
+ line-height : 150%%;
+ text-align : left;
+ text-indent : 0mm;
+ margin-left : 1em;
+ margin-right : 2em;
+ margin-top : 3px;
+ margin-bottom : 3px;
+}
+li {
+ background : url(../image_sys/bullet_09.png) no-repeat 0px 6px;
+}
+ul { }
+h0, h1, h2, h3, h4, h5, h6, h7 {
+ font-weight : bold;
+ line-height : 120%%;
+ text-align : left;
+ margin-top : 20px;
+ margin-bottom : 10px;
+}
+h4.norm, h5.norm, h6.norm, h7.norm {
+ margin-top : 10px;
+ margin-bottom : 0px;
+}
+h0 { font-size : 1.85rem; }
+h1 { font-size : 1.8rem; }
+h2 { font-size : 1.75rem; }
+h3 { font-size : 1.7rem; }
+h4 { font-size : 1.65rem; }
+h5 { font-size : 1.6rem; }
+h6 { font-size : 1.55rem; }
+h7 { font-size : 1.5rem; }
+h0, h1, h2, h3, h4, h5, h6, h7 {
+ text-shadow : .2em .2em .3em #808080;
+}
+h1.i { margin-left : 2em; }
+h2.i { margin-left : 3em; }
+h3.i { margin-left : 4em; }
+h4.i { margin-left : 5em; }
+h5.i { margin-left : 6em; }
+h6.i { margin-left : 7em; }
+h7.i { margin-left : 8em; }
+h8.i { margin-left : 9em; }
+h9.i { margin-left : 10em; }
+.toc {
+ font-weight : normal;
+ margin-top : 6px;
+ margin-bottom : 6px;
+}
+h0.toc {
+ margin-left : 1em;
+ font-size : 1.85rem;
+ line-height : 150%%;
+}
+h1.toc {
+ margin-left : 1em;
+ font-size : 1.8rem;
+ line-height : 150%%;
+}
+h2.toc {
+ margin-left : 2em;
+ font-size : 1.75rem;
+ line-height : 140%%;
+}
+h3.toc {
+ margin-left : 3em;
+ font-size : 1.7rem;
+ line-height : 120%%;
+}
+h4.toc {
+ margin-left : 4em;
+ font-size : 1.65rem;
+ line-height : 120%%;
+}
+h5.toc {
+ margin-left : 5em;
+ font-size : 1.6rem;
+ line-height : 110%%;
+}
+h6.toc {
+ margin-left : 6em;
+ font-size : 1.55rem;
+ line-height : 110%%;
+}
+h7.toc {
+ margin-left : 7em;
+ font-size : 1.5rem;
+ line-height : 100%%;
+}
+.subtoc {
+ margin-right : 34%%;
+ font-weight : normal;
+}
+h5.subtoc {
+ margin-left : 2em;
+ font-size : 1.45rem;
+ margin-top : 2px;
+ margin-bottom : 2px;
+}
+h6.subtoc {
+ margin-left : 3em;
+ font-size : 1.4rem;
+ margin-top : 0px;
+ margin-bottom : 0px;
+}
+h7.subtoc {
+ margin-left : 4em;
+ font-size : 1.35rem;
+ margin-top : 0px;
+ margin-bottom : 0px;
+}
+input, select, textarea {
+ font-size : 2.2rem;
+}
+input[type="text"] {
+ font-size : 1.8rem;
+ line-height : 120%%;
+}
+button[type="submit"] {
+ font-size : 1.8rem;
+ line-height : 120%%;
+}
+p.form {
+ font-size : 2.2rem;
+ line-height : 150%%;
+}
+.icon-bar {
+ width : 100%%;
+ overflow : auto;
+ margin : 0em 0em 0em;
+}
+.left-bar {
+ width : 85%%;
+ float : left;
+ display : inline;
+ overflow : auto;
+}
+.toc-button {
+ position : absolute;
+ top : 8px;
+ width : 3em;
+ height : 3em;
+ border-radius : 50%%;
+ background : #CCCCCC;
+ fill : #333333;
+ box-shadow : 0 2px 5px #AAAAAA inset;
+}
+.toc-button svg {
+ position : relative;
+ left : 25%%;
+ top : 25%%;
+ width : 150%%;
+ height : 150%%;
+}
+.toc-button p {
+ vertical-align : center;
+ font-size : 1.8rem;
+}
+.prev-next-button {
+ position : absolute;
+ top : 8px;
+ width : 3em;
+ height : 3em;
+ border-radius : 50%%;
+ background : #CCCCCC;
+ box-shadow : 0 2px 5px #AAAAAA inset;
+}
+.prev-next-button svg {
+ position : relative;
+ left : 20%%;
+ top : 20%%;
+ width : 60%%;
+ height : 60%%;
+}
+.menu {
+ right : 8em;
+ }
+.previous {
+ right : 4em;
+ }
+.next {
+ right : 0em;
+ }
+.arrow {
+ fill : #333333;
+}
+.minitoc {
+ line-height : 120%%;
+ font-size : 1.6rem;
+ margin-top : 6px;
+ margin-bottom : 0px;
+ padding-left : 0em;
+ text-indent : 0em;
+ -khtml-user-select : none;
+ -moz-user-select : none;
+ -ms-user-select : none;
+ -o-user-select : none;
+ -webkit-user-select : none;
+ user-select : none;
+}
+/* flex */
+.flex-menu-bar {
+ display : -webkit-flex;
+ display : flex;
+ -webkit-flex-wrap : wrap;
+ -webkit-align-items : center;
+ align-items : center;
+ width : 100%%;
+ margin-left : 5%%;
+ margin-right : 2%%;
+ background-color : #FFFFFF;
+}
+.flex-menu-option {
+ background-color : #FFFFFF;
+ margin-right : 4px;
+}
+.flex-list {
+ display : -webkit-flex;
+ display : flex;
+ -webkit-align-items : center;
+ display : block;
+ align-items : center;
+ width : 100%%;
+ background-color : #FFFFFF;
+}
+.flex-list-item {
+ background-color : #FFFFFF;
+ margin : 4px;
+}
+/* grid */
+.wrapper {
+ display : grid;
+ grid-template-columns : 100%%;
+ grid-template-areas :
+ "headband"
+ "doc_header"
+ "doc_title"
+ "doc_toc"
+ "doc_prefix"
+ "doc_intro"
+ "doc_body"
+ "doc_endnotes"
+ "doc_glossary"
+ "doc_biblio"
+ "doc_bookindex"
+ "doc_blurb"
+ "doc_suffix";
+ margin : 0px;
+ padding : 0px;
+ background-color : #FFFFFF;
+}
+.delimit {
+ border-style : none;
+ border-color : #FFFFFF;
+ padding : 10px;
+}
+.headband {
+ grid-area : headband;
+ background-color : #FFFFFF;
+}
+.doc_header {
+ grid-area : doc_header;
+}
+.doc_title {
+ grid-area : doc_title;
+}
+.doc_toc {
+ grid-area : doc_toc;
+}
+.doc_prefix {
+ grid-area : doc_prefix;
+}
+.doc_intro {
+ grid-area : doc_intro;
+}
+.doc_body {
+ grid-area : doc_body;
+}
+.doc_endnotes {
+ grid-area : doc_endnotes;
+}
+.doc_glossary {
+ grid-area : doc_glossary;
+}
+.doc_biblio {
+ grid-area : doc_biblio;
+}
+.doc_bookindex {
+ grid-area : doc_bookindex;
+}
+.doc_blurb {
+ grid-area : doc_blurb;
+}
+.doc_suffix {
+ grid-area : doc_suffix;
+}
+.nav-ul {
+ list-style : none;
+ float : left;
+}
+.nav-li {
+ float : left;
+ padding-right : 0.7em;
+}
+.nav-li a {
+ text-decoration : none;
+ color : #FFFFFF;
+}
+footer {
+ background-color : #00704E;
+}
+┃",
+ _color_ocn_light,
+ _css_indent,
+ _color_ocn_light,
+);
+ string _css_dark_html_seg = format(q"┃
+html {
+}
+*{
+ padding : 0px;
+ margin : 0px;
+}
+body {
+ height : 100vh;
+ background-color : #000000;
+ color : #CCCCCC;
+ background : #000000;
+ background-color : #000000;
+}
+a:link {
+ color : #FFFFFF;
+ text-decoration : none;
+}
+a:visited {
+ color : #999999;
+ text-decoration : none;
+}
+a:hover {
+ color : #000000;
+ background-color : #555555;
+}
+a.lnkocn:link {
+ color : %s;
+ text-decoration : none;
+}
+a.lnkocn:visited {
+ color : #9ACD32;
+ text-decoration : none;
+}
+a.lnkocn:hover {
+ color : #BBBBBB;
+ font-size : 1.8rem;
+}
+a.lnkicon:link {
+ text-decoration : none;
+}
+a.lnkicon:visited {
+ text-decoration : none;
+}
+a.lnkicon:hover {
+ color : #BBBBBB;
+ font-size : 120%%;
+}
+a:hover img {
+ background-color : #000000;
+}
+a:active {
+ color : #888888;
+ text-decoration : underline;
+}
+input {
+ color : #FFFFFF;
+ background-color : #777777;
+}
+div {
+ margin-left : 0;
+ margin-right : 0;
+}
+div.p {
+ margin-left : 5%%;
+ margin-right : 1%%;
+}
+div.substance {
+ width : 100%%;
+ background-color : #000000;
+}
+div.ocn {
+ width : 5%%;
+ float : right;
+ top : 0;
+ background-color : #000000;
+}
+div.endnote {
+ width : 95%%;
+ background-color : #000000;
+}
+div.toc {
+ position : absolute;
+ float : left;
+ margin : 0;
+ padding : 0;
+ padding-top : 0.5em;
+ border : 0;
+ width : 13em;
+ background-color : #111111;
+ margin-right : 1em;
+}
+div.summary {
+ margin : 0;
+ padding : 0;
+ border-left : 13em solid #111111;
+ padding-left : 1em;
+ background-color : #111111;
+}
+div.content, div.main_column {
+ margin : 0;
+ padding : 0;
+ border-left : 13em solid #000000;
+ padding-left : 1em;
+ padding-right : 1em;
+}
+div.content0, div.main_column0 {
+ margin : 0;
+ padding : 0;
+ border-left : 0%% solid #000000;
+ padding-left : 5%%;
+}
+div.scroll {
+ margin : 0;
+ padding : 0;
+ padding-left : 1em;
+ padding-right : 1em;
+}
+div.content:after {
+ content : ' ';
+ clear : both;
+ display : block;
+ height : 0;
+ overflow : hidden;
+}
+div.footer {
+ clear : left;
+ padding : 0.5em;
+ font-size : 1.4rem;
+ margin : 0;
+}
+div.toc ul {
+ list-style : none;
+ padding : 0;
+ margin : 0;
+}
+div.toc li ul a, li ul span.currentlink
+{
+ font-weight : normal;
+ font-size : 1.5rem;
+ padding-left : 2em;
+ background-color : #111111;
+}
+div.toc a, span.currentlink{
+ display : block;
+ text-decoration : none;
+ padding-left : 0.5em;
+ color : #FF00AA;
+}
+hr {
+ width : 90%%;
+ margin-left : 5%%;
+ margin-right : 2em;
+ margin-top : 1.8em;
+ margin-bottom : 1.8em;
+}
+span.currentlink {
+ text-decoration : none;
+ background-color : #AAAAF9;
+}
+div.toc a:visited {
+ color : #FF00AA;
+}
+div.toc a:hover {
+ color : #CCCCCC;
+ background-color : #F9F9AA;
+}
+nav#toc ol {
+ list-style-type : none;
+}
+.norm, .bold, .verse, .group, .block, .alt {
+ line-height : 133%%;
+ margin-top : 12px;
+ margin-bottom : 0px;
+ padding-left : 0em;
+ text-indent : 0em;
+}
+p, h0, h1, h2, h3, h4, h5, h6, h7, ul, li {
+ display : block;
+ font-family : verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman;
+ margin-left : 5%%;
+ margin-right : 2em;
+}
+p {
+ font-size : 1.6rem;
+ font-weight : normal;
+ line-height : 133%%;
+ text-align : justify;
+ text-indent : 0mm;
+ margin-top : 0.8em;
+ margin-bottom : 0.8em;
+}
+img {
+ max-width : 100%%;
+ height : auto;
+}
+pre {
+ width : auto;
+ display : block;
+ clear : both;
+ color : #555555;
+}
+pre.codeline {
+ display : table;
+ clear : both;
+ table-layout : fixed;
+ margin-left : 5%%;
+ margin-right : 5%%;
+ width : 90%%;
+ white-space : pre-wrap;
+ border-style : none;
+ border-radius : 5px 5px 5px 5px;
+ box-shadow : 0 2px 5px #AAAAAA inset;
+ margin-bottom : 1em;
+ padding : 0.5em 1em;
+ page-break-inside : avoid;
+ word-wrap : break-word;
+ font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
+ white-space : pre;
+ white-space : pre-wrap;
+ white-space : -moz-pre-wrap;
+ white-space : -o-pre-wrap;
+ background-color : #555555;
+ color : #DDDDDD;
+ font-size : 1.5rem;
+ line-height : 100%%;
+}
+pre.codeline::before {
+ counter-reset : linenum;
+}
+pre.codeline span.tr {
+ display : table-row;
+ counter-increment : linenum;
+}
+pre.codeline span.th {
+ display : table-cell;
+ user-select : none;
+ -moz-user-select : none;
+ -webkit-user-select : none;
+ padding : 0.5em 0.5em;
+}
+pre.codeline span.th::before {
+ content : counter(linenum) ".";
+ color : #999999;
+ text-align : right;
+ display : block;
+}
+pre.codeline span.th {
+ width : 4em;
+}
+pre.codeline code {
+ display : table-cell;
+}
+p.code {
+ border-style : none;
+}
+p.spaced { white-space : pre; }
+p.block {
+ white-space : pre;
+}
+p.group { }
+p.alt { }
+p.verse {
+ white-space : pre;
+ margin-bottom : 6px;
+}
+p.caption {
+ text-align : left;
+ font-size : 1.4rem;
+ display : inline;
+}
+p.endnote {
+ font-size : 1.5rem;
+ line-height : 120%%;
+ text-align : left;
+ margin-right : 15mm;
+ padding-left : 1em;
+ text-indent : -1em;
+}
+p.center {
+ text-align : center;
+}
+p.bold {
+ font-weight : bold;
+}
+p.bold_left {
+ font-weight : bold;
+ text-align : left;
+}
+p.centerbold {
+ text-align : center;
+ font-weight : bold;
+}
+p.em {
+ font-weight : bold;
+ font-style : normal;
+ background : #FFF3B6;
+}
+.small, .small_center {
+ font-size : 1.4rem;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ margin-right : 6px;
+}
+p.small {
+ text-align : left;
+}
+p.small_center {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : center;
+}
+.tiny, .tiny_left, .tiny_right, .tiny_center {
+ font-size : 1.35rem;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ color : #EEEEEE;
+ margin-right : 6px;
+ text-align : left;
+}
+p.tiny { }
+p.tiny_left {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : left;
+}
+p.tiny_right {
+ margin-right : 1em;
+ text-align : right;
+}
+p.tiny_center {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : center;
+}
+p.concordance_word {
+ line-height : 150%%;
+ font-weight : bold;
+ display : inline;
+ margin-top : 4px;
+ margin-bottom : 1px;
+}
+p.concordance_count {
+ font-size : 1.4rem;
+ color : #555555;
+ display : inline;
+ margin-left : 0em;
+}
+p.concordance_object {
+ font-size : 1.4rem;
+ line-height : 120%%;
+ text-align : left;
+ margin-left : 3em;
+ margin-top : 1px;
+ margin-bottom : 3px;
+}
+p.book_index_lev1 {
+ line-height : 100%%;
+ margin-top : 4px;
+ margin-bottom : 1px;
+}
+p.book_index_lev2 {
+ line-height : 100%%;
+ text-align : left;
+ margin-left : 3em;
+ margin-top : 1px;
+ margin-bottom : 3px;
+}
+tt {
+ font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
+ background-color : #555555;
+ color : #DDDDDD;
+}
+%s
+note { white-space : pre; }
+label.ocn {
+ width : 2%%;
+ float : right;
+ top : 0;
+ font-size : 1.4rem;
+ margin-top : 0px;
+ margin-bottom : 6px;
+ margin-right : 6px;
+ text-align : right;
+ color : %s;
+ -khtml-user-select : none;
+ -moz-user-select : none;
+ -ms-user-select : none;
+ -o-user-select : none;
+ -webkit-user-select : none;
+ user-select : none;
+}
+table {
+ display : block;
+ margin-left : 5%%;
+ margin-right : 2em;
+ background-color : inherit;
+}
+tr { }
+th,td {
+ vertical-align : top;
+ text-align : left;
+}
+th {
+ font-weight : bold;
+}
+em {
+ font-weight : bold;
+ font-style : italic;
+}
+p.left,th.left,td.left {
+ text-align : left;
+}
+p.small_left,th.small_left,td.small_left {
+ text-align : left;
+ font-size : 1.4rem;
+}
+p.right,th.right,td.right {
+ text-align : right;
+}
+ul, li {
+ list-style-type : none;
+ list-style : none;
+ padding-left : 20px;
+ font-weight : normal;
+ line-height : 150%%;
+ text-align : left;
+ text-indent : 0mm;
+ margin-left : 1em;
+ margin-right : 2em;
+ margin-top : 3px;
+ margin-bottom : 3px;
+}
+li {
+ background : (../image_sys/bullet_09.png) no-repeat 0px 6px;
+}
+ul { }
+h0, h1, h2, h3, h4, h5, h6, h7 {
+ font-weight : bold;
+ line-height : 120%%;
+ text-align : left;
+ margin-top : 20px;
+ margin-bottom : 10px;
+}
+h4.norm, h5.norm, h6.norm, h7.norm {
+ margin-top : 10px;
+ margin-bottom : 0px;
+}
+h0 { font-size : 1.9rem; }
+h1 { font-size : 1.8rem; }
+h2 { font-size : 1.75rem; }
+h3 { font-size : 1.7rem; }
+h4 { font-size : 1.65rem; }
+h5 { font-size : 1.6rem; }
+h6 { font-size : 1.55rem; }
+h7 { font-size : 1.5rem; }
+h0, h1, h2, h3, h4, h5, h6, h7 {
+ text-shadow : .2em .2em .3em #999999;
+}
+h1.i { margin-left : 2em; }
+h2.i { margin-left : 3em; }
+h3.i { margin-left : 4em; }
+h4.i { margin-left : 5em; }
+h5.i { margin-left : 6em; }
+h6.i { margin-left : 7em; }
+h7.i { margin-left : 8em; }
+h8.i { margin-left : 9em; }
+h9.i { margin-left : 10em; }
+.toc {
+ font-weight : normal;
+ margin-top : 6px;
+ margin-bottom : 6px;
+}
+h0.toc {
+ margin-left : 1em;
+ font-size : 1.8rem;
+ line-height : 150%%;
+}
+h1.toc {
+ margin-left : 1em;
+ font-size : 1.75rem;
+ line-height : 150%%;
+}
+h2.toc {
+ margin-left : 2em;
+ font-size : 1.7rem;
+ line-height : 140%%;
+}
+h3.toc {
+ margin-left : 3em;
+ font-size : 1.65rem;
+ line-height : 120%%;
+}
+h4.toc {
+ margin-left : 4em;
+ font-size : 1.6rem;
+ line-height : 120%%;
+}
+h5.toc {
+ margin-left : 5em;
+ font-size : 1.5rem;
+ line-height : 110%%;
+}
+h6.toc {
+ margin-left : 6em;
+ font-size : 1.5rem;
+ line-height : 110%%;
+}
+h7.toc {
+ margin-left : 7em;
+ font-size : 1.45rem;
+ line-height : 100%%;
+}
+.subtoc {
+ margin-right : 34%%;
+ font-weight : normal;
+}
+h5.subtoc {
+ margin-left : 2em;
+ font-size : 1.4rem;
+ margin-top : 2px;
+ margin-bottom : 2px;
+}
+h6.subtoc {
+ margin-left : 3em;
+ font-size : 1.35;
+ margin-top : 0px;
+ margin-bottom : 0px;
+}
+h7.subtoc {
+ margin-left : 4em;
+ font-size : 1.3rem;
+ margin-top : 0px;
+ margin-bottom : 0px;
+}
+input, select, textarea {
+ font-size : 2.2rem;
+}
+input[type="text"] {
+ font-size : 1.8rem;
+ line-height : 120%%;
+}
+button[type="submit"] {
+ font-size : 1.8rem;
+ line-height : 120%%;
+}
+p.form {
+ font-size : 2.2rem;
+ line-height : 150%%;
+}
+.icon-bar {
+ width : 100%%;
+ overflow : auto;
+ margin : 0em 0em 0em;
+}
+.left-bar {
+ width : 85%%;
+ float : left;
+ display : inline;
+ overflow : auto;
+}
+.toc-button {
+ position : absolute;
+ top : 8px;
+ width : 3em;
+ height : 3em;
+ border-radius : 50%%;
+ background : #555555;
+ fill : #DDDDDD;
+ box-shadow : 0 2px 5px #EEEEEE inset;
+}
+.toc-button svg {
+ position : relative;
+ left : 25%%;
+ top : 25%%;
+ width : 150%%;
+ height : 150%%;
+}
+.toc-button p {
+ vertical-align : center;
+ font-size : 1.8rem;
+}
+.prev-next-button {
+ position : absolute;
+ top : 8px;
+ width : 3em;
+ height : 3em;
+ border-radius : 50%%;
+ background : #555555;
+ box-shadow : 0 2px 5px #AAAAAA inset;
+}
+.prev-next-button svg {
+ position : relative;
+ left : 20%%;
+ top : 20%%;
+ width : 60%%;
+ height : 60%%;
+}
+.menu {
+ right : 8em;
+ }
+.previous {
+ right : 4em;
+ }
+.next {
+ right : 0em;
+ }
+.arrow {
+ fill : #DDDDDD;
+}
+.minitoc {
+ line-height : 120%%;
+ font-size : 1.6rem;
+ margin-top : 6px;
+ margin-bottom : 0px;
+ padding-left : 0em;
+ text-indent : 0em;
+ -khtml-user-select : none;
+ -moz-user-select : none;
+ -ms-user-select : none;
+ -o-user-select : none;
+ -webkit-user-select : none;
+ user-select : none;
+}
+/* flex */
+.flex-menu-bar {
+ display : -webkit-flex;
+ display : flex;
+ -webkit-flex-wrap : wrap;
+ -webkit-align-items : center;
+ align-items : center;
+ width : 100%%;
+ margin-left : 5%%;
+ margin-right : 2%%;
+ background-color : #000000;
+}
+.flex-menu-option {
+ background-color : #000000;
+ margin-right : 4px;
+}
+.flex-list {
+ display : -webkit-flex;
+ display : flex;
+ -webkit-align-items : center;
+ display : block;
+ align-items : center;
+ width : 100%%;
+ background-color : #000000;
+}
+.flex-list-item {
+ background-color : #000000;
+ margin : 4px;
+}
+/* grid */
+.wrapper {
+ display : grid;
+ grid-template-columns : 100%%;
+ grid-template-areas :
+ "headband"
+ "doc_header"
+ "doc_title"
+ "doc_toc"
+ "doc_prefix"
+ "doc_intro"
+ "doc_body"
+ "doc_endnotes"
+ "doc_glossary"
+ "doc_biblio"
+ "doc_bookindex"
+ "doc_blurb"
+ "doc_suffix";
+ margin : 0px;
+ padding : 0px;
+ background-color : #000000;
+}
+.delimit {
+ border-style : none;
+ border-color : #000000;
+ padding : 10px;
+}
+.headband {
+ grid-area : headband;
+ background-color : #000000;
+}
+.doc_header {
+ grid-area : doc_header;
+}
+.doc_title {
+ grid-area : doc_title;
+}
+.doc_toc {
+ grid-area : doc_toc;
+}
+.doc_prefix {
+ grid-area : doc_prefix;
+}
+.doc_intro {
+ grid-area : doc_intro;
+}
+.doc_body {
+ grid-area : doc_body;
+}
+.doc_endnotes {
+ grid-area : doc_endnotes;
+}
+.doc_glossary {
+ grid-area : doc_glossary;
+}
+.doc_biblio {
+ grid-area : doc_biblio;
+}
+.doc_bookindex {
+ grid-area : doc_bookindex;
+}
+.doc_blurb {
+ grid-area : doc_blurb;
+}
+.doc_suffix {
+ grid-area : doc_suffix;
+}
+.nav-ul {
+ list-style : none;
+ float : left;
+}
+.nav-li {
+ float : left;
+ padding-right : 0.7em;
+}
+.nav-li a {
+ text-decoration : none;
+ color : #000000;
+}
+footer {
+ background-color : #FF704E;
+}
+┃",
+ _color_ocn_dark,
+ _css_indent,
+ _color_ocn_dark,
+);
+ string _css_light_html_scroll = format(q"┃
+html {
+ font-size : 62.5%%;
+}
+*{
+ padding : 0px;
+ margin : 0px;
+}
+body {
+ height : 100vh;
+ font-size : 1.6rem;
+ background-color : #FFFFFF;
+ color : #000000;
+ background : #FFFFFF;
+ background-color : #FFFFFF;
+}
+a:link {
+ color : #003399;
+ text-decoration : none;
+}
+a:visited {
+ color : #003399;
+ text-decoration : none;
+}
+a:hover {
+ color : #000000;
+ background-color : #F9F9AA;
+}
+a.lnkocn:link {
+ color : %s;
+ text-decoration : none;
+}
+a.lnkocn:visited {
+ color : #32CD32;
+ text-decoration : none;
+}
+a.lnkocn:hover {
+ color : #777777;
+ font-size : 1.8rem;
+}
+a.lnkicon:link {
+ text-decoration : none;
+}
+a.lnkicon:visited {
+ text-decoration : none;
+}
+a.lnkicon:hover {
+ font-size : 160%%;
+}
+a:hover img {
+ background-color : #FFFFFF;
+}
+a:active {
+ color : #003399;
+ text-decoration : underline;
+}
+input {
+ color : #000000;
+ background-color : #FFFFFF;
+}
+div {
+ margin-left : 0;
+ margin-right : 0;
+}
+div.p {
+ margin-left : 5%%;
+ margin-right : 1%%;
+}
+div.substance {
+ width : 100%%;
+ background-color : #FFFFFF;
+}
+div.ocn {
+ width : 5%%;
+ float : right;
+ top : 0;
+ background-color : #FFFFFF;
+}
+div.endnote {
+ width : 95%%;
+ background-color : #FFFFFF;
+}
+div.toc {
+ position : absolute;
+ float : left;
+ margin : 0;
+ padding : 0;
+ padding-top : 0.5em;
+ border : 0;
+ width : 13em;
+ background-color : #EEEEEE;
+ margin-right : 1em;
+}
+div.summary {
+ margin : 0;
+ padding : 0;
+ border-left : 13em solid #EEEEEE;
+ padding-left : 1em;
+ background-color : #EEEEEE;
+}
+div.content, div.main_column {
+ margin : 0;
+ padding : 0;
+ border-left : 13em solid #FFFFFF;
+ padding-left : 1em;
+ padding-right : 1em;
+}
+div.content0, div.main_column0 {
+ margin : 0;
+ padding : 0;
+ border-left : 0%% solid #FFFFFF;
+ padding-left : 5%%;
+}
+div.scroll {
+ margin : 0;
+ padding : 0;
+ padding-left : 1em;
+ padding-right : 1em;
+}
+div.content:after {
+ content : ' ';
+ clear : both;
+ display : block;
+ height : 0;
+ overflow : hidden;
+}
+div.footer {
+ clear : left;
+ padding : 0.5em;
+ font-size : 1.4rem;
+ margin : 0;
+}
+div.toc ul {
+ list-style : none;
+ padding : 0;
+ margin : 0;
+}
+div.toc li ul a, li ul span.currentlink
+{
+ font-weight : normal;
+ font-size : 1.5rem;
+ padding-left : 2em;
+ background-color : #EEEEEE;
+}
+div.toc a, span.currentlink{
+ display : block;
+ text-decoration : none;
+ padding-left : 0.5em;
+ color : #0000aa;
+}
+hr {
+ width : 90%%;
+ margin-left : 5%%;
+ margin-right : 2em;
+ margin-top : 1.8em;
+ margin-bottom : 1.8em;
+}
+span.currentlink {
+ text-decoration : none;
+ background-color : #AAAAAA;
+}
+div.toc a:visited {
+ color : #0000aa;
+}
+div.toc a:hover {
+ color : #000000;
+ background-color : #F9F9AA;
+}
+nav#toc ol {
+ list-style-type : none;
+}
+.norm, .bold, .verse, .group, .block, .alt {
+ line-height : 133%%;
+ margin-top : 12px;
+ margin-bottom : 0px;
+ padding-left : 0em;
+ text-indent : 0em;
+}
+p, h0, h1, h2, h3, h4, h5, h6, h7, ul, li {
+ display : block;
+ font-family : verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman;
+ margin-left : 5%%;
+ margin-right : 2em;
+}
+p {
+ font-size : 1.6rem;
+ font-weight : normal;
+ line-height : 133%%;
+ text-align : justify;
+ text-indent : 0mm;
+ margin-top : 0.8em;
+ margin-bottom : 0.8em;
+}
+img {
+ max-width : 100%%;
+ height : auto;
+}
+pre {
+ width : auto;
+ display : block;
+ clear : both;
+ color : #555555;
+}
+pre.codeline {
+ display : table;
+ clear : both;
+ table-layout : fixed;
+ margin-left : 5%%;
+ margin-right : 5%%;
+ width : 90%%;
+ white-space : pre-wrap;
+ border-style : none;
+ border-radius : 5px 5px 5px 5px;
+ box-shadow : 0 2px 5px #AAAAAA inset;
+ margin-bottom : 1em;
+ padding : 0.5em 1em;
+ page-break-inside : avoid;
+ word-wrap : break-word;
+ font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
+ white-space : pre;
+ white-space : pre-wrap;
+ white-space : -moz-pre-wrap;
+ white-space : -o-pre-wrap;
+ background-color : #EEEEEE;
+ color : #000000;
+ font-size : 1.5rem;
+ line-height : 100%%;
+}
+pre.codeline::before {
+ counter-reset : linenum;
+}
+pre.codeline span.tr {
+ display : table-row;
+ counter-increment : linenum;
+}
+pre.codeline span.th {
+ display : table-cell;
+ user-select : none;
+ -moz-user-select : none;
+ -webkit-user-select : none;
+ padding : 0.5em 0.5em;
+ /* background-color : #666666; */
+}
+pre.codeline span.th::before {
+ content : counter(linenum) ".";
+ color : #999999;
+ text-align : right;
+ display : block;
+}
+pre.codeline span.th {
+ width : 4em;
+}
+pre.codeline code {
+ display : table-cell;
+}
+p.code {
+ border-style : none;
+}
+p.spaced { white-space : pre; }
+p.block {
+ white-space : pre;
+}
+p.group { }
+p.alt { }
+p.verse {
+ white-space : pre;
+ margin-bottom : 6px;
+}
+p.caption {
+ text-align : left;
+ font-size : 1.4rem;
+ display : inline;
+}
+p.endnote {
+ font-size : 1.55rem;
+ line-height : 120%%;
+ text-align : left;
+ margin-right : 15mm;
+ padding-left : 1em;
+ text-indent : -1em;
+}
+p.center {
+ text-align : center;
+}
+p.bold {
+ font-weight : bold;
+}
+p.bold_left {
+ font-weight : bold;
+ text-align : left;
+}
+p.centerbold {
+ text-align : center;
+ font-weight : bold;
+}
+p.em {
+ font-weight : bold;
+ font-style : normal;
+ background : #FFF3B6;
+}
+.small, .small_center {
+ font-size : 1.4rem;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ margin-right : 6px;
+}
+p.small {
+ text-align : left;
+}
+p.small_center {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : center;
+}
+.tiny, .tiny_left, .tiny_right, .tiny_center {
+ font-size : 1.2rem;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ color : #777777;
+ margin-right : 6px;
+ text-align : left;
+}
+p.tiny { }
+p.tiny_left {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : left;
+}
+p.tiny_right {
+ margin-right : 1em;
+ text-align : right;
+}
+p.tiny_center {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : center;
+}
+p.icons, .icons_center {
+ font-size : 100%%;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ margin-right : 6px;
+}
+p.icons {
+ text-align : left;
+}
+p.concordance_word {
+ line-height : 150%%;
+ font-weight : bold;
+ display : inline;
+ margin-top : 4px;
+ margin-bottom : 1px;
+}
+p.concordance_count {
+ font-size : 1.4rem;
+ color : #777777;
+ display : inline;
+ margin-left : 0em;
+}
+p.concordance_object {
+ font-size : 1.4rem;
+ line-height : 120%%;
+ text-align : left;
+ margin-left : 3em;
+ margin-top : 1px;
+ margin-bottom : 3px;
+}
+p.book_index_lev1 {
+ line-height : 100%%;
+ margin-top : 4px;
+ margin-bottom : 1px;
+}
+p.book_index_lev2 {
+ line-height : 100%%;
+ text-align : left;
+ margin-left : 3em;
+ margin-top : 1px;
+ margin-bottom : 3px;
+}
+tt {
+ font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
+ background-color : #EEEEEE;
+ color : #000000;
+}
+%s
+note { white-space : pre; }
+label.ocn {
+ width : 2%%;
+ float : right;
+ top : 0;
+ font-size : 1.4rem;
+ margin-top : 0px;
+ margin-bottom : 6px;
+ margin-right : 6px;
+ text-align : right;
+ color : %s;
+ -khtml-user-select : none;
+ -moz-user-select : none;
+ -ms-user-select : none;
+ -o-user-select : none;
+ -webkit-user-select : none;
+ user-select : none;
+}
+table {
+ display : block;
+ margin-left : 5%%;
+ margin-right : 2em;
+ background-color : inherit;
+}
+tr { }
+th,td {
+ vertical-align : top;
+ text-align : left;
+}
+th {
+ font-weight : bold;
+}
+em {
+ font-weight : bold;
+ font-style : italic;
+}
+p.left,th.left,td.left {
+ text-align : left;
+}
+p.small_left,th.small_left,td.small_left {
+ text-align : left;
+ font-size : 1.4rem;
+}
+p.right,th.right,td.right {
+ text-align : right;
+}
+ul, li {
+ list-style-type : none;
+ list-style : none;
+ padding-left : 20px;
+ font-weight : normal;
+ line-height : 150%%;
+ text-align : left;
+ text-indent : 0mm;
+ margin-left : 1em;
+ margin-right : 2em;
+ margin-top : 3px;
+ margin-bottom : 3px;
+}
+li {
+ background : url(../image_sys/bullet_09.png) no-repeat 0px 6px;
+}
+ul { }
+h0, h1, h2, h3, h4, h5, h6, h7 {
+ font-weight : bold;
+ line-height : 120%%;
+ text-align : left;
+ margin-top : 20px;
+ margin-bottom : 10px;
+}
+h4.norm, h5.norm, h6.norm, h7.norm {
+ margin-top : 10px;
+ margin-bottom : 0px;
+}
+h0 { font-size : 1.85rem; }
+h1 { font-size : 1.8rem; }
+h2 { font-size : 1.75rem; }
+h3 { font-size : 1.7rem; }
+h4 { font-size : 1.65rem; }
+h5 { font-size : 1.6rem; }
+h6 { font-size : 1.55rem; }
+h7 { font-size : 1.5rem; }
+h0, h1, h2, h3, h4, h5, h6, h7 {
+ text-shadow : .2em .2em .3em #808080;
+}
+h1.i { margin-left : 2em; }
+h2.i { margin-left : 3em; }
+h3.i { margin-left : 4em; }
+h4.i { margin-left : 5em; }
+h5.i { margin-left : 6em; }
+h6.i { margin-left : 7em; }
+h7.i { margin-left : 8em; }
+h8.i { margin-left : 9em; }
+h9.i { margin-left : 10em; }
+.toc {
+ font-weight : normal;
+ margin-top : 6px;
+ margin-bottom : 6px;
+}
+h0.toc {
+ margin-left : 1em;
+ font-size : 1.85rem;
+ line-height : 150%%;
+}
+h1.toc {
+ margin-left : 1em;
+ font-size : 1.8rem;
+ line-height : 150%%;
+}
+h2.toc {
+ margin-left : 2em;
+ font-size : 1.75rem;
+ line-height : 140%%;
+}
+h3.toc {
+ margin-left : 3em;
+ font-size : 1.7rem;
+ line-height : 120%%;
+}
+h4.toc {
+ margin-left : 4em;
+ font-size : 1.65rem;
+ line-height : 120%%;
+}
+h5.toc {
+ margin-left : 5em;
+ font-size : 1.6rem;
+ line-height : 110%%;
+}
+h6.toc {
+ margin-left : 6em;
+ font-size : 1.55rem;
+ line-height : 110%%;
+}
+h7.toc {
+ margin-left : 7em;
+ font-size : 1.5rem;
+ line-height : 100%%;
+}
+.subtoc {
+ margin-right : 34%%;
+ font-weight : normal;
+}
+h5.subtoc {
+ margin-left : 2em;
+ font-size : 1.45rem;
+ margin-top : 2px;
+ margin-bottom : 2px;
+}
+h6.subtoc {
+ margin-left : 3em;
+ font-size : 1.4rem;
+ margin-top : 0px;
+ margin-bottom : 0px;
+}
+h7.subtoc {
+ margin-left : 4em;
+ font-size : 1.35rem;
+ margin-top : 0px;
+ margin-bottom : 0px;
+}
+input, select, textarea {
+ font-size : 2.2rem;
+}
+input[type="text"] {
+ font-size : 1.8rem;
+ line-height : 120%%;
+}
+button[type="submit"] {
+ font-size : 1.8rem;
+ line-height : 120%%;
+}
+p.form {
+ font-size : 2.2rem;
+ line-height : 150%%;
+}
+/* flex */
+.flex-menu-bar {
+ display : -webkit-flex;
+ display : flex;
+ -webkit-flex-wrap : wrap;
+ -webkit-align-items : center;
+ align-items : center;
+ width : 100%%;
+ margin-left : 5%%;
+ margin-right : 2%%;
+ background-color : #FFFFFF;
+}
+.flex-menu-option {
+ background-color : #FFFFFF;
+ margin-right : 4px;
+}
+.flex-list {
+ display : -webkit-flex;
+ display : flex;
+ -webkit-align-items : center;
+ display : block;
+ align-items : center;
+ width : 100%%;
+ background-color : #FFFFFF;
+}
+.flex-list-item {
+ background-color : #FFFFFF;
+ margin : 4px;
+}
+/* grid */
+.wrapper {
+ display : grid;
+ grid-template-columns : 100%%;
+ grid-template-areas :
+ "headband"
+ "doc_header"
+ "doc_title"
+ "doc_toc"
+ "doc_prefix"
+ "doc_intro"
+ "doc_body"
+ "doc_endnotes"
+ "doc_glossary"
+ "doc_biblio"
+ "doc_bookindex"
+ "doc_blurb"
+ "doc_suffix";
+ margin : 0px;
+ padding : 0px;
+ background-color : #FFFFFF;
+}
+.delimit {
+ border-style : none;
+ border-color : #FFFFFF;
+ padding : 10px;
+}
+.headband {
+ grid-area : headband;
+ background-color : #FFFFFF;
+}
+.doc_header {
+ grid-area : doc_header;
+}
+.doc_title {
+ grid-area : doc_title;
+}
+.doc_toc {
+ grid-area : doc_toc;
+}
+.doc_prefix {
+ grid-area : doc_prefix;
+}
+.doc_intro {
+ grid-area : doc_intro;
+}
+.doc_body {
+ grid-area : doc_body;
+}
+.doc_endnotes {
+ grid-area : doc_endnotes;
+}
+.doc_glossary {
+ grid-area : doc_glossary;
+}
+.doc_biblio {
+ grid-area : doc_biblio;
+}
+.doc_bookindex {
+ grid-area : doc_bookindex;
+}
+.doc_blurb {
+ grid-area : doc_blurb;
+}
+.doc_suffix {
+ grid-area : doc_suffix;
+}
+.nav-ul {
+ list-style : none;
+ float : left;
+}
+.nav-li {
+ float : left;
+ padding-right : 0.7em;
+}
+.nav-li a {
+ text-decoration : none;
+ color : #FFFFFF;
+}
+footer {
+ background-color : #00704E;
+}
+┃",
+ _color_ocn_light,
+ _css_indent,
+ _color_ocn_light,
+);
+ string _css_dark_html_scroll = format(q"┃
+html {
+}
+*{
+ padding : 0px;
+ margin : 0px;
+}
+body {
+ height : 100vh;
+ background-color : #000000;
+ color : #CCCCCC;
+ background : #000000;
+ background-color : #000000;
+}
+a:link {
+ color : #FFFFFF;
+ text-decoration : none;
+}
+a:visited {
+ color : #999999;
+ text-decoration : none;
+}
+a:hover {
+ color : #000000;
+ background-color : #555555;
+}
+a.lnkocn:link {
+ color : %s;
+ text-decoration : none;
+}
+a.lnkocn:visited {
+ color : #9ACD32;
+ text-decoration : none;
+}
+a.lnkocn:hover {
+ color : #BBBBBB;
+ font-size : 1.8rem;
+}
+a.lnkicon:link {
+ text-decoration : none;
+}
+a.lnkicon:visited {
+ text-decoration : none;
+}
+a.lnkicon:hover {
+ color : #BBBBBB;
+ font-size : 120%%;
+}
+a:hover img {
+ background-color : #000000;
+}
+a:active {
+ color : #888888;
+ text-decoration : underline;
+}
+input {
+ color : #FFFFFF;
+ background-color : #777777;
+}
+div {
+ margin-left : 0;
+ margin-right : 0;
+}
+div.p {
+ margin-left : 5%%;
+ margin-right : 1%%;
+}
+div.substance {
+ width : 100%%;
+ background-color : #000000;
+}
+div.ocn {
+ width : 5%%;
+ float : right;
+ top : 0;
+ background-color : #000000;
+}
+div.endnote {
+ width : 95%%;
+ background-color : #000000;
+}
+div.toc {
+ position : absolute;
+ float : left;
+ margin : 0;
+ padding : 0;
+ padding-top : 0.5em;
+ border : 0;
+ width : 13em;
+ background-color : #111111;
+ margin-right : 1em;
+}
+div.summary {
+ margin : 0;
+ padding : 0;
+ border-left : 13em solid #111111;
+ padding-left : 1em;
+ background-color : #111111;
+}
+div.content, div.main_column {
+ margin : 0;
+ padding : 0;
+ border-left : 13em solid #000000;
+ padding-left : 1em;
+ padding-right : 1em;
+}
+div.content0, div.main_column0 {
+ margin : 0;
+ padding : 0;
+ border-left : 0%% solid #000000;
+ padding-left : 5%%;
+}
+div.scroll {
+ margin : 0;
+ padding : 0;
+ padding-left : 1em;
+ padding-right : 1em;
+}
+div.content:after {
+ content : ' ';
+ clear : both;
+ display : block;
+ height : 0;
+ overflow : hidden;
+}
+div.footer {
+ clear : left;
+ padding : 0.5em;
+ font-size : 1.4rem;
+ margin : 0;
+}
+div.toc ul {
+ list-style : none;
+ padding : 0;
+ margin : 0;
+}
+div.toc li ul a, li ul span.currentlink
+{
+ font-weight : normal;
+ font-size : 1.5rem;
+ padding-left : 2em;
+ background-color : #111111;
+}
+div.toc a, span.currentlink{
+ display : block;
+ text-decoration : none;
+ padding-left : 0.5em;
+ color : #FF00AA;
+}
+hr {
+ width : 90%%;
+ margin-left : 5%%;
+ margin-right : 2em;
+ margin-top : 1.8em;
+ margin-bottom : 1.8em;
+}
+span.currentlink {
+ text-decoration : none;
+ background-color : #AAAAF9;
+}
+div.toc a:visited {
+ color : #FF00AA;
+}
+div.toc a:hover {
+ color : #CCCCCC;
+ background-color : #F9F9AA;
+}
+nav#toc ol {
+ list-style-type : none;
+}
+.norm, .bold, .verse, .group, .block, .alt {
+ line-height : 133%%;
+ margin-top : 12px;
+ margin-bottom : 0px;
+ padding-left : 0em;
+ text-indent : 0em;
+}
+p, h0, h1, h2, h3, h4, h5, h6, h7, ul, li {
+ display : block;
+ font-family : verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman;
+ margin-left : 5%%;
+ margin-right : 2em;
+}
+p {
+ font-size : 1.6rem;
+ font-weight : normal;
+ line-height : 133%%;
+ text-align : justify;
+ text-indent : 0mm;
+ margin-top : 0.8em;
+ margin-bottom : 0.8em;
+}
+img {
+ max-width : 100%%;
+ height : auto;
+}
+pre {
+ width : auto;
+ display : block;
+ clear : both;
+ color : #555555;
+}
+pre.codeline {
+ display : table;
+ clear : both;
+ table-layout : fixed;
+ margin-left : 5%%;
+ margin-right : 5%%;
+ width : 90%%;
+ white-space : pre-wrap;
+ border-style : none;
+ border-radius : 5px 5px 5px 5px;
+ box-shadow : 0 2px 5px #AAAAAA inset;
+ margin-bottom : 1em;
+ padding : 0.5em 1em;
+ page-break-inside : avoid;
+ word-wrap : break-word;
+ font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
+ white-space : pre;
+ white-space : pre-wrap;
+ white-space : -moz-pre-wrap;
+ white-space : -o-pre-wrap;
+ background-color : #555555;
+ color : #DDDDDD;
+ font-size : 1.5rem;
+ line-height : 100%%;
+}
+pre.codeline::before {
+ counter-reset : linenum;
+}
+pre.codeline span.tr {
+ display : table-row;
+ counter-increment : linenum;
+}
+pre.codeline span.th {
+ display : table-cell;
+ user-select : none;
+ -moz-user-select : none;
+ -webkit-user-select : none;
+ padding : 0.5em 0.5em;
+}
+pre.codeline span.th::before {
+ content : counter(linenum) ".";
+ color : #999999;
+ text-align : right;
+ display : block;
+}
+pre.codeline span.th {
+ width : 4em;
+}
+pre.codeline code {
+ display : table-cell;
+}
+p.code {
+ border-style : none;
+}
+p.spaced { white-space : pre; }
+p.block {
+ white-space : pre;
+}
+p.group { }
+p.alt { }
+p.verse {
+ white-space : pre;
+ margin-bottom : 6px;
+}
+p.caption {
+ text-align : left;
+ font-size : 1.4rem;
+ display : inline;
+}
+p.endnote {
+ font-size : 1.5rem;
+ line-height : 120%%;
+ text-align : left;
+ margin-right : 15mm;
+ padding-left : 1em;
+ text-indent : -1em;
+}
+p.center {
+ text-align : center;
+}
+p.bold {
+ font-weight : bold;
+}
+p.bold_left {
+ font-weight : bold;
+ text-align : left;
+}
+p.centerbold {
+ text-align : center;
+ font-weight : bold;
+}
+p.em {
+ font-weight : bold;
+ font-style : normal;
+ background : #FFF3B6;
+}
+.small, .small_center {
+ font-size : 1.4rem;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ margin-right : 6px;
+}
+p.small {
+ text-align : left;
+}
+p.small_center {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : center;
+}
+.tiny, .tiny_left, .tiny_right, .tiny_center {
+ font-size : 1.35rem;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ color : #EEEEEE;
+ margin-right : 6px;
+ text-align : left;
+}
+p.tiny { }
+p.tiny_left {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : left;
+}
+p.tiny_right {
+ margin-right : 1em;
+ text-align : right;
+}
+p.tiny_center {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : center;
+}
+p.concordance_word {
+ line-height : 150%%;
+ font-weight : bold;
+ display : inline;
+ margin-top : 4px;
+ margin-bottom : 1px;
+}
+p.concordance_count {
+ font-size : 1.4rem;
+ color : #555555;
+ display : inline;
+ margin-left : 0em;
+}
+p.concordance_object {
+ font-size : 1.4rem;
+ line-height : 120%%;
+ text-align : left;
+ margin-left : 3em;
+ margin-top : 1px;
+ margin-bottom : 3px;
+}
+p.book_index_lev1 {
+ line-height : 100%%;
+ margin-top : 4px;
+ margin-bottom : 1px;
+}
+p.book_index_lev2 {
+ line-height : 100%%;
+ text-align : left;
+ margin-left : 3em;
+ margin-top : 1px;
+ margin-bottom : 3px;
+}
+tt {
+ font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
+ background-color : #555555;
+ color : #DDDDDD;
+}
+%s
+note { white-space : pre; }
+label.ocn {
+ width : 2%%;
+ float : right;
+ top : 0;
+ font-size : 1.4rem;
+ margin-top : 0px;
+ margin-bottom : 6px;
+ margin-right : 6px;
+ text-align : right;
+ color : %s;
+ -khtml-user-select : none;
+ -moz-user-select : none;
+ -ms-user-select : none;
+ -o-user-select : none;
+ -webkit-user-select : none;
+ user-select : none;
+}
+table {
+ display : block;
+ margin-left : 5%%;
+ margin-right : 2em;
+ background-color : inherit;
+}
+tr { }
+th,td {
+ vertical-align : top;
+ text-align : left;
+}
+th {
+ font-weight : bold;
+}
+em {
+ font-weight : bold;
+ font-style : italic;
+}
+p.left,th.left,td.left {
+ text-align : left;
+}
+p.small_left,th.small_left,td.small_left {
+ text-align : left;
+ font-size : 1.4rem;
+}
+p.right,th.right,td.right {
+ text-align : right;
+}
+ul, li {
+ list-style-type : none;
+ list-style : none;
+ padding-left : 20px;
+ font-weight : normal;
+ line-height : 150%%;
+ text-align : left;
+ text-indent : 0mm;
+ margin-left : 1em;
+ margin-right : 2em;
+ margin-top : 3px;
+ margin-bottom : 3px;
+}
+li {
+ background : (../image_sys/bullet_09.png) no-repeat 0px 6px;
+}
+ul { }
+h0, h1, h2, h3, h4, h5, h6, h7 {
+ font-weight : bold;
+ line-height : 120%%;
+ text-align : left;
+ margin-top : 20px;
+ margin-bottom : 10px;
+}
+h4.norm, h5.norm, h6.norm, h7.norm {
+ margin-top : 10px;
+ margin-bottom : 0px;
+}
+h0 { font-size : 1.9rem; }
+h1 { font-size : 1.8rem; }
+h2 { font-size : 1.75rem; }
+h3 { font-size : 1.7rem; }
+h4 { font-size : 1.65rem; }
+h5 { font-size : 1.6rem; }
+h6 { font-size : 1.55rem; }
+h7 { font-size : 1.5rem; }
+h0, h1, h2, h3, h4, h5, h6, h7 {
+ text-shadow : .2em .2em .3em #999999;
+}
+h1.i { margin-left : 2em; }
+h2.i { margin-left : 3em; }
+h3.i { margin-left : 4em; }
+h4.i { margin-left : 5em; }
+h5.i { margin-left : 6em; }
+h6.i { margin-left : 7em; }
+h7.i { margin-left : 8em; }
+h8.i { margin-left : 9em; }
+h9.i { margin-left : 10em; }
+.toc {
+ font-weight : normal;
+ margin-top : 6px;
+ margin-bottom : 6px;
+}
+h0.toc {
+ margin-left : 1em;
+ font-size : 1.8rem;
+ line-height : 150%%;
+}
+h1.toc {
+ margin-left : 1em;
+ font-size : 1.75rem;
+ line-height : 150%%;
+}
+h2.toc {
+ margin-left : 2em;
+ font-size : 1.7rem;
+ line-height : 140%%;
+}
+h3.toc {
+ margin-left : 3em;
+ font-size : 1.65rem;
+ line-height : 120%%;
+}
+h4.toc {
+ margin-left : 4em;
+ font-size : 1.6rem;
+ line-height : 120%%;
+}
+h5.toc {
+ margin-left : 5em;
+ font-size : 1.5rem;
+ line-height : 110%%;
+}
+h6.toc {
+ margin-left : 6em;
+ font-size : 1.5rem;
+ line-height : 110%%;
+}
+h7.toc {
+ margin-left : 7em;
+ font-size : 1.45rem;
+ line-height : 100%%;
+}
+.subtoc {
+ margin-right : 34%%;
+ font-weight : normal;
+}
+h5.subtoc {
+ margin-left : 2em;
+ font-size : 1.4rem;
+ margin-top : 2px;
+ margin-bottom : 2px;
+}
+h6.subtoc {
+ margin-left : 3em;
+ font-size : 1.35;
+ margin-top : 0px;
+ margin-bottom : 0px;
+}
+h7.subtoc {
+ margin-left : 4em;
+ font-size : 1.3rem;
+ margin-top : 0px;
+ margin-bottom : 0px;
+}
+input, select, textarea {
+ font-size : 2.2rem;
+}
+input[type="text"] {
+ font-size : 1.8rem;
+ line-height : 120%%;
+}
+button[type="submit"] {
+ font-size : 1.8rem;
+ line-height : 120%%;
+}
+p.form {
+ font-size : 2.2rem;
+ line-height : 150%%;
+}
+/* flex */
+.flex-menu-bar {
+ display : -webkit-flex;
+ display : flex;
+ -webkit-flex-wrap : wrap;
+ -webkit-align-items : center;
+ align-items : center;
+ width : 100%%;
+ margin-left : 5%%;
+ margin-right : 2%%;
+ background-color : #000000;
+}
+.flex-menu-option {
+ background-color : #000000;
+ margin-right : 4px;
+}
+.flex-list {
+ display : -webkit-flex;
+ display : flex;
+ -webkit-align-items : center;
+ display : block;
+ align-items : center;
+ width : 100%%;
+ background-color : #000000;
+}
+.flex-list-item {
+ background-color : #000000;
+ margin : 4px;
+}
+/* grid */
+.wrapper {
+ display : grid;
+ grid-template-columns : 100%%;
+ grid-template-areas :
+ "headband"
+ "doc_header"
+ "doc_title"
+ "doc_toc"
+ "doc_prefix"
+ "doc_intro"
+ "doc_body"
+ "doc_endnotes"
+ "doc_glossary"
+ "doc_biblio"
+ "doc_bookindex"
+ "doc_blurb"
+ "doc_suffix";
+ margin : 0px;
+ padding : 0px;
+ background-color : #000000;
+}
+.delimit {
+ border-style : none;
+ border-color : #000000;
+ padding : 10px;
+}
+.headband {
+ grid-area : headband;
+ background-color : #000000;
+}
+.doc_header {
+ grid-area : doc_header;
+}
+.doc_title {
+ grid-area : doc_title;
+}
+.doc_toc {
+ grid-area : doc_toc;
+}
+.doc_prefix {
+ grid-area : doc_prefix;
+}
+.doc_intro {
+ grid-area : doc_intro;
+}
+.doc_body {
+ grid-area : doc_body;
+}
+.doc_endnotes {
+ grid-area : doc_endnotes;
+}
+.doc_glossary {
+ grid-area : doc_glossary;
+}
+.doc_biblio {
+ grid-area : doc_biblio;
+}
+.doc_bookindex {
+ grid-area : doc_bookindex;
+}
+.doc_blurb {
+ grid-area : doc_blurb;
+}
+.doc_suffix {
+ grid-area : doc_suffix;
+}
+.nav-ul {
+ list-style : none;
+ float : left;
+}
+.nav-li {
+ float : left;
+ padding-right : 0.7em;
+}
+.nav-li a {
+ text-decoration : none;
+ color : #000000;
+}
+footer {
+ background-color : #FF704E;
+}
+┃",
+ _color_ocn_dark,
+ _css_indent,
+ _color_ocn_dark,
+);
+ string _css_light_epub = format(q"┃
+html {
+ font-size : 62.5%%;
+}
+*{
+ padding : 0px;
+ margin : 0px;
+}
+body {
+ height : 100vh;
+ font-size : 1.6rem;
+ background-color : #FFFFFF;
+ color : #000000;
+ background : #FFFFFF;
+ background-color : #FFFFFF;
+}
+a:link {
+ color : #003399;
+ text-decoration : none;
+}
+a:visited {
+ color : #003399;
+ text-decoration : none;
+}
+a:hover {
+ color : #000000;
+ background-color : #F9F9AA;
+}
+a.lnkocn:link {
+ color : %s;
+ text-decoration : none;
+}
+a.lnkocn:visited {
+ color : #32CD32;
+ text-decoration : none;
+}
+a.lnkocn:hover {
+ color : #777777;
+ font-size : 1.8rem;
+}
+a.lnkicon:link {
+ text-decoration : none;
+}
+a.lnkicon:visited {
+ text-decoration : none;
+}
+a.lnkicon:hover {
+ font-size : 160%%;
+}
+a:hover img {
+ background-color : #FFFFFF;
+}
+a:active {
+ color : #003399;
+ text-decoration : underline;
+}
+input {
+ color : #000000;
+ background-color : #FFFFFF;
+}
+div {
+ margin-left : 0;
+ margin-right : 0;
+}
+div.p {
+ margin-left : 5%%;
+ margin-right : 1%%;
+}
+div.substance {
+ width : 100%%;
+ background-color : #FFFFFF;
+}
+div.ocn {
+ width : 5%%;
+ float : right;
+ top : 0;
+ background-color : #FFFFFF;
+}
+div.endnote {
+ width : 95%%;
+ background-color : #FFFFFF;
+}
+div.toc {
+ position : absolute;
+ float : left;
+ margin : 0;
+ padding : 0;
+ padding-top : 0.5em;
+ border : 0;
+ width : 13em;
+ background-color : #EEEEEE;
+ margin-right : 1em;
+}
+div.summary {
+ margin : 0;
+ padding : 0;
+ border-left : 13em solid #EEEEEE;
+ padding-left : 1em;
+ background-color : #EEEEEE;
+}
+div.content, div.main_column {
+ margin : 0;
+ padding : 0;
+ border-left : 13em solid #FFFFFF;
+ padding-left : 1em;
+ padding-right : 1em;
+}
+div.content0, div.main_column0 {
+ margin : 0;
+ padding : 0;
+ border-left : 0%% solid #FFFFFF;
+ padding-left : 5%%;
+}
+div.scroll {
+ margin : 0;
+ padding : 0;
+ padding-left : 1em;
+ padding-right : 1em;
+}
+div.content:after {
+ content : ' ';
+ clear : both;
+ display : block;
+ height : 0;
+ overflow : hidden;
+}
+div.footer {
+ clear : left;
+ padding : 0.5em;
+ font-size : 1.4rem;
+ margin : 0;
+}
+div.toc ul {
+ list-style : none;
+ padding : 0;
+ margin : 0;
+}
+div.toc li ul a, li ul span.currentlink
+{
+ font-weight : normal;
+ font-size : 1.5rem;
+ padding-left : 2em;
+ background-color : #EEEEEE;
+}
+div.toc a, span.currentlink{
+ display : block;
+ text-decoration : none;
+ padding-left : 0.5em;
+ color : #0000aa;
+}
+hr {
+ width : 90%%;
+ margin-left : 5%%;
+ margin-right : 2em;
+ margin-top : 1.8em;
+ margin-bottom : 1.8em;
+}
+span.currentlink {
+ text-decoration : none;
+ background-color : #AAAAAA;
+}
+div.toc a:visited {
+ color : #0000aa;
+}
+div.toc a:hover {
+ color : #000000;
+ background-color : #F9F9AA;
+}
+nav#toc ol {
+ list-style-type : none;
+}
+.norm, .bold, .verse, .group, .block, .alt {
+ line-height : 133%%;
+ margin-top : 12px;
+ margin-bottom : 0px;
+ padding-left : 0em;
+ text-indent : 0em;
+}
+p, h0, h1, h2, h3, h4, h5, h6, h7, ul, li {
+ display : block;
+ font-family : verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman;
+ margin-left : 5%%;
+ margin-right : 2em;
+}
+p {
+ font-size : 1.6rem;
+ font-weight : normal;
+ line-height : 133%%;
+ text-align : justify;
+ text-indent : 0mm;
+ margin-top : 0.8em;
+ margin-bottom : 0.8em;
+}
+img {
+ max-width : 100%%;
+ height : auto;
+}
+pre {
+ width : auto;
+ display : block;
+ clear : both;
+ color : #555555;
+}
+pre.codeline {
+ display : table;
+ clear : both;
+ table-layout : fixed;
+ margin-left : 5%%;
+ margin-right : 5%%;
+ width : 90%%;
+ white-space : pre-wrap;
+ border-style : none;
+ border-radius : 5px 5px 5px 5px;
+ box-shadow : 0 2px 5px #AAAAAA inset;
+ margin-bottom : 1em;
+ padding : 0.5em 1em;
+ page-break-inside : avoid;
+ word-wrap : break-word;
+ font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
+ white-space : pre;
+ white-space : pre-wrap;
+ white-space : -moz-pre-wrap;
+ white-space : -o-pre-wrap;
+ background-color : #EEEEEE;
+ color : #000000;
+ font-size : 1.5rem;
+ line-height : 100%%;
+}
+pre.codeline::before {
+ counter-reset : linenum;
+}
+pre.codeline span.tr {
+ display : table-row;
+ counter-increment : linenum;
+}
+pre.codeline span.th {
+ display : table-cell;
+ user-select : none;
+ -moz-user-select : none;
+ -webkit-user-select : none;
+ padding : 0.5em 0.5em;
+ /* background-color : #666666; */
+}
+pre.codeline span.th::before {
+ content : counter(linenum) ".";
+ color : #999999;
+ text-align : right;
+ display : block;
+}
+pre.codeline span.th {
+ width : 4em;
+}
+pre.codeline code {
+ display : table-cell;
+}
+p.code {
+ border-style : none;
+}
+p.spaced { white-space : pre; }
+p.block {
+ white-space : pre;
+}
+p.group { }
+p.alt { }
+p.verse {
+ white-space : pre;
+ margin-bottom : 6px;
+}
+p.caption {
+ text-align : left;
+ font-size : 1.4rem;
+ display : inline;
+}
+p.endnote {
+ font-size : 1.55rem;
+ line-height : 120%%;
+ text-align : left;
+ margin-right : 15mm;
+ padding-left : 1em;
+ text-indent : -1em;
+}
+p.center {
+ text-align : center;
+}
+p.bold {
+ font-weight : bold;
+}
+p.bold_left {
+ font-weight : bold;
+ text-align : left;
+}
+p.centerbold {
+ text-align : center;
+ font-weight : bold;
+}
+p.em {
+ font-weight : bold;
+ font-style : normal;
+ background : #FFF3B6;
+}
+.small, .small_center {
+ font-size : 1.4rem;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ margin-right : 6px;
+}
+p.small {
+ text-align : left;
+}
+p.small_center {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : center;
+}
+.tiny, .tiny_left, .tiny_right, .tiny_center {
+ font-size : 1.2rem;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ color : #777777;
+ margin-right : 6px;
+ text-align : left;
+}
+p.tiny { }
+p.tiny_left {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : left;
+}
+p.tiny_right {
+ margin-right : 1em;
+ text-align : right;
+}
+p.tiny_center {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : center;
+}
+p.icons, .icons_center {
+ font-size : 100%%;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ margin-right : 6px;
+}
+p.icons {
+ text-align : left;
+}
+p.concordance_word {
+ line-height : 150%%;
+ font-weight : bold;
+ display : inline;
+ margin-top : 4px;
+ margin-bottom : 1px;
+}
+p.concordance_count {
+ font-size : 1.4rem;
+ color : #777777;
+ display : inline;
+ margin-left : 0em;
+}
+p.concordance_object {
+ font-size : 1.4rem;
+ line-height : 120%%;
+ text-align : left;
+ margin-left : 3em;
+ margin-top : 1px;
+ margin-bottom : 3px;
+}
+p.book_index_lev1 {
+ line-height : 100%%;
+ margin-top : 4px;
+ margin-bottom : 1px;
+}
+p.book_index_lev2 {
+ line-height : 100%%;
+ text-align : left;
+ margin-left : 3em;
+ margin-top : 1px;
+ margin-bottom : 3px;
+}
+tt {
+ font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
+ background-color : #EEEEEE;
+ color : #000000;
+}
+%s
+note { white-space : pre; }
+label.ocn {
+ width : 2%%;
+ float : right;
+ top : 0;
+ font-size : 1.4rem;
+ margin-top : 0px;
+ margin-bottom : 6px;
+ margin-right : 6px;
+ text-align : right;
+ color : %s;
+ -khtml-user-select : none;
+ -moz-user-select : none;
+ -ms-user-select : none;
+ -o-user-select : none;
+ -webkit-user-select : none;
+ user-select : none;
+}
+table {
+ display : block;
+ margin-left : 5%%;
+ margin-right : 2em;
+ background-color : inherit;
+}
+tr { }
+th,td {
+ vertical-align : top;
+ text-align : left;
+}
+th {
+ font-weight : bold;
+}
+em {
+ font-weight : bold;
+ font-style : italic;
+}
+p.left,th.left,td.left {
+ text-align : left;
+}
+p.small_left,th.small_left,td.small_left {
+ text-align : left;
+ font-size : 1.4rem;
+}
+p.right,th.right,td.right {
+ text-align : right;
+}
+ul, li {
+ list-style-type : none;
+ list-style : none;
+ padding-left : 20px;
+ font-weight : normal;
+ line-height : 150%%;
+ text-align : left;
+ text-indent : 0mm;
+ margin-left : 1em;
+ margin-right : 2em;
+ margin-top : 3px;
+ margin-bottom : 3px;
+}
+li {
+ background : url(../image_sys/bullet_09.png) no-repeat 0px 6px;
+}
+ul { }
+h0, h1, h2, h3, h4, h5, h6, h7 {
+ font-weight : bold;
+ line-height : 120%%;
+ text-align : left;
+ margin-top : 20px;
+ margin-bottom : 10px;
+}
+h4.norm, h5.norm, h6.norm, h7.norm {
+ margin-top : 10px;
+ margin-bottom : 0px;
+}
+h0 { font-size : 1.85rem; }
+h1 { font-size : 1.8rem; }
+h2 { font-size : 1.75rem; }
+h3 { font-size : 1.7rem; }
+h4 { font-size : 1.65rem; }
+h5 { font-size : 1.6rem; }
+h6 { font-size : 1.55rem; }
+h7 { font-size : 1.5rem; }
+h0, h1, h2, h3, h4, h5, h6, h7 {
+ text-shadow : .2em .2em .3em #808080;
+}
+h1.i { margin-left : 2em; }
+h2.i { margin-left : 3em; }
+h3.i { margin-left : 4em; }
+h4.i { margin-left : 5em; }
+h5.i { margin-left : 6em; }
+h6.i { margin-left : 7em; }
+h7.i { margin-left : 8em; }
+h8.i { margin-left : 9em; }
+h9.i { margin-left : 10em; }
+.toc {
+ font-weight : normal;
+ margin-top : 6px;
+ margin-bottom : 6px;
+}
+h0.toc {
+ margin-left : 1em;
+ font-size : 1.85rem;
+ line-height : 150%%;
+}
+h1.toc {
+ margin-left : 1em;
+ font-size : 1.8rem;
+ line-height : 150%%;
+}
+h2.toc {
+ margin-left : 2em;
+ font-size : 1.75rem;
+ line-height : 140%%;
+}
+h3.toc {
+ margin-left : 3em;
+ font-size : 1.7rem;
+ line-height : 120%%;
+}
+h4.toc {
+ margin-left : 4em;
+ font-size : 1.65rem;
+ line-height : 120%%;
+}
+h5.toc {
+ margin-left : 5em;
+ font-size : 1.6rem;
+ line-height : 110%%;
+}
+h6.toc {
+ margin-left : 6em;
+ font-size : 1.55rem;
+ line-height : 110%%;
+}
+h7.toc {
+ margin-left : 7em;
+ font-size : 1.5rem;
+ line-height : 100%%;
+}
+.subtoc {
+ margin-right : 34%%;
+ font-weight : normal;
+}
+h5.subtoc {
+ margin-left : 2em;
+ font-size : 1.45rem;
+ margin-top : 2px;
+ margin-bottom : 2px;
+}
+h6.subtoc {
+ margin-left : 3em;
+ font-size : 1.4rem;
+ margin-top : 0px;
+ margin-bottom : 0px;
+}
+h7.subtoc {
+ margin-left : 4em;
+ font-size : 1.35rem;
+ margin-top : 0px;
+ margin-bottom : 0px;
+}
+input, select, textarea {
+ font-size : 2.2rem;
+}
+input[type="text"] {
+ font-size : 1.8rem;
+ line-height : 120%%;
+}
+button[type="submit"] {
+ font-size : 1.8rem;
+ line-height : 120%%;
+}
+p.form {
+ font-size : 2.2rem;
+ line-height : 150%%;
+}
+
+┃",
+ _color_ocn_light,
+ _css_indent,
+ _color_ocn_light,
+);
+ string _css_dark_epub = format(q"┃
+html {
+}
+*{
+ padding : 0px;
+ margin : 0px;
+}
+body {
+ height : 100vh;
+ background-color : #000000;
+ color : #CCCCCC;
+ background : #000000;
+ background-color : #000000;
+}
+a:link {
+ color : #FFFFFF;
+ text-decoration : none;
+}
+a:visited {
+ color : #999999;
+ text-decoration : none;
+}
+a:hover {
+ color : #000000;
+ background-color : #555555;
+}
+a.lnkocn:link {
+ color : %s;
+ text-decoration : none;
+}
+a.lnkocn:visited {
+ color : #9ACD32;
+ text-decoration : none;
+}
+a.lnkocn:hover {
+ color : #BBBBBB;
+ font-size : 1.8rem;
+}
+a.lnkicon:link {
+ text-decoration : none;
+}
+a.lnkicon:visited {
+ text-decoration : none;
+}
+a.lnkicon:hover {
+ color : #BBBBBB;
+ font-size : 120%%;
+}
+a:hover img {
+ background-color : #000000;
+}
+a:active {
+ color : #888888;
+ text-decoration : underline;
+}
+input {
+ color : #FFFFFF;
+ background-color : #777777;
+}
+div {
+ margin-left : 0;
+ margin-right : 0;
+}
+div.p {
+ margin-left : 5%%;
+ margin-right : 1%%;
+}
+div.substance {
+ width : 100%%;
+ background-color : #000000;
+}
+div.ocn {
+ width : 5%%;
+ float : right;
+ top : 0;
+ background-color : #000000;
+}
+div.endnote {
+ width : 95%%;
+ background-color : #000000;
+}
+div.toc {
+ position : absolute;
+ float : left;
+ margin : 0;
+ padding : 0;
+ padding-top : 0.5em;
+ border : 0;
+ width : 13em;
+ background-color : #111111;
+ margin-right : 1em;
+}
+div.summary {
+ margin : 0;
+ padding : 0;
+ border-left : 13em solid #111111;
+ padding-left : 1em;
+ background-color : #111111;
+}
+div.content, div.main_column {
+ margin : 0;
+ padding : 0;
+ border-left : 13em solid #000000;
+ padding-left : 1em;
+ padding-right : 1em;
+}
+div.content0, div.main_column0 {
+ margin : 0;
+ padding : 0;
+ border-left : 0%% solid #000000;
+ padding-left : 5%%;
+}
+div.scroll {
+ margin : 0;
+ padding : 0;
+ padding-left : 1em;
+ padding-right : 1em;
+}
+div.content:after {
+ content : ' ';
+ clear : both;
+ display : block;
+ height : 0;
+ overflow : hidden;
+}
+div.footer {
+ clear : left;
+ padding : 0.5em;
+ font-size : 1.4rem;
+ margin : 0;
+}
+div.toc ul {
+ list-style : none;
+ padding : 0;
+ margin : 0;
+}
+div.toc li ul a, li ul span.currentlink
+{
+ font-weight : normal;
+ font-size : 1.5rem;
+ padding-left : 2em;
+ background-color : #111111;
+}
+div.toc a, span.currentlink{
+ display : block;
+ text-decoration : none;
+ padding-left : 0.5em;
+ color : #FF00AA;
+}
+hr {
+ width : 90%%;
+ margin-left : 5%%;
+ margin-right : 2em;
+ margin-top : 1.8em;
+ margin-bottom : 1.8em;
+}
+span.currentlink {
+ text-decoration : none;
+ background-color : #AAAAF9;
+}
+div.toc a:visited {
+ color : #FF00AA;
+}
+div.toc a:hover {
+ color : #CCCCCC;
+ background-color : #F9F9AA;
+}
+nav#toc ol {
+ list-style-type : none;
+}
+.norm, .bold, .verse, .group, .block, .alt {
+ line-height : 133%%;
+ margin-top : 12px;
+ margin-bottom : 0px;
+ padding-left : 0em;
+ text-indent : 0em;
+}
+p, h0, h1, h2, h3, h4, h5, h6, h7, ul, li {
+ display : block;
+ font-family : verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman;
+ margin-left : 5%%;
+ margin-right : 2em;
+}
+p {
+ font-size : 1.6rem;
+ font-weight : normal;
+ line-height : 133%%;
+ text-align : justify;
+ text-indent : 0mm;
+ margin-top : 0.8em;
+ margin-bottom : 0.8em;
+}
+img {
+ max-width : 100%%;
+ height : auto;
+}
+pre {
+ width : auto;
+ display : block;
+ clear : both;
+ color : #555555;
+}
+pre.codeline {
+ display : table;
+ clear : both;
+ table-layout : fixed;
+ margin-left : 5%%;
+ margin-right : 5%%;
+ width : 90%%;
+ white-space : pre-wrap;
+ border-style : none;
+ border-radius : 5px 5px 5px 5px;
+ box-shadow : 0 2px 5px #AAAAAA inset;
+ margin-bottom : 1em;
+ padding : 0.5em 1em;
+ page-break-inside : avoid;
+ word-wrap : break-word;
+ font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
+ white-space : pre;
+ white-space : pre-wrap;
+ white-space : -moz-pre-wrap;
+ white-space : -o-pre-wrap;
+ background-color : #555555;
+ color : #DDDDDD;
+ font-size : 1.5rem;
+ line-height : 100%%;
+}
+pre.codeline::before {
+ counter-reset : linenum;
+}
+pre.codeline span.tr {
+ display : table-row;
+ counter-increment : linenum;
+}
+pre.codeline span.th {
+ display : table-cell;
+ user-select : none;
+ -moz-user-select : none;
+ -webkit-user-select : none;
+ padding : 0.5em 0.5em;
+}
+pre.codeline span.th::before {
+ content : counter(linenum) ".";
+ color : #999999;
+ text-align : right;
+ display : block;
+}
+pre.codeline span.th {
+ width : 4em;
+}
+pre.codeline code {
+ display : table-cell;
+}
+p.code {
+ border-style : none;
+}
+p.spaced { white-space : pre; }
+p.block {
+ white-space : pre;
+}
+p.group { }
+p.alt { }
+p.verse {
+ white-space : pre;
+ margin-bottom : 6px;
+}
+p.caption {
+ text-align : left;
+ font-size : 1.4rem;
+ display : inline;
+}
+p.endnote {
+ font-size : 1.5rem;
+ line-height : 120%%;
+ text-align : left;
+ margin-right : 15mm;
+ padding-left : 1em;
+ text-indent : -1em;
+}
+p.center {
+ text-align : center;
+}
+p.bold {
+ font-weight : bold;
+}
+p.bold_left {
+ font-weight : bold;
+ text-align : left;
+}
+p.centerbold {
+ text-align : center;
+ font-weight : bold;
+}
+p.em {
+ font-weight : bold;
+ font-style : normal;
+ background : #FFF3B6;
+}
+.small, .small_center {
+ font-size : 1.4rem;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ margin-right : 6px;
+}
+p.small {
+ text-align : left;
+}
+p.small_center {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : center;
+}
+.tiny, .tiny_left, .tiny_right, .tiny_center {
+ font-size : 1.35rem;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ color : #EEEEEE;
+ margin-right : 6px;
+ text-align : left;
+}
+p.tiny { }
+p.tiny_left {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : left;
+}
+p.tiny_right {
+ margin-right : 1em;
+ text-align : right;
+}
+p.tiny_center {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : center;
+}
+p.concordance_word {
+ line-height : 150%%;
+ font-weight : bold;
+ display : inline;
+ margin-top : 4px;
+ margin-bottom : 1px;
+}
+p.concordance_count {
+ font-size : 1.4rem;
+ color : #555555;
+ display : inline;
+ margin-left : 0em;
+}
+p.concordance_object {
+ font-size : 1.4rem;
+ line-height : 120%%;
+ text-align : left;
+ margin-left : 3em;
+ margin-top : 1px;
+ margin-bottom : 3px;
+}
+p.book_index_lev1 {
+ line-height : 100%%;
+ margin-top : 4px;
+ margin-bottom : 1px;
+}
+p.book_index_lev2 {
+ line-height : 100%%;
+ text-align : left;
+ margin-left : 3em;
+ margin-top : 1px;
+ margin-bottom : 3px;
+}
+tt {
+ font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
+ background-color : #555555;
+ color : #DDDDDD;
+}
+%s
+note { white-space : pre; }
+label.ocn {
+ width : 2%%;
+ float : right;
+ top : 0;
+ font-size : 1.4rem;
+ margin-top : 0px;
+ margin-bottom : 6px;
+ margin-right : 6px;
+ text-align : right;
+ color : %s;
+ -khtml-user-select : none;
+ -moz-user-select : none;
+ -ms-user-select : none;
+ -o-user-select : none;
+ -webkit-user-select : none;
+ user-select : none;
+}
+table {
+ display : block;
+ margin-left : 5%%;
+ margin-right : 2em;
+ background-color : inherit;
+}
+tr { }
+th,td {
+ vertical-align : top;
+ text-align : left;
+}
+th {
+ font-weight : bold;
+}
+em {
+ font-weight : bold;
+ font-style : italic;
+}
+p.left,th.left,td.left {
+ text-align : left;
+}
+p.small_left,th.small_left,td.small_left {
+ text-align : left;
+ font-size : 1.4rem;
+}
+p.right,th.right,td.right {
+ text-align : right;
+}
+ul, li {
+ list-style-type : none;
+ list-style : none;
+ padding-left : 20px;
+ font-weight : normal;
+ line-height : 150%%;
+ text-align : left;
+ text-indent : 0mm;
+ margin-left : 1em;
+ margin-right : 2em;
+ margin-top : 3px;
+ margin-bottom : 3px;
+}
+li {
+ background : (../image_sys/bullet_09.png) no-repeat 0px 6px;
+}
+ul { }
+h0, h1, h2, h3, h4, h5, h6, h7 {
+ font-weight : bold;
+ line-height : 120%%;
+ text-align : left;
+ margin-top : 20px;
+ margin-bottom : 10px;
+}
+h4.norm, h5.norm, h6.norm, h7.norm {
+ margin-top : 10px;
+ margin-bottom : 0px;
+}
+h0 { font-size : 1.9rem; }
+h1 { font-size : 1.8rem; }
+h2 { font-size : 1.75rem; }
+h3 { font-size : 1.7rem; }
+h4 { font-size : 1.65rem; }
+h5 { font-size : 1.6rem; }
+h6 { font-size : 1.55rem; }
+h7 { font-size : 1.5rem; }
+h0, h1, h2, h3, h4, h5, h6, h7 {
+ text-shadow : .2em .2em .3em #999999;
+}
+h1.i { margin-left : 2em; }
+h2.i { margin-left : 3em; }
+h3.i { margin-left : 4em; }
+h4.i { margin-left : 5em; }
+h5.i { margin-left : 6em; }
+h6.i { margin-left : 7em; }
+h7.i { margin-left : 8em; }
+h8.i { margin-left : 9em; }
+h9.i { margin-left : 10em; }
+.toc {
+ font-weight : normal;
+ margin-top : 6px;
+ margin-bottom : 6px;
+}
+h0.toc {
+ margin-left : 1em;
+ font-size : 1.8rem;
+ line-height : 150%%;
+}
+h1.toc {
+ margin-left : 1em;
+ font-size : 1.75rem;
+ line-height : 150%%;
+}
+h2.toc {
+ margin-left : 2em;
+ font-size : 1.7rem;
+ line-height : 140%%;
+}
+h3.toc {
+ margin-left : 3em;
+ font-size : 1.65rem;
+ line-height : 120%%;
+}
+h4.toc {
+ margin-left : 4em;
+ font-size : 1.6rem;
+ line-height : 120%%;
+}
+h5.toc {
+ margin-left : 5em;
+ font-size : 1.5rem;
+ line-height : 110%%;
+}
+h6.toc {
+ margin-left : 6em;
+ font-size : 1.5rem;
+ line-height : 110%%;
+}
+h7.toc {
+ margin-left : 7em;
+ font-size : 1.45rem;
+ line-height : 100%%;
+}
+.subtoc {
+ margin-right : 34%%;
+ font-weight : normal;
+}
+h5.subtoc {
+ margin-left : 2em;
+ font-size : 1.4rem;
+ margin-top : 2px;
+ margin-bottom : 2px;
+}
+h6.subtoc {
+ margin-left : 3em;
+ font-size : 1.35;
+ margin-top : 0px;
+ margin-bottom : 0px;
+}
+h7.subtoc {
+ margin-left : 4em;
+ font-size : 1.3rem;
+ margin-top : 0px;
+ margin-bottom : 0px;
+}
+input, select, textarea {
+ font-size : 2.2rem;
+}
+input[type="text"] {
+ font-size : 1.8rem;
+ line-height : 120%%;
+}
+button[type="submit"] {
+ font-size : 1.8rem;
+ line-height : 120%%;
+}
+p.form {
+ font-size : 2.2rem;
+ line-height : 150%%;
+}
+
+┃",
+ _color_ocn_dark,
+ _css_indent,
+ _color_ocn_dark,
+);
+ auto css_() {
+ struct _CSS {
+ string html_seg = "/* spine css html seg stylesheet */\n";
+ string html_scroll = "/* spine css html scroll stylesheet */\n";
+ string epub = "/* spine css epub stylesheet */\n";
+ }
+ return _CSS();
+ }
+ auto css = css_();
+ if (doc_matters.opt.action.css_theme_default) {
+ css.html_seg ~= _css_light_html_seg;
+ css.html_scroll ~= _css_light_html_scroll;
+ css.epub ~= _css_light_epub;
+ } else {
+ css.html_seg ~= _css_dark_html_seg;
+ css.html_scroll ~= _css_dark_html_scroll;
+ css.epub ~= _css_dark_epub;
+ }
+ return css;
+ }
+}