From 90873fabd7451e1dd8c4b39303906e19bdc481f7 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 10 Apr 2024 22:24:34 -0400 Subject: 0.16.0 sisudoc (src/sisudoc sisudoc spine) - src/sisudoc (replaces src/doc_reform) - sisudoc spine (used more) --- src/doc_reform/io_out/cgi_sqlite_search_form.d | 1959 ----------- src/doc_reform/io_out/create_zip_file.d | 68 - src/doc_reform/io_out/defaults.d | 186 - src/doc_reform/io_out/epub3.d | 810 ----- src/doc_reform/io_out/html.d | 626 ---- src/doc_reform/io_out/html_snippet.d | 103 - src/doc_reform/io_out/hub.d | 238 -- src/doc_reform/io_out/latex.d | 1771 ---------- src/doc_reform/io_out/metadata.d | 609 ---- src/doc_reform/io_out/odt.d | 2162 ------------ src/doc_reform/io_out/package.d | 69 - src/doc_reform/io_out/paths_output.d | 672 ---- src/doc_reform/io_out/rgx.d | 157 - src/doc_reform/io_out/rgx_latex.d | 68 - src/doc_reform/io_out/rgx_xhtml.d | 63 - src/doc_reform/io_out/source_pod.d | 424 --- src/doc_reform/io_out/sqlite.d | 1761 ---------- src/doc_reform/io_out/xmls.d | 1424 -------- src/doc_reform/io_out/xmls_css.d | 4451 ------------------------ 19 files changed, 17621 deletions(-) delete mode 100644 src/doc_reform/io_out/cgi_sqlite_search_form.d delete mode 100644 src/doc_reform/io_out/create_zip_file.d delete mode 100644 src/doc_reform/io_out/defaults.d delete mode 100644 src/doc_reform/io_out/epub3.d delete mode 100644 src/doc_reform/io_out/html.d delete mode 100644 src/doc_reform/io_out/html_snippet.d delete mode 100644 src/doc_reform/io_out/hub.d delete mode 100644 src/doc_reform/io_out/latex.d delete mode 100644 src/doc_reform/io_out/metadata.d delete mode 100644 src/doc_reform/io_out/odt.d delete mode 100644 src/doc_reform/io_out/package.d delete mode 100644 src/doc_reform/io_out/paths_output.d delete mode 100644 src/doc_reform/io_out/rgx.d delete mode 100644 src/doc_reform/io_out/rgx_latex.d delete mode 100644 src/doc_reform/io_out/rgx_xhtml.d delete mode 100644 src/doc_reform/io_out/source_pod.d delete mode 100644 src/doc_reform/io_out/sqlite.d delete mode 100644 src/doc_reform/io_out/xmls.d delete mode 100644 src/doc_reform/io_out/xmls_css.d (limited to 'src/doc_reform/io_out') diff --git a/src/doc_reform/io_out/cgi_sqlite_search_form.d b/src/doc_reform/io_out/cgi_sqlite_search_form.d deleted file mode 100644 index e835b07..0000000 --- a/src/doc_reform/io_out/cgi_sqlite_search_form.d +++ /dev/null @@ -1,1959 +0,0 @@ -/+ -- Name: Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 - 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 ~ "
"); - string[] pair = pair_str.split("="); - canned_query[pair[0]] = pair[1]; - } - // foreach (field, content; canned_query) { - // cgi.write(field ~ ": " ~ content ~ "
"); - // } - } - static struct Rgx { - // static canned_query = ctRegex!(`\A(?P.+)\Z`, "m"); - static search_text_area = ctRegex!(`\A(?P.+)\Z`, "m"); - // static fulltext = ctRegex!(`\A(?P.+)\Z`, "m"); - static line = ctRegex!(`^(?P.+?)(?: ~|$)`, "m"); - static text = ctRegex!(`(?:^|\s~\s*)text:\s+(?P.+?)(?: ~|$)`, "m"); - static author = ctRegex!(`(?:^|\s~\s*)author:\s+(?P.+)$`, "m"); - static title = ctRegex!(`(?:^|\s~\s*)title:\s+(?P.+)$`, "m"); - static uid = ctRegex!(`(?:^|\s~\s*)uid:\s+(?P.+)$`, "m"); - static fn = ctRegex!(`(?:^|\s~\s*)fn:\s+(?P.+)$`, "m"); - static keywords = ctRegex!(`(?:^|\s~\s*)keywords:\s+(?P.+)$`, "m"); - static topic_register = ctRegex!(`(?:^|\s~\s*)topic_register:\s+(?P.+)$`, "m"); - static subject = ctRegex!(`(?:^|\s~\s*)subject:\s+(?P.+)$`, "m"); - static description = ctRegex!(`(?:^|\s~\s*)description:\s+(?P.+)$`, "m"); - static publisher = ctRegex!(`(?:^|\s~\s*)publisher:\s+(?P.+)$`, "m"); - static editor = ctRegex!(`(?:^|\s~\s*)editor:\s+(?P.+)$`, "m"); - static contributor = ctRegex!(`(?:^|\s~\s*)contributor:\s+(?P.+)$`, "m"); - static date = ctRegex!(`(?:^|\s~\s*)date:\s+(?P.+)$`, "m"); - static results_type = ctRegex!(`(?:^|\s~\s*)type:\s+(?P.+)$`, "m"); - static format = ctRegex!(`(?:^|\s~\s*)format:\s+(?P.+)$`, "m"); - static source = ctRegex!(`(?:^|\s~\s*)source:\s+(?P.+)$`, "m"); - static language = ctRegex!(`(?:^|\s~\s*)language:\s+(?P.+)$`, "m"); - static relation = ctRegex!(`(?:^|\s~\s*)relation:\s+(?P.+)$`, "m"); - static coverage = ctRegex!(`(?:^|\s~\s*)coverage:\s+(?P.+)$`, "m"); - static rights = ctRegex!(`(?:^|\s~\s*)rights:\s+(?P.+)$`, "m"); - static comment = ctRegex!(`(?:^|\s~\s*)comment:\s+(?P.+)$`, "m"); - // static abstract_ = ctRegex!(`(?:^|\s~\s*)abstract:\s+(?P.+)$`, "m"); - static src_filename_base = ctRegex!(`^src_filename_base:\s+(?P.+)$`, "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 ~ "
"); - } else if (environment.get("REQUEST_METHOD", "POST") == "GET") { - got.canned_query = environment.get("QUERY_STRING", ""); - // cgi.write("f.canned_query: " ~ got.canned_query ~ "
"); - 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 ~ "
"); - } - 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[&]smo=)(?P[0-9]+)`); - static results_type = ctRegex!(`[&]rt=(?Pidx|txt)`); - static results_type_index = ctRegex!(`[&]rt=idx`); - static results_type_text = ctRegex!(`[&]rt=txt`); - static fn = ctRegex!(`[&]fn=(?P[^&]+)`); - } - 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 = - "" - ~ "" - ~ "※" - ~ ""; - 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 = - "" - ~ "" - ~ "<< prev" - ~ " || "; - } - arrow_next = - "" - ~ "" - ~ "next >>" - ~ ""; - _previous_next = "
" ~ arrow_previous ~ arrow_next; - return _previous_next; - } - { - header = format(q"┃ - - - - - - %s - - - - - - - -┃", - conf.http_host, - ); - } - { - table = format(q"┃ - - - -
- - -
- %s -
-
-
-┃"); - } - { - 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 = - "" - ~ "POST: " - ~ "" - ~ method_post_url_construct - ~ "" - ~ "
"; - } else if (conf.request_method == "GET") { - _the_can = - "" - ~ "GET:  " - ~ "" - ~ method_get_url - ~ ""; - } - 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"┃ - -database: %%s; selected view: index -search string: %%s %%s %%s %%s %%s %%s
-%%s %%s %%s %%s %%s %%s -
-┃", - cv.db_selected, - (tf.text.empty ? "" : "\"text: " ~ tf.text ~ "; "), - (tf.title.empty ? "" : "\"title: " ~ tf.title ~ "; "), - (tf.author.empty ? "" : "\"author: " ~ tf.author ~ "; "), - (tf.date.empty ? "" : "\"date " ~ tf.date ~ "; "), - (tf.uid.empty ? "" : "\"uid: " ~ tf.uid ~ "; "), - (tf.fn.empty ? "" : "\"fn: " ~ tf.fn ~ "; "), - (tf.text.empty ? "" : "text: " ~ tf.text ~ "
"), - (tf.title.empty ? "" : "title: " ~ tf.title ~ "
"), - (tf.author.empty ? "" : "author: " ~ tf.author ~ "
"), - (tf.date.empty ? "" : "date: " ~ tf.date ~ "
"), - (tf.uid.empty ? "" : "\"uid: " ~ tf.uid ~ "; "), - (tf.fn.empty ? "" : "\"fn: " ~ tf.fn ~ "; "), - ); - } - return tip; - } - form = format(q"┃ -
- - -
- - - %%s - %%s - %%s -
- - - - - index - text / grep; - match limit: - 1,000 - 2,500 -
- echo query - search url - searched - sql statement - -
-
- - -
-┃", - "%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 ~ "
"); - // } - } - { // debug cgi info - // cgi.write("db_selected: " ~ cv.db_selected ~ "
\n"); - // cgi.write("search_text: " ~ cv.search_text ~ "
\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 ~ "
\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") ~ ";
\n"); - // cgi.write("cv.checked_tip: " ~ (cv.checked_tip ? "checked" : "off") ~ "; \n"); - // cgi.write("cv.checked_sql: " ~ (cv.checked_sql ? "checked" : "off") ~ "
\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 = ""; - string _span_close = ""; - 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"]+?>"); - foreach (_sf; _sf_arr) { - auto rgx_matched_text = regex(_sf, "i"); - auto rgx_marked_pair = regex(r"┤(?P" ~ _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 - ~ "
" - ~ sql_select.the_body.strip.split("\n ").join(" ").split("\n").join("
") - ~ "
\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) ? "" : "

"; - _matched_ocn_open = (idx == 1) ? "" : "

"; - _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 - ~ "


" - ~ "

\"" - ~ row["title"].as!string ~ "\"" - ~ " " - ~ _date - ~ "[" ~ row["language_document_char"].as!string ~ "] " - ~ row["creator_author_last_first"].as!string - ~ " " - ~ show_matched_objects(row["src_filename_base"].as!string) - ~ "

" - ~ "
" - ); - } - if (cv.results_type == "txt") { - if (row["ocn"].as!string != "0") { - cgi.write( - "
" - ~ "" - ~ "
" - ~ highlight_text_matched(row["body"].as!string, tf.text) - ~ "
" - ~ "
" - ); - } else { - cgi.write( - "
" - ~ "" - ~ "
" - ~ highlight_text_matched(row["body"].as!string, tf.text) - ~ "
" - ~ "
" - ); - } - } else { - if (row["ocn"].as!string != "0") { - cgi.write( - _matched_ocn_open - ~ "" - ~ row["ocn"].as!string - ~ ", " - ); - } else { - cgi.write( - _matched_ocn_open - ~ "" - ~ row["ocn"].as!string - ~ ", " - ); - } - _matched_ocn_open = ""; - } - } - cgi.write( previous_next); - - } else { // offset_not_beyond_limit = false; - cgi.write("select_query_results empty

\n"); - } - cgi.write("

- - -
- git -

-"); - } - sql_search_query; - } - { - db.close; - } - { - string tail = format(q"┃ - -┃"); - 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/doc_reform/io_out/create_zip_file.d b/src/doc_reform/io_out/create_zip_file.d deleted file mode 100644 index 54a3d53..0000000 --- a/src/doc_reform/io_out/create_zip_file.d +++ /dev/null @@ -1,68 +0,0 @@ -/+ -- Name: Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 - 2024 Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -module doc_reform.io_out.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/doc_reform/io_out/defaults.d b/src/doc_reform/io_out/defaults.d deleted file mode 100644 index 2faf927..0000000 --- a/src/doc_reform/io_out/defaults.d +++ /dev/null @@ -1,186 +0,0 @@ -/+ -- Name: Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 - 2024 Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -/++ - default settings -+/ -module doc_reform.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/doc_reform/io_out/epub3.d b/src/doc_reform/io_out/epub3.d deleted file mode 100644 index a42941a..0000000 --- a/src/doc_reform/io_out/epub3.d +++ /dev/null @@ -1,810 +0,0 @@ -/+ -- Name: Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 - 2024 Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -module doc_reform.io_out.epub3; -@safe: -template outputEPub3() { - import - std.file, - std.outbuffer, - std.uri, - std.zip, - std.conv : to; - import - doc_reform.io_out, - doc_reform.io_out.rgx, - doc_reform.io_out.rgx_xhtml, - doc_reform.io_out.create_zip_file, - doc_reform.io_out.xmls, - doc_reform.io_out.xmls_css; - mixin InternalMarkup; - mixin outputXHTMLs; - static auto rgx = RgxO(); - static auto rgx_xhtml = RgxXHTML(); - string special_characters_text(string _txt) { - _txt = _txt - .replaceAll(rgx_xhtml.ampersand, "&") // "&" - .replaceAll(rgx_xhtml.quotation, """) // """ - .replaceAll(rgx_xhtml.less_than, "<") // "<" - .replaceAll(rgx_xhtml.greater_than, ">") // ">" - .replaceAll(rgx.br_line, "
") - .replaceAll(rgx.br_line_inline, "
") - .replaceAll(rgx.br_line_spaced, "
\n
") - .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"┃┃") ~ "\n"; - o ~= format(q"┃ - - - ┃") ~ "\n\n"; - return o; - } - string epub3_oebps_content(D,M,P)(D doc_abstraction, M doc_matters, P parts) { - auto xhtml_format = outputXHTMLs(); - auto pth_epub3 = spinePathsEPUB!()(doc_matters.output_path, doc_matters.src.language); - string _uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO sort uuid in doc_matters! - string content = format(q"┃ - - - %s - main - %s - subtitle - %s - %s - %s - Copyright: %s - %s - urn:uuid:%s - - - - - ┃", - _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"┃ - ┃", - image.baseName.stripExtension, - (pth_epub3.doc_oebps_image).chompPrefix("OEBPS/"), - image, - image.extension.chompPrefix("."), - ); - } - content ~= " " ~ "" ~ "\n "; - content ~= " " ~ "" ~ "\n "; - content ~= parts["spine"]; - content ~= " " ~ "" ~ "\n "; - content ~= " " ~ "" ~ "\n "; - content ~= parts["guide"]; - content ~= " " ~ "" ~ "\n "; - content ~= "" ~ ""; - 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"┃ - - %s - - -
-
-

Contents

-
- -
- - \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"┃ - ┃", - obj.tags.segment_anchor_tag_epub, - obj.tags.segment_anchor_tag_epub, - ); - oepbs_content_parts["spine"] ~= - format(q"┃ - ┃", - obj.tags.segment_anchor_tag_epub, - ); - oepbs_content_parts["guide"] ~= - format(q"┃ - ┃", - 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"┃ - ┃", - 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"┃ - ┃", - obj.tags.segment_anchor_tag_epub, - obj.metainfo.object_number, - ); - oepbs_content_parts["guide"] ~= - format(q"┃ - ┃", - 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 doc_reform.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/doc_reform/io_out/html.d b/src/doc_reform/io_out/html.d deleted file mode 100644 index f463b3a..0000000 --- a/src/doc_reform/io_out/html.d +++ /dev/null @@ -1,626 +0,0 @@ -/+ -- Name: Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 - 2024 Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -module doc_reform.io_out.html; -@safe: -template outputHTML() { - import - std.file, - std.outbuffer, - std.uri, - std.conv : to; - import - doc_reform.io_out, - doc_reform.io_out.rgx, - doc_reform.meta.rgx_files, - doc_reform.io_out.rgx_xhtml, - doc_reform.io_out.create_zip_file, - doc_reform.io_out.xmls, - doc_reform.io_out.xmls_css; - mixin 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 doc_reform.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 doc_reform.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 doc_reform.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/doc_reform/io_out/html_snippet.d b/src/doc_reform/io_out/html_snippet.d deleted file mode 100644 index b1abaca..0000000 --- a/src/doc_reform/io_out/html_snippet.d +++ /dev/null @@ -1,103 +0,0 @@ -/+ -- Name: Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 - 2024 Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -module doc_reform.io_out.html_snippet; -@safe: -template htmlSnippet() { - import - std.file, - std.outbuffer, - std.format, - std.uri, - std.conv : to; - import - doc_reform.io_out.rgx, - doc_reform.meta.rgx_files, - doc_reform.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"┃ - - - - - - -

- ⟰   -  ≅  -

- -┃", - 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, "&") // "&" - .replaceAll(rgx_xhtml.quotation, """) // """ - .replaceAll(rgx_xhtml.less_than, "<") // "<" - .replaceAll(rgx_xhtml.greater_than, ">") // ">" - .replaceAll(rgx.br_line, "
") - .replaceAll(rgx.br_line_inline, "
") - .replaceAll(rgx.br_line_spaced, "
\n
") - .replaceAll(rgx.nbsp_char, " "); - return _txt; - } -} diff --git a/src/doc_reform/io_out/hub.d b/src/doc_reform/io_out/hub.d deleted file mode 100644 index ba1c206..0000000 --- a/src/doc_reform/io_out/hub.d +++ /dev/null @@ -1,238 +0,0 @@ -/+ -- Name: Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 - 2024 Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -/++ - output hub
- check & generate output types requested -+/ -module doc_reform.io_out.hub; -@safe: -template outputHub() { - import doc_reform.io_out, - doc_reform.io_out.metadata, - doc_reform.io_out.xmls, - doc_reform.io_out.create_zip_file, - doc_reform.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 doc_reform.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 doc_reform.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 doc_reform.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 doc_reform.io_out.html; - outputHTML!().seg(doc_abstraction, doc_matters); - msg.vv("html seg done"); - } - if (sched == outTask.html_stuff) { - import doc_reform.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 doc_reform.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 doc_reform.io_out.odt; - outputODT!()(doc_abstraction, doc_matters); - msg.vv("odf:odt done"); - } - if (sched == outTask.sqlite) { - msg.v("sqlite processing... "); - import doc_reform.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 doc_reform.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 doc_reform.io_out.sqlite; - doc_abstraction.SQLiteHubBuildTablesAndPopulate!()(doc_matters); - msg.vv("sqlite delete done"); - } - } -} -template outputHubInitialize() { - import std.file; - import doc_reform.io_out, - doc_reform.io_out.metadata, - doc_reform.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 doc_reform.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 doc_reform.io_out, - doc_reform.io_out.metadata, - doc_reform.io_out.xmls, - doc_reform.io_out.create_zip_file, - doc_reform.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 doc_reform.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 doc_reform.io_out.sqlite; - SQLiteTablesCreate!()(env, opt_action, config); - if ((opt_action.vox_gt2)) { - writeln("sqlite create table done"); - } - } - } -} diff --git a/src/doc_reform/io_out/latex.d b/src/doc_reform/io_out/latex.d deleted file mode 100644 index f53433c..0000000 --- a/src/doc_reform/io_out/latex.d +++ /dev/null @@ -1,1771 +0,0 @@ -/+ -- Name: Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 - 2024 Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -module doc_reform.io_out.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 - doc_reform.io_out, - doc_reform.io_out.rgx, - doc_reform.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 doc_reform.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 doc_reform.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 doc_reform.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 doc_reform.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&%% - \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 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/doc_reform/io_out/metadata.d b/src/doc_reform/io_out/metadata.d deleted file mode 100644 index 2ddc19d..0000000 --- a/src/doc_reform/io_out/metadata.d +++ /dev/null @@ -1,609 +0,0 @@ -/+ -- Name: Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 - 2024 Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -module doc_reform.io_out.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"┃ -
- -
-   %s  - %s - - - - - -
- -
-
- - - -
┃", - doc_matters.conf_make_meta.conf.w_srv_cgi_action, - (doc_matters.conf_make_meta.conf.w_srv_db_sqlite_filename.empty) - ? "" - : "\n 🔎 ", - (doc_matters.conf_make_meta.conf.w_srv_db_sqlite_filename.empty) - ? "" - : "\n ", - 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 ", - doc_matters.src.filename_base, - ); - } else { - o = ""; - } - return o; - } - import - std.file, - std.format; - import doc_reform.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"┃ - - - -⌘ Curated metadata - Topics - - - - - - - - - -┃", - 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 doc_reform.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 doc_reform.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"┃ - - - - ┃"); - metadata_ ~= "
"; - if (doc_matters.opt.action.html_link_curate) { - metadata_ ~= format(q"┃

[  HOME  |  ≅ Collection ]  [ -  🖋 Authors  | -  ⌘ Topics ]

- ┃", - (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"┃

[ ≅ HOME   ≅ Collection ] - ┃"); - } - metadata_ ~= "

" ~ inline_search_form(doc_matters) ~ "

"; - if (!(doc_matters.conf_make_meta.meta.title_full.empty)) { - metadata_ ~= "

Title: " ~ doc_matters.conf_make_meta.meta.title_full ~ "

"; - } 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_ ~= "

Author: " - ~ doc_matters.conf_make_meta.meta.creator_author ~ "

"; - } else { - metadata_ ~= "

Author: " - ~ doc_matters.conf_make_meta.meta.creator_author ~ "

"; - } - } 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_ ~= "

Published: " ~ doc_matters.conf_make_meta.meta.date_published ~ "

"; - if (!(doc_matters.conf_make_meta.meta.rights_copyright.empty)) { - metadata_ ~= "

Copyright: " ~ special_characters_text(doc_matters.conf_make_meta.meta.rights_copyright) ~ "

"; - } 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_ ~= "

License: " ~ special_characters_text(doc_matters.conf_make_meta.meta.rights_license) ~ "

"; - } 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_ ~= "

Summary:

" ~ special_characters_text(doc_matters.conf_make_meta.meta.notes_summary) ~ "

"; - } else if (doc_matters.opt.action.debug_do) { - writeln("WARNING no summary of text provided in document header ", doc_matters.src.filename_base); - } - metadata_ ~= "

source: " ~ doc_matters.src.filename_base ~ "

"; - if (doc_matters.opt.action.html_link_markup_source) { - metadata_ ~= "

●  markup source:  the pod [" - ~ " 🫛 zipped | " - ~ "" - ~ " 🫛 tree ] "; - } - metadata_ ~= "

●  outputs:  [ html: " - ~ " ▤ scroll  " - ~ "|" - ~ " ※ seg ]   " - ~ "[" - ~ " ◆ epub ]   "; - if ((doc_matters.opt.action.html_link_pdf) || (doc_matters.opt.action.html_link_pdf_a4)) { - metadata_ ~= "[ pdf: " - ~ " □ a4  " - ~ "|" - ~ " □ U.S. letter ] "; - } else if (doc_matters.opt.action.html_link_pdf_a4) { - metadata_ ~= "[" - ~ " □ pdf (a4) ] "; - } else if (doc_matters.opt.action.html_link_pdf_letter) { - metadata_ ~= "[" - ~ " □ pdf (U.S. letter) ] "; - } - metadata_ ~= "

"; - if (doc_matters.conf_make_meta.meta.classify_topic_register_arr.length > 0) { - metadata_ ~= "

Topics:

"; - 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_ ~= - "

" - ~ subject_tree[0] - ~ "

"; - } else { - metadata_ ~= - "

" ~ subject_tree[0] ~ "

"; - } - } - 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_ ~= - "

" - ~ subject_tree[1] - ~ "

"; - } else { - metadata_ ~= - "

" ~ subject_tree[1] ~ "

"; - } - } - 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_ ~= - "

" - ~ subject_tree[2] - ~ "

"; - } else { - metadata_ ~= - "

" ~ subject_tree[2] ~ "

"; - } - } - 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_ ~= - "

" - ~ subject_tree[3] - ~ "

"; - } else { - metadata_ ~= - "

" ~ subject_tree[3] ~ "

"; - } - } - 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_ ~= - "

" - ~ subject_tree[4] - ~ "

"; - } else { - metadata_ ~= - "

" ~ subject_tree[4] ~ "

"; - } - } - } - } - } - } - } - } - } 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/doc_reform/io_out/odt.d b/src/doc_reform/io_out/odt.d deleted file mode 100644 index 1681bb1..0000000 --- a/src/doc_reform/io_out/odt.d +++ /dev/null @@ -1,2162 +0,0 @@ -/+ -- Name: Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 - 2024 Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -module doc_reform.io_out.odt; -@safe: -template formatODT() { - import - doc_reform.io_out, - doc_reform.io_out.rgx, - doc_reform.io_out.rgx_xhtml; - import - std.digest.sha, - std.file, - std.outbuffer, - std.uri, - std.zip, - std.conv : to; - import - doc_reform.io_out.create_zip_file, - doc_reform.io_out.xmls, - doc_reform.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"┃ - - - - ┃", - _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 ~= ""; - } - } - } - return tags; - } - string obj_num(O)(const O obj) { // TODO - string _on; - _on = (obj.metainfo.object_number.empty) - ? "" - : (format(q"┃ - 「%s」┃", - 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"┃ - - %s - - - - %s - - - ┃", - "$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 - %s%s%s - ┃", - (obj.attrib.indent_base < 4) - ? "\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"┃ - %s - - - - - %s%s%s - ┃", - _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"┃ - %s - - - - - %s%s%s - ┃", - obj.attrib.indent_base, - _bullet(obj), - obj.metainfo.object_number, - obj.metainfo.object_number, - _tags(obj), - _txt, - obj_num(obj), - ); - } else { - _txt = format(q"┃ - %s - - - - - %s%s%s - ┃", - 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"┃ - %s - %s%s%s - ┃", - _bullet(obj), - _tags(obj), - _txt, - obj_num(obj), - ); - } else if (obj.attrib.indent_base == obj.attrib.indent_hang) { - _txt = format(q"┃ - %s - %s%s%s - ┃", - obj.attrib.indent_base, - _bullet(obj), - _tags(obj), - _txt, - obj_num(obj), - ); - } else { - _txt = format(q"┃ - %s - %s%s%s - ┃", - _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"┃ - %s - - - - - %s - ┃", - _bullet(obj), - obj.metainfo.object_number, - obj.metainfo.object_number, - // _tags(obj), - _line, - ); - } else { - _block ~= format(q"┃ - %s┃", - _line); - } - } - _block ~= format(q"┃ - - 「%s」 - - ┃", - obj_num(obj)); - return _block; - } - string _special_characters(O)(string _txt, const O obj) { - _txt = _txt - .replaceAll(rgx_xhtml.ampersand, "&") - .replaceAll(rgx_xhtml.quotation, """) - .replaceAll(rgx_xhtml.less_than, "<") - .replaceAll(rgx_xhtml.greater_than, ">") - .replaceAll(rgx.nbsp_char, " "); - 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, " "); - } - return _txt; - } - string _font_face(string _txt){ - _txt = _txt - .replaceAll(rgx.inline_strike, "$1") - .replaceAll(rgx.inline_insert, "$1") - .replaceAll(rgx.inline_cite, "$1") - .replaceAll(rgx.inline_emphasis, format(q"┃%s┃", "$1")) - .replaceAll(rgx.inline_bold, format(q"┃%s┃", "$1")) - .replaceAll(rgx.inline_italics, format(q"┃%s┃", "$1")) - .replaceAll(rgx.inline_underscore, format(q"┃%s┃", "$1")) - .replaceAll(rgx.inline_superscript, format(q"┃%s┃","$1")) - .replaceAll(rgx.inline_subscript, format(q"┃%s┃", "$1")) - .replaceAll(rgx.inline_mono, format(q"┃%s┃", "$1")); - return _txt; - } - auto _obj_num(O)(O obj) { // NOT USED YET - struct objNum { - string reference() { - return format(q"┃ - - - ┃", - obj.object_number, - obj.object_number, - ); - } - string display() { - return format(q"┃ - %s%s%s - ┃", - on_o, - obj.object_number, - on_c, - ); - } - } - return objNum(); - } - string _break_page()() { - return format(q"┃ - - ┃", - ); - } - 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, "
"); - } - 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"┃%s┃", - _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"┃%s┃", - _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 $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 - %s%s%s - ┃", - _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 - - - - - %s%s%s - ┃", - _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 - - "^[ ]"   - - 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"┃ - - - - - - %s - ┃", - obj.metainfo.object_number, - obj.metainfo.object_number, - _line, - ); - } else { - _block ~= format(q"┃ - %s┃", - _line); - } - } - _block ~= format(q"┃ - - 「%s」 - - ┃", - 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 ~= ""; - 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"┃ - - %s - - ┃", - (row_idx == 0 && obj.table.heading) ? "Table_Heading" : "P_table_cell", - cell, - ); - } - } - _table ~= ""; - } - 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"┃ - - - - - - - %s - - - 「%s」 - ┃", - _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 - doc_reform.io_out, - doc_reform.io_out.rgx, - doc_reform.io_out.rgx_xhtml; - import - std.digest.sha, - std.file, - std.outbuffer, - std.uri, - std.zip, - std.conv : to; - import - doc_reform.io_out.create_zip_file, - doc_reform.io_out.xmls, - doc_reform.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"┃ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ┃",); - string _odt_head = format(q"┃ - - - - - - - - - - - - - - %s - - - - - - - - - - - - - - ┃", - (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"┃spine: <www.doc_reform.org> and <www.sisudoc.org> - ┃",); - 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"┃┃",); - string br_pg = format(q"┃┃",); - _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"┃┃"); - string[] _images = [ _bullet ]; - foreach (image; doc_matters.srcs.image_list) { - _images ~= format(q"┃ ┃", image); - } - string _manifest_xml = format(q"┃ - - - - - %s - - - - - - ┃", - _images.join("\n"), - ); - return _manifest_xml; - } - void images_cp(M)( - auto ref M doc_matters, - ) { - { /+ (copy odt images) +/ - import doc_reform.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"┃ - - - %s - %s - %s - en-US - - - ┃", - 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 doc_reform.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 doc_reform.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"┃ - - - - - - - - - - - - - - - - - - ┃"); - return _manifest_rdf; - } - string settings_xml() { - string _settings_xml = format(q"┃ - - - - 0 - 0 - 0 - 0 - true - false - - - view2 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 2 - true - 100 - false - - - - - true - false - false - true - true - false - true - false - false - - false - false - false - true - true - 0 - false - false - false - false - true - false - false - false - false - true - true - false - false - true - false - true - false - high-resolution - 1 - 0 - true - - - false - true - - false - true - false - true - false - true - false - - true - true - false - true - true - true - false - false - - false - 0 - false - false - true - true - - - - ┃"); - return _settings_xml; - } - string styles_xml() { - string _styles_xml = format(q"┃ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ┃"); - 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 doc_reform.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/doc_reform/io_out/package.d b/src/doc_reform/io_out/package.d deleted file mode 100644 index fe06e84..0000000 --- a/src/doc_reform/io_out/package.d +++ /dev/null @@ -1,69 +0,0 @@ -/+ -- Name: Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 - 2024 Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -module doc_reform.io_out; -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 - doc_reform.share.defaults, - doc_reform.io_in.paths_source, - doc_reform.io_out.defaults, - doc_reform.io_out.paths_output; diff --git a/src/doc_reform/io_out/paths_output.d b/src/doc_reform/io_out/paths_output.d deleted file mode 100644 index 43e4546..0000000 --- a/src/doc_reform/io_out/paths_output.d +++ /dev/null @@ -1,672 +0,0 @@ -/+ -- Name: Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 - 2024 Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -/++ - default settings -+/ -module doc_reform.io_out.paths_output; -@safe: -import - std.array, - std.path, - std.regex, - std.stdio; -import - doc_reform.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/doc_reform/io_out/rgx.d b/src/doc_reform/io_out/rgx.d deleted file mode 100644 index f21f4ba..0000000 --- a/src/doc_reform/io_out/rgx.d +++ /dev/null @@ -1,157 +0,0 @@ -/+ -- Name: Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 - 2024 Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -/++ - regex: regular expressions used in sisu document parser -+/ -module doc_reform.io_out.rgx; -@safe: -static template spineRgxOut() { - static struct RgxO { - static make_breakpage = ctRegex!(`new=(?P.+?)(?:;|$)`); - static make_breakcolumn = ctRegex!(`break=(?P.+?)(?:;|$)`,); - static newline = ctRegex!("\n", "mg"); - static space = ctRegex!(`[ ]`, "mg"); - static spaces_keep = ctRegex!(`(?P^[ ]+|[ ]{2,})`, "mg"); // code, verse, block - static spaces_line_start = ctRegex!(`^(?P[ ]+)`, "mg"); - static nbsp_char = ctRegex!(`░`, "mg"); - static nbsp_chars = ctRegex!(`[░]+`, "mg"); - static middle_dot = ctRegex!(`·`, "mg"); - static src_pth_sst_or_ssm = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.](?Pss[tm]))$`); - static src_pth_pod_sst_or_ssm = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)media/text/[a-z]{2}/(?P[a-zA-Z0-9][a-zA-Z0-9._-]*?[.]ss[tm])$`); - static src_pth_contents = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9][a-zA-Z0-9._-]*)/pod[.]manifest$`); - static src_pth_zip = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.]zip)$`); - static src_pth_types = ctRegex!(`^(?P[/]?[a-zA-Z0-9._-]+/)*(?P(?P[a-zA-Z0-9._-]+[.]ss[tm])|(?P[a-zA-Z0-9._-]+/pod[.]manifest)|(?P[a-zA-Z0-9._-]+[.]zip))$`); - static src_fn = ctRegex!(`^([/]?(?:[a-zA-Z0-9._-]+/)*)(?P(?P[a-zA-Z0-9._-]+)[.](?Pss[tm]))$`); - static src_fn_master = ctRegex!(`^(?P/?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.]ssm)$`); - static src_fn_find_inserts = ctRegex!(`^(?P/?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.]ss[im])$`); - static insert_src_fn_ssi_or_sst = ctRegex!(`^<<\s*(?P[a-zA-Z0-9._-]+/)*(?P[a-zA-Z0-9._-]+[.]ss[ti])$`); - static src_base_parent_dir_name = ctRegex!(`[/](?P(?:[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure - static src_formalised_file_path_parts = ctRegex!(`(?P(?:[/a-zA-Z0-9._-]+?)(?P[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.+?)】`, "m"); - static inline_notes_al_all_note = ctRegex!(`【(?P\d+|(?:[*]|[+])+)\s+(?P.+?)\s*】`, "mg"); - static inline_notes_al_regular_number_note = ctRegex!(`【(?P\d+)\s+(?P.+?)\s*】`, "mg"); - static inline_notes_al_special_char_note = ctRegex!(`【(?P(?:[*]|[+])+)\s+(?P.+?)】`, "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
┥)☼(?P(?P[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P\d+)h(?P\d+))\s*(?P.*?┝┤.*?├)`, "mg");
-    static inline_image_without_dimensions          = ctRegex!(`(?P
┥)☼(?P(?P[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P0)h(?P0))\s*(?P.*?┝┤.*?├)`, "mg");
-    static inline_image_info                        = ctRegex!(`☼?(?P[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P\d+)h(?P\d+)`, "mg");
-    static inline_link_anchor                       = ctRegex!(`┃(?P\S+?)┃`, "mg"); // TODO *~text_link_anchor
-    static inline_link                              = ctRegex!(`┥(?P.+?)┝┤(?P#?(\S+?))├`, "mg");
-    static inline_link_empty                        = ctRegex!(`┥(?P.+?)┝┤├`, "mg");
-    static inline_link_number                       = ctRegex!(`┥(?P.+?)┝┤(?P[0-9]+)├`, "mg"); // not used
-    static inline_link_number_only                  = ctRegex!(`(?P┥.+?┝)┤(?P[0-9]+)├`, "mg");
-    static inline_link_stow_uri                     = ctRegex!(`┥(?P.+?)┝┤(?P[^ 0-9#┥┝┤├][^ 0-9┥┝┤├]+)├`, "mg"); // will not stow (stowed links) or object number internal links
-    static inline_link_hash                         = ctRegex!(`┥(?P.+?)┝┤(?P#(?P\S+?))├`, "mg");
-    static inline_link_seg_and_hash                 = ctRegex!(`┥(?P.+?)┝┤(?P(?P[^/#├]*)#(?P.+?))├`, "mg");
-    static inline_link_clean                        = ctRegex!(`┤(?:.+?)├|[┥┝]`, "mg");
-    static inline_link_toc_to_backmatter            = ctRegex!(`┤#(?Pendnotes|bibliography|bookindex|glossary|blurb)├`, "mg");
-    static url                                      = ctRegex!(`https?://`, "mg");
-    static uri                                      = ctRegex!(`(?:https?|git)://`, "mg");
-    static uri_identify_components                  = ctRegex!(`(?P(?:https?|git)://)(?P\S+?/)(?P[^/]+)$`, "mg");
-    static inline_link_subtoc                       = ctRegex!(`^(?P[5-7])~ ┥(?P.+?)┝┤(?P.+?)├`, "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.+?)┣[*]`, "mg");
-    static inline_bold                              = ctRegex!(`⑆[!]┨(?P.+?)┣[!]`, "mg");
-    static inline_underscore                        = ctRegex!(`⑆[_]┨(?P.+?)┣[_]`, "mg");
-    static inline_italics                           = ctRegex!(`⑆[/]┨(?P.+?)┣[/]`, "mg");
-    static inline_superscript                       = ctRegex!(`⑆\^┨(?P.+?)┣\^`, "mg");
-    static inline_subscript                         = ctRegex!(`⑆[,]┨(?P.+?)┣[,]`, "mg");
-    static inline_strike                            = ctRegex!(`⑆[-]┨(?P.+?)┣[-]`, "mg");
-    static inline_insert                            = ctRegex!(`⑆[+]┨(?P.+?)┣[+]`, "mg");
-    static inline_mono                              = ctRegex!(`⑆[■]┨(?P.+?)┣[■]`, "mg");
-    static inline_cite                              = ctRegex!(`⑆[‖]┨(?P.+?)┣[‖]`, "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[1-9])[*] `, "m");
-    static grouped_para_indent_hang                 = ctRegex!(`^_(?P[0-9])_(?P[0-9])[ ]`, "m");
-  }
-}
diff --git a/src/doc_reform/io_out/rgx_latex.d b/src/doc_reform/io_out/rgx_latex.d
deleted file mode 100644
index bf20142..0000000
--- a/src/doc_reform/io_out/rgx_latex.d
+++ /dev/null
@@ -1,68 +0,0 @@
-/+
-- Name: Spine, Doc Reform [a part of]
-  - Description: documents, structuring, processing, publishing, search
-    - static content generator
-
-  - Author: Ralph Amissah
-    [ralph.amissah@gmail.com]
-
-  - Copyright: (C) 2015 - 2024 Ralph Amissah, All Rights Reserved.
-
-  - License: AGPL 3 or later:
-
-    Spine (SiSU), a framework for document structuring, publishing and
-    search
-
-    Copyright (C) Ralph Amissah
-
-    This program is free software: you can redistribute it and/or modify it
-    under the terms of the GNU AFERO General Public License as published by the
-    Free Software Foundation, either version 3 of the License, or (at your
-    option) any later version.
-
-    This program is distributed in the hope that it will be useful, but WITHOUT
-    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-    FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-    more details.
-
-    You should have received a copy of the GNU General Public License along with
-    this program. If not, see [https://www.gnu.org/licenses/].
-
-    If you have Internet connection, the latest version of the AGPL should be
-    available at these locations:
-    [https://www.fsf.org/licensing/licenses/agpl.html]
-    [https://www.gnu.org/licenses/agpl.html]
-
-  - Spine (by Doc Reform, related to SiSU) uses standard:
-    - docReform markup syntax
-      - standard SiSU markup syntax with modified headers and minor modifications
-    - docReform object numbering
-      - standard SiSU object citation numbering & system
-
-  - Homepages:
-    [https://www.sisudoc.org]
-    [https://www.doc-reform.org]
-
-  - Git
-    [https://git.sisudoc.org/]
-
-+/
-/++
-  regex: regular expressions used in sisu document parser
-+/
-module doc_reform.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/doc_reform/io_out/rgx_xhtml.d b/src/doc_reform/io_out/rgx_xhtml.d
deleted file mode 100644
index 6ee9623..0000000
--- a/src/doc_reform/io_out/rgx_xhtml.d
+++ /dev/null
@@ -1,63 +0,0 @@
-/+
-- Name: Spine, Doc Reform [a part of]
-  - Description: documents, structuring, processing, publishing, search
-    - static content generator
-
-  - Author: Ralph Amissah
-    [ralph.amissah@gmail.com]
-
-  - Copyright: (C) 2015 - 2024 Ralph Amissah, All Rights Reserved.
-
-  - License: AGPL 3 or later:
-
-    Spine (SiSU), a framework for document structuring, publishing and
-    search
-
-    Copyright (C) Ralph Amissah
-
-    This program is free software: you can redistribute it and/or modify it
-    under the terms of the GNU AFERO General Public License as published by the
-    Free Software Foundation, either version 3 of the License, or (at your
-    option) any later version.
-
-    This program is distributed in the hope that it will be useful, but WITHOUT
-    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-    FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-    more details.
-
-    You should have received a copy of the GNU General Public License along with
-    this program. If not, see [https://www.gnu.org/licenses/].
-
-    If you have Internet connection, the latest version of the AGPL should be
-    available at these locations:
-    [https://www.fsf.org/licensing/licenses/agpl.html]
-    [https://www.gnu.org/licenses/agpl.html]
-
-  - Spine (by Doc Reform, related to SiSU) uses standard:
-    - docReform markup syntax
-      - standard SiSU markup syntax with modified headers and minor modifications
-    - docReform object numbering
-      - standard SiSU object citation numbering & system
-
-  - Homepages:
-    [https://www.sisudoc.org]
-    [https://www.doc-reform.org]
-
-  - Git
-    [https://git.sisudoc.org/]
-
-+/
-/++
-  regex: regular expressions used in sisu document parser
-+/
-module doc_reform.io_out.rgx_xhtml;
-@safe:
-static template spineRgxXHTML() {
-  static struct RgxXHTML {
-    static ampersand                                = ctRegex!(`[&]`, "m");      // &
-    static quotation                                = ctRegex!(`["]`, "m");      // "
-    static less_than                                = ctRegex!(`[<]`, "m");      // <
-    static greater_than                             = ctRegex!(`[>]`, "m");      // >
-    static line_break                               = ctRegex!(` [\\]{2}`, "m"); // 
- } -} diff --git a/src/doc_reform/io_out/source_pod.d b/src/doc_reform/io_out/source_pod.d deleted file mode 100644 index 19b117f..0000000 --- a/src/doc_reform/io_out/source_pod.d +++ /dev/null @@ -1,424 +0,0 @@ -/+ -- Name: Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 - 2024 Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -module doc_reform.io_out.source_pod; -@system: // is not @safe: use: @system: or @trusted: -template spinePod() { - import - doc_reform.meta.rgx_files, - doc_reform.io_out; - import - std.digest.sha, - std.file, - std.outbuffer, - std.zip, - std.conv : to; - import - doc_reform.io_out.create_zip_file, - doc_reform.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 doc_reform.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\S+?)(?P[a-z_-]+)/(?Pmedia/text/)(?P\S+?)/(?P\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\S+?)(?P[a-z_-]+)/(?Pmedia/text/)(?P\S+?)/(?P\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/doc_reform/io_out/sqlite.d b/src/doc_reform/io_out/sqlite.d deleted file mode 100644 index 32bf6e9..0000000 --- a/src/doc_reform/io_out/sqlite.d +++ /dev/null @@ -1,1761 +0,0 @@ -/+ -- Name: Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 - 2024 Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -module doc_reform.io_out.sqlite; -import - doc_reform.io_out, - doc_reform.io_out.rgx, - doc_reform.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, "&") - .replaceAll(rgx_xhtml.quotation, """) - .replaceAll(rgx_xhtml.less_than, "<") - .replaceAll(rgx_xhtml.greater_than, ">") - .replaceAll(rgx.nbsp_char, " ") - .replaceAll(rgx.br_line_inline, "
") - .replaceAll(rgx.br_line, "
") - .replaceAll(rgx.br_line_spaced, "

") - .replaceAll(rgx_xhtml.line_break, "
"); - return _txt; - } - string _html_font_face(string _txt){ - _txt = _txt - .replaceAll(rgx.inline_emphasis, "$1") - .replaceAll(rgx.inline_bold, "$1") - .replaceAll(rgx.inline_underscore, "$1") - .replaceAll(rgx.inline_italics, "$1") - .replaceAll(rgx.inline_superscript, "$1") - .replaceAll(rgx.inline_subscript, "$1") - .replaceAll(rgx.inline_strike, "$1") - .replaceAll(rgx.inline_insert, "$1") - .replaceAll(rgx.inline_mono, "$1") - .replaceAll(rgx.inline_cite, "$1"); - 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, "&") - .replaceAll(rgx_xhtml.quotation, """) - .replaceAll(rgx_xhtml.less_than, "<") - .replaceAll(rgx_xhtml.greater_than, ">") - .replaceAll(rgx.nbsp_char, " ") - .replaceAll(rgx.br_line_inline, "
") - .replaceAll(rgx.br_line, "
") - .replaceAll(rgx.br_line_spaced, "

") - .replaceAll(rgx_xhtml.line_break, "
"); - return _txt; - } - string html_special_characters_code(string _txt){ - _txt = _txt - .replaceAll(rgx_xhtml.ampersand, "&") - .replaceAll(rgx_xhtml.quotation, """) - .replaceAll(rgx_xhtml.less_than, "<") - .replaceAll(rgx_xhtml.greater_than, ">") - .replaceAll(rgx.nbsp_char, " "); - return _txt; - } - string html_font_face(string _txt){ - _txt = _txt - .replaceAll(rgx.inline_emphasis, "$1") - .replaceAll(rgx.inline_bold, "$1") - .replaceAll(rgx.inline_underscore, "$1") - .replaceAll(rgx.inline_italics, "$1") - .replaceAll(rgx.inline_superscript, "$1") - .replaceAll(rgx.inline_subscript, "$1") - .replaceAll(rgx.inline_strike, "$1") - .replaceAll(rgx.inline_insert, "$1") - .replaceAll(rgx.inline_mono, "$1") - .replaceAll(rgx.inline_cite, "$1"); - 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, - "  ") - .replaceAll(rgx.grouped_para_indent_2, - "    ") - .replaceAll(rgx.grouped_para_indent_3, - "      ") - .replaceAll(rgx.grouped_para_indent_4, - "        ") - .replaceAll(rgx.grouped_para_indent_5, - "          ") - .replaceAll(rgx.grouped_para_indent_6, - "            ") - .replaceAll(rgx.grouped_para_indent_7, - "              ") - .replaceAll(rgx.grouped_para_indent_8, - "                ") - .replaceAll(rgx.grouped_para_indent_9, - "                  ") - .replaceAll(rgx.grouped_para_indent_hang, "  ") - .replaceAll(rgx.grouped_para_bullet, "●  ") - .replaceAll(rgx.grouped_para_bullet_indent_1, - "  ●  ") - .replaceAll(rgx.grouped_para_bullet_indent_2, - "    ●  ") - .replaceAll(rgx.grouped_para_bullet_indent_3, - "      ●  ") - .replaceAll(rgx.grouped_para_bullet_indent_4, - "        ●  ") - .replaceAll(rgx.grouped_para_bullet_indent_5, - "          ●  ") - .replaceAll(rgx.grouped_para_bullet_indent_6, - "            ●  ") - .replaceAll(rgx.grouped_para_bullet_indent_7, - "              ●  ") - .replaceAll(rgx.grouped_para_bullet_indent_8, - "                ●  ") - .replaceAll(rgx.grouped_para_bullet_indent_9, - "                  ●  "); - } - 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 $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, - ("$1")) - .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"" - ~ "" ~ m.captures["num"] ~ "." - ~ m.captures["note"] - ~ "

"; - } - _txt = replaceAll!(m => - (" " ~ "" ~ m["num"] ~ "")) - (_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"┃

- %s -

┃", - 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) ? ("●  " ~ _txt) : _txt; - _txt = inline_markup(doc_matters, obj, _txt); - string o = format(q"┃

- %s -

┃", - 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"┃

- %s -

┃", - 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"┃

- %s -

┃", - 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"┃ -

%s

┃", - 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"┃

%s

┃", - 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"┃

%s

┃", - 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 ~= ""; - 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 ~= ""; - } - } - _table ~= ""; - } - 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"┃

- - %s -
- %s -

┃", - 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/doc_reform/io_out/xmls.d b/src/doc_reform/io_out/xmls.d deleted file mode 100644 index bff6fc1..0000000 --- a/src/doc_reform/io_out/xmls.d +++ /dev/null @@ -1,1424 +0,0 @@ -/+ -- Name: Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 - 2024 Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -module doc_reform.io_out.xmls; -@safe: -template outputXHTMLs() { - import - std.file, - std.outbuffer, - std.uri, - std.conv : to; - import - doc_reform.io_out, - doc_reform.io_out.rgx, - doc_reform.meta.rgx_files, - doc_reform.io_out.rgx_xhtml, - doc_reform.io_out.create_zip_file, - doc_reform.io_out.xmls, - doc_reform.io_out.xmls_css; - mixin spineRgxOut; - mixin spineRgxXHTML; - struct outputXHTMLs { - static auto rgx = RgxO(); - static auto rgx_xhtml = RgxXHTML(); - string div_delimit( - string section, - return ref string previous_section - ) { - string delimit = ""; - string delimit_ = ""; - if (section != previous_section) { - switch (section) { - case "head": - delimit_ ~= "\n
\n" ; - break; - case "toc": - delimit_ ~= "\n
\n" ; - break; - case "bookindex": - delimit_ ~= "\n
\n" ; - break; - default: - delimit_ ~= "\n
\n" ; - break; - } - if (previous_section.length > 0) { - delimit ~= "\n
"; - } - 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, "&") // "&" - .replaceAll(rgx_xhtml.quotation, """) // """ - .replaceAll(rgx_xhtml.less_than, "<") // "<" - .replaceAll(rgx_xhtml.greater_than, ">") // ">" - .replaceAll(rgx.br_line, "
") - .replaceAll(rgx.br_line_inline, "
") - .replaceAll(rgx.br_line_spaced, "
\n
") - .replaceAll(rgx.nbsp_char, " "); - return _txt; - } - string special_characters_date(string _txt) { - _txt = _txt - .replaceAll(regex(r"(?:-00)+"), "") - .replaceAll(rgx.br_line, "
") - .replaceAll(rgx.br_line_inline, "
") - .replaceAll(rgx.br_line_spaced, "
\n
") - .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, - "  ") - .replaceAll(rgx.grouped_para_indent_2, - "    ") - .replaceAll(rgx.grouped_para_indent_3, - "      ") - .replaceAll(rgx.grouped_para_indent_4, - "        ") - .replaceAll(rgx.grouped_para_indent_5, - "          ") - .replaceAll(rgx.grouped_para_indent_6, - "            ") - .replaceAll(rgx.grouped_para_indent_7, - "              ") - .replaceAll(rgx.grouped_para_indent_8, - "                ") - .replaceAll(rgx.grouped_para_indent_9, - "                  ") - .replaceAll(rgx.grouped_para_indent_hang, "  ") - .replaceAll(rgx.grouped_para_bullet, "●  ") - .replaceAll(rgx.grouped_para_bullet_indent_1, - "  ●  ") - .replaceAll(rgx.grouped_para_bullet_indent_2, - "    ●  ") - .replaceAll(rgx.grouped_para_bullet_indent_3, - "      ●  ") - .replaceAll(rgx.grouped_para_bullet_indent_4, - "        ●  ") - .replaceAll(rgx.grouped_para_bullet_indent_5, - "          ●  ") - .replaceAll(rgx.grouped_para_bullet_indent_6, - "            ●  ") - .replaceAll(rgx.grouped_para_bullet_indent_7, - "              ●  ") - .replaceAll(rgx.grouped_para_bullet_indent_8, - "                ●  ") - .replaceAll(rgx.grouped_para_bullet_indent_9, - "                  ●  "); - } - if (!(obj.metainfo.is_a == "code")) { - _txt = (_txt) - .replaceAll(rgx_xhtml.line_break, "
"); - } - return _txt; - } - string font_face(string _txt) { - _txt = _txt - .replaceAll(rgx.inline_emphasis, ("$1")) - .replaceAll(rgx.inline_bold, ("$1")) - .replaceAll(rgx.inline_underscore, ("$1")) - .replaceAll(rgx.inline_italics, ("$1")) - .replaceAll(rgx.inline_superscript, ("$1")) - .replaceAll(rgx.inline_subscript, ("$1")) - .replaceAll(rgx.inline_strike, ("$1")) - .replaceAll(rgx.inline_insert, ("$1")) - .replaceAll(rgx.inline_mono, ("$1")) - .replaceAll(rgx.inline_cite, ("$1")); - 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 ~= "
"; - } - } - } - return tags; - } - string header_metadata(M)( - M doc_matters, - ) { - string _publisher="Publisher"; // TODO - string o; - o = format(q"┃ - - - - - - - - - - - - - - - ┃", - 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, - ("

$1

")) - .replaceAll( - rgx.br_line, "") - .replaceAll( - rgx.br_line_inline, ""); - } else { - _locations = "

spine

\n

sources / git

\n

www.sisudoc.org

"; - } - string o; - o = format(q"┃
- %s -
┃", - _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"┃ -
- -
-   %s - %s - - - - - -
- -
-
- -
-    - %s - - - - - - -
- -
┃", - doc_matters.conf_make_meta.conf.w_srv_cgi_action, - (doc_matters.conf_make_meta.conf.w_srv_db_sqlite_filename.empty) - ? "" - : "\n 🔎 ", - (doc_matters.conf_make_meta.conf.w_srv_db_sqlite_filename.empty) - ? "" - : "\n ", - 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 ", - 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"┃

⟰  [ %s  ◆ %s%s ℹ ]   ≅ | 🖋 | ⌘ |

┃", - (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) - ? (" □ ") - : "", - (doc_matters.opt.action.html_link_pdf || doc_matters.opt.action.html_link_pdf_letter) - ? (" □ ") - : "", - (type == "seg") ? "../" : "", - doc_matters.src.filename_base, - (type == "seg") ? "../" : "", - (type == "seg") ? "../" : "", - (type == "seg") ? "../" : "", - ) - : ""); - o = format(q"┃ - - - - - %s%s - - - %s - - - - - - - -
-
- %s -
- %s -
%s -
-
┃", - 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"┃ - ┃", - ); - string html_simple = format(q"┃ - ┃", - doc_matters.src.language, - doc_matters.src.language, - ); - string html_strict = format(q"┃ - ┃", - doc_matters.src.language, - doc_matters.src.language, - ); - string o; - o = format(q"┃%s - - - %s%s - - - - - - - - - - - - - - - - - - - - ┃", - 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"┃
┃"); - return o; -} -string tail(M)(M doc_matters) { - string o; - o = format(q"┃
-
- -
- %s -
-

- %s -

-
-
-
-

- ≅ SiSU Spine ፨ (object numbering & object search) -

-

- (web 1993, object numbering 1997, object search 2002 ...) 2024 -

-
- - - - -┃", - special_characters_text(doc_matters.conf_make_meta.meta.rights_copyright), - ((doc_matters.conf_make_meta.meta.rights_license).empty) ? "" : "
", - ((doc_matters.conf_make_meta.meta.rights_license).empty) ? "" - : "License: " ~ 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 $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, - ("$1")) - .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, - (" $1 ") - ); - } - if (obj.has.inline_notes_star) { - _txt = font_face(_txt); - _txt = _txt.replaceAll( - rgx.inline_notes_al_special_char_note, - (" $1 ") - ); - } - 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", - "

", - "", - " ", - m.captures[1], - ".", - m.captures[2], - "

" - ); - } - _txt = _txt.replaceAll( - rgx.inline_notes_al_special_char_note, - (" $1 ") - ); - } - 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", - "

", - "", - " ", - m.captures[1], - ".", - m.captures[2], - "

" - ); - } - _txt = _txt.replaceAll( - rgx.inline_notes_al_regular_number_note, - (" $1 ") - ); - } 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 ~= "
\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"┃

- ۰ %s -

- ┃", - indent, - indent, - link, - text, - )); - } - } - lev4_subtoc ~= "
\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"┃ - - ┃", - ); - } - if (obj.tags.segname_prev == "") { - prev = ""; - } else { - prev = format(q"┃ - - ┃", - obj.tags.segname_prev, - ); - } - if (obj.tags.segname_next == "") { - next = ""; - } else { - next = format(q"┃ - - ┃", - obj.tags.segname_next, - ); - } - string _toc_pre_next = format(q"┃ ┃", - toc, - prev, - next, - ); - string _pre_next = format(q"┃ ┃", - 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 = "
"; - 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) - ? "" - : ""; - if (_txt.empty) { - o = format(q"┃%s - ┃", - _horizontal_rule, - ); - } else { - o = ""; - if (obj.metainfo.is_of_section == "toc") { - o ~= format(q"┃ -
- - -
┃", - 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 -
- - %s%s - %s - -
┃", - _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 -
- %s%s - %s - -
┃", - _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) ? ("●  " ~ _txt) : _txt; - _txt = _txt.replaceFirst(rgx.inline_link_anchor, - ""); - if (!(obj.metainfo.identifier.empty)) { - o = format(q"┃
- -

%s - %s -

-
┃", - 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"┃
-

%s - %s -

-
┃", - 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"┃
- -

- %s -

-
┃", - 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"┃
-

- %s -

-
┃", - 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"┃
- -

- %s -

-
┃", - 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"┃
-

- %s -

-
┃", - 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"┃
- -

%s

-
┃", - 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"┃
-

%s

-
┃", - 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"┃
- -

%s

-
┃", - 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"┃
-

%s

-
┃", - 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 ~= ""; - 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 ~= ""; - } - } - _table ~= ""; - } - 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"┃
- -

%s - - %s -
- %s -

-
┃", - 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 = "
\n";
-          foreach (k, _line; _block_lines) {
-            if (k == 1) {
-              _codelines ~= format(q"┃    %s
-    ┃",
-                _line,
-              );
-            } else {
-              _codelines ~= format(q"┃    %s
-    ┃",
-                _line,
-              );
-            }
-          }
-          _codelines ~= "  
"; - } else { - _codelines = "
\n";
-          _codelines ~= _txt;
-          _codelines ~= "  
"; - } - return _codelines; - } - if (!(obj.metainfo.identifier.empty)) { - o = format(q"┃
- -

%s

-
┃", - 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"┃
-

%s

-
┃", - obj.metainfo.is_a, - codelines(_txt) - ); - } - return o; - } - } -} diff --git a/src/doc_reform/io_out/xmls_css.d b/src/doc_reform/io_out/xmls_css.d deleted file mode 100644 index da85ade..0000000 --- a/src/doc_reform/io_out/xmls_css.d +++ /dev/null @@ -1,4451 +0,0 @@ -/+ -- Name: Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 - 2024 Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -/++ - default css settings -+/ -module doc_reform.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; - } -} -- cgit v1.2.3