diff options
| author | Ralph Amissah <ralph.amissah@gmail.com> | 2026-05-25 10:21:59 -0400 |
|---|---|---|
| committer | Ralph Amissah <ralph.amissah@gmail.com> | 2026-05-25 12:20:54 -0400 |
| commit | db3dd3c3a5f4c5cde9a736cb688f05af9f79d718 (patch) | |
| tree | 1ce0c71cbeeae23566001904b9de3609ced76ebe /src/sisudoc/io_out | |
| parent | 0.22.0 (diff) | |
separate abstraction lib from output processing
create new directories under ./src/sisudoc ocda & outputs in order to
separate the document abstraction library from downstream output
processing (stuff broken till paths & modules fixed)
Diffstat (limited to 'src/sisudoc/io_out')
24 files changed, 0 insertions, 18435 deletions
diff --git a/src/sisudoc/io_out/create_abstraction_db.d b/src/sisudoc/io_out/create_abstraction_db.d deleted file mode 100644 index 20ca074..0000000 --- a/src/sisudoc/io_out/create_abstraction_db.d +++ /dev/null @@ -1,355 +0,0 @@ -/+ -- Name: SisuDoc Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 (continuously updated, current 2026) Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -module sisudoc.io_out.create_abstraction_db; - -/+ ↓ write document abstraction as per-document sqlite3 database +/ -template spineAbstractionDb() { - import std.conv : to; - import std.file; - import std.path; - import std.stdio; - import std.string; - import std.array; - import d2sqlite3; - import sisudoc.io_out.paths_output; - - void spineAbstractionDb(D)(D doc) { - auto doc_abstraction = doc.abstraction; - auto doc_matters = doc.matters; - - /+ ↓ determine output path +/ - auto out_pth = spineOutPaths!()(doc_matters.output_path, doc_matters.src.language); - string base_dir = "abstraction"; - string base_pth = ((out_pth.output_base.chainPath(base_dir)).asNormalizedPath).array; - try { - if (!exists(base_pth)) { - base_pth.mkdirRecurse; - } - } catch (Exception ex) { - } - string db_file = ((base_pth.chainPath( - doc_matters.src.doc_uid_out ~ ".abstraction.db")).asNormalizedPath).array; - - /+ ↓ remove existing file to start fresh +/ - try { - if (exists(db_file)) { - remove(db_file); - } - } catch (Exception ex) { - } - - if (doc_matters.opt.action.vox_gt_1) { - writeln(" ", db_file); - } - - /+ ↓ open database and create schema +/ - auto db = Database(db_file); - db.run("PRAGMA journal_mode=WAL"); - db.run("PRAGMA synchronous=NORMAL"); - - db.run(" - CREATE TABLE metadata ( - key TEXT PRIMARY KEY, - value TEXT NOT NULL - ); - - CREATE TABLE objects ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - section TEXT NOT NULL, - seq INTEGER NOT NULL, - ocn INTEGER DEFAULT 0, - is_a TEXT NOT NULL, - is_of_part TEXT, - is_of_type TEXT, - heading_level INTEGER, - identifier TEXT, - parent_ocn INTEGER DEFAULT 0, - last_descendant_ocn INTEGER DEFAULT 0, - ancestors TEXT, - dummy_heading INTEGER DEFAULT 0, - object_number_off INTEGER DEFAULT 0, - indent_base INTEGER DEFAULT 0, - indent_hang INTEGER DEFAULT 0, - bullet INTEGER DEFAULT 0, - lang TEXT, - has_links INTEGER DEFAULT 0, - has_notes_reg INTEGER DEFAULT 0, - has_notes_star INTEGER DEFAULT 0, - has_images INTEGER DEFAULT 0, - segment TEXT, - segment_prev TEXT, - segment_next TEXT, - anchor TEXT, - table_cols INTEGER, - table_widths TEXT, - table_header INTEGER, - code_syntax TEXT, - code_linenumbers INTEGER DEFAULT 0, - text TEXT - ); - - CREATE INDEX idx_objects_section ON objects(section); - CREATE INDEX idx_objects_ocn ON objects(ocn); - CREATE INDEX idx_objects_parent ON objects(parent_ocn); - CREATE INDEX idx_objects_is_a ON objects(is_a); - CREATE INDEX idx_objects_heading ON objects(heading_level) - WHERE heading_level IS NOT NULL; - "); - - /+ ↓ populate metadata +/ - db.run("BEGIN TRANSACTION"); - - auto meta_stmt = db.prepare( - "INSERT INTO metadata (key, value) VALUES (:key, :value)" - ); - auto meta = doc_matters.conf_make_meta.meta; - - void insertMeta(string key, string value) { - if (value.length > 0) { - meta_stmt.bind(":key", key); - meta_stmt.bind(":value", value); - meta_stmt.execute(); - meta_stmt.reset(); - } - } - - insertMeta("title.main", meta.title_main); - insertMeta("title.subtitle", meta.title_subtitle); - insertMeta("title.full", meta.title_full); - insertMeta("title.language", meta.title_language); - insertMeta("creator.author", meta.creator_author); - insertMeta("creator.author_surname", meta.creator_author_surname); - insertMeta("creator.author_surname_fn", meta.creator_author_surname_fn); - insertMeta("creator.author_email", meta.creator_author_email); - insertMeta("creator.illustrator", meta.creator_illustrator); - insertMeta("creator.translator", meta.creator_translator); - insertMeta("date.published", meta.date_published); - insertMeta("date.created", meta.date_created); - insertMeta("date.issued", meta.date_issued); - insertMeta("date.available", meta.date_available); - insertMeta("date.modified", meta.date_modified); - insertMeta("date.valid", meta.date_valid); - insertMeta("rights.copyright", meta.rights_copyright); - insertMeta("rights.license", meta.rights_license); - insertMeta("classify.topic_register", meta.classify_topic_register); - insertMeta("classify.subject", meta.classify_subject); - insertMeta("classify.keywords", meta.classify_keywords); - insertMeta("classify.loc", meta.classify_loc); - insertMeta("classify.dewey", meta.classify_dewey); - insertMeta("identifier.isbn", meta.identifier_isbn); - insertMeta("identifier.oclc", meta.identifier_oclc); - insertMeta("language.document", meta.language_document); - insertMeta("notes.abstract", meta.notes_abstract); - insertMeta("notes.description", meta.notes_description); - insertMeta("notes.summary", meta.notes_summary); - - /+ ↓ make settings +/ - auto make = doc_matters.conf_make_meta.make; - insertMeta("make.doc_type", make.doc_type); - insertMeta("make.auto_num_top_at_level", make.auto_num_top_at_level); - insertMeta("make.auto_num_top_lv", make.auto_num_top_lv.to!string); - insertMeta("make.auto_num_depth", make.auto_num_depth.to!string); - - /+ ↓ doc_has counts +/ - insertMeta("doc_has.inline_links", doc_matters.has.inline_links.to!string); - insertMeta("doc_has.inline_notes_reg", doc_matters.has.inline_notes_reg.to!string); - insertMeta("doc_has.inline_notes_star", doc_matters.has.inline_notes_star.to!string); - insertMeta("doc_has.tables", doc_matters.has.tables.to!string); - insertMeta("doc_has.codeblocks", doc_matters.has.codeblocks.to!string); - insertMeta("doc_has.images", doc_matters.has.images.to!string); - insertMeta("doc_has.poems", doc_matters.has.poems.to!string); - insertMeta("doc_has.groups", doc_matters.has.groups.to!string); - insertMeta("doc_has.blocks", doc_matters.has.blocks.to!string); - insertMeta("doc_has.quotes", doc_matters.has.quotes.to!string); - - meta_stmt.finalize(); - - /+ ↓ populate objects +/ - auto obj_stmt = db.prepare( - "INSERT INTO objects (" - ~ "section, seq, ocn, is_a, is_of_part, is_of_type," - ~ "heading_level, identifier, parent_ocn, last_descendant_ocn," - ~ "ancestors, dummy_heading, object_number_off," - ~ "indent_base, indent_hang, bullet, lang," - ~ "has_links, has_notes_reg, has_notes_star, has_images," - ~ "segment, segment_prev, segment_next, anchor," - ~ "table_cols, table_widths, table_header," - ~ "code_syntax, code_linenumbers, text" - ~ ") VALUES (" - ~ ":section, :seq, :ocn, :is_a, :is_of_part, :is_of_type," - ~ ":heading_level, :identifier, :parent_ocn, :last_descendant_ocn," - ~ ":ancestors, :dummy_heading, :object_number_off," - ~ ":indent_base, :indent_hang, :bullet, :lang," - ~ ":has_links, :has_notes_reg, :has_notes_star, :has_images," - ~ ":segment, :segment_prev, :segment_next, :anchor," - ~ ":table_cols, :table_widths, :table_header," - ~ ":code_syntax, :code_linenumbers, :text" - ~ ")" - ); - - string[] section_order = ["head", "toc", "body", "endnotes", - "glossary", "bibliography", "bookindex", "blurb"]; - - foreach (section; section_order) { - if (section !in doc_abstraction) continue; - auto section_objs = doc_abstraction[section]; - if (section_objs.length == 0) continue; - - foreach (seq, obj; section_objs) { - obj_stmt.bind(":section", section); - obj_stmt.bind(":seq", cast(int) seq); - obj_stmt.bind(":ocn", obj.metainfo.ocn); - obj_stmt.bind(":is_a", obj.metainfo.is_a); - - /+ ↓ nullable string fields +/ - void bindStr(string param, string val) { - import std.typecons : Nullable; - if (val.length > 0) { - obj_stmt.bind(param, val); - } else { - obj_stmt.bind(param, Nullable!string()); - } - } - - bindStr(":is_of_part", obj.metainfo.is_of_part); - bindStr(":is_of_type", obj.metainfo.is_of_type); - - /+ ↓ heading level +/ - { - import std.typecons : Nullable; - if (obj.metainfo.is_a == "heading" && obj.metainfo.heading_lev_markup < 9) { - obj_stmt.bind(":heading_level", obj.metainfo.heading_lev_markup); - } else { - obj_stmt.bind(":heading_level", Nullable!int()); - } - } - - bindStr(":identifier", obj.metainfo.identifier); - obj_stmt.bind(":parent_ocn", obj.metainfo.parent_ocn); - obj_stmt.bind(":last_descendant_ocn", obj.metainfo.last_descendant_ocn); - - /+ ↓ ancestors as space-separated integers +/ - { - bool has_ancestors = false; - foreach (a; obj.metainfo.markedup_ancestors) { - if (a != 0) { has_ancestors = true; break; } - } - if (has_ancestors) { - string anc; - foreach (i, a; obj.metainfo.markedup_ancestors) { - if (i > 0) anc ~= " "; - anc ~= a.to!string; - } - obj_stmt.bind(":ancestors", anc); - } else { - import std.typecons : Nullable; - obj_stmt.bind(":ancestors", Nullable!string()); - } - } - - obj_stmt.bind(":dummy_heading", obj.metainfo.dummy_heading ? 1 : 0); - obj_stmt.bind(":object_number_off", obj.metainfo.object_number_off ? 1 : 0); - obj_stmt.bind(":indent_base", obj.attrib.indent_base); - obj_stmt.bind(":indent_hang", obj.attrib.indent_hang); - obj_stmt.bind(":bullet", obj.attrib.bullet ? 1 : 0); - bindStr(":lang", obj.attrib.language); - obj_stmt.bind(":has_links", obj.has.inline_links ? 1 : 0); - obj_stmt.bind(":has_notes_reg", obj.has.inline_notes_reg ? 1 : 0); - obj_stmt.bind(":has_notes_star", obj.has.inline_notes_star ? 1 : 0); - obj_stmt.bind(":has_images", obj.has.images ? 1 : 0); - bindStr(":segment", obj.tags.in_segment_html); - bindStr(":segment_prev", obj.tags.segname_prev); - bindStr(":segment_next", obj.tags.segname_next); - bindStr(":anchor", obj.tags.anchor_tag_html); - - /+ ↓ table properties +/ - { - import std.typecons : Nullable; - if (obj.metainfo.is_a == "table" && obj.table.number_of_columns > 0) { - obj_stmt.bind(":table_cols", obj.table.number_of_columns); - if (obj.table.column_widths.length > 0) { - string[] ws; - foreach (w; obj.table.column_widths) ws ~= w.to!string; - obj_stmt.bind(":table_widths", ws.join(" ")); - } else { - obj_stmt.bind(":table_widths", Nullable!string()); - } - obj_stmt.bind(":table_header", obj.table.heading ? 1 : 0); - } else { - obj_stmt.bind(":table_cols", Nullable!int()); - obj_stmt.bind(":table_widths", Nullable!string()); - obj_stmt.bind(":table_header", Nullable!int()); - } - } - - /+ ↓ code block properties +/ - { - import std.typecons : Nullable; - if (obj.metainfo.is_a == "code") { - bindStr(":code_syntax", obj.code_block.syntax); - obj_stmt.bind(":code_linenumbers", obj.code_block.linenumbers ? 1 : 0); - } else { - obj_stmt.bind(":code_syntax", Nullable!string()); - obj_stmt.bind(":code_linenumbers", 0); - } - } - - /+ ↓ text content +/ - bindStr(":text", obj.text); - - obj_stmt.execute(); - obj_stmt.reset(); - } - } - - obj_stmt.finalize(); - db.run("COMMIT TRANSACTION"); - } -} diff --git a/src/sisudoc/io_out/create_zip_file.d b/src/sisudoc/io_out/create_zip_file.d deleted file mode 100644 index 4063ab5..0000000 --- a/src/sisudoc/io_out/create_zip_file.d +++ /dev/null @@ -1,67 +0,0 @@ -/+ -- Name: SisuDoc Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 (continuously updated, current 2026) Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -module sisudoc.io_out.create_zip_file; -@safe: -template createZipFile() { - import std.file; - import std.outbuffer; - import std.string; - import std.zip; - void createZipFile( - string zip_file_name, - void[] compressed_zip_data, - ) { - try { - write(zip_file_name, compressed_zip_data); - } catch (ZipException ex) { - // Handle Errors - } - } -} diff --git a/src/sisudoc/io_out/curate/metadoc_curate.d b/src/sisudoc/io_out/curate/metadoc_curate.d deleted file mode 100644 index 8e87167..0000000 --- a/src/sisudoc/io_out/curate/metadoc_curate.d +++ /dev/null @@ -1,90 +0,0 @@ -/+ -- Name: SisuDoc Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 (continuously updated, current 2026) Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -module sisudoc.io_out.curate.metadoc_curate; -@safe: -template spineMetaDocCurate() { - auto spineMetaDocCurate(T,H)( - T doc_matters, - H hvst, - ) { - import sisudoc.meta.defaults; - import sisudoc.meta.rgx; - import std.array; - import std.exception; - import std.regex; - import std.stdio; - import std.string; - import std.typecons; - import std.uni; - import std.utf; - import std.conv : to; - mixin InternalMarkup; - static auto mkup = InlineMarkup(); - import sisudoc.io_out.paths_output; - auto pth_html_abs = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language); - auto pth_html_rel = spineDocRootTreeHTML!()(doc_matters.src.language); - hvst.curate.title = doc_matters.conf_make_meta.meta.title_full; - hvst.curate.author = doc_matters.conf_make_meta.meta.creator_author; - hvst.curate.author_surname = doc_matters.conf_make_meta.meta.creator_author_surname; - hvst.curate.author_surname_fn = doc_matters.conf_make_meta.meta.creator_author_surname_fn; - hvst.curate.author_arr = doc_matters.conf_make_meta.meta.creator_author_arr; - hvst.curate.language_original = doc_matters.conf_make_meta.meta.original_language; - hvst.curate.language = doc_matters.src.language; - hvst.curate.uid = doc_matters.src.doc_uid; - hvst.curate.date_published = doc_matters.conf_make_meta.meta.date_published; - hvst.curate.topic_register_arr = doc_matters.conf_make_meta.meta.classify_topic_register_arr; - hvst.curate.path_html_metadata = pth_html_rel.fn_metadata(doc_matters.src.filename); - hvst.curate.path_html_scroll = pth_html_rel.fn_scroll(doc_matters.src.filename); - hvst.curate.path_html_segtoc = pth_html_rel.fn_seg(doc_matters.src.filename, "toc"); - hvst.curate.path_abs_html_scroll = pth_html_abs.fn_scroll(doc_matters.src.filename); - hvst.curate.path_abs_html_segtoc = pth_html_abs.fn_seg(doc_matters.src.filename, "toc"); - return hvst.curate; - } -} diff --git a/src/sisudoc/io_out/curate/metadoc_curate_authors.d b/src/sisudoc/io_out/curate/metadoc_curate_authors.d deleted file mode 100644 index 6a356e7..0000000 --- a/src/sisudoc/io_out/curate/metadoc_curate_authors.d +++ /dev/null @@ -1,528 +0,0 @@ -/+ -- Name: SisuDoc Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 (continuously updated, current 2026) Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -module sisudoc.io_out.curate.metadoc_curate_authors; -@safe: - import std.algorithm; - import std.array; - import std.exception; - import std.regex; - import std.stdio; - import std.string; - import std.conv : to; - import sisudoc.meta.defaults; - import sisudoc.meta.rgx; - mixin spineCurateMetadata; - mixin InternalMarkup; -template spineMetaDocCuratesAuthors() { - static auto mkup = InlineMarkup(); - void spineMetaDocCuratesAuthors(H,M,O)( - H curates, - M _make_and_meta_struct, - O _opt_action, - ) { - string inline_search_form(M)( - M _make_and_meta_truct, - ) { - string o; - string _form; - if (_opt_action.html_link_search) { - o = format(q"┃ - <div class="flex-menu-option"> - <!-- SiSU Spine Search --> - <form action="%s" target="_top" method="POST" accept-charset="UTF-8" id="search"> - <font size="2"> - <input type="text" name="sf" size="24" maxlength="255">%s - <input type="hidden" name="sml" value="1000"> - <input type="hidden" name="ec" value="on"> - <input type="hidden" name="url" value="on"> - <button type="submit" form="search">㏈ ፨</button> - </font></form> - <!-- SiSU Spine Search --> - </div>┃", - _make_and_meta_struct.conf.w_srv_cgi_action, - (_make_and_meta_struct.conf.w_srv_db_sqlite_filename.empty) - ? "" - : "\n <input type=\"hidden\" name=\"db\" value=\"" - ~ _make_and_meta_struct.conf.w_srv_db_sqlite_filename - ~ "\">", - ); - } else { - o = ""; - } - return o; - } -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.lev0:hover { - color : #FFFFFF; - background-color : #000000; - } - a.lev1:hover { - color : #FFFFFF; - background : #333333; - } - a.lev2:hover { - color : #FFFFFF; - background : #555555; - } - a.lev3:hover { - color : #FFFFFF; - background : #777777; - } - 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, select, textarea { - font-size : 150%%; - } - 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.lev0:hover { - color : #000000; - background-color : #FFFFFF; - } - a.lev1:hover { - color : #FFFFFF; - background : #444444; - } - a.lev2:hover { - background : #888888; - } - a.lev3:hover { - background : #BBBBBB; - } - 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, select, textarea { - font-size : 150%%; - } - input { - color : #000000; - background-color : #FFFFFF; - } -┃"); -string theme_dark_1 = format(q"┃ - h1 { - color : #FFFFFF; - background : #000000; - } - p.letter { - color : #FFFFFF; - background : #333333; - } - p.lev0 { - color : #FFFFFF; - background : #000000; - } - p.lev1 { - color : #FFFFFF; - background : #333333; - } - p.lev2 { - background : #555555; - } - p.lev3 { - background : #777777; - } - p.lev4 { - background : #AAAAAA; - } - p.lev5 { - } -┃"); -string theme_light_1 = format(q"┃ - h1 { - color : #FFFFFF; - background : #1A3A7A; - } - p.letter { - color : #FFFFFF; - background : #1A3A7A; - } - p.lev0 { - color : #FFFFFF; - background : #000000; - } - p.lev1 { - color : #FFFFFF; - background : #444444; - } - p.lev2 { - background : #888888; - } - p.lev3 { - background : #BBBBBB; - } - p.lev4 { - background : #EEEEEE; - } - p.lev5 { - } -┃"); - string[] authors = []; - authors ~= format(q"┃ -<!DOCTYPE html> -<html> -<head> -<meta charset="utf-8"> -<title>⌘ Curated metadata - 🖋 Authors</title> -<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> -<meta name="dc.title" content= "metadata curate, Authors & Topics - information Structuring Universe, Structured information Serialised Units" /> -<meta name="dc.subject" content= "document structuring, ebook, publishing, PDF, LaTeX, XML, ODF, SQL, postgresql, sqlite, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, granular search, digital library" /> -<meta name="generator" content="spine" /> -<link rel="generator" href="https://sisudoc.org" /> -<link href="./css/curate.css" rel="stylesheet"> -<style TYPE="text/css"> -/* spine curate css default stylesheet */%s - .norm, .bold { - line-height : 150%%; - margin-left : 1em; - margin-right : 2em; - margin-top : 10px; - margin-bottom : 0px; - text-indent : 0mm; - } - p, h0, h1, h2, h3, h4, h5, h6, h7 { - display : block; - font-family : verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman; - font-size : 100%%; - font-weight : normal; - line-height : 150%%; - /* text-align : justify; */ - margin-left : 1em; - text-indent : 0mm; - margin-top : 2px; - margin-bottom : 2px; - margin-right : 6px; - text-align : left; - } - h0, h1, h2, h3, h4, h5, h6, h7 { text-shadow: .2em .2em .3em #999999; } - h1 { - font-size : 120%%; - font-weight : bold; - color : #FFFFFF; - background : #000088; - margin-left : 0em; - } - p.work { - font-size : 80%%; - margin-left : 5em; - margin-top : 0px; - margin-bottom : 0px; - margin-right : 6px; - text-align : left; - } - p.author { - font-size : 100%%; - margin-left : 2em; - margin-top : 0px; - margin-bottom : 0px; - margin-right : 6px; - text-align : left; - } - p.publication { - font-size : 90%%; - margin-left : 4em; - margin-top : 0px; - margin-bottom : 0px; - margin-right : 6px; - text-align : left; - } - p.letter { - font-weight : bold; - font-size : 80%%; - margin-left : 1em; - margin-top : 0px; - margin-bottom : 0px; - margin-right : 6px; - text-align : left; - } - p.icons, .icons_center { - font-size : 100%%; - margin-top : 0px; - margin-bottom : 0px; - margin-right : 6px; - } - p.icons { - text-align : left; - } - p.lev0 { - font-size : 120%%; - margin-left : 1em; - } - p.lev1 { - font-size : 115%%; - margin-left : 2em; - } - p.lev2 { - font-size : 110%%; - margin-left : 3em; - } - p.lev3 { - font-size : 105%%; - margin-left : 4em; - } - p.lev4 { - font-size : 100%%; - margin-left : 5em; - } - p.lev5 { - font-size : 95%%; - margin-left : 6em; - }%s - /* flex */ - .flex-menu-bar { - display : -webkit-flex; - display : flex; - -webkit-flex-wrap : wrap; - -webkit-align-items : center; - align-items : center; - width : 100%%; - margin-left : 0%%; - margin-right : 2%%; - background-color : inherited; - } - .flex-menu-option { - background-color : inherited; - margin-right : 4px; - } - .flex-list { - display : -webkit-flex; - display : flex; - -webkit-align-items : center; - display : block; - align-items : center; - width : 100%%; - background-color : inherited; - } - .flex-list-item { - background-color : inherited; - margin : 4px; - } -</style> -<link rel="shortcut icon" href="../_sisu/image/rb7.ico" /> -</head> -<body lang="en" xml:lang="en"> -<a name="top" id="top"></a> -<a name="up" id="up"></a> -<a name="start" id="start"></a> -<h1>⌘ Curated metadata - 🖋 Authors (output organised by language & filetype)</h1> -<div class="flex-menu-bar"> -<div class="flex-menu-option"> -<p class="icons">[<a href="../../index.html" class="lnkicon"> ⟰ HOME </a> | <a href="../index.html" class="lnkicon"> ≅ Collection </a>] - [<a href="topics.html" class="lnkicon"> ⌘ Curated metadata - ⌘ Topics </a>] </p> -</div> -%s -</div> -<p></p> -<hr /> -<p><a href="#A" class="lnkicon">A</a>, <a href="#B" class="lnkicon">B</a>, <a href="#C" class="lnkicon">C</a>, <a href="#D" class="lnkicon">D</a>, <a href="#E" class="lnkicon">E</a>, <a href="#F" class="lnkicon">F</a>, <a href="#G" class="lnkicon">G</a>, <a href="#H" class="lnkicon">H</a>, <a href="#I" class="lnkicon">I</a>, <a href="#J" class="lnkicon">J</a>, <a href="#K" class="lnkicon">K</a>, <a href="#L" class="lnkicon">L</a>, <a href="#M" class="lnkicon">M</a>, <a href="#N" class="lnkicon">N</a>, <a href="#O" class="lnkicon">O</a>, <a href="#P" class="lnkicon">P</a>, <a href="#Q" class="lnkicon">Q</a>, <a href="#R" class="lnkicon">R</a>, <a href="#S" class="lnkicon">S</a>, <a href="#T" class="lnkicon">T</a>, <a href="#U" class="lnkicon">U</a>, <a href="#V" class="lnkicon">V</a>, <a href="#W" class="lnkicon">W</a>, <a href="#X" class="lnkicon">X</a>, <a href="#Y" class="lnkicon">Y</a>, <a href="#Z" class="lnkicon">Z</a>, -┃", - _opt_action.css_theme_default ? theme_light_0 : theme_dark_0, - _opt_action.css_theme_default ? theme_light_1 : theme_dark_1, - inline_search_form(_make_and_meta_struct), -) ~ "\n"; - string[string] _au; - string[] _auth_date_title; - string[] _author_date_title; - string _prev_auth = ""; - char _prev_k = "_".to!char; - foreach(doc_curate; - curates - .multiSort!( - "toUpper(a.author_surname_fn) < toUpper(b.author_surname_fn)", - "a.date_published < b.date_published", - "a.title < b.title", - SwapStrategy.unstable - ) - ) { - if (doc_curate.author_surname_fn != _prev_auth) { - _au[doc_curate.author_surname_fn] - = format(q"┃<p class="author"><a name="%s" class="lev0">%s</a></p> <p class="publication">%s "<a href="%s">%s</a>" [<a href="%s"> %s </a>]</p>┃", - doc_curate.author_surname.translate([' ' : "_"]), - doc_curate.author_surname_fn, - (doc_curate.date_published.length > 0) - ? doc_curate.date_published : "", - doc_curate.path_html_segtoc, - doc_curate.title, - doc_curate.path_html_metadata, - doc_curate.language, - ); - _prev_auth = doc_curate.author_surname_fn; - } else { - _au[doc_curate.author_surname_fn] - ~= format(q"┃<p class="publication">%s "<a href="%s">%s</a>" [<a href="%s"> %s </a>]</p>┃", - (doc_curate.date_published.length > 0) - ? doc_curate.date_published : "", - doc_curate.path_html_segtoc, - doc_curate.title, - doc_curate.path_html_metadata, - doc_curate.language, - ); - } - _author_date_title ~= format(q"┃%s %s "%s" [<a href="%s"> %s </a>]%s┃", - doc_curate.author_surname_fn, - (doc_curate.date_published.length > 0) - ? "(" ~ doc_curate.date_published ~ ")" : "", - doc_curate.title, - doc_curate.path_html_metadata, - doc_curate.language, - (_opt_action.show_curate_authors) ? "\n " ~ doc_curate.path_abs_html_scroll : "", - ); - } - foreach (k; _au.keys.sort) { - if (k.toUpper.to!(char[])[0] != _prev_k) { - authors ~= format(q"┃<p class="letter"><a name="%s">%s</a></p><p class="book_index_lev1"><a name="a"></a></p>┃", - k.toUpper.to!(char[])[0], - k.toUpper.to!(char[])[0], - ); - _prev_k = k.toUpper.to!(char[])[0]; - } - authors ~= _au[k]; - } - authors - ~= format(q"┃ -<hr /> -<a name="bottom" id="bottom"></a> -<a name="down" id="down"></a> -<a name="end" id="end"></a> -<a name="finish" id="finish"></a> -<a name="stop" id="stop"></a> -<a name="credits"></a> -</body> -</html> -┃") ~ "\n"; - import sisudoc.io_out.paths_output; - auto out_pth = spinePathsHTML!()(_make_and_meta_struct.conf.output_path, ""); - try { - auto f = File(out_pth.curate("authors.html"), "w"); - foreach (o; authors) { - f.writeln(o); - } - } catch (ErrnoException ex) { - // Handle error - } - if (_opt_action.show_curate_authors) { - foreach(_adt; _author_date_title.sort) { - writeln(_adt); - } - } - } -} diff --git a/src/sisudoc/io_out/curate/metadoc_curate_topics.d b/src/sisudoc/io_out/curate/metadoc_curate_topics.d deleted file mode 100644 index 05643b9..0000000 --- a/src/sisudoc/io_out/curate/metadoc_curate_topics.d +++ /dev/null @@ -1,691 +0,0 @@ -/+ -- Name: SisuDoc Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 (continuously updated, current 2026) Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -module sisudoc.io_out.curate.metadoc_curate_topics; -@safe: - import std.algorithm; - import std.array; - import std.exception; - import std.regex; - import std.stdio; - import std.string; - import std.conv : to; - import sisudoc.meta.defaults; - import sisudoc.meta.rgx; - mixin spineCurateMetadata; - mixin InternalMarkup; -template spineMetaDocCuratesTopics() { - static auto mkup = InlineMarkup(); - void spineMetaDocCuratesTopics(H,M,O)( - H hvst, - M _make_and_meta_struct, - O _opt_action, - ) { - string inline_search_form(M)( - M _make_and_meta_truct, - ) { - string o; - string _form; - if (_opt_action.html_link_search) { - o = format(q"┃ - <div class="flex-menu-option"> - <!-- SiSU Spine Search --> - <form action="%s" target="_top" method="POST" accept-charset="UTF-8" id="search"> - <font size="2"> - <input type="text" name="sf" size="24" maxlength="255">%s - <input type="hidden" name="sml" value="1000"> - <input type="hidden" name="ec" value="on"> - <input type="hidden" name="url" value="on"> - <button type="submit" form="search">㏈ ፨</button> - </font></form> - <!-- SiSU Spine Search --> - </div>┃", - _make_and_meta_struct.conf.w_srv_cgi_action, - (_make_and_meta_struct.conf.w_srv_db_sqlite_filename.empty) - ? "" - : "\n <input type=\"hidden\" name=\"db\" value=\"" - ~ _make_and_meta_struct.conf.w_srv_db_sqlite_filename - ~ "\">", - ); - } else { - o = ""; - } - return o; - } - auto min_repeat_number = 42; - string[] _document_topic_register; - string[] _topic_register; - string[] _sub_topic_register; - string[] topics = []; - string _auth = ""; - foreach(k, doc_curate; hvst.curates) { - _topic_register = []; - foreach(topic; doc_curate.topic_register_arr.sort) { - _sub_topic_register = []; - string _spaces; - string[] subject_tree = topic.split(mkup.sep); - switch (subject_tree.length) { - case 1: - hvst.subject_trees[subject_tree[0]]["_a"]["_a"]["_a"] ~= doc_curate; - break; - case 2: - hvst.subject_trees[subject_tree[0]][subject_tree[1]]["_a"]["_a"] ~= doc_curate; - break; - case 3: - hvst.subject_trees[subject_tree[0]][subject_tree[1]][subject_tree[2]]["_a"] ~= doc_curate; - break; - case 4: - hvst.subject_trees[subject_tree[0]][subject_tree[1]][subject_tree[2]][subject_tree[3]] ~= doc_curate; - break; - default: - break; - } - _topic_register ~= _sub_topic_register.join("\n"); - } - auto char_repeat_number = (doc_curate.title.length - + doc_curate.author.length + 16); - char_repeat_number = (char_repeat_number > min_repeat_number) - ? char_repeat_number - : min_repeat_number; - _document_topic_register ~= format( - "\"%s\", %s%s\n%s", - doc_curate.title, - doc_curate.author, - (doc_curate.date_published.length > 0) ? " (" ~ doc_curate.date_published ~ ")" : "", - _topic_register.sort!("toUpper(a) < toUpper(b)", SwapStrategy.unstable).release.join("\n"), - ); - } -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.lev0:hover { - color : #FFFFFF; - background-color : #000000; - } - a.lev1:hover { - color : #FFFFFF; - background : #333333; - } - a.lev2:hover { - color : #FFFFFF; - background : #555555; - } - a.lev3:hover { - color : #FFFFFF; - background : #777777; - } - 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, select, textarea { - font-size : 150%%; - } - 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.lev0:hover { - color : #000000; - background-color : #FFFFFF; - } - a.lev1:hover { - color : #FFFFFF; - background : #444444; - } - a.lev2:hover { - background : #888888; - } - a.lev3:hover { - background : #BBBBBB; - } - 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, select, textarea { - font-size : 150%%; - } - input { - color : #000000; - background-color : #FFFFFF; - } -┃"); -string theme_dark_1 = format(q"┃ - h1 { - color : #FFFFFF; - background : #000000; - } - p.letter { - color : #FFFFFF; - background : #333333; - } - p.lev0 { - color : #FFFFFF; - background : #000000; - } - p.lev1 { - color : #FFFFFF; - background : #333333; - } - p.lev2 { - background : #555555; - } - p.lev3 { - background : #777777; - } - p.lev4 { - background : #AAAAAA; - } - p.lev5 { - } -┃"); -string theme_light_1 = format(q"┃ - h1 { - color : #FFFFFF; - background : #1A3A7A; - } - p.letter { - color : #FFFFFF; - background : #1A3A7A; - } - p.lev0 { - color : #FFFFFF; - background : #000000; - } - p.lev1 { - color : #FFFFFF; - background : #444444; - } - p.lev2 { - background : #888888; - } - p.lev3 { - background : #BBBBBB; - } - p.lev4 { - background : #EEEEEE; - } - p.lev5 { - } -┃"); - topics ~= format(q"┃<!DOCTYPE html> -<html> -<head> -<meta charset="utf-8"> -<title>⌘ Curated metadata - ⌘ Topics</title> -<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> -<meta name="dc.title" content= "metadata curate, Authors & Topics - information Structuring Universe, Structured information Serialised Units" /> -<meta name="dc.subject" content= "document structuring, ebook, publishing, PDF, LaTeX, XML, ODF, SQL, postgresql, sqlite, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, granular search, digital library" /> -<meta name="generator" content="spine" /> -<link rel="generator" href="https://sisudoc.org" /> -<link href="./css/curate.css" rel="stylesheet"> -<style TYPE="text/css"> -/* spine curate css default stylesheet */%s - .norm, .bold { - line-height : 150%%; - margin-left : 1em; - margin-right : 2em; - margin-top : 10px; - margin-bottom : 0px; - text-indent : 0mm; - } - p, h0, h1, h2, h3, h4, h5, h6, h7 { - display : block; - font-family : verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman; - font-size : 100%%; - font-weight : normal; - line-height : 150%%; - /* text-align : justify; */ - margin-left : 1em; - text-indent : 0mm; - margin-top : 2px; - margin-bottom : 2px; - margin-right : 6px; - text-align : left; - } - h0, h1, h2, h3, h4, h5, h6, h7 { text-shadow: .2em .2em .3em #999999; } - h1 { - font-size : 120%%; - font-weight : bold; - color : #FFFFFF; - background : #000088; - margin-left : 0em; - } - p.work { - font-size : 80%%; - margin-left : 5em; - margin-top : 0px; - margin-bottom : 0px; - margin-right : 6px; - text-align : left; - } - p.author { - font-size : 100%%; - margin-left : 2em; - margin-top : 0px; - margin-bottom : 0px; - margin-right : 6px; - text-align : left; - } - p.publication { - font-size : 90%%; - margin-left : 4em; - margin-top : 0px; - margin-bottom : 0px; - margin-right : 6px; - text-align : left; - } - p.letter { - font-weight : bold; - font-size : 80%%; - margin-left : 1em; - margin-top : 0px; - margin-bottom : 0px; - margin-right : 6px; - text-align : left; - } - p.icons, .icons_center { - font-size : 100%%; - margin-top : 0px; - margin-bottom : 0px; - margin-right : 6px; - } - p.icons { - text-align : left; - } - p.lev0 { - font-size : 120%%; - margin-left : 1em; - } - p.lev1 { - font-size : 115%%; - margin-left : 2em; - } - p.lev2 { - font-size : 110%%; - margin-left : 3em; - } - p.lev3 { - font-size : 105%%; - margin-left : 4em; - } - p.lev4 { - font-size : 100%%; - margin-left : 5em; - } - p.lev5 { - font-size : 95%%; - margin-left : 6em; - }%s - /* flex */ - .flex-menu-bar { - display : -webkit-flex; - display : flex; - -webkit-flex-wrap : wrap; - -webkit-align-items : center; - align-items : center; - width : 100%%; - margin-left : 0%%; - margin-right : 2%%; - background-color : inherited; - } - .flex-menu-option { - background-color : inherited; - margin-right : 4px; - } - .flex-list { - display : -webkit-flex; - display : flex; - -webkit-align-items : center; - display : block; - align-items : center; - width : 100%%; - background-color : inherited; - } - .flex-list-item { - background-color : inherited; - margin : 4px; - } -</style> -<link rel="shortcut icon" href="../_sisu/image/rb7.ico" /> -</head> -<body lang="en" xml:lang="en"> -<a name="top" id="top"></a> -<a name="up" id="up"></a> -<a name="start" id="start"></a> -<h1>⌘ Curated metadata - ⌘ Topics (output organised by language & filetype)</h1> -<div class="flex-menu-bar"> -<div class="flex-menu-option"> -<p class="icons">[<a href="../../index.html" class="lnkicon"> ⟰ HOME </a> | <a href="../index.html" class="lnkicon"> ≅ Collection </a>] - [<a href="authors.html" class="lnkicon"> ⌘ Curated metadata - 🖋 Authors </a>] -</p> -</div> - %s -</div> -<p><a href="#A" class="lnkicon">A</a>, <a href="#B" class="lnkicon">B</a>, <a href="#C" class="lnkicon">C</a>, <a href="#D" class="lnkicon">D</a>, <a href="#E" class="lnkicon">E</a>, <a href="#F" class="lnkicon">F</a>, <a href="#G" class="lnkicon">G</a>, <a href="#H" class="lnkicon">H</a>, <a href="#I" class="lnkicon">I</a>, <a href="#J" class="lnkicon">J</a>, <a href="#K" class="lnkicon">K</a>, <a href="#L" class="lnkicon">L</a>, <a href="#M" class="lnkicon">M</a>, <a href="#N" class="lnkicon">N</a>, <a href="#O" class="lnkicon">O</a>, <a href="#P" class="lnkicon">P</a>, <a href="#Q" class="lnkicon">Q</a>, <a href="#R" class="lnkicon">R</a>, <a href="#S" class="lnkicon">S</a>, <a href="#T" class="lnkicon">T</a>, <a href="#U" class="lnkicon">U</a>, <a href="#V" class="lnkicon">V</a>, <a href="#W" class="lnkicon">W</a>, <a href="#X" class="lnkicon">X</a>, <a href="#Y" class="lnkicon" class="lnkicon">Y</a>, <a href="#Z" class="lnkicon">Z</a>, -<p></p> -<hr /> -┃", - _opt_action.css_theme_default ? theme_light_0 : theme_dark_0, - _opt_action.css_theme_default ? theme_light_1 : theme_dark_1, - inline_search_form(_make_and_meta_struct), -) ~ "\n"; - char _prev_k = "_".to!char; - int _kn; - foreach(k0; - hvst.subject_trees.keys - .sort!("toUpper(a) < toUpper(b)", SwapStrategy.unstable) - ) { - if (k0.toUpper.to!(char[])[0] != _prev_k) { - topics ~= format(q"┃<p class="letter"><a name="%s">%s</a></p><p class="book_index_lev1"><a name="a"></a></p>┃", - k0.toUpper.to!(char[])[0], - k0.toUpper.to!(char[])[0], - ); - _prev_k = k0.toUpper.to!(char[])[0]; - } - if (k0 != "_a") { - topics ~= format(q"┃<p class="lev0"><a name="%s" class="lev0">%s</a></p>┃", - k0.translate([' ' : "_"]), k0,) ~ "\n"; - if (_opt_action.show_curate_topics) { - writeln("", k0); - } - if ("_a" in hvst.subject_trees[k0]) { - foreach (t_a_; - hvst.subject_trees[k0]["_a"]["_a"]["_a"] - .multiSort!("toUpper(a.title) < toUpper(b.title)", "a.author < b.author", SwapStrategy.unstable) - ) { - _auth = []; - if (t_a_.author_arr.length < 2) { - _auth = format(q"┃ <a href="authors.html#%s">%s</a>┃", - t_a_.author_surname.translate([' ' : "_"]), - t_a_.author, - ); - } else { - foreach (a; t_a_.author_arr) { - _auth ~= format(q"┃ <a href="authors.html#%s">%s</a>,┃", - t_a_.author_surname.translate([' ' : "_"]), - a, - ); - } - } - topics ~= format(q"┃<p class="work"><a href="%s">"%s"</a> - %s [<a href="%s"> %s </a>]┃", - t_a_.path_html_segtoc, - t_a_.title, - _auth, - t_a_.path_html_metadata, - t_a_.language, - ) ~ "\n"; - if (_opt_action.show_curate_topics) { - writeln("- ", t_a_.title, " - ", t_a_.author); - } - } - } - foreach(k1; - hvst.subject_trees[k0].keys - .sort!("toUpper(a) < toUpper(b)", SwapStrategy.unstable) - ) { - if (k1 != "_a") { - topics ~= format(q"┃<p class="lev1"><a name="%s.%s" class="lev1">%s</a></p>┃", - k0.translate([' ' : "_"]), - k1.translate([' ' : "_"]), k1,) ~ "\n"; - if (_opt_action.show_curate_topics) { - writeln(" ", k1); - } - if ("_a" in hvst.subject_trees[k0][k1]) { - foreach (t_a_; - hvst.subject_trees[k0][k1]["_a"]["_a"] - .multiSort!("toUpper(a.title) < toUpper(b.title)", "a.author < b.author", SwapStrategy.unstable) - ) { - _auth = []; - if (t_a_.author_arr.length < 2) { - _auth = format(q"┃ <a href="authors.html#%s">%s</a>┃", - t_a_.author_surname.translate([' ' : "_"]), - t_a_.author, - ); - } else { - foreach (a; t_a_.author_arr) { - _auth ~= format(q"┃ <a href="authors.html#%s">%s</a>,┃", - t_a_.author_surname.translate([' ' : "_"]), - a, - ); - } - } - topics ~= format(q"┃<p class="work"><a href="%s">%s</a> - %s [<a href="%s"> %s </a>]┃", - t_a_.path_html_segtoc, - t_a_.title, - _auth, - t_a_.path_html_metadata, - t_a_.language, - ) ~ "\n"; - if (_opt_action.show_curate_topics) { - writeln(" - ", t_a_.title, " - ", t_a_.author); - } - } - } - } - foreach(k2; - hvst.subject_trees[k0][k1].keys - .sort!("toUpper(a) < toUpper(b)", SwapStrategy.unstable) - ) { - if (k2 != "_a") { - topics ~= format(q"┃<p class="lev2"><a name="%s.%s.%s" class="lev2">%s</a></p>┃", - k0.translate([' ' : "_"]), k1.translate([' ' : "_"]), - k2.translate([' ' : "_"]), k2,) ~ "\n"; - if (_opt_action.show_curate_topics) { - writeln(" ", k2); - } - if ("_a" in hvst.subject_trees[k0][k1][k2]) { - foreach (t_a_; - hvst.subject_trees[k0][k1][k2]["_a"] - .multiSort!("toUpper(a.title) < toUpper(b.title)", "a.author < b.author", SwapStrategy.unstable) - ) { - _auth = []; - if (t_a_.author_arr.length < 2) { - _auth = format(q"┃ <a href="authors.html#%s">%s</a>┃", - t_a_.author_surname.translate([' ' : "_"]), - t_a_.author, - ); - } else { - foreach (a; t_a_.author_arr) { - _auth ~= format(q"┃ <a href="authors.html#%s">%s</a>,┃", - t_a_.author_surname.translate([' ' : "_"]), - a, - ); - } - } - topics ~= format(q"┃<p class="work"><a href="%s">%s</a> - %s [<a href="%s"> %s </a>]┃", - t_a_.path_html_segtoc, - t_a_.title, - _auth, - t_a_.path_html_metadata, - t_a_.language, - ) ~ "\n"; - if (_opt_action.show_curate_topics) { - writeln(" - ", t_a_.title, " - ", t_a_.author); - } - } - } - } - foreach(k3; - hvst.subject_trees[k0][k1][k2].keys - .sort!("toUpper(a) < toUpper(b)", SwapStrategy.unstable) - ) { - if (k3 != "_a") { - topics ~= format(q"┃<p class="lev3"><a name="%s.%s.%s.%s" class="lev3">%s</a></p>┃", - k0.translate([' ' : "_"]), k1.translate([' ' : "_"]), k2.translate([' ' : "_"]), - k3.translate([' ' : "_"]), k3,) ~ "\n"; - if (_opt_action.show_curate_topics) { - writeln(" ", k3); - } - { - foreach (t_a_; - hvst.subject_trees[k0][k1][k2][k3] - .multiSort!("toUpper(a.title) < toUpper(b.title)", "a.author < b.author", SwapStrategy.unstable) - ) { - _auth = []; - if (t_a_.author_arr.length < 2) { - _auth = format(q"┃<a href="authors.html#%s">%s</a>┃", - t_a_.author_surname.translate([' ' : "_"]), - t_a_.author, - ); - } else { - foreach (a; t_a_.author_arr) { - _auth ~= format(q"┃ <a href="authors.html#%s">%s</a>,┃", - t_a_.author_surname.translate([' ' : "_"]), - a, - ); - } - } - topics ~= format(q"┃ <p class="work"><a href="%s">%s</a> - %s [<a href="%s"> %s </a>]┃", - t_a_.path_html_segtoc, - t_a_.title, - _auth, - t_a_.path_html_metadata, - t_a_.language, - ) ~ "\n"; - if (_opt_action.show_curate_topics) { - writeln(" - ", t_a_.title, " - ", t_a_.author); - } - } - } - } - } - } - } - } - } - topics - ~= format(q"┃ -<hr /> -<a name="bottom" id="bottom"></a> -<a name="down" id="down"></a> -<a name="end" id="end"></a> -<a name="finish" id="finish"></a> -<a name="stop" id="stop"></a> -<a name="credits"></a> -</body> -</html> -┃") ~ "\n"; - import sisudoc.io_out.paths_output; - auto out_pth = spinePathsHTML!()(_make_and_meta_struct.conf.output_path, ""); - try { - auto f = File(out_pth.curate("topics.html"), "w"); - foreach (o; topics) { - f.writeln(o); - } - } catch (ErrnoException ex) { - // Handle error - } - } -} diff --git a/src/sisudoc/io_out/defaults.d b/src/sisudoc/io_out/defaults.d deleted file mode 100644 index 290ca89..0000000 --- a/src/sisudoc/io_out/defaults.d +++ /dev/null @@ -1,186 +0,0 @@ -/+ -- Name: SisuDoc Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 (continuously updated, current 2026) Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -/++ - default settings -+/ -module sisudoc.io_out.defaults; -@safe: - -template InternalMarkup() { - import std.array; - static struct InlineMarkup { - string en_a_o = "【"; string en_a_c = "】"; - string en_b_o = "〖"; string en_b_c = "〗"; - string quote_o = "“"; string quote_c = "”"; - string ff_i = "⑆"; string ff_o = "┨"; string ff_c = "┣"; // fontface - string lnk_o = "┥"; string lnk_c = "┝"; - string url_o = "┤"; string url_c = "├"; - string emph = "*"; - string bold = "!"; - string italic = "/"; - string underscore = "_"; - string superscript = "^"; - string subscript = ","; - string mono = "■"; - string cite = "‖"; - string mark_internal_site_lnk = "¤"; - string nbsp = "░"; - string br_line = "┘"; - string br_line_inline = "┙"; - string br_line_spaced = "┚"; - string br_obj = "break_obj"; - string br_page_line = "┼"; - string br_page = "┿"; - string br_page_new = "╂"; - string tc_s = "┊"; - string tc_o = "┏"; - string tc_c = "┚"; - string tc_p = "┆"; - string img = "☼"; - string sep = "␣"; // "~";"␣"; // "~"; - string uid_sep = ":"; - string on_o = "「"; string on_c = "」"; - string mk_bullet = "● "; - static string indent_by_spaces_provided(int indent, string _indent_spaces ="░░") { - _indent_spaces = replicate(_indent_spaces, indent); - return _indent_spaces; - } - static string repeat_character_by_number_provided(C,N)(C _character ="-", N number=10) { - _character = replicate(_character, number); - return _character; - } - } -} -template spineLanguageCodes() { - /+ language codes +/ - struct Lang { - static string[string][string] codes() { - auto _lang_codes = [ - "am": [ "c": "am", "n": "Amharic", "t": "Amharic", "xlp": "amharic" ], - "bg": [ "c": "bg", "n": "Bulgarian", "t": "Български (Bəlgarski)", "xlp": "bulgarian" ], - "bn": [ "c": "bn", "n": "Bengali", "t": "Bengali", "xlp": "bengali" ], - "br": [ "c": "br", "n": "Breton", "t": "Breton", "xlp": "breton" ], - "ca": [ "c": "ca", "n": "Catalan", "t": "catalan", "xlp": "catalan" ], - "cs": [ "c": "cs", "n": "Czech", "t": "česky", "xlp": "czech" ], - "cy": [ "c": "cy", "n": "Welsh", "t": "Welsh", "xlp": "welsh" ], - "da": [ "c": "da", "n": "Danish", "t": "dansk", "xlp": "danish" ], - "de": [ "c": "de", "n": "German", "t": "Deutsch", "xlp": "german" ], - "el": [ "c": "el", "n": "Greek", "t": "Ελληνικά (Ellinika)", "xlp": "greek" ], - "en": [ "c": "en", "n": "English", "t": "English", "xlp": "english" ], - "eo": [ "c": "eo", "n": "Esperanto", "t": "Esperanto", "xlp": "esperanto" ], - "es": [ "c": "es", "n": "Spanish", "t": "español", "xlp": "spanish" ], - "et": [ "c": "et", "n": "Estonian", "t": "Estonian", "xlp": "estonian" ], - "eu": [ "c": "eu", "n": "Basque", "t": "basque", "xlp": "basque" ], - "fi": [ "c": "fi", "n": "Finnish", "t": "suomi", "xlp": "finnish" ], - "fr": [ "c": "fr", "n": "French", "t": "français", "xlp": "french" ], - "ga": [ "c": "ga", "n": "Irish", "t": "Irish", "xlp": "irish" ], - "gl": [ "c": "gl", "n": "Galician", "t": "Galician", "xlp": "galician" ], - "he": [ "c": "he", "n": "Hebrew", "t": "Hebrew", "xlp": "hebrew" ], - "hi": [ "c": "hi", "n": "Hindi", "t": "Hindi", "xlp": "hindi" ], - "hr": [ "c": "hr", "n": "Croatian", "t": "Croatian", "xlp": "croatian" ], - "hy": [ "c": "hy", "n": "Armenian", "t": "Armenian", "xlp": "armenian" ], - "ia": [ "c": "ia", "n": "Interlingua", "t": "Interlingua", "xlp": "interlingua" ], - "is": [ "c": "is", "n": "Icelandic", "t": "Icelandic", "xlp": "icelandic" ], - "it": [ "c": "it", "n": "Italian", "t": "Italiano", "xlp": "italian" ], - "ja": [ "c": "ja", "n": "Japanese", "t": "日本語 (Nihongo)", "xlp": "japanese" ], - "ko": [ "c": "ko", "n": "Korean", "t": "Korean", "xlp": "korean" ], - "la": [ "c": "la", "n": "Latin", "t": "Latin", "xlp": "latin" ], - "lo": [ "c": "lo", "n": "Lao", "t": "Lao", "xlp": "lao" ], - "lt": [ "c": "lt", "n": "Lithuanian", "t": "Lithuanian", "xlp": "lithuanian" ], - "lv": [ "c": "lv", "n": "Latvian", "t": "Latvian", "xlp": "latvian" ], - "ml": [ "c": "ml", "n": "Malayalam", "t": "Malayalam", "xlp": "malayalam" ], - "mr": [ "c": "mr", "n": "Marathi", "t": "Marathi", "xlp": "marathi" ], - "nl": [ "c": "nl", "n": "Dutch", "t": "Nederlands", "xlp": "dutch" ], - "no": [ "c": "no", "n": "Norwegian", "t": "norsk", "xlp": "norsk" ], - "nn": [ "c": "nn", "n": "Norwegian Nynorsk", "t": "nynorsk", "xlp": "nynorsk" ], - "oc": [ "c": "oc", "n": "Occitan", "t": "Occitan", "xlp": "occitan" ], - "pl": [ "c": "pl", "n": "Polish", "t": "polski", "xlp": "polish" ], - "pt": [ "c": "pt", "n": "Portuguese", "t": "Português", "xlp": "portuges" ], - "pt_BR": [ "c": "pt_BR", "n": "Portuguese Brazil", "t": "Brazilian Português", "xlp": "brazilian" ], - "ro": [ "c": "ro", "n": "Romanian", "t": "română", "xlp": "romanian" ], - "ru": [ "c": "ru", "n": "Russian", "t": "Русский (Russkij)", "xlp": "russian" ], - "sa": [ "c": "sa", "n": "Sanskrit", "t": "Sanskrit", "xlp": "sanskrit" ], - "se": [ "c": "se", "n": "Sami", "t": "Samin", "xlp": "samin" ], - "sk": [ "c": "sk", "n": "Slovak", "t": "slovensky", "xlp": "slovak" ], - "sl": [ "c": "sl", "n": "Slovenian", "t": "Slovenian", "xlp": "slovenian" ], - "sq": [ "c": "sq", "n": "Albanian", "t": "Albanian", "xlp": "albanian" ], - "sr": [ "c": "sr", "n": "Serbian", "t": "Serbian", "xlp": "serbian" ], - "sv": [ "c": "sv", "n": "Swedish", "t": "svenska", "xlp": "swedish" ], - "ta": [ "c": "ta", "n": "Tamil", "t": "Tamil", "xlp": "tamil" ], - "te": [ "c": "te", "n": "Telugu", "t": "Telugu", "xlp": "telugu" ], - "th": [ "c": "th", "n": "Thai", "t": "Thai", "xlp": "thai" ], - "tk": [ "c": "tk", "n": "Turkmen", "t": "Turkmen", "xlp": "turkmen" ], - "tr": [ "c": "tr", "n": "Turkish", "t": "Türkçe", "xlp": "turkish" ], - "uk": [ "c": "uk", "n": "Ukranian", "t": "українська (ukrajins\"ka)", "xlp": "ukrainian" ], - "ur": [ "c": "ur", "n": "Urdu", "t": "Urdu", "xlp": "urdu" ], - "us": [ "c": "en", "n": "English (American)","t": "English", "xlp": "english" ], - "vi": [ "c": "vi", "n": "Vietnamese", "t": "Vietnamese", "xlp": "vietnamese" ], - "zh": [ "c": "zh", "n": "Chinese", "t": "中文", "xlp": "chinese" ], - "en": [ "c": "en", "n": "English", "t": "English", "xlp": "english" ], - "xx": [ "c": "xx", "n": "Default", "t": "English", "xlp": "english" ], - ]; - return _lang_codes; - } - static string[] code_arr_ptr() { - string[] _lang_codes = ["am", "bg", "bn", "br", "ca", "cs", "cy", "da", "de", "el", "en", "eo", "es", "et", "eu", "fi", "fr", "ga", "gl", "he", "hi", "hr", "hy", "ia", "is", "it", "ja", "ko", "la", "lo", "lt", "lv", "ml", "mr", "nl", "no", "nn", "oc", "pl", "pt", "pt_BR", "ro", "ru", "sa", "se", "sk", "sl", "sq", "sr", "sv", "ta", "te", "th", "tk", "tr", "uk", "ur", "us", "vi", "zh", "en", "xx",]; - return _lang_codes; - } - static string[] code_arr() { - string[] _lang_codes = ["am", "bg", "bn", "br", "ca", "cs", "cy", "da", "de", "el", "en", "eo", "es", "et", "eu", "fi", "fr", "ga", "gl", "he", "hi", "hr", "hy", "ia", "is", "it", "ja", "ko", "la", "lo", "lt", "lv", "ml", "mr", "nl", "no", "nn", "oc", "pl", "pt", "pt_BR", "ro", "ru", "sa", "se", "sk", "sl", "sq", "sr", "sv", "ta", "te", "th", "tk", "tr", "uk", "ur", "vi", "zh"]; - return _lang_codes; - } - static auto codes_() { - return "(" ~ join(code_arr,"|") ~ ")"; - } - static auto codes_regex() { - return regex(codes_); - } - } -} diff --git a/src/sisudoc/io_out/epub3.d b/src/sisudoc/io_out/epub3.d deleted file mode 100644 index c715630..0000000 --- a/src/sisudoc/io_out/epub3.d +++ /dev/null @@ -1,804 +0,0 @@ -/+ -- Name: SisuDoc Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 (continuously updated, current 2026) Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -module sisudoc.io_out.epub3; -@safe: -template outputEPub3() { - import std.file; - import std.outbuffer; - import std.uri; - import std.zip; - import std.conv : to; - import sisudoc.io_out; - import sisudoc.io_out.rgx; - import sisudoc.io_out.rgx_xhtml; - import sisudoc.io_out.create_zip_file; - import sisudoc.io_out.xmls; - import sisudoc.io_out.xmls_css; - mixin InternalMarkup; - mixin outputXHTMLs; - static auto rgx = RgxO(); - static auto rgx_xhtml = RgxXHTML(); - string special_characters_text(string _txt) { - _txt = _txt - .replaceAll(rgx_xhtml.ampersand, "&") // "&" - .replaceAll(rgx_xhtml.quotation, """) // """ - .replaceAll(rgx_xhtml.less_than, "<") // "<" - .replaceAll(rgx_xhtml.greater_than, ">") // ">" - .replaceAll(rgx.br_line, "<br />") - .replaceAll(rgx.br_line_inline, "<br />") - .replaceAll(rgx.br_line_spaced, "<br />\n<br />") - .replaceAll(rgx.nbsp_char, " "); - return _txt; - } - string epub3_mimetypes() { - string o; - o = format(q"┃application/epub+zip┃") ~ "\n"; - return o; - } - string epub3_container_xml() { - string o; - o = format(q"┃<?xml version="1.0" encoding="utf-8"?>┃") ~ "\n"; - o ~= format(q"┃<container version="1.0" - xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> - <rootfiles> - <rootfile full-path="OEBPS/content.opf" - media-type="application/oebps-package+xml" /> - </rootfiles>┃") ~ "\n</container>\n"; - return o; - } - string epub3_oebps_content(D,P)(D doc, P parts) { - auto xhtml_format = outputXHTMLs(); - auto pth_epub3 = spinePathsEPUB!()(doc.matters.output_path, doc.matters.src.language); - string _uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO sort uuid in doc.matters! - string content = format(q"┃<?xml version="1.0" encoding="utf-8"?> - <package version="3.0" xmlns="http://www.idpf.org/2007/opf" unique-identifier="uid" prefix="rendition: http://www.idpf.org/vocab/rendition/#"> - <metadata - xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" - xmlns:dcterms="https://purl.org/dc/terms/" - xmlns:dc="https://purl.org/dc/elements/1.1/" - unique-identifier="urn:uuid:%s" version="2.0"> - <dc:title id="title">%s</dc:title> - <meta refines="#title" property="title-type">main</meta> - <dc:title id="subtitle">%s</dc:title> - <meta refines="#subtitle" property="title-type">subtitle</meta> - <dc:creator file-as="%s" id="aut">%s</dc:creator> - <dc:language>%s</dc:language> - <dc:date id="published">%s</dc:date> - <dc:rights>Copyright: %s</dc:rights> - <dc:identifier scheme="URI">%s</dc:identifier> - <dc:identifier id="bookid">urn:uuid:%s</dc:identifier> - </metadata> - <manifest> - <item id="css" href="%s" media-type="text/css"/> - <item id="nav" href="toc_nav.xhtml" media-type="application/xhtml+xml" properties="nav" /> - ┃", - _uuid, - xhtml_format.special_characters_text(doc.matters.conf_make_meta.meta.title_main), - (doc.matters.conf_make_meta.meta.title_sub.empty) - ? "" : xhtml_format.special_characters_text(doc.matters.conf_make_meta.meta.title_sub), - (doc.matters.conf_make_meta.meta.creator_author.empty) - ? "" : xhtml_format.special_characters_text(doc.matters.conf_make_meta.meta.creator_author), - (doc.matters.conf_make_meta.meta.creator_author.empty) - ? "" : xhtml_format.special_characters_text(doc.matters.conf_make_meta.meta.creator_author), - doc.matters.src.language, // language, fix (needed in dochead metadata) - (doc.matters.conf_make_meta.meta.date_published.empty) - ? "" : xhtml_format.special_characters_date(doc.matters.conf_make_meta.meta.date_published), - (doc.matters.conf_make_meta.meta.rights_copyright.empty) - ? "" : xhtml_format.special_characters_text(doc.matters.conf_make_meta.meta.rights_copyright), - _uuid, - _uuid, - (pth_epub3.fn_oebps_css).chompPrefix("OEBPS/"), - ); - content ~= parts["manifest_documents"]; - // TODO sort jpg & png - foreach (image; doc.matters.srcs.image_list) { - content ~= format(q"┃ <item id="%s" href="%s/%s" media-type="image/%s" /> - ┃", - image.baseName.stripExtension, - (pth_epub3.doc_oebps_image).chompPrefix("OEBPS/"), - image, - image.extension.chompPrefix("."), - ); - } - content ~= " " ~ "</manifest>" ~ "\n "; - content ~= " " ~ "<spine>" ~ "\n "; - content ~= parts["spine"]; - content ~= " " ~ "</spine>" ~ "\n "; - content ~= " " ~ "<guide>" ~ "\n "; - content ~= parts["guide"]; - content ~= " " ~ "</guide>" ~ "\n "; - content ~= "" ~ "</package>"; - debug(epubmanifest) { - foreach (section; doc.matters.has.keys_seq.seg) { // TODO - foreach (obj; doc.abstraction[section]) { - if (obj.metainfo.is_a == "heading") { - if (obj.metainfo.heading_lev_markup == 4) { - writefln( - "%s~ [%s.xhtml] %s", - obj.marked_up_level, - obj.tags.segment_anchor_tag_epub, - obj.text - ); - } else if (obj.metainfo.heading_lev_markup > 4) { - writefln( - "%s~ [%s.xhtml#%s] %s", - obj.marked_up_level, - obj.tags.segment_anchor_tag_epub, - obj.metainfo.object_number, - obj.text - ); - } - } - } - } - } - return content; - } - string epub3_oebps_toc_nav_xhtml(D)(D doc) { - enum DomTags { none, open, close, close_and_open, open_still, } - auto markup = InlineMarkup(); - static auto rgx = RgxO(); - static auto rgx_xhtml = RgxXHTML(); - string toc; - bool _new_title_set = false; - string toc_head = format(q"┃<html xmlns="https://www.w3.org/1999/xhtml" - xmlns:epub="http://www.idpf.org/2007/ops"> - <head> - <title>%s</title> - </head> - <body> - <section epub:type="frontmatter toc"> - <header> - <h1>Contents</h1> - </header> - <nav epub:type="toc" id="toc"> - ┃", - (doc.matters.conf_make_meta.meta.title_full).special_characters_text, - ); - string _toc_nav_tail = ""; - // writeln(doc.matters.has.keys_seq.seg); // DEBUG line - foreach (sect; doc.matters.has.keys_seq.seg) { - foreach (obj; doc.abstraction[sect]) { - if ((sect == "head") && (obj.metainfo.is_a == "heading")) { - toc = toc_head; - } - if (sect == "tail") { // skip - } else if ((sect != "tail") && (obj.metainfo.is_a == "heading")) { - string _txt = obj.text.replaceAll(rgx.inline_notes_al_gen, "").strip; - foreach_reverse (n; 0 .. 7) { - string k = n.to!string; - switch (obj.metainfo.dom_structure_collapsed_tags_status[n]) { - case DomTags.none : - break; - case DomTags.close : - toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "</li>" ~ "\n"; - toc ~= markup.indent_by_spaces_provided(n, " ") ~ "</ol>" ~ "\n"; - break; - case DomTags.close_and_open : - toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "</li>" ~ "\n"; - goto default; - case DomTags.open : - if (!(_new_title_set)) { - toc ~= markup.indent_by_spaces_provided(n, " ") ~ "<ol>" ~ "\n"; - } - goto default; - default : - if ((obj.metainfo.dom_structure_collapsed_tags_status[n] == DomTags.close_and_open || - obj.metainfo.dom_structure_collapsed_tags_status[n] == DomTags.open - )) { - if ((sect == "head") && (obj.metainfo.is_a == "heading")) { - toc ~= format(q"┃ <li> - <a href="_the_title.xhtml">%s</a> - </li>┃", - obj.text - .replaceAll(rgx.inline_notes_al_gen, "") - .replaceAll(rgx.br_line_inline, "<br />") - .strip, - ); - toc ~= "\n"; - _new_title_set = true; - } else { - _new_title_set = false; - string _hashtag = ""; - if ((obj.metainfo.heading_lev_markup <= 4) && (obj.metainfo.ocn == 0)) { - _hashtag = "#" ~ obj.metainfo.ocn.to!string; - } - string _href = "<a href=\"" - ~ obj.tags.segment_anchor_tag_epub ~ ".xhtml" - ~ _hashtag - ~ "\">"; - toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "<li>" ~ "\n" - ~ markup.indent_by_spaces_provided((n + 2), " ") - ~ _href ~ _txt.special_characters_text ~ "</a>" ~ "\n"; - } - } - break; - } - if (doc.matters.has.keys_seq.seg[doc.matters.has.keys_seq.seg.length - 2] == sect) { - // writeln(n, ": ", sect, ": ", _txt, " - ", obj.metainfo.dom_structure_collapsed_tags_status); // DEBUG - // read last heading (heading prior to closing) and determine what those instructions imply still need to be done - // CLOSE // DomTags { 0 none, 1 open, 2 close, 3 close_and_open, 4 open_still, } - if (n == 6) {_toc_nav_tail = "";} - switch (obj.metainfo.dom_structure_collapsed_tags_status[n]) { - case 0: case 2: - // case DomTags.none: case DomTags.close: - break; - case 1: case 3: case 4: - // case DomTags.open: case DomTags.close_and_open: case DomTags.open_still: - if (n != 0) { - _toc_nav_tail ~= " " ~ markup.indent_by_spaces_provided((n + 1), " ") ~ "</li>" ~ "\n"; - _toc_nav_tail ~= " " ~ markup.indent_by_spaces_provided(n, " ") ~ "</ol>" ~ "\n"; - } - break; - default : - break; - } - if (n == 0) { - _toc_nav_tail ~=" </nav> - </section> - </body> - </html>\n"; - } - } - } - } - } - } - toc ~= _toc_nav_tail; - return toc; - } - @system void outputEPub3(D)(D doc) { - mixin spineRgxOut; - mixin spineRgxXHTML; - auto xhtml_format = outputXHTMLs(); - static auto rgx = RgxO(); - static auto rgx_xhtml = RgxXHTML(); - string segment_filename; - string[] top_level_headings = ["","","",""]; - string[string] oepbs_content_parts; - string suffix = ".xhtml"; - struct writeOut { /+ epub specific documents +/ - /+ fixed output +/ - string mimetypes; - string meta_inf_container_xml; - string oebps_toc_nav_xhtml; - /+ variable output +/ - string oebps_content_opf; - string[][string] doc_epub3; - string[][string] doc_epub3_endnotes; - string[] doc_parts; - } - auto epubWrite = writeOut(); - foreach (section; doc.matters.has.keys_seq.seg) { - foreach (obj; doc.abstraction[section]) { - string _txt = xhtml_format.special_characters_breaks_indents_bullets(obj); - if (obj.metainfo.is_a == "heading") { - assert(section == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); - switch (obj.metainfo.heading_lev_markup) { - case 0: .. case 3: - /+ fill buffer, and replace with new levels from 1 to 3 +/ - switch (obj.metainfo.heading_lev_markup) { - case 0: - top_level_headings[0] = ""; - top_level_headings[1] = ""; - top_level_headings[2] = ""; - top_level_headings[3] = ""; - goto default; - case 1: - top_level_headings[1] = ""; - top_level_headings[2] = ""; - top_level_headings[3] = ""; - goto default; - case 2: - top_level_headings[2] = ""; - top_level_headings[3] = ""; - goto default; - case 3: - top_level_headings[3] = ""; - goto default; - default: - epubWrite.doc_parts ~= obj.tags.segment_anchor_tag_epub; - epubWrite.doc_epub3[obj.tags.segment_anchor_tag_epub] ~= xhtml_format.epub3_seg_head(doc.matters); - Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc.matters, suffix, "epub"); - epubWrite.doc_epub3[obj.tags.segment_anchor_tag_epub] ~= t[0]; - epubWrite.doc_epub3_endnotes[obj.tags.segment_anchor_tag_epub] ~= t[1]; - break; - } - break; - case 4: - segment_filename = obj.tags.segment_anchor_tag_epub; - epubWrite.doc_epub3[segment_filename] ~= xhtml_format.epub3_seg_head(doc.matters); - Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc.matters, suffix, "epub"); - epubWrite.doc_epub3[segment_filename] ~= t[0]; - epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; - break; - case 5: .. case 7: - Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc.matters, suffix, "epub"); - epubWrite.doc_epub3[segment_filename] ~= t[0]; - epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; - break; - case 8: .. case 9: - { /+ debug +/ - if (doc.matters.opt.action.debug_do_epub) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); - writeln(__FILE__, ":", __LINE__, ": ", obj.text); - } - } - break; - default: - { /+ debug +/ - if (doc.matters.opt.action.debug_do_epub) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); - } - } - break; - } - } else { - assert(section == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); - Tuple!(string, string[]) t; - switch (obj.metainfo.is_of_part) { - case "frontmatter": assert(section == "head" || "toc"); - switch (obj.metainfo.is_of_type) { - case "para": - switch (obj.metainfo.is_a) { - case "toc": - t = xhtml_format.para_seg(_txt, obj, doc.matters, suffix, "epub"); - epubWrite.doc_epub3[segment_filename] ~= t[0]; - epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; - break; - default: - { /+ debug +/ - if (doc.matters.opt.action.debug_do_epub) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); - } - } - break; - } - break; - default: - { /+ debug +/ - if (doc.matters.opt.action.debug_do_epub) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); - } - } - break; - } - break; - case "body": assert(section == "body"); - switch (obj.metainfo.is_of_type) { - case "para": - switch (obj.metainfo.is_a) { - case "para": - t = xhtml_format.para_seg(_txt, obj, doc.matters, suffix, "epub"); - epubWrite.doc_epub3[segment_filename] ~= t[0]; - epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; - break; - default: - { /+ debug +/ - if (doc.matters.opt.action.debug_do_epub) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); - } - } - break; - } - break; - case "block": - switch (obj.metainfo.is_a) { - case "quote": - t = xhtml_format.quote_seg(_txt, obj, doc.matters, suffix, "epub"); - epubWrite.doc_epub3[segment_filename] ~= t[0].to!string; - epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; - break; - case "group": - t = xhtml_format.group_seg(_txt, obj, doc.matters, suffix, "epub"); - epubWrite.doc_epub3[segment_filename] ~= t[0].to!string; - epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; - break; - case "block": - t = xhtml_format.block_seg(_txt, obj, doc.matters, suffix, "epub"); - epubWrite.doc_epub3[segment_filename] ~= t[0].to!string; - epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; - break; - case "poem": - break; - case "verse": - t = xhtml_format.verse_seg(_txt, obj, doc.matters, suffix, "epub"); - epubWrite.doc_epub3[segment_filename] ~= t[0].to!string; - epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; - break; - case "code": - epubWrite.doc_epub3[segment_filename] ~= xhtml_format.code(_txt, obj, doc.matters); - break; - case "table": - epubWrite.doc_epub3[segment_filename] ~= xhtml_format.table(_txt, obj, doc.matters); - epubWrite.doc_epub3_endnotes[segment_filename] ~= ""; - break; - default: - { /+ debug +/ - if (doc.matters.opt.action.debug_do_epub) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); - } - } - break; - } - break; - default: - { /+ debug +/ - if (doc.matters.opt.action.debug_do_epub) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); - } - } - break; - } - break; - case "backmatter": - assert(section == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); - switch (obj.metainfo.is_of_type) { - case "para": - switch (obj.metainfo.is_a) { - case "endnote": assert(section == "endnotes"); - t = xhtml_format.para_seg(_txt, obj, doc.matters, suffix, "epub"); - epubWrite.doc_epub3[segment_filename] ~= t[0]; - break; - case "glossary": assert(section == "glossary"); - t = xhtml_format.para_seg(_txt, obj, doc.matters, suffix, "epub"); - epubWrite.doc_epub3[segment_filename] ~= t[0]; - epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; - break; - case "bibliography": assert(section == "bibliography"); - t = xhtml_format.para_seg(_txt, obj, doc.matters, suffix, "epub"); - epubWrite.doc_epub3[segment_filename] ~= t[0]; - epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; - break; - case "bookindex": assert(section == "bookindex"); - t = xhtml_format.para_seg(_txt, obj, doc.matters, suffix, "epub"); - epubWrite.doc_epub3[segment_filename] ~= t[0]; - epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; - break; - case "blurb": assert(section == "blurb"); - t = xhtml_format.para_seg(_txt, obj, doc.matters, suffix, "epub"); - epubWrite.doc_epub3[segment_filename] ~= t[0]; - epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; - break; - case "tail": assert(section == "tail"); - t = xhtml_format.para_seg(_txt, obj, doc.matters, suffix, "epub"); - epubWrite.doc_epub3[segment_filename] ~= t[0]; - epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; - break; - default: - { /+ debug +/ - if (doc.matters.opt.action.debug_do_epub) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); - } - } - break; - } - break; - default: - { /+ debug +/ - if (doc.matters.opt.action.debug_do_epub) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); - } - } - break; - } - break; - case "comment": - break; - default: - { /+ debug +/ - if (doc.matters.opt.action.debug_do_epub) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); - } - } - break; - } - } - if (obj.metainfo.is_a == "heading") { - // assert(obj.text.length > 0); // check assertion - if (obj.metainfo.heading_lev_markup <= 4) { - oepbs_content_parts["manifest_documents"] ~= - format(q"┃<item id="%s.xhtml" href="%s.xhtml" media-type="application/xhtml+xml" /> - ┃", - obj.tags.segment_anchor_tag_epub, - obj.tags.segment_anchor_tag_epub, - ); - oepbs_content_parts["spine"] ~= - format(q"┃<itemref idref="%s.xhtml" linear="yes" /> - ┃", - obj.tags.segment_anchor_tag_epub, - ); - oepbs_content_parts["guide"] ~= - format(q"┃<reference type="%s" href="%s" /> - ┃", - obj.tags.segment_anchor_tag_epub, - obj.tags.segment_anchor_tag_epub, - ); - } else if (obj.metainfo.heading_lev_markup > 4) { - oepbs_content_parts["manifest_documents"] ~= - format(q"┃<item id="%s.xhtml#%s" href="%s.xhtml#%s" media-type="application/xhtml+xml" /> - ┃", - obj.tags.segment_anchor_tag_epub, - obj.metainfo.object_number, - obj.tags.segment_anchor_tag_epub, - obj.metainfo.object_number, - ); - oepbs_content_parts["spine"] ~= - format(q"┃<itemref idref="%s.xhtml#%s" linear="yes" /> - ┃", - obj.tags.segment_anchor_tag_epub, - obj.metainfo.object_number, - ); - oepbs_content_parts["guide"] ~= - format(q"┃<reference type="%s#%s" href="%s#%s" /> - ┃", - obj.tags.segment_anchor_tag_epub, - obj.metainfo.object_number, - obj.tags.segment_anchor_tag_epub, - obj.metainfo.object_number, - ); - } - } - } - } - /+ epub specific documents +/ - epubWrite.mimetypes = epub3_mimetypes; - epubWrite.meta_inf_container_xml = epub3_container_xml; - epubWrite.oebps_toc_nav_xhtml = doc.epub3_oebps_toc_nav_xhtml; - epubWrite.oebps_content_opf = doc.epub3_oebps_content(oepbs_content_parts); - epubWrite.epub3_write_output_files(doc.matters); - } - @system void epub3_write_output_files(W,M)( - W epub_write, - M doc_matters, - ) { - debug(asserts) { - static assert(is(typeof(epub_write.doc_epub3) == string[][string])); - static assert(is(typeof(epub_write.mimetypes) == string)); - static assert(is(typeof(epub_write.meta_inf_container_xml) == string)); - static assert(is(typeof(epub_write.oebps_toc_nav_xhtml) == string)); - static assert(is(typeof(epub_write.oebps_content_opf) == string)); - } - static auto rgx = RgxO(); - static auto rgx_xhtml = RgxXHTML(); - auto pth_epub3 = spinePathsEPUB!()(doc_matters.output_path, doc_matters.src.language); - auto xhtml_format = outputXHTMLs(); - /+ zip file +/ - auto fn_epub = pth_epub3.epub_file(doc_matters.src.filename); - auto zip = new ZipArchive(); // ZipArchive zip = new ZipArchive(); - /+ zip archive member files +/ - void EPUBzip()(string contents, string fn) { - auto zip_arc_member_file = new ArchiveMember(); - zip_arc_member_file.name = fn; - auto zip_data = new OutBuffer(); - (doc_matters.opt.action.debug_do_epub) - ? zip_data.write(contents.dup) - : zip_data.write(contents.dup - .replaceAll(rgx.spaces_line_start, "") - .replaceAll(rgx.newline, " ") - .strip - ); - zip_arc_member_file.expandedData = zip_data.toBytes(); - zip.addMember(zip_arc_member_file); - createZipFile!()(fn_epub, zip.build()); - } - try { - if (!exists(pth_epub3.base)) { - pth_epub3.base.mkdirRecurse; - } - if (!exists(pth_epub3.base ~ "/index.html")) { - import sisudoc.io_out.html_snippet; - mixin htmlSnippet; - auto f = File(pth_epub3.base ~"/index.html", "w"); - f.writeln(format_html_blank_page_guide_home( - "../../css/html_scroll.css", - (doc_matters.opt.action.webserver_url_doc_root.length > 0) - ? doc_matters.opt.action.webserver_url_doc_root - : doc_matters.conf_make_meta.conf.w_srv_data_root_url, - "../../index.html", - )); - } - { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub) { - if (!exists(pth_epub3.dbg_doc_meta_inf(doc_matters.src.filename))) { - pth_epub3.dbg_doc_meta_inf(doc_matters.src.filename).mkdirRecurse; - } - if (!exists(pth_epub3.dbg_doc_oebps_css(doc_matters.src.filename))) { - pth_epub3.dbg_doc_oebps_css(doc_matters.src.filename).mkdirRecurse; - } - if (!exists(pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename))) { - pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename).mkdirRecurse; - } - } - } - { /+ OEBPS/[segments].xhtml (the document contents) +/ - foreach (seg_filename; doc_matters.has.segnames_lv_0_to_4) { - string fn = pth_epub3.fn_oebps_content_xhtml(seg_filename); - auto zip_arc_member_file = new ArchiveMember(); - zip_arc_member_file.name = fn; - auto zip_data = new OutBuffer(); - { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub) { - string fn_dbg = pth_epub3.dbg_fn_oebps_content_xhtml(doc_matters.src.filename, seg_filename); - auto f = File(fn_dbg, "w"); - foreach (docseg; epub_write.doc_epub3[seg_filename]) { - f.writeln(docseg); - } - foreach (docseg; epub_write.doc_epub3_endnotes[seg_filename]) { - f.writeln(docseg); - } - f.writeln(xhtml_format.tail(doc_matters)); - } - } - foreach (docseg; epub_write.doc_epub3[seg_filename]) { - zip_data.write(docseg.dup); - } - foreach (docseg; epub_write.doc_epub3_endnotes[seg_filename]) { - zip_data.write(docseg.dup); - } - zip_data.write(xhtml_format.tail(doc_matters).dup); - zip_arc_member_file.expandedData = zip_data.toBytes(); - zip.addMember(zip_arc_member_file); - /+ create the zip file +/ - createZipFile!()(fn_epub, zip.build()); - } - } - string fn; - string fn_dbg; - File f; - { /+ mimetypes (identify zip file type) +/ - { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub) { - fn_dbg = pth_epub3.dbg_fn_mimetypes(doc_matters.src.filename); - File(fn_dbg, "w").writeln(epub_write.mimetypes); - } - } - fn = pth_epub3.fn_mimetypes; - EPUBzip(epub_write.mimetypes, fn); - } - { /+ META-INF/container.xml (identify doc root) +/ - { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub) { - fn_dbg = pth_epub3.dbg_fn_dmi_container_xml(doc_matters.src.filename); - File(fn_dbg, "w").writeln(epub_write.meta_inf_container_xml); - } - } - fn = pth_epub3.fn_dmi_container_xml; - EPUBzip(epub_write.meta_inf_container_xml, fn); - } - { /+ OEBPS/toc_nav.xhtml (navigation toc epub3) +/ - { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub) { - fn_dbg = pth_epub3.dbg_fn_oebps_toc_nav_xhtml(doc_matters.src.filename); - File(fn_dbg, "w").writeln(epub_write.oebps_toc_nav_xhtml); - } - } - fn = pth_epub3.fn_oebps_toc_nav_xhtml; - EPUBzip(epub_write.oebps_toc_nav_xhtml, fn); - } - { /+ OEBPS/content.opf (doc manifest) +/ - { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub) { - fn_dbg = pth_epub3.dbg_fn_oebps_content_opf(doc_matters.src.filename); - File(fn_dbg, "w").writeln(epub_write.oebps_content_opf); - } - } - fn = pth_epub3.fn_oebps_content_opf; - EPUBzip(epub_write.oebps_content_opf, fn); - } - { /+ OEBPS/_dr/image (images) +/ - foreach (image; doc_matters.srcs.image_list) { - { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub) { - if (doc_matters.opt.action.vox_gt_3) { - 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_gt_1) { - writeln(" ", fn_epub); - } - debug(epub_archive) { - if (exists(fn_epub)) { - try { - auto zipped = new ZipArchive((fn_epub).read); - foreach (filename, member; zipped.directory) { - auto data = zipped.expand(member); - writeln(filename, " length ", data.length); - } - } catch (ZipException ex) { - // Handle errors - } - } - } - } -} diff --git a/src/sisudoc/io_out/html.d b/src/sisudoc/io_out/html.d deleted file mode 100644 index a294f30..0000000 --- a/src/sisudoc/io_out/html.d +++ /dev/null @@ -1,615 +0,0 @@ -/+ -- Name: SisuDoc Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 (continuously updated, current 2026) Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -module sisudoc.io_out.html; -@safe: -template outputHTML() { - import std.file; - import std.outbuffer; - import std.uri; - import std.conv : to; - import sisudoc.io_out; - import sisudoc.io_out.rgx; - import sisudoc.meta.rgx_files; - import sisudoc.io_out.rgx_xhtml; - import sisudoc.io_out.create_zip_file; - import sisudoc.io_out.xmls; - import sisudoc.io_out.xmls_css; - mixin outputXHTMLs; - void scroll(D)(D doc) { - mixin spineRgxOut; - mixin spineRgxXHTML; - auto xhtml_format = outputXHTMLs(); - static auto rgx = RgxO(); - static auto rgx_xhtml = RgxXHTML(); - string[] doc_html; - string[] doc_out; - 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_out = xhtml_format.html_head(doc.matters, "scroll") - ~ doc_html - ~ xhtml_format.dom_close - ~ xhtml_format.tail(doc.matters); - scroll_write_output(doc_out, doc.matters); - } - @trusted void scroll_write_output(O,M)( - O doc_out, - M doc_matters, - ) { - debug(asserts) { - static assert(is(typeof(doc_out) == 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_out) { - f.writeln(o); - } - } - if (!exists(pth_html.base ~ "/index.html")) { - import sisudoc.io_out.html_snippet; - mixin htmlSnippet; - auto f = File(pth_html.base ~"/index.html", "w"); - f.writeln(format_html_blank_page_guide_home( - "../../css/html_scroll.css", - (doc_matters.opt.action.webserver_url_doc_root.length > 0) - ? doc_matters.opt.action.webserver_url_doc_root - : doc_matters.conf_make_meta.conf.w_srv_data_root_url, - "../../index.html", - )); - } - } catch (ErrnoException ex) { - // Handle error - } - if (doc_matters.opt.action.vox_gt_1) { - writeln(" ", pth_html.fn_scroll(doc_matters.src.filename)); - } - } - void seg(D)(D doc) { - 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 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_gt_1) { - writeln(" ", pth_html.fn_seg(doc_matters.src.filename, "toc")); - } - } - void css(M)(M doc_matters) { - auto css = spineCss(doc_matters); - auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language); - try { - if (!exists(pth_html.css)) { - (pth_html.css).mkdirRecurse; - } - { - auto f = File(pth_html.fn_seg_css, "w"); - f.writeln(css.html_seg); - f = File(pth_html.fn_scroll_css, "w"); - f.writeln(css.html_scroll); - } - if (!exists(pth_html.css ~ "/index.html")) { - import sisudoc.io_out.html_snippet; - mixin htmlSnippet; - auto f = File(pth_html.css ~"/index.html", "w"); - f.writeln(format_html_blank_page_guide_home( - "./css/html_scroll.css", - (doc_matters.opt.action.webserver_url_doc_root.length > 0) - ? doc_matters.opt.action.webserver_url_doc_root - : doc_matters.conf_make_meta.conf.w_srv_data_root_url, - "../index.html", - )); - } - } catch (ErrnoException ex) { - // Handle error - } - } - @trusted void images_cp(M)(M doc_matters) { // @system - { /+ (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_gt_1) { - writeln("WARNING image not found: ", fn_src_in); - } - } - } - if (!exists(pth_html.image ~ "/index.html")) { - import sisudoc.io_out.html_snippet; - mixin htmlSnippet; - auto f = File(pth_html.image ~"/index.html", "w"); - f.writeln(format_html_blank_page_guide_home( - "../css/html_scroll.css", - (doc_matters.opt.action.webserver_url_doc_root.length > 0) - ? doc_matters.opt.action.webserver_url_doc_root - : doc_matters.conf_make_meta.conf.w_srv_data_root_url , - "../index.html", - )); - } - } - } -} diff --git a/src/sisudoc/io_out/html_snippet.d b/src/sisudoc/io_out/html_snippet.d deleted file mode 100644 index d02cb28..0000000 --- a/src/sisudoc/io_out/html_snippet.d +++ /dev/null @@ -1,101 +0,0 @@ -/+ -- Name: SisuDoc Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 (continuously updated, current 2026) Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -module sisudoc.io_out.html_snippet; -@safe: -template htmlSnippet() { - import std.file; - import std.outbuffer; - import std.format; - import std.uri; - import std.conv : to; - import sisudoc.io_out.rgx; - import sisudoc.meta.rgx_files; - import sisudoc.io_out.rgx_xhtml; - auto format_html_blank_page_guide_home()( - string css_style, - string home_url, - string collection_home_path - ) { - auto html_blank_default = format(q"┃<!DOCTYPE html> -<html> - <head> - <meta http-equiv="Content-Type" content="text/plain; charset=UTF-8" /> - <link href="%s" rel="stylesheet" /> - </head> - <body> - <p class="icons"> - <a href="%s" class="lnkicon">⟰ </a> - <a href="%s" class="lnkicon"> ≅ </a> - </p> - </body> -</html>┃", - css_style, - home_url, - collection_home_path - ); - return html_blank_default; - } - string special_characters_text(string _txt) { - mixin spineRgxOut; - mixin spineRgxXHTML; - static auto rgx = RgxO(); - static auto rgx_xhtml = RgxXHTML(); - _txt = _txt - .replaceAll(rgx_xhtml.ampersand, "&") // "&" - .replaceAll(rgx_xhtml.quotation, """) // """ - .replaceAll(rgx_xhtml.less_than, "<") // "<" - .replaceAll(rgx_xhtml.greater_than, ">") // ">" - .replaceAll(rgx.br_line, "<br />") - .replaceAll(rgx.br_line_inline, "<br />") - .replaceAll(rgx.br_line_spaced, "<br />\n<br />") - .replaceAll(rgx.nbsp_char, " "); - return _txt; - } -} diff --git a/src/sisudoc/io_out/hub.d b/src/sisudoc/io_out/hub.d deleted file mode 100644 index 6ca047a..0000000 --- a/src/sisudoc/io_out/hub.d +++ /dev/null @@ -1,239 +0,0 @@ -/+ -- Name: SisuDoc Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 (continuously updated, current 2026) Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -/++ - output hub<BR> - check & generate output types requested -+/ -module sisudoc.io_out.hub; -@safe: -template outputHub() { - import sisudoc.io_out, - sisudoc.io_out.metadata, - sisudoc.io_out.xmls, - sisudoc.io_out.create_zip_file, - sisudoc.io_out.paths_output; - @system void outputHub(D)(D doc) { - mixin Msg; - auto msg = Msg!()(doc.matters); - enum outTask { source_or_pod, sqlite, sqlite_multi, latex, odt, epub, html_scroll, html_seg, html_stuff, text, skel } - void Scheduled(D)(int sched, D doc) { - auto msg = Msg!()(doc.matters); - if (sched == outTask.source_or_pod) { - msg.v("spine (doc reform) source processing... "); - if (doc.matters.opt.action.pod) { msg.v("spine (doc reform) source pod processing... "); } - import sisudoc.io_out.source_pod; - spinePod!()(doc.matters); - if (doc.matters.opt.action.source) { msg.vv("spine (doc reform) source done"); } - if (doc.matters.opt.action.pod) { msg.vv("spine (doc reform) source pod done"); } - } - if (sched == outTask.epub) { - msg.v("epub3 processing... "); - import sisudoc.io_out.epub3; - doc.outputEPub3!(); - msg.vv("epub3 done"); - } - if (sched == outTask.html_stuff) { - outputMetadata!()(doc.matters); - msg.vv("html metadata done"); - } - if (sched == outTask.html_scroll) { - msg.v("html scroll processing... "); - import sisudoc.io_out.html; - outputHTML!().scroll(doc); - msg.vv("html scroll done"); - } - if (sched == outTask.html_seg) { - msg.v("html seg processing... "); - import sisudoc.io_out.html; - outputHTML!().seg(doc); - msg.vv("html seg done"); - } - if (sched == outTask.html_stuff) { - import sisudoc.io_out.html; - outputHTML!().css(doc.matters); - outputHTML!().images_cp(doc.matters); - msg.vv("html css & images done"); - } - if (sched == outTask.latex) { - msg.v("latex processing... (available for downstream processing & pdf output"); - import sisudoc.io_out.latex; - import std.file; - if ((isValidPath(doc.matters.output_path ~ "/latex/sty")) - && (!(exists(doc.matters.output_path ~ "/latex/sty"))) - ) { - outputLaTeXstyInit!()( - doc.matters.output_path, - doc.matters.opt.action.generated_by, - doc.matters.generator_program.name_version_and_compiler, - doc.matters.generator_program.time_output_generated, - ); - } - outputLaTeX!()(doc.abstraction, doc.matters); - msg.vv("latex done"); - } - if (sched == outTask.text) { - msg.v("text processing... "); - import sisudoc.io_out.text; - outputText!()(doc.abstraction, doc.matters); - msg.vv("text done"); - } - if (sched == outTask.odt) { - msg.v("odf:odt processing... "); - import sisudoc.io_out.odt; - outputODT!()(doc.abstraction, doc.matters); - msg.vv("odf:odt done"); - } - if (sched == outTask.sqlite) { - msg.v("sqlite processing... "); - import sisudoc.io_out.sqlite; - doc.SQLiteHubDiscreteBuildTablesAndPopulate!(); - msg.vv("sqlite done"); - } - if (sched == outTask.skel) { - msg.v("skel processing... "); - import sisudoc.io_out.skel; - outputSkel!()(doc.abstraction, doc.matters); - msg.vv("skel done"); - } - } - if (doc.matters.opt.action.vox_gt_1) { 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); - } - } else { - import std.parallelism; - foreach(schedule; parallel(doc.matters.opt.action.output_task_scheduler)) { - Scheduled!()(schedule, doc); - } - } - if (doc.matters.opt.action.sqlite_update) { - msg.v("sqlite update processing..."); - import sisudoc.io_out.sqlite; - doc.SQLiteHubBuildTablesAndPopulate!(); - msg.vv("sqlite update done"); - } else if (doc.matters.opt.action.sqlite_delete) { - msg.v("sqlite delete processing..."); - import sisudoc.io_out.sqlite; - doc.SQLiteHubBuildTablesAndPopulate!(); - msg.vv("sqlite delete done"); - } - } -} -template outputHubInitialize() { - import std.file; - import sisudoc.io_out, - sisudoc.io_out.metadata, - sisudoc.io_out.paths_output; - string _bespoke_homepage = "./spine-bespoke-output/html/homepage.index.html"; - @system void outputHubInitialize(O,I)( - O opt_action, - I program_info - ) { - if ((opt_action.html || opt_action.html_seg || opt_action.html_scroll) - && opt_action.output_dir_set.length > 0 - && !(opt_action.output_dir_set ~ "/index.html").exists - ) { - writeln(_bespoke_homepage); - if ((_bespoke_homepage).exists) { - writeln("copy bespoke html homepage\n", _bespoke_homepage, " -> ", opt_action.output_dir_set, "/index.html"); - _bespoke_homepage.copy(opt_action.output_dir_set ~ "/index.html"); - } else { - writeln("place bespoke homepage in ", _bespoke_homepage); - } - } - if ( - opt_action.latex_document_header_sty - || ( - opt_action.latex - && opt_action.output_dir_set.length > 0 - && !(isValidPath(opt_action.output_dir_set ~ "/latex/sty"))) - ) { // .sty need to be produced only once (if unchanged per output-dir of which there usually will be only one) - import sisudoc.io_out.latex; - outputLaTeXstyInit!()( - opt_action.output_dir_set, - opt_action.generated_by, - program_info.name_version_and_compiler, - program_info.time_output_generated, - ); - writeln(opt_action.latex); - } - } -} -template outputHubOp() { - import sisudoc.io_out, - sisudoc.io_out.metadata, - sisudoc.io_out.xmls, - sisudoc.io_out.create_zip_file, - sisudoc.io_out.paths_output; - @system void outputHubOp(E,O,C)(E env, O opt_action, C config) { - if ((opt_action.sqlite_db_drop)) { - if ((opt_action.vox_gt_2)) { - writeln("sqlite drop db..."); - } - import sisudoc.io_out.sqlite; - SQLiteDbDrop!()(opt_action, config); - if ((opt_action.vox_gt_3)) { - writeln("sqlite drop db done"); - } - } - if ((opt_action.sqlite_db_create)) { - if ((opt_action.vox_gt_2)) { - auto pth_sqlite_db = spinePathsSQLite!()(opt_action.cgi_sqlite_search_filename, opt_action.output_dir_set); - writeln("sqlite create table..."); - } - import sisudoc.io_out.sqlite; - SQLiteTablesCreate!()(env, opt_action, config); - if ((opt_action.vox_gt_3)) { - writeln("sqlite create table done"); - } - } - } -} diff --git a/src/sisudoc/io_out/latex.d b/src/sisudoc/io_out/latex.d deleted file mode 100644 index 8a1ae3e..0000000 --- a/src/sisudoc/io_out/latex.d +++ /dev/null @@ -1,1786 +0,0 @@ -/+ -- Name: SisuDoc Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 (continuously updated, current 2026) Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -module sisudoc.io_out.latex; -@safe: -template paperLaTeX() { - import std.format; - import 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.file; - import std.outbuffer; - import std.uri; - import std.conv : to; - import sisudoc.io_out; - import sisudoc.io_out.rgx; - import sisudoc.io_out.rgx_latex; - mixin spineRgxOut; - static auto rgx = RgxO(); - mixin spineRgxLSC; - static auto rgx_sc = RgxLSC(); - mixin spineLanguageCodes; - auto lang = Lang(); - auto paper = paperLaTeX; - string sp_char_ops()( - string _txt, - ) { - string _unescape_sp_char_esc()(string _txt) { - _txt = _txt - .replaceAll(rgx_sc.latex_special_char_escaped, - format(q"┃%s┃", "$1")) - .replaceAll(rgx_sc.latex_special_char_escaped_braced, - format(q"┃%s┃", "$1")); - return _txt; - } - string _unescape_fontface_esc()(string _txt) { - _txt = _txt.replaceAll(rgx_sc.latex_identify_inline_fontface, - format(q"┃%s%s┃", "$1", "$2")); - return _txt; - } - _txt = replaceAll!(m => "\\" ~ m[1])(_txt, rgx_sc.latex_special_char_for_escape); - _txt = replaceAll!(m => "{\\" ~ m[1] ~ "}")(_txt, rgx_sc.latex_special_char_for_escape_and_braces); - _txt = replaceAll!(m => "''")(_txt, rgx.quotes_open_and_close); - _txt = replaceAll!(m => "$\\cdot$")(_txt, rgx.middle_dot); - _txt = replaceAll!(m => _unescape_sp_char_esc(m[0]))(_txt, rgx_sc.latex_identify_inline_link); - _txt = replaceAll!(m => _unescape_fontface_esc(m[0]))(_txt, rgx_sc.latex_identify_inline_fontface); - return _txt; - } - string sp_char_esc(O)( - string _txt, - const O obj, - ) { - if (obj.metainfo.is_a != "code") { - _txt = _txt.sp_char_ops; - } - return _txt; - } - string sp_char_esc_txt()( - string _txt, - ) { - _txt = _txt.sp_char_ops; - return _txt; - } - string marked_linebreaks_newlines()( - string _txt, - ) { - _txt = _txt.split(rgx.br_linebreaks_newlines).join("\\br\n").strip; - // _txt = replaceAll!(m => "\\br " ~ m[1])(_txt, rgx.br_linebreaks_newlines); - return _txt; - } - string fontface()( - string _txt, - ) { - _txt = _txt - .replaceAll(rgx.inline_emphasis, format(q"┃\begin{bfseries}%s\end{bfseries}┃", "$1")) - .replaceAll(rgx.inline_bold, format(q"┃\begin{bfseries}%s\end{bfseries}┃", "$1")) - .replaceAll(rgx.inline_italics, format(q"┃\emph{%s}┃", "$1")) - .replaceAll(rgx.inline_italics, format(q"┃\uline{%s}┃", "$1")) - .replaceAll(rgx.inline_superscript, format(q"┃$$^{%s}$$┃", "$1")) - .replaceAll(rgx.inline_subscript, format(q"┃$$_{%s}$$┃", "$1")) - .replaceAll(rgx.inline_strike, format(q"┃\sout{%s}┃", "$1")) - .replaceAll(rgx.inline_insert, format(q"┃\uline{%s}┃", "$1")) - .replaceAll(rgx.inline_mono, format(q"┃\begin{monosp}%s\end{monosp}┃", "$1")) - .replaceAll(rgx.inline_italics, format(q"┃``%s''┃", "$1")); - return _txt; - } - string leading_hardspaces()( - string _txt, - ) { - string hardspaces(string _spaces) { - _spaces = _spaces - .replaceAll(rgx.space, "{\\s}"); - return _spaces; - } - _txt = replaceAll!(m => hardspaces(m[0]))(_txt, rgx.spaces_line_start); - return _txt; - } - string nbsp_char()(string _txt) { - if (_txt.match(rgx.nbsp_char)) { - foreach (m; _txt.matchAll(rgx.nbsp_chars)) { - int spaces_ = 0; - foreach (n; m[0].matchAll(rgx.nbsp_char)) { - spaces_ ++; - } - _txt = _txt.replaceFirst(rgx.nbsp_chars, "\\spaces{" ~ spaces_.to!string ~ "}"); - } - } - return _txt; - } - string spaces_to_nbsp()(string _txt) { - if (_txt.match(rgx.spaces_keep)) { - foreach (m; _txt.matchAll(rgx.spaces_keep)) { - int spaces_ = 0; - foreach (n; m[0].matchAll(rgx.space)) { - spaces_ ++; - } - _txt = _txt.replaceFirst(rgx.spaces_keep, "\\spaces{" ~ spaces_.to!string ~ "}"); - } - } - return _txt; - } - string nbsp_char_to_space()(string _txt) { - if (_txt.match(rgx.nbsp_char)) { - _txt = _txt.replaceAll(rgx.nbsp_char, " "); - } - return _txt; - } - string links_and_images(O,M)( - string _txt, - const O obj, - M doc_matters, - ) { - if (obj.has.inline_links) { // TODO some images do not have inline links ... image without link - string _width_adjust(string _width) { - if (_width.to!int > 300) { _width = "300"; } // will need to vary max with papersize & orientation - return _width; - } - string _latex_image_path(string _image_path) { - auto pth_latex = spinePathsLaTeX(doc_matters); - _image_path = pth_latex.base_filename(doc_matters.src.filename) ~ "/" ~ _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 quote(O,M)( - string _txt, - O obj, - M doc_matters, - ) { - if (obj.metainfo.is_a == "quote") { - 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 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[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": - _txt = _txt.quote(obj, doc_matters) - .links_and_images(obj, doc_matters); - goto default; - 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_gt_2) { - 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_gt_2) { - 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_gt_1) { - writeln(" ", pth_latex.latex_file_with_path(paper_size_orientation)); - } - { - auto f = File(pth_latex.latex_file_with_path(paper_size_orientation), "w"); - f.writeln(latex_content.head); - f.writeln(latex_content.content); - f.writeln(latex_content.tail); - foreach (image; doc_matters.srcs.image_list) { - string fn_src_in = doc_matters.src.image_dir_path ~ "/" ~ image; - string fn_src_out_file = pth_latex.latex_path_stuff ~ "/" ~ image; - if (exists(fn_src_in)) { - fn_src_in.copy(fn_src_out_file); - } - } - } - if (!exists(pth_latex.latex_path_stuff ~ "/index.html")) { - import sisudoc.io_out.html_snippet; - mixin htmlSnippet; - auto f = File(pth_latex.latex_path_stuff ~"/index.html", "w"); - f.writeln(format_html_blank_page_guide_home( - "../../css/html_scroll.css", - (doc_matters.opt.action.webserver_url_doc_root.length > 0) - ? doc_matters.opt.action.webserver_url_doc_root - : doc_matters.conf_make_meta.conf.w_srv_data_root_url - , - "../../index.html", - )); - } - // should be in latex init and done just once, doc_matters not passed there though - if (!exists(pth_latex.base ~ "/index.html")) { - import sisudoc.io_out.html_snippet; - mixin htmlSnippet; - auto f = File(pth_latex.base ~"/index.html", "w"); - f.writeln(format_html_blank_page_guide_home( - "../css/html_scroll.css", - (doc_matters.opt.action.webserver_url_doc_root.length > 0) - ? doc_matters.opt.action.webserver_url_doc_root - : doc_matters.conf_make_meta.conf.w_srv_data_root_url, - "../index.html", - )); - } - if (!exists(pth_latex.base_sty ~ "/index.html")) { - import sisudoc.io_out.html_snippet; - mixin htmlSnippet; - auto f = File(pth_latex.base_sty ~"/index.html", "w"); - f.writeln(format_html_blank_page_guide_home( - "../../css/html_scroll.css", - (doc_matters.opt.action.webserver_url_doc_root.length > 0) - ? doc_matters.opt.action.webserver_url_doc_root - : doc_matters.conf_make_meta.conf.w_srv_data_root_url, - "../../index.html", - )); - } - } catch (ErrnoException ex) { - // handle error - } - } - void outputLaTeX(D,M)( - const D doc_abstraction, - M doc_matters, - ) { - struct LaTeX { - string head; - string content; - string tail; - } - LaTeX latex = LaTeX(); - foreach (paper_size_orientation; doc_matters.conf_make_meta.conf.set_papersize) { - latex.head = latex_head(doc_matters, paper_size_orientation); - latex.content = latex_body(doc_abstraction, doc_matters, paper_size_orientation); - latex.tail = latex_tail(doc_matters, paper_size_orientation); - latex.writeOutputLaTeX(doc_matters, paper_size_orientation); - } - } -} -template outputLaTeXstyInit() { - import sisudoc.io_out; - auto paper = paperLaTeX; - void writeOutputLaTeXstyStatic( - string latex_sty, - string output_dir, - string filename, - ) { - if ((output_dir.length > 0) - && isValidPath(output_dir) - ) { - auto pth_latex = spinePathsLaTeXsty(output_dir); - try { - import std.file; - if (!exists(pth_latex.base_sty)) { - (pth_latex.base_sty).mkdirRecurse; - } - { - auto f = File(pth_latex.latex_document_header_sty(filename), "w"); - f.writeln(latex_sty); - } - } catch (ErrnoException ex) { - // handle error - } - } - } - void outputLaTeXstyInit()( - string output_dir, - bool generated_by, - string name_version_and_compiler, - string time_output_generated, - ) { - string latex_sty = outputLaTeXstyStatic!()(generated_by, name_version_and_compiler, time_output_generated); - latex_sty.writeOutputLaTeXstyStatic(output_dir, "spineShared.sty"); - auto sty_a4p = paper.a4.portrait; - auto latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_a4p, generated_by, name_version_and_compiler, time_output_generated); - latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_a4p.stylesheet ~ ".sty"); - auto sty_a4l = paper.a4.landscape; - latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_a4l, generated_by, name_version_and_compiler, time_output_generated); - latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_a4l.stylesheet ~ ".sty"); - auto sty_b4p = paper.b4.portrait; - latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_b4p, generated_by, name_version_and_compiler, time_output_generated); - latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_b4p.stylesheet ~ ".sty"); - auto sty_b4l = paper.b4.landscape; - latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_b4l, generated_by, name_version_and_compiler, time_output_generated); - latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_b4l.stylesheet ~ ".sty"); - auto sty_a5p = paper.a5.portrait; - latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_a5p, generated_by, name_version_and_compiler, time_output_generated); - latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_a5p.stylesheet ~ ".sty"); - auto sty_a5l = paper.a5.landscape; - latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_a5l, generated_by, name_version_and_compiler, time_output_generated); - latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_a5l.stylesheet ~ ".sty"); - auto sty_letter_p = paper.letter.portrait; - latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_letter_p, generated_by, name_version_and_compiler, time_output_generated); - latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_letter_p.stylesheet ~ ".sty"); - auto sty_letter_l = paper.letter.landscape; - latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_letter_l, generated_by, name_version_and_compiler, time_output_generated); - latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_letter_l.stylesheet ~ ".sty"); - auto sty_legal_p = paper.legal.portrait; - latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_legal_p, generated_by, name_version_and_compiler, time_output_generated); - latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_legal_p.stylesheet ~ ".sty"); - auto sty_legal_l = paper.legal.landscape; - latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_legal_l, generated_by, name_version_and_compiler, time_output_generated); - latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_legal_l.stylesheet ~ ".sty"); - } -} -template outputLaTeXstyStatic() { - import std.format; - import 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{dejavu} -\renewcommand*\familydefault{\sfdefault} -\usepackage{inconsolata} -\usepackage[T1]{fontenc} -\usepackage{newunicodechar} -%% \usepackage[utf8]{inputenc} -\usepackage{alltt} -\PassOptionsToPackage{hyphens}{url} -\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=true, - colorlinks=true, - urlcolor=black, - filecolor=black, - linkcolor=black, - citecolor=black, %% links_mono_or_color_set -]{hyperref} -\usepackage{xurl} -%% \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}} -\renewcommand{\-}{\hspace*{1ex}} -\newcommand{\caret}{{\^{~}}} -\newcommand{\pipe}{{\textbar}} -\newcommand{\curlyOpen}{{} -\newcommand{\curlyClose}{}} -\newcommand{\lt}{{UseTextSymbol{OML}{<}}} -\newcommand{\gt}{{UseTextSymbol{OML}{>}}} -\renewcommand{\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=200 -\clubpenalty=150 -\widowpenalty=150 -\setlength{\emergencystretch}{3em} -%% \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; - import std.conv : to; - auto outputLaTeXstyPaperSizeAndOrientation(P)( - P doc_sty_info, - bool generated_by, - string name_version_and_compiler, - string time_output_generated, - ) { - string latex_sty = format(q"┃%%%% spine LaTeX output%s%s -%% - called by .tex document to set paper dimensions (size and orientation) -%% - calls spineShared.sty used/shared by all spine documents -\ProvidesPackage{./sty/%s} -\usepackage{geometry} -\geometry{ - %s, - %s, - left=%s, - right=%s, - top=%s, - bottom=%s, -} -\usepackage{./sty/spineShared}┃", - generated_by ? " " ~ name_version_and_compiler : "", - generated_by ? " (generated " ~ time_output_generated ~ ")" : "", - doc_sty_info.stylesheet, - doc_sty_info.papersize, - doc_sty_info.orient, - doc_sty_info.margin_left, - doc_sty_info.margin_right, - doc_sty_info.margin_top, - doc_sty_info.margin_bottom, -); - return latex_sty; - } -} diff --git a/src/sisudoc/io_out/metadata.d b/src/sisudoc/io_out/metadata.d deleted file mode 100644 index 92b3bf9..0000000 --- a/src/sisudoc/io_out/metadata.d +++ /dev/null @@ -1,628 +0,0 @@ -/+ -- Name: SisuDoc Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 (continuously updated, current 2026) Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -module sisudoc.io_out.metadata; -// @safe: -template outputMetadata() { - void outputMetadata(T)(T doc_matters) { - string inline_search_form(M)( - M doc_matters, - ) { - string o; - string _form; - if (doc_matters.opt.action.html_link_search) { - o = format(q"┃ - <div class="flex-menu-option"> - <!-- SiSU Spine Search --> - <form action="%s" target="_top" method="POST" accept-charset="UTF-8" id="searchtxt"> - <font size="2">%s - <input type="text" name="sf" size="24" maxlength="255">%s - <input type="hidden" name="sml" value="1000"> - <input type="hidden" name="ec" value="on"> - <input type="hidden" name="url" value="on"> - <input type="hidden" name="rt" value="txt"> - <button type="submit" form="searchtxt" name="fn" value="%s"> • ⚏ </button> - </font></form> - <!-- SiSU Spine Search --> - </div> - <div class="flex-menu-option"> - <!-- SiSU Spine Search --> - <form action="%s" target="_top" method="POST" accept-charset="UTF-8" id="search"> - <font size="2"> - <input type="text" name="sf" size="24" maxlength="255">%s - <input type="hidden" name="sml" value="1000"> - <input type="hidden" name="ec" value="on"> - <input type="hidden" name="url" value="on"> - <button type="submit" form="search" name="fn" value="%s">• ፨</button> - <button type="submit" form="search">㏈ ፨</button> - </font></form> - <!-- SiSU Spine Search --> - </div>┃", - doc_matters.conf_make_meta.conf.w_srv_cgi_action, - (doc_matters.conf_make_meta.conf.w_srv_db_sqlite_filename.empty) - ? "" - : "\n <a href=\"" - ~ doc_matters.conf_make_meta.conf.w_srv_cgi_action - ~ "\">🔎 </a>", - (doc_matters.conf_make_meta.conf.w_srv_db_sqlite_filename.empty) - ? "" - : "\n <input type=\"hidden\" name=\"db\" value=\"" - ~ doc_matters.conf_make_meta.conf.w_srv_db_sqlite_filename - ~ "\">", - doc_matters.src.filename_base, - doc_matters.conf_make_meta.conf.w_srv_cgi_action, - (doc_matters.conf_make_meta.conf.w_srv_db_sqlite_filename.empty) - ? "" - : "\n <input type=\"hidden\" name=\"db\" value=\"" - ~ doc_matters.conf_make_meta.conf.w_srv_db_sqlite_filename - ~ "\">", - doc_matters.src.filename_base, - ); - } else { - o = ""; - } - return o; - } - import std.digest.crc; - import std.digest.sha; - import std.file; - import std.format; - import sisudoc.io_out; - mixin InternalMarkup; - char[] metadata_; -string theme_dark_0 = format(q"┃ - body { - color : #CCCCCC; - background : #000000; - background-color : #000000; - } - a:link { - color : #FFFFFF; - text-decoration : none; - } - a:visited { - color : #999999; - text-decoration : none; - } - a:hover { - color : #000000; - background-color : #555555; - } - a:hover img { - background-color : #000000; - } - a:active { - color : #888888; - text-decoration : underline; - } - a.lnkicon:link { - text-decoration : none; - } - a.lnkicon:visited { - text-decoration : none; - } - a.lnkicon:hover { - font-size : 160%%; - } - a:hover img { - background-color : #FFFFFF; - } - input { - color : #FFFFFF; - background-color : #777777; - } -┃"); -string theme_light_0 = format(q"┃ - body { - color : #000000; - background : #FFFFFF; - background-color : #FFFFFF; - } - a:link { - color : #003399; - text-decoration : none; - } - a:visited { - color : #003399; - text-decoration : none; - } - a:hover { - color : #000000; - background-color : #f9f9aa; - } - a:hover img { - background-color : #FFFFFF; - } - a:active { - color : #003399; - text-decoration : underline; - } - a.lnkicon:link { - text-decoration : none; - } - a.lnkicon:visited { - text-decoration : none; - } - a.lnkicon:hover { - font-size : 160%%; - } - a:hover img { - background-color : #FFFFFF; - } - input { - color : #000000; - background-color : #FFFFFF; - } -┃"); -string theme_dark_1 = format(q"┃ - h1 { - color : #FFFFFF; - background : #000000; - } - p.letter { - color : #FFFFFF; - background : #333333; - } -┃"); -string theme_light_1 = format(q"┃ - h1 { - color : #FFFFFF; - background : #1A3A7A; - } - p.letter { - color : #FFFFFF; - background : #1A3A7A; - } -┃"); - metadata_ ~= format(q"┃<!DOCTYPE html> -<html> -<head> -<meta charset="utf-8"> -<title>⌘ Curated metadata - Topics</title> -<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -<meta name="dc.title" content= "metadata curate, Authors & Topics - information Structuring Universe, Structured information Serialised Units" /> -<meta name="dc.subject" content= "document structuring, ebook, publishing, PDF, LaTeX, XML, ODF, SQL, postgresql, sqlite, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, granular search, digital library" /> -<meta name="generator" content="spine" /> -<link rel="generator" href="https://sisudoc.org" /> -<link href="./css/curate.css" rel="stylesheet"> -<style TYPE="text/css"> -/* spine curate css default stylesheet */%s - .norm, .bold { - line-height : 150%%; - margin-left : 1em; - margin-right : 2em; - margin-top : 10px; - margin-bottom : 0px; - text-indent : 0mm; - } - p, h0, h1, h2, h3, h4, h5, h6, h7 { - display : block; - font-family : verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman; - font-size : 100%%; - font-weight : normal; - line-height : 150%%; - /* text-align : justify; */ - margin-left : 1em; - text-indent : 0mm; - margin-top : 2px; - margin-bottom : 2px; - margin-right : 6px; - text-align : left; - } - h0, h1, h2, h3, h4, h5, h6, h7 { text-shadow: .2em .2em .3em #999999; } - h1 { - font-size : 120%%; - font-weight : bold; - color : #FFFFFF; - background : #000088; - margin-left : 0em; - } - p.work { - font-size : 80%%; - margin-left : 5em; - margin-top : 0px; - margin-bottom : 0px; - margin-right : 6px; - text-align : left; - } - p.author { - font-size : 100%%; - margin-left : 2em; - margin-top : 0px; - margin-bottom : 0px; - margin-right : 6px; - text-align : left; - } - p.publication { - font-size : 80%%; - margin-left : 4em; - margin-top : 0px; - margin-bottom : 0px; - margin-right : 6px; - text-align : left; - } - p.letter { - font-weight : bold; - font-size : 60%%; - margin-left : 1em; - margin-top : 0px; - margin-bottom : 0px; - margin-right : 6px; - text-align : left; - } - p.icons, .icons_center { - font-size : 100%%; - margin-top : 0px; - margin-bottom : 0px; - margin-right : 6px; - } - p.icons { - text-align : left; - } - p.lev0 { - font-size : 120%%; - margin-left : 1em; - } - p.lev1 { - font-size : 110%%; - margin-left : 2em; - } - p.lev2 { - font-size : 100%%; - margin-left : 3em; - } - p.lev3 { - font-size : 90%%; - margin-left : 4em; - } - p.lev4 { - font-size : 80%%; - margin-left : 5em; - } - p.lev5 { - font-size : 80%%; - margin-left : 6em; - }%s - /* flex */ - .flex-menu-bar { - display : -webkit-flex; - display : flex; - -webkit-flex-wrap : wrap; - -webkit-align-items : center; - align-items : center; - width : 100%%; - margin-left : 0%%; - margin-right : 2%%; - background-color : inherited; - } - .flex-menu-option { - background-color : inherited; - margin-right : 4px; - } - .flex-list { - display : -webkit-flex; - display : flex; - -webkit-align-items : center; - display : block; - align-items : center; - width : 100%%; - background-color : inherited; - } - .flex-list-item { - background-color : inherited; - margin : 4px; - } -</style> -<link rel="shortcut icon" href="../_sisu/image/rb7.ico" /> -</head> -┃", - doc_matters.opt.action.css_theme_default ? theme_light_0 : theme_dark_0, - doc_matters.opt.action.css_theme_default ? theme_light_1 : theme_dark_1, -) ~ "\n"; - void metadata_write_output(M)(M doc_matters, char[] 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.write(o); - } - } - if (!exists(pth_html.base ~ "/index.html")) { - import sisudoc.io_out.html_snippet; - mixin htmlSnippet; - auto f = File(pth_html.base ~"/index.html", "w"); - f.writeln(format_html_blank_page_guide_home( - "../../css/html_scroll.css", - (doc_matters.opt.action.webserver_url_doc_root.length > 0) - ? doc_matters.opt.action.webserver_url_doc_root - : doc_matters.conf_make_meta.conf.w_srv_data_root_url, - "../../index.html", - )); - } - } catch (ErrnoException ex) { - // Handle error - } - if (doc_matters.opt.action.vox_gt_1) { writeln(" ", pth_html.fn_scroll("metadata." ~ doc_matters.src.filename)); } - } - static auto mkup = InlineMarkup(); - import sisudoc.io_out.html_snippet; - mixin htmlSnippet; - if (doc_matters.opt.action.debug_do) { - writeln(doc_matters.src.filename_base); - writeln("Title: ", doc_matters.conf_make_meta.meta.title_full); - writeln(" Author: ", doc_matters.conf_make_meta.meta.creator_author); - writeln(" Published: ", doc_matters.conf_make_meta.meta.date_published); - writeln(" Copyright: ", doc_matters.conf_make_meta.meta.rights_copyright); - writeln(" License: ", special_characters_text(doc_matters.conf_make_meta.meta.rights_license)); - if (doc_matters.conf_make_meta.meta.classify_topic_register_arr.length > 0) { - foreach (topic; doc_matters.conf_make_meta.meta.classify_topic_register_arr.sort!("toUpper(a) < toUpper(b)", SwapStrategy.unstable)) { - string[] subject_tree = topic.split(mkup.sep); - if (subject_tree.length > 0) { writeln(" ", subject_tree[0]); } - if (subject_tree.length > 1) { writeln(" ", subject_tree[1]); } - if (subject_tree.length > 2) { writeln(" ", subject_tree[2]); } - if (subject_tree.length > 3) { writeln(" ", subject_tree[3]); } - if (subject_tree.length > 4) { writeln(" ", subject_tree[4]); } - } - } - } - auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language); - auto pth_epub = spinePathsEPUB!()(doc_matters.output_path, doc_matters.src.language); - auto pth_text = spinePathsText!()(doc_matters); - auto pth_pdf = spinePathsPDF!()(doc_matters); - auto pth_pod = spinePathsPods!()(doc_matters); - metadata_ ~= format(q"┃<body lang="en" xml:lang="en"> - <a name="top" id="top"></a> - <a name="up" id="up"></a> - <a name="start" id="start"></a> - ┃"); - metadata_ ~= "<div class=\"flex-menu-bar\"><div class=\"flex-menu-option\">"; - if (doc_matters.opt.action.html_link_curate) { - metadata_ ~= format(q"┃<p class="icons">[<a href="%s" class="lnkicon"> <b>⟰</b> HOME </a> | <a href="../../index.html" class="lnkicon"> ≅ Collection </a>] [ - <a href="../../authors.html" class="lnkicon"> 🖋 Authors </a> | - <a href="../../topics.html" class="lnkicon"> ⌘ Topics </a>]</p> - ┃", - (doc_matters.opt.action.webserver_url_doc_root.length > 0) - ? doc_matters.opt.action.webserver_url_doc_root - : doc_matters.conf_make_meta.conf.w_srv_data_root_url - , // HOME index.html equivalent _cfg.www_url_doc_root, - ); - } else { - metadata_ ~= format(q"┃<p class="icons">[<a href="../../../index.html" class="lnkicon"> ≅ <b>HOME</b> </a> <a href="../../index.html" class="lnkicon"> ≅ Collection </a>] - ┃"); - } - metadata_ ~= "</div>" ~ inline_search_form(doc_matters) ~ "</div><hr />"; - if (!(doc_matters.conf_make_meta.meta.title_full.empty)) { - metadata_ ~= "<p class=\"lev0\">Title: <b><a href=\"" ~ doc_matters.src.filename_base ~ "/toc.html\">" ~ doc_matters.conf_make_meta.meta.title_full ~ "</a></b></p>"; - } else if (doc_matters.opt.action.debug_do || doc_matters.opt.action.vox_gt_3) { - writeln("ERROR no Title information provided in document header ", doc_matters.src.filename_base); - } - if (!(doc_matters.conf_make_meta.meta.creator_author.empty)) { - if (doc_matters.opt.action.html_link_curate) { - metadata_ ~= "<p class=\"lev1\">Author: <b><a href=\"../../authors.html#" ~ doc_matters.conf_make_meta.meta.creator_author_surname.translate([' ' : "_"]) ~ "\">" - ~ doc_matters.conf_make_meta.meta.creator_author ~ "</a></b></p>"; - } else { - metadata_ ~= "<p class=\"lev1\">Author: <b>" - ~ doc_matters.conf_make_meta.meta.creator_author ~ "</b></p>"; - } - } else if (doc_matters.opt.action.debug_do || doc_matters.opt.action.vox_gt_3) { - writeln("ERROR no Author information provided in document header ", doc_matters.src.filename_base); - } - metadata_ ~= "<p class=\"lev1\">Published: " ~ doc_matters.conf_make_meta.meta.date_published ~ "</p>"; - if (!(doc_matters.conf_make_meta.meta.rights_copyright.empty)) { - metadata_ ~= "<p class=\"lev1\">Copyright: " ~ special_characters_text(doc_matters.conf_make_meta.meta.rights_copyright) ~ "</p>"; - } else if (doc_matters.opt.action.debug_do || doc_matters.opt.action.vox_gt_3) { - writeln("WARNING no Copyright information provided in document header ", doc_matters.src.filename_base); - } - if (!(doc_matters.conf_make_meta.meta.rights_license.empty)) { - metadata_ ~= "<p class=\"lev1\">License: " ~ special_characters_text(doc_matters.conf_make_meta.meta.rights_license) ~ "</p>"; - } else if (doc_matters.opt.action.debug_do || doc_matters.opt.action.vox_gt_3) { - writeln("WARNING no License information provided in document header ", doc_matters.src.filename_base); - } - if (!(doc_matters.conf_make_meta.meta.notes_summary.empty)) { - metadata_ ~= "<hr /><p class=\"lev0\">Summary:</p><p class=\"lev1\">" ~ special_characters_text(doc_matters.conf_make_meta.meta.notes_summary) ~ "</p>"; - } else if (doc_matters.opt.action.debug_do) { - writeln("WARNING no summary of text provided in document header ", doc_matters.src.filename_base); - } - metadata_ ~= "<p class=\"lev1\">● outputs: [ html: <a href=\"" ~ doc_matters.src.filename_base ~ ".html\" class=\"lnkicon\">" - ~ " ▤ scroll </a> " - ~ "|<a href=\"" ~ doc_matters.src.filename_base ~ "/toc.html\" class=\"lnkicon\">" - ~ " ※ seg </a>] " - ~ "[<a href=\"../../" ~ pth_epub.internal_base ~ "/" ~ doc_matters.src.filename_base ~ "." ~ doc_matters.src.language ~ ".epub\" class=\"lnkicon\">" - ~ " ◆ epub </a>] "; - if ((doc_matters.opt.action.html_link_pdf) || (doc_matters.opt.action.html_link_pdf_a4)) { - metadata_ ~= "[ pdf: <a href=\"../../pdf/" - ~ doc_matters.src.filename_base - ~ "." ~ doc_matters.src.language ~ ".a4.portrait.pdf\" class=\"lnkicon\">" - ~ " □ a4 </a> " - ~ "|<a href=\"../../pdf/" - ~ doc_matters.src.filename_base - ~ "." ~ doc_matters.src.language ~ ".letter.portrait.pdf\" class=\"lnkicon\">" - ~ " □ U.S. letter </a>] "; - } else if (doc_matters.opt.action.html_link_pdf_a4) { - metadata_ ~= "[<a href=\"../../pdf/" - ~ doc_matters.src.filename_base - ~ "." ~ doc_matters.src.language ~ ".a4.portrait.pdf\" class=\"lnkicon\">" - ~ " □ pdf (a4) </a>] "; - } else if (doc_matters.opt.action.html_link_pdf_letter) { - metadata_ ~= "[<a href=\"../../pdf/" - ~ doc_matters.src.filename_base - ~ "." ~ doc_matters.src.language ~ ".letter.portrait.pdf\" class=\"lnkicon\">" - ~ " □ pdf (U.S. letter) </a>] "; - } - if (doc_matters.opt.action.html_link_text) { - metadata_ ~= " [<a href=\"../" ~ "text/" ~ doc_matters.src.filename_base ~ "." ~ doc_matters.src.language ~ ".txt\" class=\"lnkicon\">" - ~ " □ txt </a>] "; - } - metadata_ ~= "</p>"; - if (doc_matters.opt.action.html_link_markup_source) { - metadata_ ~= "<hr /><p class=\"lev1\">source: " ~ doc_matters.src.filename_base ~ "</p>"; - metadata_ ~= "<p class=\"lev1\">● markup source: the pod [<a href=\"../../" ~ pth_pod.internal_base ~ "/" ~ doc_matters.src.filename_base ~ ".zip\" class=\"lnkicon\">" - ~ " 🫛 zipped </a>| " - ~ "<a href=\"../../" ~ pth_pod.internal_base ~ "/" ~ doc_matters.src.filename_base ~ "/\" class=\"lnkicon\">" - ~ " 🫛 tree </a>] "; - metadata_ ~= "<p class=\"lev1\">● source digests:" - ~ " [ <a href=\"../../" ~ pth_pod.internal_base ~ "/" ~ doc_matters.src.filename_base ~ ".digests.txt\" class=\"lnkizipcon\">" - ~ " # digests </a>]</p>"; - auto pths_pod = spinePathsPods!()(doc_matters); - auto fn_pod = pths_pod.pod_filename(doc_matters.src.filename).zpod; - if (doc_matters.opt.action.pod) { - try { // get sha digest for pod - metadata_ ~= "<p class=\"lev2\">"; - auto data = (cast(byte[]) (fn_pod).read); // prevents code from being safe - metadata_ ~= "<tt>" ~ data.sha256Of.toHexString ~ "::" ~ data.length.to!string ~ "</tt> - " ~ doc_matters.src.filename_base ~ ".zip"; - metadata_ ~= "</p>"; - } catch (Exception ex) { - writeln("WARNING, source doc_matters.src.filename_base not found: ", doc_matters.src.filename_base, ".zip\n ", fn_pod); - } - } - } - if (doc_matters.conf_make_meta.meta.classify_topic_register_arr.length > 0) { - metadata_ ~= "<hr /><p class=\"lev0\">Topics:</p>"; - string[] _top = ["", "", "", "", ""]; - foreach (topic; doc_matters.conf_make_meta.meta.classify_topic_register_arr.sort!("toUpper(a) < toUpper(b)", SwapStrategy.unstable)) { - string[] subject_tree = topic.split(mkup.sep); - if (subject_tree.length > 0) { - if (subject_tree[0] != _top[0]) { - _top[0] = subject_tree[0]; - if (doc_matters.opt.action.html_link_curate) { - metadata_ ~= - "<p class=\"lev1\"><a href=\"../../topics.html#" - ~ subject_tree[0].translate([' ' : "_"]) ~ "\">" - ~ subject_tree[0] - ~ "</a></p>"; - } else { - metadata_ ~= - "<p class=\"lev1\">" ~ subject_tree[0] ~ "</p>"; - } - } - if (subject_tree.length > 1) { - if (subject_tree[1] != _top[1]) { - _top[1] = subject_tree[1]; - _top[2] = ""; _top[3] = ""; _top[4] = ""; - if (doc_matters.opt.action.html_link_curate) { - metadata_ ~= - "<p class=\"lev2\"><a href=\"../../topics.html#" - ~ subject_tree[0].translate([' ' : "_"]) ~ "." - ~ subject_tree[1].translate([' ' : "_"]) ~ "\">" - ~ subject_tree[1] - ~ "</a></p>"; - } else { - metadata_ ~= - "<p class=\"lev2\">" ~ subject_tree[1] ~ "</p>"; - } - } - if (subject_tree.length > 2) { - if (subject_tree[2] != _top[2]) { - _top[2] = subject_tree[2]; - _top[3] = ""; _top[4] = ""; - if (doc_matters.opt.action.html_link_curate) { - metadata_ ~= - "<p class=\"lev3\"><a href=\"../../topics.html#" - ~ subject_tree[0].translate([' ' : "_"]) ~ "." - ~ subject_tree[1].translate([' ' : "_"]) ~ "." - ~ subject_tree[2].translate([' ' : "_"]) ~ "\">" - ~ subject_tree[2] - ~ "</a></p>"; - } else { - metadata_ ~= - "<p class=\"lev3\">" ~ subject_tree[2] ~ "</p>"; - } - } - if (subject_tree.length > 3) { - if (subject_tree[3] != _top[3]) { - _top[3] = subject_tree[3]; - _top[4] = ""; - if (doc_matters.opt.action.html_link_curate) { - metadata_ ~= - "<p class=\"lev4\"><a href=\"../../topics.html#" - ~ subject_tree[0].translate([' ' : "_"]) ~ "." - ~ subject_tree[1].translate([' ' : "_"]) ~ "." - ~ subject_tree[2].translate([' ' : "_"]) ~ "." - ~ subject_tree[3].translate([' ' : "_"]) ~ "\">" - ~ subject_tree[3] - ~ "</a></p>"; - } else { - metadata_ ~= - "<p class=\"lev4\">" ~ subject_tree[3] ~ "</p>"; - } - } - if (subject_tree.length > 4) { - if (subject_tree[4] != _top[4]) { - _top[4] = subject_tree[4]; - if (doc_matters.opt.action.html_link_curate) { - metadata_ ~= - "<p class=\"lev5\"><a href=\"../../topics.html#" - ~ subject_tree[0].translate([' ' : "_"]) ~ "." - ~ subject_tree[1].translate([' ' : "_"]) ~ "." - ~ subject_tree[2].translate([' ' : "_"]) ~ "." - ~ subject_tree[3].translate([' ' : "_"]) ~ "." - ~ subject_tree[4].translate([' ' : "_"]) ~ "\">" - ~ subject_tree[4] - ~ "</a></p>"; - } else { - metadata_ ~= - "<p class=\"lev5\">" ~ subject_tree[4] ~ "</p>"; - } - } - } - } - } - } - } - } - } else if (doc_matters.opt.action.debug_do) { - writeln("WARNING no topic_register classification of text provided in document header ", doc_matters.src.filename_base); - } - metadata_write_output(doc_matters, metadata_); - } -} diff --git a/src/sisudoc/io_out/odt.d b/src/sisudoc/io_out/odt.d deleted file mode 100644 index 7a85bfb..0000000 --- a/src/sisudoc/io_out/odt.d +++ /dev/null @@ -1,2153 +0,0 @@ -/+ -- Name: SisuDoc Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 (continuously updated, current 2026) Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -module sisudoc.io_out.odt; -@safe: -template formatODT() { - import sisudoc.io_out; - import sisudoc.io_out.rgx; - import sisudoc.io_out.rgx_xhtml; - import std.file; - import std.outbuffer; - import std.uri; - import std.zip; - import std.conv : to; - import sisudoc.io_out.create_zip_file; - import sisudoc.io_out.xmls; - import sisudoc.io_out.xmls_css; - mixin spineRgxOut; - mixin spineRgxXHTML; - struct formatODT { - static auto rgx = RgxO(); - static auto rgx_xhtml = RgxXHTML(); - string _tags(O)(const O obj) { - string _tags = ""; - if (obj.tags.anchor_tags.length > 0) { - foreach (tag_; obj.tags.anchor_tags) { - if (tag_.length > 0) { - _tags ~= format(q"┃<text:span text:style-name="Span_subscript"> - <text:bookmark-start text:name="%s"/> - <text:bookmark-end text:name="%s"/> - </text:span> - ┃", - _special_characters(tag_, obj), - _special_characters(tag_, obj), - ); - } - } - } - return _tags; - } - string _xhtml_anchor_tags(O)(O obj) { - const(string[]) anchor_tags = obj.tags.anchor_tags; - string tags=""; - if (anchor_tags.length > 0) { - foreach (tag; anchor_tags) { - if (!(tag.empty)) { - tags ~= "<a name=\"" ~ tag ~ "\"></a>"; - } - } - } - return tags; - } - string obj_num(O)(const O obj) { // TODO - string _on; - _on = (obj.metainfo.object_number.empty) - ? "" - : (format(q"┃ - <text:span text:style-name="Span_subscript">「%s」</text:span>┃", - obj.metainfo.object_number, - )); - return _on; - } - string _footnotes()(string _txt) { - static auto rgx = RgxO(); - static auto rgx_xhtml = RgxXHTML(); - _txt = _txt.replaceAll( - rgx.inline_notes_al_regular_number_note, - format(q"┃<text:note text:id="ftn%s" text:note-class="footnote"> - <text:note-citation> - %s - </text:note-citation> - <text:note-body> - <text:p text:style-name="Footnote"> - %s - </text:p> - </text:note-body> - </text:note>┃", - "$1", "$1", "$2", - ) - ); - return _txt; - } - string _bullet(O)(const O obj) { - string _b = ""; - if (obj.attrib.bullet) { - _b = format(q"┃● ┃",); - } - return _b; - } - string _indent(O)(string _txt, const O obj) { // TODO - // if (obj.attrib.indent_base > 0 || - // obj.attrib.indent_hang > 0 - // ) { - if (obj.metainfo.is_a == "toc") { - _txt = format(q"┃ - %s<text:h text:style-name="H_%s" text:outline-level="%s"> - %s%s%s - </text:h>┃", - (obj.attrib.indent_base < 4) - ? "<text:p text:style-name=\"Standard\"/>\n " : "", - obj.attrib.indent_base, - obj.attrib.indent_base, - _tags(obj), - _txt, - obj_num(obj), - ); - } else if (!empty(obj.metainfo.object_number)) { - if (obj.attrib.indent_base == 0 && obj.attrib.indent_hang == 0) { - _txt = format(q"┃ - <text:p text:style-name="P_normal">%s - <text:span text:style-name="Span_subscript"> - <text:bookmark-start text:name="%s"/> - <text:bookmark-end text:name="%s"/> - </text:span> - %s%s%s - </text:p>┃", - _bullet(obj), - obj.metainfo.object_number, - obj.metainfo.object_number, - _tags(obj), - _txt, - obj_num(obj), - ); - } else if (obj.attrib.indent_base == obj.attrib.indent_hang) { - _txt = format(q"┃ - <text:p text:style-name="P_indent_%s">%s - <text:span text:style-name="Span_subscript"> - <text:bookmark-start text:name="%s"/> - <text:bookmark-end text:name="%s"/> - </text:span> - %s%s%s - </text:p>┃", - obj.attrib.indent_base, - _bullet(obj), - obj.metainfo.object_number, - obj.metainfo.object_number, - _tags(obj), - _txt, - obj_num(obj), - ); - } else { - _txt = format(q"┃ - <text:p text:style-name="P_h%s_i%s">%s - <text:span text:style-name="Span_subscript"> - <text:bookmark-start text:name="%s"/> - <text:bookmark-end text:name="%s"/> - </text:span> - %s%s%s - </text:p>┃", - obj.attrib.indent_base, - obj.attrib.indent_hang, - _bullet(obj), - obj.metainfo.object_number, - obj.metainfo.object_number, - _tags(obj), - _txt, - obj_num(obj), - ); - } - } else { - if (obj.attrib.indent_base == 0 && obj.attrib.indent_hang == 0) { /+ can omit and would explicitly set indent base and hang as 0 each below +/ - _txt = format(q"┃ - <text:p text:style-name="P_normal">%s - %s%s%s - </text:p>┃", - _bullet(obj), - _tags(obj), - _txt, - obj_num(obj), - ); - } else if (obj.attrib.indent_base == obj.attrib.indent_hang) { - _txt = format(q"┃ - <text:p text:style-name="P_indent_%s">%s - %s%s%s - </text:p>┃", - obj.attrib.indent_base, - _bullet(obj), - _tags(obj), - _txt, - obj_num(obj), - ); - } else { - _txt = format(q"┃ - <text:p text:style-name="P_h%s_i%s">%s - %s%s%s - </text:p>┃", - _bullet(obj), - obj.attrib.indent_base, - obj.attrib.indent_hang, - _tags(obj), - _txt, - obj_num(obj), - ); - } - } - return _txt; - } - string _block_type_delimiters(O)(string[] _block_lines, const O obj) { // TODO - string _block = ""; - foreach (i, _line; _block_lines) { - _line = _footnotes(_line); - if (i == 0) { - _block ~= format(q"┃ - <text:p text:style-name="P_group">%s - <text:span text:style-name="Span_subscript"> - <text:bookmark-start text:name="%s"/> - <text:bookmark-end text:name="%s"/> - </text:span> - %s - </text:p>┃", - _bullet(obj), - obj.metainfo.object_number, - obj.metainfo.object_number, - // _tags(obj), - _line, - ); - } else { - _block ~= format(q"┃ - <text:p text:style-name="P_group">%s</text:p>┃", - _line); - } - } - _block ~= format(q"┃ - <text:p text:style-name="P_group"> - <text:span text:style-name="Span_subscript">「%s」</text:span> - </text:p> - <text:p text:style-name="Standard"/>┃", - obj_num(obj)); - return _block; - } - string _special_characters(O)(string _txt, const O obj) { - _txt = _txt - .replaceAll(rgx_xhtml.ampersand, "&") - .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, "<del>$1</del>") - .replaceAll(rgx.inline_insert, "<ins>$1</ins>") - .replaceAll(rgx.inline_cite, "<cite>$1</cite>") - .replaceAll(rgx.inline_emphasis, format(q"┃<text:span text:style-name="Span_bold">%s</text:span>┃", "$1")) - .replaceAll(rgx.inline_bold, format(q"┃<text:span text:style-name="Span_bold">%s</text:span>┃", "$1")) - .replaceAll(rgx.inline_italics, format(q"┃<text:span text:style-name="Span_italic">%s</text:span>┃", "$1")) - .replaceAll(rgx.inline_underscore, format(q"┃<text:span text:style-name="Span_underscore">%s</text:span>┃", "$1")) - .replaceAll(rgx.inline_superscript, format(q"┃<text:span text:style-name="Span_superscript">%s</text:span>┃","$1")) - .replaceAll(rgx.inline_subscript, format(q"┃<text:span text:style-name="Span_subscript">%s</text:span>┃", "$1")) - .replaceAll(rgx.inline_mono, format(q"┃<text:span text:style-name="Span_monospace">%s</text:span>┃", "$1")); - return _txt; - } - auto _obj_num(O)(O obj) { // NOT USED YET - struct objNum { - string reference() { - return format(q"┃<text:span text:style-name="Span_subscript"> - <text:bookmark-start text:name="%s"/> - <text:bookmark-end text:name="%s"/> - </text:span>┃", - obj.object_number, - obj.object_number, - ); - } - string display() { - return format(q"┃<text:span text:style-name="Span_subscript"> - %s%s%s - </text:span>┃", - on_o, - obj.object_number, - on_c, - ); - } - } - return objNum(); - } - string _break_page()() { - return format(q"┃ - <text:p text:style-name="P_normal_page_new"/> - ┃", - ); - } - string _empty_line_break(O)(string _txt, const O obj) { - if (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block") { - _txt = _txt - .replaceAll(rgx.br_empty_line, "<br />"); - } - return _txt; - } - string _links(O)(string _txt, const O obj) { - if (obj.metainfo.is_a != "code") { - if (obj.metainfo.is_a == "toc") { - _txt = replaceAll!(m => - m[1] ~ "┤" - ~ (replaceAll!(n => - n["type"] ~ n["path"] ~ (n["file"].encodeComponent) - )((obj.stow.link[m["num"].to!ulong]).to!string, rgx.uri_identify_components)) - ~ "├" - )(_txt, rgx.inline_link_number_only) - .replaceAll(rgx.inline_link, - format(q"┃<text:bookmark-ref text:reference-format="text" text:ref-name="%s">%s</text:bookmark-ref>┃", - _special_characters("$3", obj), - _special_characters("$1", obj) - )); - } else { - _txt = replaceAll!(m => - m[1] ~ "┤" - ~ (replaceAll!(n => - n["type"] ~ n["path"] ~ (n["file"].encodeComponent) - )((obj.stow.link[m["num"].to!ulong]).to!string, rgx.uri_identify_components)) - ~ "├" - )(_txt, rgx.inline_link_number_only) - .replaceAll(rgx.inline_link, - format(q"┃<text:a xl:type="simple" xl:href="%s">%s</text:a>┃", - _special_characters("$2", obj), - _special_characters("$1", obj) - )); - } - } - debug(links) { - if (obj.text.match(rgx.inline_link_number) - && _txt.match(rgx.inline_link_number_only) - ) { - writeln(">> ", _txt); - writeln("is_a: ", obj.metainfo.is_a); - } - } - return _txt; - } - string _images(O)(string _txt, const O obj) { - if (_txt.match(rgx.inline_image)) { - _txt = _txt - .replaceAll(rgx.inline_image, - ("$1<draw:frame draw:style-name=\"fr1\" draw:name=\"graphics12\" text:anchor-type=\"as-char\" svg:width=\"$4px\" svg:height=\"$5px\" draw:z-index=\"2\"><draw:image xl:href=\"Pictures/$3\" xl:type=\"simple\" xl:show=\"embed\" xl:actuate=\"onLoad\"/></draw:frame> $6")) - .replaceAll( - rgx.inline_link_empty, - ("$1")); - } - return _txt; - } - string markup(O)(const O obj) { - /+ markup TODO +/ - string _txt = obj.text; - _txt = _special_characters(_txt, obj); // TODO & why both obj & obj.text, consider also in output_xmls.org - if (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block") { - _txt = replaceAll!(m => _preserve_white_spaces(m[1], obj))(_txt, rgx.spaces_keep); - } // check that this does what you want, keep: leading spaces (indent) & more than single spaces within text - // _txt = _preserve_white_spaces(_txt, obj); // (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block") - _txt = _font_face(_txt); - _txt = _images(_txt, obj); // (obj.metainfo.is_a != "code") - _txt = _links(_txt, obj); // (obj.metainfo.is_a != "code") - _txt = _empty_line_break(_txt, obj); // (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block") - return _txt; - } - string heading(O,M)( - const O obj, - const M doc_matters, - ) { - assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter"); - assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb"); - assert(obj.metainfo.is_of_type == "para"); - assert(obj.metainfo.is_a == "heading"); - string _o_txt_odt = markup(obj); - if (obj.metainfo.dummy_heading - && (obj.metainfo.is_a == "toc" || obj.metainfo.is_a == "heading")) { - _o_txt_odt = ""; - } else if (obj.metainfo.is_a == "toc") { - _o_txt_odt = format(q"┃%s<text:h text:style-name="H_%s" text:outline-level="%s"> - %s%s%s - </text:h>┃", - _break_page, - obj.metainfo.heading_lev_markup, - obj.metainfo.heading_lev_markup, - _tags(obj), - _o_txt_odt, - obj_num(obj), - ); - } else { - _o_txt_odt = _footnotes(_o_txt_odt); - _o_txt_odt = format(q"┃%s<text:h text:style-name="H_%s" text:outline-level="%s"> - <text:span text:style-name="Span_subscript"> - <text:bookmark-start text:name="%s"/> - <text:bookmark-end text:name="%s"/> - </text:span> - %s%s%s - </text:h>┃", - _break_page, - obj.metainfo.heading_lev_markup, - obj.metainfo.heading_lev_markup, - obj.metainfo.object_number, - obj.metainfo.object_number, - _tags(obj), - _o_txt_odt, - obj_num(obj), - ); - } - return _o_txt_odt; - } - string para(O,M)( - const O obj, - const M doc_matters, - ) { - assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter"); - assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb"); - assert(obj.metainfo.is_of_type == "para"); - assert(obj.metainfo.is_a == "para" || "toc" || "endnote" || "glossary" || "bibliography" || "bookindex" || "blurb"); - string _o_txt_odt; - if (obj.metainfo.dummy_heading - && (obj.metainfo.is_a == "toc" || obj.metainfo.is_a == "heading")) { - _o_txt_odt = ""; - } else { - _o_txt_odt = markup(obj); - _o_txt_odt = _footnotes(_o_txt_odt); - _o_txt_odt = _indent(_o_txt_odt, obj); // final setting? - } - return _o_txt_odt; - } - string quote(O,M)( - const O obj, - const M doc_matters, - ) { - assert(obj.metainfo.is_of_part == "body"); - assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); - assert(obj.metainfo.is_of_type == "block"); - assert(obj.metainfo.is_a == "quote"); - string _o_txt_odt = markup(obj); - _o_txt_odt = _footnotes(_o_txt_odt); // decide - return _o_txt_odt; - } - string group(O,M)( - const O obj, - const M doc_matters, - ) { - assert(obj.metainfo.is_of_part == "body"); - assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); - assert(obj.metainfo.is_of_type == "block"); - assert(obj.metainfo.is_a == "group"); - string _o_txt_odt = markup(obj); - /+ TODO - - split lines - - only double newlines (paragraph delimiter), (not line breaks, single new lines) - - no hard space indentation - +/ - string[] _block_lines = (_o_txt_odt).split(rgx.br_linebreaks_newlines); - _o_txt_odt = _block_type_delimiters(_block_lines, obj); - return _o_txt_odt; - } - string block(O,M)( - const O obj, - const M doc_matters, - ) { - assert(obj.metainfo.is_of_part == "body"); - assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); - assert(obj.metainfo.is_of_type == "block"); - assert(obj.metainfo.is_a == "block"); - string _o_txt_odt = markup(obj); - string[] _block_lines = (_o_txt_odt).split(rgx.br_linebreaks_newlines); - _o_txt_odt = _block_type_delimiters(_block_lines, obj); - return _o_txt_odt; - } - string verse(O,M)( - const O obj, - const M doc_matters, - ) { - assert(obj.metainfo.is_of_part == "body"); - assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); - assert(obj.metainfo.is_of_type == "block"); - assert(obj.metainfo.is_a == "verse"); - string _o_txt_odt = markup(obj); - string[] _block_lines = (_o_txt_odt).split(rgx.br_linebreaks_newlines); - _o_txt_odt = _block_type_delimiters(_block_lines, obj); - return _o_txt_odt; - } - string code(O,M)( - const O obj, - const M doc_matters, - ) { - assert(obj.metainfo.is_of_part == "body"); - assert(obj.metainfo.is_of_section == "body"); - assert(obj.metainfo.is_of_type == "block"); - assert(obj.metainfo.is_a == "code"); - string _o_txt_odt = markup(obj); - /+ TODO - - split lines - - each line including empty lines - - hard space indentation - - "^[ ]"   - - count number only at beginning of line and replace each - +/ - string[] _block_lines = (_o_txt_odt).split(rgx.br_linebreaks_newlines); - string _block = ""; - foreach (i, _line; _block_lines) { - if (i == 1) { - _block ~= format(q"┃ - <text:p text:style-name="P_code"> - <text:span text:style-name="Span_subscript"> - <text:bookmark-start text:name="%s"/> - <text:bookmark-end text:name="%s"/> - </text:span> - %s - </text:p>┃", - obj.metainfo.object_number, - obj.metainfo.object_number, - _line, - ); - } else { - _block ~= format(q"┃ - <text:p text:style-name="P_code">%s</text:p>┃", - _line); - } - } - _block ~= format(q"┃ - <text:p text:style-name="P_group"> - <text:span text:style-name="Span_subscript">「%s」</text:span> - </text:p> - <text:p text:style-name="Standard"/>┃", - obj_num(obj)); - _o_txt_odt = _block; - return _o_txt_odt; - } - Tuple!(string, string) tablarize(O)( - const O obj, - string _txt, - ) { - string[] _table_rows = (_txt).split(rgx.table_delimiter_row); - string[] _table_cols; - string _table; - string _tablenote; - foreach(row_idx, row; _table_rows) { - _table_cols = row.split(rgx.table_delimiter_col); - _table ~= "<table:table-row>"; - foreach(col_idx, cell; _table_cols) { - if ((_table_cols.length == 1) - && (_table_rows.length <= row_idx+2)) { // check row_idx+2 (rather than == ++row_idx) - _tablenote ~= cell; - } else { - _table ~= format(q"┃<table:table-cell office:value-type="string"> - <text:p text:style-name="%s"> - %s - </text:p> - </table:table-cell>┃", - (row_idx == 0 && obj.table.heading) ? "Table_Heading" : "P_table_cell", - cell, - ); - } - } - _table ~= "</table:table-row>"; - } - Tuple!(string, string) t = tuple( - _table, - _tablenote, - ); - return t; - } - int _table_number = 0; - string table(O,M)( - const O obj, - const M doc_matters, - ) { - assert(obj.metainfo.is_of_part == "body"); - assert(obj.metainfo.is_of_section == "body"); - assert(obj.metainfo.is_of_type == "block"); - assert(obj.metainfo.is_a == "table"); - string _o_txt_odt = markup(obj); - Tuple!(string, string) t = tablarize(obj, _o_txt_odt); - string _note = t[1]; - _o_txt_odt = format(q"┃ - <table:table table:name="Table%s" table:style-name="Table1"> - <text:span text:style-name="Span_subscript"> - <text:bookmark-start text:name="%s"/> - <text:bookmark-end text:name="%s"/> - </text:span> - <table:table-column table:style-name="Table1.D" table:number-columns-repeated="%s"/> - %s - </table:table> - <text:p text:style-name="P_group"> - <text:span text:style-name="Span_subscript">「%s」</text:span> - </text:p>┃", - _table_number++, - obj.metainfo.object_number, - obj.metainfo.object_number, - obj.table.number_of_columns, - t[0], - obj.metainfo.object_number, - // _note, - ); - return _o_txt_odt; - } - } -} -template outputODT() { - import sisudoc.io_out; - import sisudoc.io_out.rgx; - import sisudoc.io_out.rgx_xhtml; - import std.file; - import std.outbuffer; - import std.uri; - import std.zip; - import std.conv : to; - import sisudoc.io_out.create_zip_file; - import sisudoc.io_out.xmls; - import sisudoc.io_out.xmls_css; - mixin InternalMarkup; - mixin spineRgxOut; - mixin spineRgxXHTML; - static auto rgx = RgxO(); - static auto rgx_xhtml = RgxXHTML(); - // mixin outputXmlODT; - string odt_head(I)(I doc_matters) { - string _has_tables = format(q"┃ - <style:style style:name="Table1" style:family="table"> - <style:table-properties style:width="16.999cm" table:align="margins"/> - </style:style> - <style:style style:name="Table1.A" style:family="table-column"> - <style:table-column-properties style:column-width="16.999cm" style:rel-column-width="65535*"/> - </style:style> - <style:style style:name="Table1.B" style:family="table-column"> - <style:table-column-properties style:column-width="8.499cm" style:rel-column-width="32767*"/> - </style:style> - <style:style style:name="Table1.C" style:family="table-column"> - <style:table-column-properties style:column-width="5.666cm" style:rel-column-width="21845*"/> - </style:style> - <style:style style:name="Table1.D" style:family="table-column"> - <style:table-column-properties style:column-width="4.349cm" style:rel-column-width="16383*"/> - </style:style> - <style:style style:name="Table1.E" style:family="table-column"> - <style:table-column-properties style:column-width="3.399cm" style:rel-column-width="13107*"/> - </style:style> - <style:style style:name="Table1.F" style:family="table-column"> - <style:table-column-properties style:column-width="2.833cm" style:rel-column-width="10922*"/> - </style:style> - <style:style style:name="Table1.G" style:family="table-column"> - <style:table-column-properties style:column-width="2.428cm" style:rel-column-width="9362*"/> - </style:style> - <style:style style:name="Table1.H" style:family="table-column"> - <style:table-column-properties style:column-width="2.124cm" style:rel-column-width="8191*"/> - </style:style> - <style:style style:name="Table2" style:family="table"> - <style:table-properties style:width="16.999cm" table:align="margins"/> - </style:style> - <style:style style:name="Table2.A" style:family="table-column"> - <style:table-column-properties style:column-width="16.999cm" style:rel-column-width="65535*"/> - </style:style> - <style:style style:name="Table2.B" style:family="table-column"> - <style:table-column-properties style:column-width="8.499cm" style:rel-column-width="32767*"/> - </style:style> - <style:style style:name="Table2.C" style:family="table-column"> - <style:table-column-properties style:column-width="5.666cm" style:rel-column-width="21845*"/> - </style:style> - <style:style style:name="Table2.D" style:family="table-column"> - <style:table-column-properties style:column-width="4.349cm" style:rel-column-width="16383*"/> - </style:style> - <style:style style:name="Table2.E" style:family="table-column"> - <style:table-column-properties style:column-width="3.999cm" style:rel-column-width="13107*"/> - </style:style> - <style:style style:name="Table2.F" style:family="table-column"> - <style:table-column-properties style:column-width="2.833cm" style:rel-column-width="10922*"/> - </style:style> - <style:style style:name="Table2.G" style:family="table-column"> - <style:table-column-properties style:column-width="2.428cm" style:rel-column-width="9362*"/> - </style:style> - <style:style style:name="Table2.H" style:family="table-column"> - <style:table-column-properties style:column-width="2.124cm" style:rel-column-width="8191*"/> - </style:style> - <style:style style:name="Table2.I" style:family="table-column"> - <style:table-column-properties style:column-width="1.8887cm" style:rel-column-width="7281*"/> - </style:style> - <style:style style:name="Table2.J" style:family="table-column"> - <style:table-column-properties style:column-width="1.6999cm" style:rel-column-width="6553*"/> - </style:style> - <style:style style:name="Table2.K" style:family="table-column"> - <style:table-column-properties style:column-width="1.5453cm" style:rel-column-width="5957*"/> - </style:style> - <style:style style:name="Table2.L" style:family="table-column"> - <style:table-column-properties style:column-width="1.416cm" style:rel-column-width="5461*"/> - </style:style> - <style:style style:name="Table2.M" style:family="table-column"> - <style:table-column-properties style:column-width="1.307" style:rel-column-width="5041*"/> - </style:style> - <style:style style:name="Table2.N" style:family="table-column"> - <style:table-column-properties style:column-width="1.214cm" style:rel-column-width="4681*"/> - </style:style> - ┃",); - string _odt_head = format(q"┃<?xml version="1.0" encoding="UTF-8"?> - <office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xl="https://www.w3.org/1999/xlink" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="https://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="https://openoffice.org/2004/office" xmlns:ooow="https://openoffice.org/2004/writer" xmlns:oooc="https://openoffice.org/2004/calc" xmlns:dom="https://www.w3.org/2001/xml-events" xmlns:xforms="https://www.w3.org/2002/xforms" xmlns:xsd="https://www.w3.org/2001/XMLSchema" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="https://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="https://www.w3.org/1999/xhtml" xmlns:grddl="https://www.w3.org/2003/g/data-view#" xmlns:tableooo="https://openoffice.org/2009/table" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="https://www.w3.org/TR/css3-text/" office:version="1.2"> - <office:scripts/> - <office:font-face-decls> - <style:font-face style:name="DejaVu Sans Mono" svg:font-family="'DejaVu Sans Mono'" style:font-adornments="Book" style:font-family-generic="modern" style:font-pitch="fixed"/> - <style:font-face style:name="Inconsolata" svg:font-family="Inconsolata" style:font-adornments="Regular" style:font-pitch="fixed"/> - <style:font-face style:name="Liberation Mono" svg:font-family="'Liberation Mono'" style:font-adornments="Regular" style:font-family-generic="modern" style:font-pitch="fixed"/> - <style:font-face style:name="DejaVu Sans" svg:font-family="'DejaVu Sans'" style:font-adornments="ExtraLight" style:font-family-generic="swiss" style:font-pitch="variable"/> - <style:font-face style:name="Nimbus Sans L" svg:font-family="'Nimbus Sans L'" style:font-pitch="variable"/> - <style:font-face style:name="Tahoma" svg:font-family="Tahoma, Lucidasans, 'Lucida Sans', 'Arial Unicode MS'" style:font-pitch="variable"/> - <style:font-face style:name="Nimbus Roman No9 L" svg:font-family="'Nimbus Roman No9 L'" style:font-family-generic="roman" style:font-pitch="variable"/> - <style:font-face style:name="Bitstream Vera Sans" svg:font-family="'Bitstream Vera Sans'" style:font-family-generic="swiss" style:font-pitch="variable"/> - </office:font-face-decls> - <office:automatic-styles> - %s - <style:style style:name="P_table_cell" style:family="paragraph" style:parent-style-name="Table_Contents"> - <style:paragraph-properties fo:text-align="justify" style:justify-single-word="false"/> - </style:style> - </office:automatic-styles> - <office:body> - <office:text text:use-soft-page-breaks="true"> - <office:forms form:automatic-focus="false" form:apply-design-mode="false"/> - <text:sequence-decls> - <text:sequence-decl text:display-outline-level="0" text:name="Illustration"/> - <text:sequence-decl text:display-outline-level="0" text:name="Table"/> - <text:sequence-decl text:display-outline-level="0" text:name="Text"/> - <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/> - </text:sequence-decls> - ┃", - (doc_matters.has.tables > 0) ? _has_tables : "", - ); - return _odt_head; - } - string odt_body(D,I)( - const D doc_abstraction, - I doc_matters, - ) { - mixin formatODT; - auto odt_format = formatODT(); - string delimit = ""; - string doc_odt = ""; - string _txt = ""; - foreach (part; doc_matters.has.keys_seq.scroll) { - foreach (obj; doc_abstraction[part]) { - switch (obj.metainfo.is_of_part) { - case "frontmatter": assert(part == "head" || "toc"); - switch (obj.metainfo.is_of_type) { - case "para": - switch (obj.metainfo.is_a) { - case "heading": - _txt = delimit ~ odt_format.heading(obj, doc_matters); - goto default; - case "toc": - _txt = odt_format.para(obj, doc_matters); - goto default; - default: - doc_odt ~= _txt; - _txt = ""; - break; - } - break; - default: break; - } - break; - case "body": assert(part == "body" || "head"); // surprise - switch (obj.metainfo.is_of_type) { - case "para": - switch (obj.metainfo.is_a) { - case "heading": - _txt = delimit ~ odt_format.heading(obj, doc_matters); - goto default; - case "para": - _txt = odt_format.para(obj, doc_matters); - goto default; - default: - doc_odt ~= _txt; - _txt = ""; - break; - } - break; - case "block": - switch (obj.metainfo.is_a) { - case "quote": - _txt = odt_format.quote(obj, doc_matters); - goto default; - case "group": - _txt = odt_format.group(obj, doc_matters); - goto default; - case "block": - _txt = odt_format.block(obj, doc_matters); - goto default; - case "verse": - _txt = odt_format.verse(obj, doc_matters); - goto default; - case "code": - _txt = odt_format.code(obj, doc_matters); - goto default; - case "table": - _txt = odt_format.table(obj, doc_matters); - goto default; - default: - doc_odt ~= _txt; - _txt = ""; - break; - } - break; - default: break; - } - break; - case "backmatter": - assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); - switch (obj.metainfo.is_of_type) { - case "para": - switch (obj.metainfo.is_a) { - case "heading": - _txt = delimit ~ odt_format.heading(obj, doc_matters); - goto default; - case "endnote": assert(part == "endnotes"); - _txt = odt_format.para(obj, doc_matters); - goto default; - case "glossary": assert(part == "glossary"); - _txt = odt_format.para(obj, doc_matters); - goto default; - case "bibliography": assert(part == "bibliography"); - _txt = odt_format.para(obj, doc_matters); - goto default; - case "bookindex": assert(part == "bookindex"); - _txt = odt_format.para(obj, doc_matters); - goto default; - case "blurb": assert(part == "blurb"); - _txt = odt_format.para(obj, doc_matters); - goto default; - default: - doc_odt ~= _txt; - _txt = ""; - break; - } - break; - default: break; - } - break; - case "comment": - break; - default: - { /+ debug +/ - if (doc_matters.opt.action.debug_do - && doc_matters.opt.action.vox_gt_2) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); - writeln(__FILE__, ":", __LINE__, ": ", obj.text); - } - } - break; - } - } - } - return doc_odt; - } - ; - string odt_tail() { - string _odt_tail = format(q"┃<text:p text:style-name="P_normal">spine: <<text:a xl:type="simple" xl:href="https://www.sisudoc.org">www.sisudoc.org</text:a>> and <<text:a xl:type="simple" xl:href="https://www.sisudoc.org">www.sisudoc.org</text:a>></text:p> - </office:text></office:body></office:document-content>┃",); - return _odt_tail; - } - string content_xml(D,I)( - const D doc_abstraction, - I doc_matters, - ) { - string _content_xml; - string break_line = (doc_matters.opt.action.debug_do) ? "\n" : ""; - string odt_break_page = format(q"┃<text:p text:style-name="P_normal_page_new"/>┃",); - string br_pg = format(q"┃<text:p text:style-name="P_normal_page_new"/>┃",); - _content_xml ~= odt_head(doc_matters); - _content_xml ~= odt_body(doc_abstraction, doc_matters); - _content_xml ~= odt_tail; - return _content_xml; - } - string manifest_xml(M)( - auto ref M doc_matters, - ) { - string _bullet = format(q"┃<manifest:file-entry manifest:media-type="" manifest:full-path="Pictures/bullet_09.png"/>┃"); - string[] _images = [ _bullet ]; - foreach (image; doc_matters.srcs.image_list) { - _images ~= format(q"┃ <manifest:file-entry manifest:media-type="" manifest:full-path="Pictures/%s"/>┃", image); - } - string _manifest_xml = format(q"┃<?xml version="1.0" encoding="UTF-8"?> - <manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0" manifest:version="1.2"> - <manifest:file-entry manifest:media-type="application/vnd.oasis.opendocument.text" manifest:version="1.2" manifest:full-path="/"/> - <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="styles.xml"/> - <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="content.xml"/> - %s - <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="meta.xml"/> - <manifest:file-entry manifest:media-type="application/rdf+xml" manifest:full-path="manifest.rdf"/> - <manifest:file-entry manifest:media-type="application/binary" manifest:full-path="layout-cache"/> - <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="settings.xml"/> - </manifest:manifest> - ┃", - _images.join("\n"), - ); - return _manifest_xml; - } - void images_cp(M)( - auto ref M doc_matters, - ) { - { /+ (copy odt images) +/ - import sisudoc.io_out.paths_output; - auto pth_odt = spinePathsODT!()(doc_matters); - foreach (image; doc_matters.srcs.image_list) { - auto fn_src_in = doc_matters.src.image_dir_path ~ "/" ~ image; - auto fn_src_out_file = pth_odt.image_dir("fs") ~ "/" ~ image; - auto fn_src_out_zip = pth_odt.image_dir("zip") ~ "/" ~ image; - if (exists(fn_src_in)) { - if (doc_matters.opt.action.debug_do) { - if (doc_matters.opt.action.debug_do) { - fn_src_in.copy(fn_src_out_file); - } - } - } - } - } - // return 0; - } - string meta_xml(M)( - auto ref M doc_matters, - ) { - /+ (meta_xml includes output time-stamp) +/ - string _meta_xml = format(q"┃<?xml version="1.0" encoding="UTF-8"?> - <office:document-meta xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xl="https://www.w3.org/1999/xlink" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:ooo="https://openoffice.org/2004/office" xmlns:grddl="https://www.w3.org/2003/g/data-view#" office:version="1.2"> - <office:meta> - <meta:generator>%s</meta:generator> - <meta:creation-date>%s</meta:creation-date> - <dc:date>%s</dc:date> - <dc:language>en-US</dc:language> - </office:meta> - </office:document-meta> - ┃", - doc_matters.generator_program.name_and_version, - doc_matters.generated_time, - doc_matters.generated_time, - ); - return _meta_xml; - } - void dirtree(I)( - I doc_matters, - ) { - import sisudoc.io_out.paths_output; - auto pth_odt = spinePathsODT!()(doc_matters); - if (doc_matters.opt.action.debug_do) { /+ (dir tree) +/ - if (!exists(pth_odt.meta_inf_dir("fs"))) { - pth_odt.meta_inf_dir("fs").mkdirRecurse; - } - if (!exists(pth_odt.image_dir("fs"))) { - pth_odt.image_dir("fs").mkdirRecurse; - } - } - if (!exists(pth_odt.base_pth)) { - pth_odt.base_pth.mkdirRecurse; - } - if (!exists(pth_odt.base_pth ~ "/index.html")) { - import sisudoc.io_out.html_snippet; - mixin htmlSnippet; - auto f = File(pth_odt.base_pth ~"/index.html", "w"); - f.writeln(format_html_blank_page_guide_home( - "../../css/html_scroll.css", - "https://sisudoc.org", - "../../index.html", - )); - } - // return 0; - } - string mimetype() { - string mimetype_ = format(q"┃application/vnd.oasis.opendocument.text┃"); - return mimetype_; - } - string manifest_rdf() { - string _manifest_rdf = format(q"┃<?xml version="1.0" encoding="utf-8"?> - <rdf:RDF xmlns:rdf="https://www.w3.org/1999/02/22-rdf-syntax-ns#"> - <rdf:Description rdf:about="styles.xml"> - <rdf:type rdf:resource="https://docs.oasis-open.org/ns/office/1.2/meta/odf#StylesFile"/> - </rdf:Description> - <rdf:Description rdf:about=""> - <ns0:hasPart xmlns:ns0="https://docs.oasis-open.org/ns/office/1.2/meta/pkg#" rdf:resource="styles.xml"/> - </rdf:Description> - <rdf:Description rdf:about="content.xml"> - <rdf:type rdf:resource="https://docs.oasis-open.org/ns/office/1.2/meta/odf#ContentFile"/> - </rdf:Description> - <rdf:Description rdf:about=""> - <ns0:hasPart xmlns:ns0="https://docs.oasis-open.org/ns/office/1.2/meta/pkg#" rdf:resource="content.xml"/> - </rdf:Description> - <rdf:Description rdf:about=""> - <rdf:type rdf:resource="https://docs.oasis-open.org/ns/office/1.2/meta/pkg#Document"/> - </rdf:Description> - </rdf:RDF> - ┃"); - return _manifest_rdf; - } - string settings_xml() { - string _settings_xml = format(q"┃<?xml version="1.0" encoding="UTF-8"?> - <office:document-settings xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xl="https://www.w3.org/1999/xlink" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="https://openoffice.org/2004/office" office:version="1.2"> - <office:settings> - <config:config-item-set config:name="ooo:view-settings"> - <config:config-item config:name="ViewAreaTop" config:type="int">0</config:config-item> - <config:config-item config:name="ViewAreaLeft" config:type="int">0</config:config-item> - <config:config-item config:name="ViewAreaWidth" config:type="int">0</config:config-item> - <config:config-item config:name="ViewAreaHeight" config:type="int">0</config:config-item> - <config:config-item config:name="ShowRedlineChanges" config:type="boolean">true</config:config-item> - <config:config-item config:name="InBrowseMode" config:type="boolean">false</config:config-item> - <config:config-item-map-indexed config:name="Views"> - <config:config-item-map-entry> - <config:config-item config:name="ViewId" config:type="string">view2</config:config-item> - <config:config-item config:name="ViewLeft" config:type="int">0</config:config-item> - <config:config-item config:name="ViewTop" config:type="int">0</config:config-item> - <config:config-item config:name="VisibleLeft" config:type="int">0</config:config-item> - <config:config-item config:name="VisibleTop" config:type="int">0</config:config-item> - <config:config-item config:name="VisibleRight" config:type="int">0</config:config-item> - <config:config-item config:name="VisibleBottom" config:type="int">0</config:config-item> - <config:config-item config:name="ZoomType" config:type="short">0</config:config-item> - <config:config-item config:name="ViewLayoutColumns" config:type="short">2</config:config-item> - <config:config-item config:name="ViewLayoutBookMode" config:type="boolean">true</config:config-item> - <config:config-item config:name="ZoomFactor" config:type="short">100</config:config-item> - <config:config-item config:name="IsSelectedFrame" config:type="boolean">false</config:config-item> - </config:config-item-map-entry> - </config:config-item-map-indexed> - </config:config-item-set> - <config:config-item-set config:name="ooo:configuration-settings"> - <config:config-item config:name="ChartAutoUpdate" config:type="boolean">true</config:config-item> - <config:config-item config:name="IsLabelDocument" config:type="boolean">false</config:config-item> - <config:config-item config:name="MathBaselineAlignment" config:type="boolean">false</config:config-item> - <config:config-item config:name="OutlineLevelYieldsNumbering" config:type="boolean">true</config:config-item> - <config:config-item config:name="PrintLeftPages" config:type="boolean">true</config:config-item> - <config:config-item config:name="DoNotJustifyLinesWithManualBreak" config:type="boolean">false</config:config-item> - <config:config-item config:name="AlignTabStopPosition" config:type="boolean">true</config:config-item> - <config:config-item config:name="PrintTextPlaceholder" config:type="boolean">false</config:config-item> - <config:config-item config:name="UseOldNumbering" config:type="boolean">false</config:config-item> - <config:config-item config:name="CurrentDatabaseCommand" config:type="string"/> - <config:config-item config:name="ProtectForm" config:type="boolean">false</config:config-item> - <config:config-item config:name="PrintBlackFonts" config:type="boolean">false</config:config-item> - <config:config-item config:name="PrintProspectRTL" config:type="boolean">false</config:config-item> - <config:config-item config:name="SmallCapsPercentage66" config:type="boolean">true</config:config-item> - <config:config-item config:name="PrintControls" config:type="boolean">true</config:config-item> - <config:config-item config:name="CharacterCompressionType" config:type="short">0</config:config-item> - <config:config-item config:name="PrintHiddenText" config:type="boolean">false</config:config-item> - <config:config-item config:name="UseFormerTextWrapping" config:type="boolean">false</config:config-item> - <config:config-item config:name="IsKernAsianPunctuation" config:type="boolean">false</config:config-item> - <config:config-item config:name="PrintProspect" config:type="boolean">false</config:config-item> - <config:config-item config:name="PrintEmptyPages" config:type="boolean">true</config:config-item> - <config:config-item config:name="UseFormerObjectPositioning" config:type="boolean">false</config:config-item> - <config:config-item config:name="ConsiderTextWrapOnObjPos" config:type="boolean">false</config:config-item> - <config:config-item config:name="TableRowKeep" config:type="boolean">false</config:config-item> - <config:config-item config:name="PrintReversed" config:type="boolean">false</config:config-item> - <config:config-item config:name="TabsRelativeToIndent" config:type="boolean">true</config:config-item> - <config:config-item config:name="PrintRightPages" config:type="boolean">true</config:config-item> - <config:config-item config:name="PrintPaperFromSetup" config:type="boolean">false</config:config-item> - <config:config-item config:name="AddFrameOffsets" config:type="boolean">false</config:config-item> - <config:config-item config:name="AddParaSpacingToTableCells" config:type="boolean">true</config:config-item> - <config:config-item config:name="UpdateFromTemplate" config:type="boolean">false</config:config-item> - <config:config-item config:name="AddExternalLeading" config:type="boolean">true</config:config-item> - <config:config-item config:name="PrintSingleJobs" config:type="boolean">false</config:config-item> - <config:config-item config:name="PrinterIndependentLayout" config:type="string">high-resolution</config:config-item> - <config:config-item config:name="LinkUpdateMode" config:type="short">1</config:config-item> - <config:config-item config:name="PrintAnnotationMode" config:type="short">0</config:config-item> - <config:config-item config:name="UseOldPrinterMetrics" config:type="boolean">true</config:config-item> - <config:config-item config:name="RedlineProtectionKey" config:type="base64Binary"/> - <config:config-item config:name="PrinterSetup" config:type="base64Binary"/> - <config:config-item config:name="IgnoreFirstLineIndentInNumbering" config:type="boolean">false</config:config-item> - <config:config-item config:name="CollapseEmptyCellPara" config:type="boolean">true</config:config-item> - <config:config-item config:name="PrinterName" config:type="string"/> - <config:config-item config:name="InvertBorderSpacing" config:type="boolean">false</config:config-item> - <config:config-item config:name="PrintPageBackground" config:type="boolean">true</config:config-item> - <config:config-item config:name="DoNotCaptureDrawObjsOnPage" config:type="boolean">false</config:config-item> - <config:config-item config:name="ApplyUserData" config:type="boolean">true</config:config-item> - <config:config-item config:name="TabAtLeftIndentForParagraphsInList" config:type="boolean">false</config:config-item> - <config:config-item config:name="UnxForceZeroExtLeading" config:type="boolean">true</config:config-item> - <config:config-item config:name="SaveVersionOnClose" config:type="boolean">false</config:config-item> - <config:config-item config:name="PrintFaxName" config:type="string"/> - <config:config-item config:name="AddParaTableSpacing" config:type="boolean">true</config:config-item> - <config:config-item config:name="PrintDrawings" config:type="boolean">true</config:config-item> - <config:config-item config:name="LoadReadonly" config:type="boolean">false</config:config-item> - <config:config-item config:name="PrintGraphics" config:type="boolean">true</config:config-item> - <config:config-item config:name="FieldAutoUpdate" config:type="boolean">true</config:config-item> - <config:config-item config:name="AllowPrintJobCancel" config:type="boolean">true</config:config-item> - <config:config-item config:name="UseFormerLineSpacing" config:type="boolean">false</config:config-item> - <config:config-item config:name="SaveGlobalDocumentLinks" config:type="boolean">false</config:config-item> - <config:config-item config:name="CurrentDatabaseDataSource" config:type="string"/> - <config:config-item config:name="IgnoreTabsAndBlanksForLineCalculation" config:type="boolean">false</config:config-item> - <config:config-item config:name="CurrentDatabaseCommandType" config:type="int">0</config:config-item> - <config:config-item config:name="DoNotResetParaAttrsForNumFont" config:type="boolean">false</config:config-item> - <config:config-item config:name="ClipAsCharacterAnchoredWriterFlyFrames" config:type="boolean">false</config:config-item> - <config:config-item config:name="PrintTables" config:type="boolean">true</config:config-item> - <config:config-item config:name="AddParaTableSpacingAtStart" config:type="boolean">true</config:config-item> - </config:config-item-set> - </office:settings> - </office:document-settings> - ┃"); - return _settings_xml; - } - string styles_xml() { - string _styles_xml = format(q"┃<?xml version="1.0" encoding="UTF-8"?> - <office:document-styles xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xl="https://www.w3.org/1999/xlink" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="https://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="https://openoffice.org/2004/office" xmlns:ooow="https://openoffice.org/2004/writer" xmlns:oooc="https://openoffice.org/2004/calc" xmlns:dom="https://www.w3.org/2001/xml-events" xmlns:rpt="https://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="https://www.w3.org/1999/xhtml" xmlns:grddl="https://www.w3.org/2003/g/data-view#" xmlns:tableooo="https://openoffice.org/2009/table" xmlns:css3t="https://www.w3.org/TR/css3-text/" office:version="1.2"> - <office:font-face-decls> - <style:font-face style:name="DejaVu Sans Mono" svg:font-family="'DejaVu Sans Mono'" style:font-adornments="Book" style:font-family-generic="modern" style:font-pitch="fixed"/> - <style:font-face style:name="Nimbus Sans L" svg:font-family="'Nimbus Sans L'" style:font-pitch="variable"/> - <style:font-face style:name="Tahoma" svg:font-family="Tahoma, Lucidasans, 'Lucida Sans', 'Arial Unicode MS'" style:font-pitch="variable"/> - <style:font-face style:name="Nimbus Roman No9 L" svg:font-family="'Nimbus Roman No9 L'" style:font-family-generic="roman" style:font-pitch="variable"/> - <style:font-face style:name="Bitstream Vera Sans" svg:font-family="'Bitstream Vera Sans'" style:font-family-generic="swiss" style:font-pitch="variable"/> - </office:font-face-decls> - <office:styles> - <style:default-style style:family="graphic"> - <style:graphic-properties fo:wrap-option="wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/> - <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false"> - <style:tab-stops/> - </style:paragraph-properties> - <style:text-properties style:use-window-font-color="true" fo:font-size="12pt" fo:language="en" fo:country="US" style:font-size-asian="12pt" style:language-asian="zxx" style:country-asian="none" style:font-size-complex="12pt" style:language-complex="zxx" style:country-complex="none"/> - </style:default-style> - <style:default-style style:family="paragraph"> - <style:paragraph-properties fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/> - <style:text-properties style:use-window-font-color="true" style:font-name="Nimbus Roman No9 L" fo:font-size="12pt" fo:language="en" fo:country="US" style:font-name-asian="Nimbus Sans L" style:font-size-asian="12pt" style:language-asian="zxx" style:country-asian="none" style:font-name-complex="Nimbus Sans L" style:font-size-complex="12pt" style:language-complex="zxx" style:country-complex="none" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/> - </style:default-style> - <style:default-style style:family="table"> - <style:table-properties table:border-model="collapsing"/> - </style:default-style> - <style:default-style style:family="table-row"> - <style:table-row-properties fo:keep-together="auto"/> - </style:default-style> - <style:style style:name="Standard" style:family="paragraph" style:class="text"/> - <style:style style:name="Text_body" style:display-name="Text body" style:family="paragraph" style:class="text"> - <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.212cm"/> - </style:style> - <style:style style:name="P_page_break" style:family="paragraph" style:parent-style-name="Standard"> - <style:paragraph-properties fo:break-before="page"/> - </style:style> - <style:style style:name="P_normal" style:family="paragraph" style:parent-style-name="Standard"> - <style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%%" fo:text-align="justify" style:justify-single-word="false"/> - </style:style> - <style:style style:name="P_normal_page_new" style:family="paragraph" style:parent-style-name="Standard"> - <style:paragraph-properties fo:break-after="page"/> - </style:style> - <style:style style:name="P_indent_0" style:display-name="Paragraph indent 0" style:family="paragraph" style:parent-style-name="Standard"> - <style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%%" fo:text-align="justify" style:justify-single-word="false"/> - </style:style> - <style:style style:name="P_indent_1" style:display-name="Paragraph indent 1" style:family="paragraph" style:parent-style-name="Standard"> - <style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%%" fo:margin-left="1cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/> - </style:style> - <style:style style:name="P_indent_2" style:display-name="Paragraph indent 2" style:family="paragraph" style:parent-style-name="Standard"> - <style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%%" fo:margin-left="2cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/> - </style:style> - <style:style style:name="P_indent_3" style:display-name="Paragraph indent 3" style:family="paragraph" style:parent-style-name="Standard"> - <style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%%" fo:margin-left="3cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/> - </style:style> - <style:style style:name="P_indent_4" style:display-name="Paragraph indent 4" style:family="paragraph" style:parent-style-name="Standard"> - <style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%%" fo:margin-left="4cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/> - </style:style> - <style:style style:name="P_indent_5" style:display-name="Paragraph indent 5" style:family="paragraph" style:parent-style-name="Standard"> - <style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%%" fo:margin-left="5cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/> - </style:style> - <style:style style:name="P_indent_6" style:display-name="Paragraph indent 6" style:family="paragraph" style:parent-style-name="Standard"> - <style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%%" fo:margin-left="6cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/> - </style:style> - <style:style style:name="P_indent_7" style:display-name="Paragraph indent 7" style:family="paragraph" style:parent-style-name="Standard"> - <style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%%" fo:margin-left="7cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/> - </style:style> - <style:style style:name="P_indent_8" style:display-name="Paragraph indent 8" style:family="paragraph" style:parent-style-name="Standard"> - <style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%%" fo:margin-left="8cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/> - </style:style> - <style:style style:name="P_indent_9" style:display-name="Paragraph indent 9" style:family="paragraph" style:parent-style-name="Standard"> - <style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%%" fo:margin-left="9cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/> - </style:style> - <style:style style:name="P_h0_i0" style:display-name="Hang 0 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h0_i1" style:display-name="Hang 0 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="-1cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h0_i2" style:display-name="Hang 0 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="-2cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h0_i3" style:display-name="Hang 0 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="-3cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h0_i4" style:display-name="Hang 0 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="-4cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h0_i5" style:display-name="Hang 0 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="-5cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h0_i6" style:display-name="Hang 0 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="-6cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h0_i7" style:display-name="Hang 0 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="-7cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h0_i8" style:display-name="Hang 0 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="-8cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h0_i9" style:display-name="Hang 0 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="-9cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h1_i0" style:display-name="Hang 1 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="1cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h1_i1" style:display-name="Hang 1 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h1_i2" style:display-name="Hang 1 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="-1cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h1_i3" style:display-name="Hang 1 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="-2cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h1_i4" style:display-name="Hang 1 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="-3cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h1_i5" style:display-name="Hang 1 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="-4cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h1_i6" style:display-name="Hang 1 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="-5cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h1_i7" style:display-name="Hang 1 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="-6cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h1_i8" style:display-name="Hang 1 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="-7cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h1_i9" style:display-name="Hang 1 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="-8cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h2_i0" style:display-name="Hang 2 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="2cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h2_i1" style:display-name="Hang 2 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="1cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h2_i2" style:display-name="Hang 2 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h2_i3" style:display-name="Hang 2 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="-1cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h2_i4" style:display-name="Hang 2 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="-2cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h2_i5" style:display-name="Hang 2 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="-3cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h2_i6" style:display-name="Hang 2 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="-4cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h2_i7" style:display-name="Hang 2 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="-5cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h2_i8" style:display-name="Hang 2 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="-6cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h2_i9" style:display-name="Hang 2 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="-7cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h3_i0" style:display-name="Hang 3 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="3cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h3_i1" style:display-name="Hang 3 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="2cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h3_i2" style:display-name="Hang 3 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="1cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h3_i3" style:display-name="Hang 3 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h3_i4" style:display-name="Hang 3 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="-1cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h3_i5" style:display-name="Hang 3 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="-2cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h3_i6" style:display-name="Hang 3 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="-3cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h3_i7" style:display-name="Hang 3 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="-4cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h3_i8" style:display-name="Hang 3 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="-5cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h3_i9" style:display-name="Hang 3 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="-6cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h4_i0" style:display-name="Hang 4 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="4cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h4_i1" style:display-name="Hang 4 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="3cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h4_i2" style:display-name="Hang 4 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="2cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h4_i3" style:display-name="Hang 4 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="1cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h4_i4" style:display-name="Hang 4 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h4_i5" style:display-name="Hang 4 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="-1cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h4_i6" style:display-name="Hang 4 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="-2cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h4_i7" style:display-name="Hang 4 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="-3cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h4_i8" style:display-name="Hang 4 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="-4cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h4_i9" style:display-name="Hang 4 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="-5cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h5_i0" style:display-name="Hang 5 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="5cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h5_i1" style:display-name="Hang 5 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="4cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h5_i2" style:display-name="Hang 5 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="3cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h5_i3" style:display-name="Hang 5 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="2cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h5_i4" style:display-name="Hang 5 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="1cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h5_i5" style:display-name="Hang 5 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h5_i6" style:display-name="Hang 5 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="-1cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h5_i7" style:display-name="Hang 5 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="-2cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h5_i8" style:display-name="Hang 5 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="-3cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h5_i9" style:display-name="Hang 5 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="-4cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h6_i0" style:display-name="Hang 6 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="6cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h6_i1" style:display-name="Hang 6 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="5cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h6_i2" style:display-name="Hang 6 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="4cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h6_i3" style:display-name="Hang 6 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="3cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h6_i4" style:display-name="Hang 6 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="2cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h6_i5" style:display-name="Hang 6 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="1cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h6_i6" style:display-name="Hang 6 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h6_i7" style:display-name="Hang 6 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="-1cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h6_i8" style:display-name="Hang 6 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="-2cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h6_i9" style:display-name="Hang 6 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="-3cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h7_i0" style:display-name="Hang 7 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="7cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h7_i1" style:display-name="Hang 7 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="6cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h7_i2" style:display-name="Hang 7 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="5cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h7_i3" style:display-name="Hang 7 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="4cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h7_i4" style:display-name="Hang 7 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="3cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h7_i5" style:display-name="Hang 7 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="2cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h7_i6" style:display-name="Hang 7 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="1cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h7_i7" style:display-name="Hang 7 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h7_i8" style:display-name="Hang 7 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="-1cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h7_i9" style:display-name="Hang 7 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="-2cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h8_i0" style:display-name="Hang 8 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="8cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h8_i1" style:display-name="Hang 8 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="7cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h8_i2" style:display-name="Hang 8 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="6cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h8_i3" style:display-name="Hang 8 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="5cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h8_i4" style:display-name="Hang 8 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="4cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h8_i5" style:display-name="Hang 8 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="3cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h8_i6" style:display-name="Hang 8 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="2cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h8_i7" style:display-name="Hang 8 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="1cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h8_i8" style:display-name="Hang 8 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h8_i9" style:display-name="Hang 8 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="-1cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h9_i0" style:display-name="Hang 9 Indent 0" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="9cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h9_i1" style:display-name="Hang 9 Indent 1" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="1cm" fo:margin-right="0cm" fo:text-indent="8cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h9_i2" style:display-name="Hang 9 Indent 2" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="2cm" fo:margin-right="0cm" fo:text-indent="7cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h9_i3" style:display-name="Hang 9 Indent 3" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-indent="6cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h9_i4" style:display-name="Hang 9 Indent 4" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="4cm" fo:margin-right="0cm" fo:text-indent="5cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h9_i5" style:display-name="Hang 9 Indent 5" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="5cm" fo:margin-right="0cm" fo:text-indent="4cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h9_i6" style:display-name="Hang 9 Indent 6" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="6cm" fo:margin-right="0cm" fo:text-indent="3cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h9_i7" style:display-name="Hang 9 Indent 7" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="7cm" fo:margin-right="0cm" fo:text-indent="2cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h9_i8" style:display-name="Hang 9 Indent 8" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="8cm" fo:margin-right="0cm" fo:text-indent="1cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="P_h9_i9" style:display-name="Hang 9 Indent 9" style:family="paragraph" style:parent-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-left="9cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> - <style:tab-stops> - <style:tab-stop style:position="0cm"/> - </style:tab-stops> - </style:paragraph-properties> - </style:style> - <style:style style:name="Span_bold" style:family="text"> - <style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold"/> - </style:style> - <style:style style:name="Span_italic" style:family="text"> - <style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic"/> - </style:style> - <style:style style:name="Span_underscore" style:family="text"> - <style:text-properties style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color"/> - </style:style> - <style:style style:name="Span_superscript" style:family="text"> - <style:text-properties style:text-position="super 58%%"/> - </style:style> - <style:style style:name="Span_subscript" style:family="text"> - <style:text-properties style:text-position="sub 58%%"/> - </style:style> - <style:style style:name="Span_monospace" style:family="text"> - <style:text-properties style:font-name="DejaVu Sans Mono" fo:font-size="10pt" fo:font-weight="normal" fo:background-color="#e6e6e6"/> - </style:style> - <style:style style:name="Heading" style:family="paragraph" style:next-style-name="Text_body" style:class="text"> - <style:paragraph-properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" fo:keep-with-next="always"/> - <style:text-properties style:font-name="Bitstream Vera Sans" fo:font-size="14pt" style:font-size-asian="14pt" style:font-name-complex="Tahoma" style:font-size-complex="14pt"/> - </style:style> - <style:style style:name="H_1" style:display-name="Heading 1" style:family="paragraph" style:next-style-name="Text_body" style:default-outline-level="1" style:class="text"> - <style:text-properties fo:font-size="120%%" fo:font-weight="bold" style:font-size-asian="120%%" style:font-weight-asian="bold" style:font-size-complex="115%%" style:font-weight-complex="bold"/> - </style:style> - <style:style style:name="H_2" style:display-name="Heading 2" style:family="paragraph" style:next-style-name="Text_body" style:default-outline-level="2" style:class="text"> - <style:text-properties fo:font-size="115%%" fo:font-weight="bold" style:font-size-asian="115%%" style:font-weight-asian="bold" style:font-size-complex="115%%" style:font-weight-complex="bold"/> - </style:style> - <style:style style:name="H_3" style:display-name="Heading 3" style:family="paragraph" style:next-style-name="Text_body" style:default-outline-level="3" style:class="text"> - <style:text-properties fo:font-size="110%%" fo:font-weight="bold" style:font-size-asian="110%%" style:font-weight-asian="bold" style:font-size-complex="115%%" style:font-weight-complex="bold"/> - </style:style> - <style:style style:name="H_4" style:display-name="Heading 4" style:family="paragraph" style:next-style-name="Text_body" style:default-outline-level="4" style:class="text"> - <style:text-properties fo:font-size="12pt" fo:font-style="italic" fo:font-weight="bold" style:font-size-asian="12pt" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-size-complex="12pt" style:font-style-complex="italic" style:font-weight-complex="bold"/> - </style:style> - <style:style style:name="H_5" style:display-name="Heading 5" style:family="paragraph" style:next-style-name="Text_body" style:default-outline-level="5" style:class="text"> - <style:text-properties fo:font-size="90%%" fo:font-style="italic" fo:font-weight="bold" style:font-size-asian="90%%" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-size-complex="90%%" style:font-style-complex="italic" style:font-weight-complex="bold"/> - </style:style> - <style:style style:name="H_6" style:display-name="Heading 6" style:family="paragraph" style:next-style-name="Text_body" style:default-outline-level="6" style:class="text"> - <style:text-properties fo:font-size="80%%" fo:font-style="italic" fo:font-weight="bold" style:font-size-asian="80%%" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-size-complex="80%%" style:font-style-complex="italic" style:font-weight-complex="bold"/> - </style:style> - <style:style style:name="P_group" style:family="paragraph" style:parent-style-name="Standard"> - <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm" fo:line-height="100%%" fo:text-align="justify" style:justify-single-word="false"/> - </style:style> - <style:style style:name="P_code" style:family="paragraph" style:parent-style-name="Standard"> - <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm" fo:line-height="100%%" fo:text-align="start" style:justify-single-word="false"/> - <style:text-properties style:font-name="DejaVu Sans Mono" fo:font-size="9pt" fo:font-weight="normal" fo:background-color="#e6e6e6"/> - </style:style> - <style:style style:name="Footnote" style:family="paragraph" style:class="extra"> - <style:paragraph-properties fo:margin-left="0.499cm" fo:margin-right="0cm" fo:text-indent="-0.499cm" style:auto-text-indent="false" text:number-lines="false" text:line-number="0"/> - <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/> - </style:style> - <style:style style:name="Table_Contents" style:display-name="Table Contents" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"> - <style:paragraph-properties text:number-lines="false" text:line-number="0"/> - </style:style> - <style:style style:name="Footnote_symbol" style:display-name="Footnote Symbol" style:family="text"/> - <style:style style:name="Footnote_anchor" style:display-name="Footnote Anchor" style:family="text"> - <style:text-properties style:text-position="super 58%%"/> - </style:style> - <style:style style:name="Internet_link" style:display-name="Internet link" style:family="text"> - <style:text-properties fo:color="#000080" fo:language="zxx" fo:country="none" style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color" style:language-asian="zxx" style:country-asian="none" style:language-complex="zxx" style:country-complex="none"/> - </style:style> - <style:style style:name="Graphics" style:family="graphic"> - <style:graphic-properties text:anchor-type="paragraph" svg:x="0cm" svg:y="0cm" style:wrap="dynamic" style:number-wrapped-paragraphs="no-limit" style:wrap-contour="false" style:vertical-pos="top" style:vertical-rel="paragraph" style:horizontal-pos="center" style:horizontal-rel="paragraph"/> - </style:style> - <text:outline-style style:name="Outline"> - <text:outline-level-style text:level="1" style:num-format=""> - <style:list-level-properties text:min-label-distance="0.381cm"/> - </text:outline-level-style> - <text:outline-level-style text:level="2" style:num-format=""> - <style:list-level-properties text:min-label-distance="0.381cm"/> - </text:outline-level-style> - <text:outline-level-style text:level="3" style:num-format=""> - <style:list-level-properties text:min-label-distance="0.381cm"/> - </text:outline-level-style> - <text:outline-level-style text:level="4" style:num-format=""> - <style:list-level-properties text:min-label-distance="0.381cm"/> - </text:outline-level-style> - <text:outline-level-style text:level="5" style:num-format=""> - <style:list-level-properties text:min-label-distance="0.381cm"/> - </text:outline-level-style> - <text:outline-level-style text:level="6" style:num-format=""> - <style:list-level-properties text:min-label-distance="0.381cm"/> - </text:outline-level-style> - <text:outline-level-style text:level="7" style:num-format=""> - <style:list-level-properties text:min-label-distance="0.381cm"/> - </text:outline-level-style> - <text:outline-level-style text:level="8" style:num-format=""> - <style:list-level-properties text:min-label-distance="0.381cm"/> - </text:outline-level-style> - <text:outline-level-style text:level="9" style:num-format=""> - <style:list-level-properties text:min-label-distance="0.381cm"/> - </text:outline-level-style> - <text:outline-level-style text:level="10" style:num-format=""> - <style:list-level-properties text:min-label-distance="0.381cm"/> - </text:outline-level-style> - </text:outline-style> - <text:notes-configuration text:note-class="footnote" text:citation-style-name="Footnote_symbol" text:citation-body-style-name="Footnote_anchor" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/> - <text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0"/> - <text:linenumbering-configuration text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5"/> - <style:style style:name="fr1" style:family="graphic" style:parent-style-name="Graphics"> - <style:graphic-properties style:wrap="none" style:horizontal-pos="left" style:horizontal-rel="paragraph" style:mirror="none" fo:clip="rect(0cm 0cm 0cm 0cm)" draw:luminance="0%%" draw:contrast="0%%" draw:red="0%%" draw:green="0%%" draw:blue="0%%" draw:gamma="100%%" draw:color-inversion="false" draw:image-opacity="100%%" draw:color-mode="standard"/> - </style:style> - <style:style style:name="gr1" style:family="graphic"> - <style:graphic-properties draw:stroke="none" draw:fill="none" draw:textarea-horizontal-align="center" draw:textarea-vertical-align="middle" draw:color-mode="standard" draw:luminance="0%%" draw:contrast="0%%" draw:gamma="100%%" draw:red="0%%" draw:green="0%%" draw:blue="0%%" fo:clip="rect(0cm 0cm 0cm 0cm)" draw:image-opacity="100%%" style:mirror="none" style:run-through="background" style:wrap="none" style:vertical-pos="top" style:vertical-rel="baseline" style:horizontal-pos="left" style:horizontal-rel="paragraph" draw:wrap-influence-on-position="once-concurrent" style:flow-with-text="false"/> - </style:style> - <style:style style:name="gr2" style:family="graphic"> - <style:graphic-properties draw:stroke="none" draw:fill="none" draw:textarea-horizontal-align="center" draw:textarea-vertical-align="middle" draw:color-mode="standard" draw:luminance="0%%" draw:contrast="0%%" draw:gamma="100%%" draw:red="0%%" draw:green="0%%" draw:blue="0%%" fo:clip="rect(0cm 0cm 0cm 0cm)" draw:image-opacity="100%%" style:mirror="none" style:run-through="background" style:wrap="none" style:vertical-pos="middle" style:vertical-rel="baseline" style:horizontal-pos="left" style:horizontal-rel="paragraph" draw:wrap-influence-on-position="once-concurrent" style:flow-with-text="false"/> - </style:style> - </office:styles> - <office:automatic-styles> - <style:page-layout style:name="Mpm1"> - <style:page-layout-properties fo:page-width="20.999cm" fo:page-height="29.699cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm"> - <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="none" style:adjustment="left" style:rel-width="25%%" style:color="#000000"/> - </style:page-layout-properties> - <style:header-style/> - <style:footer-style/> - </style:page-layout> - </office:automatic-styles> - <office:master-styles> - <style:master-page style:name="Standard" style:page-layout-name="Mpm1"/> - </office:master-styles> - </office:document-styles> - ┃"); - return _styles_xml; - } - @trusted void writeOutputODT(W,I)( - const W odt_content, - I doc_matters, - ) { - auto pth_odt = spinePathsODT!()(doc_matters); - auto fn_odt = pth_odt.odt_file; - auto zip = new ZipArchive(); // ZipArchive zip = new ZipArchive(); - void ODTzip()(string contents, string fn) { - auto zip_arc_member_file = new ArchiveMember(); - zip_arc_member_file.name = fn; - auto zip_data = new OutBuffer(); - (doc_matters.opt.action.debug_do) - ? zip_data.write(contents.dup) - : zip_data.write(contents.dup - .replaceAll(rgx.spaces_line_start, "") - .replaceAll(rgx.newline, "") - .strip - ); - zip_arc_member_file.expandedData = zip_data.toBytes(); - zip.addMember(zip_arc_member_file); - createZipFile!()(fn_odt, zip.build()); - } - try { - if (!exists(pth_odt.base_pth)) { // check - pth_odt.base_pth.mkdirRecurse; - } - { - string fn; - File f; - { fn = pth_odt.mimetype("zip"); - ODTzip(odt_content.mimetype, fn); - } - { fn = pth_odt.manifest_rdf("zip"); - ODTzip(odt_content.manifest_rdf, fn); - } - { fn = pth_odt.settings_xml("zip"); - ODTzip(odt_content.settings_xml, fn); - } - { fn = pth_odt.styles_xml("zip"); - ODTzip(odt_content.styles_xml, fn); - } - { fn = pth_odt.content_xml("zip"); - ODTzip(odt_content.content_xml, fn); - } - { fn = pth_odt.manifest_xml("zip"); - ODTzip(odt_content.manifest_xml, fn); - } - { fn = pth_odt.meta_xml("zip"); - ODTzip(odt_content.meta_xml, fn); - } - { /+ (images) +/ - foreach (image; doc_matters.srcs.image_list) { - auto fn_src = doc_matters.src.image_dir_path ~ "/" ~ image; - auto fn_out = pth_odt.image_dir("zip") ~ "/" ~ image; - if (exists(fn_src)) { - { - auto zip_arc_member_file = new ArchiveMember(); - zip_arc_member_file.name = fn_out; - auto zip_data = new OutBuffer(); - zip_data.write(cast(char[]) ((fn_src).read)); // trusted? - zip_arc_member_file.expandedData = zip_data.toBytes(); - zip.addMember(zip_arc_member_file); - createZipFile!()(fn_odt, zip.build()); - } - } - } - } - if (doc_matters.opt.action.vox_gt_1) { - writeln(" ", pth_odt.odt_file); - } - } - if (!exists(pth_odt.base_pth ~ "/index.html")) { - import sisudoc.io_out.html_snippet; - mixin htmlSnippet; - auto f = File(pth_odt.base_pth ~"/index.html", "w"); - f.writeln(format_html_blank_page_guide_home( - "../../css/html_scroll.css", - (doc_matters.opt.action.webserver_url_doc_root.length > 0) - ? doc_matters.opt.action.webserver_url_doc_root - : doc_matters.conf_make_meta.conf.w_srv_data_root_url, - "../../index.html", - )); - } - } catch (ErrnoException ex) { - // Handle error - } - if (doc_matters.opt.action.debug_do) { - pth_odt.mimetype("fs"); /+ (mimetype) +/ - pth_odt.manifest_rdf("fs"); /+ (manifest.rdf) +/ - pth_odt.settings_xml("fs"); /+ (settings.xml) +/ - pth_odt.styles_xml("fs"); /+ (styles_xml) +/ - pth_odt.content_xml("fs"); - pth_odt.manifest_xml("fs"); - pth_odt.meta_xml("fs"); - } - } - void outputODT(D,I)( - const D doc_abstraction, - I doc_matters, - ) { - struct ODT { - /+ fixed output +/ - string mimetype; - string manifest_rdf; - string settings_xml; - string styles_xml; - /+ variable output +/ - string content_xml; // substantive content - string manifest_xml; // image list changes - string meta_xml; // time stamp - } - // auto pth_odt = spinePathsODT!()(doc_matters); - auto odt = ODT(); - odt.mimetype = mimetype; - odt.manifest_rdf = manifest_rdf; - odt.settings_xml = settings_xml; - odt.styles_xml = styles_xml; - odt.content_xml = content_xml(doc_abstraction, doc_matters); - odt.manifest_xml = manifest_xml(doc_matters); - odt.meta_xml = meta_xml(doc_matters); - odt.writeOutputODT(doc_matters); - dirtree(doc_matters); - images_cp(doc_matters); // copy images - } -} diff --git a/src/sisudoc/io_out/package.d b/src/sisudoc/io_out/package.d deleted file mode 100644 index e0512dc..0000000 --- a/src/sisudoc/io_out/package.d +++ /dev/null @@ -1,67 +0,0 @@ -/+ -- Name: SisuDoc Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 (continuously updated, current 2026) Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -module sisudoc.io_out; -public import std.algorithm; -public import std.array; -public import std.container; -public import std.exception; -public import std.path; -public import std.process; -public import std.range; -public import std.regex; -public import std.stdio; -public import std.string; -public import std.typecons; -// public import std.uni; -public import std.utf; -public import sisudoc.share.defaults; -public import sisudoc.io_in.paths_source; -public import sisudoc.io_out.defaults; -public import sisudoc.io_out.paths_output; diff --git a/src/sisudoc/io_out/paths_output.d b/src/sisudoc/io_out/paths_output.d deleted file mode 100644 index a9d0928..0000000 --- a/src/sisudoc/io_out/paths_output.d +++ /dev/null @@ -1,719 +0,0 @@ -/+ -- Name: SisuDoc Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 (continuously updated, current 2026) Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -/++ - default settings -+/ -module sisudoc.io_out.paths_output; -@safe: -import std.array; -import std.path; -import std.regex; -import std.stdio; -import sisudoc.meta.rgx_files; -template spineOutPaths() { - auto spineOutPaths()( - string output_pth_root, - string lng = "", - ) { - struct _PathsStruct { - string output_root() { - return (output_pth_root.length > 0) - ? output_pth_root : ""; - } - string output_base() { - return ((output_root.chainPath(lng)).asNormalizedPath).array; - } - string internal_base() { - return lng.asNormalizedPath.array; - } - } - return _PathsStruct(); - } -} -template spineOutPathSQLite() { - auto spineOutPathSQLite(Po)( - Po output_pth_root, - ) { - struct _PathsStruct { - string output_root() { - return (output_pth_root.length > 0) - ? output_pth_root : ""; - } - string output_base() { - return ((output_root).asNormalizedPath).array; - } - } - return _PathsStruct(); - } -} -template spineOutPathSQLiteCGI() { - auto spineOutPathSQLiteCGI(Po)( - Po output_pth_root, - ) { - struct _PathsStruct { - string output_root() { - return (output_pth_root.length > 0) - ? output_pth_root : ""; - } - string output_base() { - return ((output_root).asNormalizedPath).array; - } - } - return _PathsStruct(); - } -} -template spineOutPathsFnPd() { - /+ TODO stuff to work out here +/ - auto spineOutPathsFnPd(Fn,Pn)( - Fn fn_src_pth, - Pn pod_name_with_path - ) { - struct _PathsStruct { - string base_filename() { - return fn_src_pth.baseName.stripExtension; - } - string base_pod_and_filename() { // TODO - /+ - - if pod, - - pod_name - - file_name - - if pod_name == file_name - - file_name - - else if pod_name != file_name - - pod_name.file_name - +/ - string _fn_src = fn_src_pth.baseName.stripExtension; - string _output_base_name; - if (!(pod_name_with_path.empty)) { - if (pod_name_with_path == _fn_src) { - _output_base_name = _fn_src; - } else { - _output_base_name = pod_name_with_path ~ "." ~ _fn_src; - } - } else { - _output_base_name = _fn_src; - } - return _output_base_name; - } - } - return _PathsStruct(); - } -} - -template spineDocRootTreeHTML() { - auto spineDocRootTreeHTML()(string lng) { - auto lng_pth = spineOutPaths!()("", lng); - string base_dir = "html"; - string suffix = ".html"; - struct _PathsStruct { - string base_filename(string fn_src) { - return fn_src.baseName.stripExtension; - } - string base_filename_scroll(string fn_src) { - return base_filename(fn_src); - } - string base_filename_seg(string fn_src) { - return base_filename(fn_src); - } - string doc_root() { - return ((lng_pth.output_root).asNormalizedPath).array; - } - string base() { - return (((lng).chainPath(base_dir)).asNormalizedPath).array; - } - string image() { - return (("image").asNormalizedPath).array; - } - string css() { - return (("css").asNormalizedPath).array; - } - string fn_seg_css() { - return ((css.chainPath("html_seg.css")).asNormalizedPath).array; - } - string fn_scroll_css() { - return ((css.chainPath("html_scroll.css")).asNormalizedPath).array; - } - string seg(string fn_src) { - return ((base.chainPath(base_filename_seg(fn_src))).asNormalizedPath).array; - } - string fn_metadata(string fn_src) { - return ((base.chainPath("metadata." ~ base_filename_scroll(fn_src) ~ suffix)).asNormalizedPath).array; - } - string fn_scroll(string fn_src) { - return ((base.chainPath(base_filename_scroll(fn_src) ~ suffix)).asNormalizedPath).array; - } - string fn_seg(string fn_src, string seg_filename) { - return ((seg(fn_src).chainPath(seg_filename ~ suffix)).asNormalizedPath).array; - } - string tail_seg(string fn_src) { - return lng ~ "/html/" ~ base_filename_seg(fn_src); - } - string tail_fn_scroll(string fn_src) { - return lng ~ "/html/" ~ base_filename_scroll(fn_src) ~ suffix; - } - string tail_fn_seg(string fn_src, string seg_filename) { - return lng ~ "/html/" ~ seg(fn_src) ~ "/" ~ seg_filename ~ suffix; - } - } - return _PathsStruct(); - } -} -template spinePathsHTML() { - auto spinePathsHTML()( - string output_path_root, - string lng, - ) { - auto doc_tree = spineDocRootTreeHTML!()(lng); - string base_dir = "html"; - string suffix = ".html"; - struct _PathsStruct { - string doc_root() { - return ((output_path_root.chainPath(doc_tree.doc_root)).asNormalizedPath).array; - } - string curate(string fn_curate) { - return doc_root ~ "/" ~ fn_curate; - } - string internal_base() { - return ((doc_tree.base).asNormalizedPath).array; - } - string base() { - return ((output_path_root.chainPath(doc_tree.base)).asNormalizedPath).array; - } - string image() { - return ((output_path_root.chainPath(doc_tree.image)).asNormalizedPath).array; - } - string css() { - return ((output_path_root.chainPath(doc_tree.css)).asNormalizedPath).array; - } - string fn_seg_css() { - return ((output_path_root.chainPath(doc_tree.fn_seg_css)).asNormalizedPath).array; - } - string fn_scroll_css() { - return ((output_path_root.chainPath(doc_tree.fn_scroll_css)).asNormalizedPath).array; - } - string seg(string fn_src) { - return ((output_path_root.chainPath(doc_tree.seg(fn_src))).asNormalizedPath).array; - } - string fn_metadata(string fn_src) { - return ((output_path_root.chainPath(doc_tree.fn_metadata(fn_src))).asNormalizedPath).array; - } - string fn_scroll(string fn_src) { - return ((output_path_root.chainPath(doc_tree.fn_scroll(fn_src))).asNormalizedPath).array; - } - string fn_seg(string fn_src, string seg_filename) { - return ((output_path_root.chainPath(doc_tree.fn_seg(fn_src, seg_filename))).asNormalizedPath).array; - } - string tail_seg(string fn_src) { - return doc_tree.tail_seg(fn_src); - } - string tail_fn_scroll(string fn_src) { - return doc_tree.tail_fn_scroll(fn_src); - } - string tail_fn_seg(string fn_src, string seg_filename) { - return doc_tree.tail_fn_seg(fn_src, seg_filename); - } - } - return _PathsStruct(); - } -} -template spineUrlsHTML() { - import std.format; - auto spineUrlsHTML()( - string url_doc_root, - string lng, - ) { - auto doc_tree = spineDocRootTreeHTML!()(lng); - string base_dir = "html"; - string suffix = ".html"; - struct _PathsStruct { - string doc_root() { - return url_doc_root ~ ((doc_tree.doc_root).asNormalizedPath).array; - } - string curate(string fn_curate) { - return format(q"┃%s/%s┃", - doc_root, - fn_curate, - ); - } - string base() { - return format(q"┃%s/%s┃", - url_doc_root, - ((doc_tree.base).asNormalizedPath).array, - ); - } - string image() { - return format(q"┃%s/%s┃", - url_doc_root, - ((doc_tree.image).asNormalizedPath).array, - ); - } - string css() { - return format(q"┃%s/%s┃", - url_doc_root, - ((doc_tree.css).asNormalizedPath).array, - ); - } - string fn_seg_css() { - return format(q"┃%s/%s┃", - url_doc_root, - ((doc_tree.fn_seg_css).asNormalizedPath).array, - ); - } - string fn_scroll_css() { - return format(q"┃%s/%s┃", - url_doc_root, - ((doc_tree.fn_scroll_css).asNormalizedPath).array, - ); - } - string seg(string fn_src) { - return format(q"┃%s/%s┃", - url_doc_root, - ((doc_tree.seg(fn_src)).asNormalizedPath).array, - ); - } - string fn_metadata(string fn_src) { - return format(q"┃%s/%s┃", - url_doc_root, - ((doc_tree.fn_metadata(fn_src)).asNormalizedPath).array, - ); - } - string fn_scroll(string fn_src) { - return format(q"┃%s/%s┃", - url_doc_root, - ((doc_tree.fn_scroll(fn_src)).asNormalizedPath).array, - ); - } - string fn_seg(string fn_src, string seg_filename) { - return format(q"┃%s/%s┃", - url_doc_root, - ((doc_tree.fn_seg(fn_src, seg_filename)).asNormalizedPath).array, - ); - } - string fn_scroll_obj_num(string fn_src, string obj_num) { - return format(q"┃%s/%s#%s┃", - url_doc_root, - ((doc_tree.fn_scroll(fn_src)).asNormalizedPath).array, - obj_num, - ); - } - string fn_seg_obj_num(string fn_src, string seg_filename, string obj_num) { - return format(q"┃%s/%s#%s┃", - url_doc_root, - ((doc_tree.fn_seg(fn_src, seg_filename)).asNormalizedPath).array, - obj_num, - ); - } - string tail_seg(string fn_src) { - return doc_tree.tail_seg(fn_src); - } - string tail_fn_scroll(string fn_src) { - return doc_tree.tail_fn_scroll(fn_src); - } - string tail_fn_seg(string fn_src, string seg_filename) { - return doc_tree.tail_fn_seg(fn_src, seg_filename); - } - } - return _PathsStruct(); - } -} -template spinePathsEPUB() { - auto spinePathsEPUB()( - string output_pth_root, - string lng, - ) { - auto out_pth = spineOutPaths!()(output_pth_root, lng); - string base_dir = "epub"; - struct _PathsStruct { - string internal_base() { - return (((out_pth.internal_base).chainPath(base_dir)).asNormalizedPath).array; - } - string base() { - return (((out_pth.output_base).chainPath(base_dir)).asNormalizedPath).array; - } - string base_filename(string fn_src) { - return fn_src.baseName.stripExtension; - } - string base_filename_epub(string fn_src) { - return base_filename(fn_src) ~ "." ~ lng; - } - string doc_meta_inf() { - return (("META-INF").asNormalizedPath).array; - } - string doc_oebps() { - return (("OEBPS").asNormalizedPath).array; - } - string doc_oebps_css() { - return ((doc_oebps.chainPath("Styles")).asNormalizedPath).array; - } - string doc_oebps_image() { - return ((doc_oebps.chainPath("image")).asNormalizedPath).array; - } - string epub_file(string fn_src) { - return ((base.chainPath(base_filename_epub(fn_src) ~ ".epub")).asNormalizedPath).array; - } - string dirtop() { - return "".chainPath("").array; - } - string fn_mimetypes() { - return ((dirtop.chainPath("mimetype")).asNormalizedPath).array; - } - string fn_dmi_container_xml() { - return ((doc_meta_inf.chainPath("container.xml")).asNormalizedPath).array; - } - string fn_oebps_toc_nav_xhtml() { - return ((doc_oebps.chainPath("toc_nav.xhtml")).asNormalizedPath).array; - } - string fn_oebps_toc_ncx() { - return ((doc_oebps.chainPath("toc.ncx")).asNormalizedPath).array; - } - string fn_oebps_content_opf() { - return ((doc_oebps.chainPath("content.opf")).asNormalizedPath).array; - } - string fn_oebps_content_xhtml(string seg_filename) { - return ((doc_oebps.chainPath(seg_filename ~ ".xhtml")).asNormalizedPath).array; - } - string fn_oebps_css() { - return ((doc_oebps_css.chainPath("epub.css")).asNormalizedPath).array; - } - /+ debug +/ - string dbg_docdir(string fn_src) { - return base.chainPath(base_filename(fn_src)).array; - } - string dbg_docdir_oebps(string fn_src) { - return dbg_docdir(fn_src).chainPath("OEBPS").array; - } - string dbg_doc_meta_inf(string fn_src) { - return dbg_docdir(fn_src).chainPath("META-INF").array; - } - string dbg_doc_oebps(string fn_src) { - return dbg_docdir(fn_src).chainPath("OEBPS").array; - } - string dbg_doc_oebps_css(string fn_src) { - return dbg_doc_oebps(fn_src).chainPath("Styles").array; - } - string dbg_doc_oebps_image(string fn_src) { - return dbg_doc_oebps(fn_src).chainPath("image").array; - } - string dbg_fn_mimetypes(string fn_src) { - return dbg_docdir(fn_src).chainPath("mimetype").array; - } - string dbg_fn_dmi_container_xml(string fn_src) { - return dbg_doc_meta_inf(fn_src).chainPath("container.xml").array; - } - string dbg_fn_oebps_toc_nav_xhtml(string fn_src) { - return dbg_docdir_oebps(fn_src).chainPath("toc_nav.xhtml").array; - } - string dbg_fn_oebps_toc_ncx(string fn_src) { - return dbg_docdir_oebps(fn_src).chainPath("toc.ncx").array; - } - string dbg_fn_oebps_content_opf(string fn_src) { - return dbg_docdir_oebps(fn_src).chainPath("content.opf").array; - } - string dbg_fn_oebps_content_xhtml(string fn_src, string seg_filename) { - return dbg_docdir_oebps(fn_src).chainPath(seg_filename ~ ".xhtml").array; - } - string dbg_fn_oebps_css(string fn_src) { - return dbg_doc_oebps_css(fn_src).chainPath("epub.css").array; - } - } - return _PathsStruct(); - } -} -template spinePathsODT() { - import std.conv; - auto spinePathsODT(M)( - M doc_matters, - ) { - auto out_pth = spineOutPaths!()(doc_matters.output_path, doc_matters.src.language); - string base_dir = "odf"; - struct _PathsStruct { - string base_pth() { // dir will contain odt document file (also debug file tree) - return (((out_pth.output_base).chainPath(base_dir)).asNormalizedPath).array; - } - string odt_file() { - return ((base_pth.chainPath(doc_matters.src.doc_uid_out ~ ".odt")).asNormalizedPath).array; - } - string dirtop(string type) { - return (type == "zip") - ? "" // ".chainPath("").array - : ((base_pth.chainPath(doc_matters.src.doc_uid_out)).asNormalizedPath).array.to!string; - } - string mimetype(string type="fs") { - assert(type == "zip" || "fs"); - return ((dirtop(type).chainPath("mimetype")).asNormalizedPath).array; - } - string manifest_rdf(string type="fs") { - assert(type == "zip" || "fs"); - return ((dirtop(type).chainPath("manifest.rdf")).asNormalizedPath).array; - } - string settings_xml(string type="fs") { - assert(type == "zip" || "fs"); - return ((dirtop(type).chainPath("settings.xml")).asNormalizedPath).array; - } - string styles_xml(string type="fs") { - assert(type == "zip" || "fs"); - return ((dirtop(type).chainPath("styles.xml")).asNormalizedPath).array; - } - string image_dir(string type="fs") { - assert(type == "zip" || "fs"); - return ((dirtop(type).chainPath("Pictures")).asNormalizedPath).array; - } - string image(string image_fn_src, string type="fs") { - assert(type == "zip" || "fs"); - return ((image_dir(type).chainPath(image_fn_src)).asNormalizedPath).array; - } - string content_xml(string type="fs") { - assert(type == "zip" || "fs"); - return ((dirtop(type).chainPath("content.xml")).asNormalizedPath).array; - } - string meta_inf_dir(string type="fs") { - assert(type == "zip" || "fs"); - return ((dirtop(type).chainPath("META-INF")).asNormalizedPath).array; - } - string manifest_xml(string type="fs") { - assert(type == "zip" || "fs"); - return ((meta_inf_dir(type).chainPath("manifest.xml")).asNormalizedPath).array; - } - string meta_xml(string type="fs") { - assert(type == "zip" || "fs"); - return ((dirtop(type).chainPath("meta.xml")).asNormalizedPath).array; - } - } - return _PathsStruct(); - } -} -template spinePathsPDF() { - auto spinePathsPDF(M)( - M doc_matters, - ) { - struct _PathsStruct { - string base_filename(string fn_src) { - return fn_src.baseName.stripExtension; - } - auto out_pth() { - string output_dir = doc_matters.output_path ~ "/pdf"; - return spineOutPaths!()(output_dir); - } - string base() { - return (((out_pth.output_root).chainPath("pdf")).asNormalizedPath).array; - } - string pdf_path_stuff() { - return ((base.chainPath(base_filename(doc_matters.src.filename))).asNormalizedPath).array; - } - } - return _PathsStruct(); - } -} -template spinePathsLaTeX() { - auto spinePathsLaTeX(M)( - M doc_matters, - ) { - struct _PathsStruct { - string base_filename(string fn_src) { - return fn_src.baseName.stripExtension; - } - auto out_pth() { - return spineOutPaths!()(doc_matters.output_path, doc_matters.src.language); - } - string base() { - return (((out_pth.output_root).chainPath("latex")).asNormalizedPath).array; - } - string base_sty() { - return (((out_pth.output_root).chainPath("latex").chainPath("sty")).asNormalizedPath).array; - } - string latex_path_stuff() { - return ((base.chainPath(base_filename(doc_matters.src.filename))).asNormalizedPath).array; - } - string latex_file_with_path(string paper_size_orientation) { - return ((base.chainPath(base_filename(doc_matters.src.filename) - ~ "." ~ doc_matters.src.language - ~ "." ~ paper_size_orientation - ~ ".tex") - ).asNormalizedPath).array; - } - string latex_sty_with_path(string paper_size_orientation) { // spineA4portrait.sty - return ((base_sty.chainPath("spine" - ~ paper_size_orientation - ~ ".sty") - ).asNormalizedPath).array; - } - string latex_sty_with_path_static() { // spineShared.sty - return ((base_sty.chainPath("spineShared.sty")).asNormalizedPath).array; - } - string images() { - string image_dir = "image"; - return (((base).chainPath(image_dir)).asNormalizedPath).array; - } - } - return _PathsStruct(); - } -} -template spinePathsLaTeXsty() { - auto spinePathsLaTeXsty(string output_dir) { - struct _PathsStruct { - auto out_pth() { - return spineOutPaths!()(output_dir); - } - string base() { - return (((out_pth.output_root).chainPath("latex")).asNormalizedPath).array; - } - string base_sty() { - return (((out_pth.output_root).chainPath("latex").chainPath("sty")).asNormalizedPath).array; - } - string latex_sty_with_path(string paper_size_orientation) { // spineA4portrait.sty - return ((base_sty.chainPath("spine" - ~ paper_size_orientation - ~ ".sty") - ).asNormalizedPath).array; - } - string latex_sty_with_path_static() { // spineShared.sty - return ((base_sty.chainPath("spineShared.sty")).asNormalizedPath).array; - } - string latex_document_header_sty(string filename) { // spineShared.sty - return ((base_sty.chainPath(filename)).asNormalizedPath).array; - } - } - return _PathsStruct(); - } -} -template spinePathsSQLiteDiscrete() { - auto spinePathsSQLiteDiscrete()( - string output_pth_root, - string lng, - ) { - struct _PathsStruct { - string base_filename(string fn_src) { - return fn_src.baseName.stripExtension; - } - string base() { - auto out_pth = spineOutPaths!()(output_pth_root, lng); - string base_dir = "sqlite"; - return (((out_pth.output_base).chainPath(base_dir)).asNormalizedPath).array; - } - string seg(string fn_src) { - return ((base.chainPath(base_filename(fn_src))).asNormalizedPath).array; - } - string sqlite_file(string fn_src) { - return ((base.chainPath(base_filename(fn_src) ~ ".sql.db")).asNormalizedPath).array; - } - } - return _PathsStruct(); - } -} -template spinePathsSQLite() { - auto spinePathsSQLite()( - string db_name, - string output_pth_root, - ) { - struct _PathsStruct { - string base_filename(string fn_src) { - return fn_src.baseName.stripExtension; - } - string base() { - auto out_pth = spineOutPathSQLite!()(output_pth_root); // decide whether to have separate files for each language - string base_dir = ""; - return (((out_pth.output_root).chainPath(base_dir)).asNormalizedPath).array; - } - string sqlite_file() { - return (base.chainPath(db_name).asNormalizedPath).array; - } - } - return _PathsStruct(); - } -} - -template spinePathsText() { - import std.conv; - auto spinePathsText(M)( - M doc_matters, - ) { - auto out_pth = spineOutPaths!()(doc_matters.output_path, doc_matters.src.language); - string base_dir = "text"; - struct _PathsStruct { - string base_pth() { - return (((out_pth.output_base).chainPath(base_dir)).asNormalizedPath).array; - } - string base_filename(string fn_src) { - return fn_src.baseName.stripExtension; - } - string text_file() { - return ((base_pth.chainPath(doc_matters.src.doc_uid_out ~ ".txt")).asNormalizedPath).array; - } - string dirtop() { - return "".chainPath("").array; - } - } - return _PathsStruct(); - } -} -template spinePathsSkel() { - import std.conv; - auto spinePathsSkel(M)( - M doc_matters, - ) { - auto out_pth = spineOutPaths!()(doc_matters.output_path, doc_matters.src.language); - string base_dir = "skel"; - struct _PathsStruct { - string base_pth() { - return (((out_pth.output_base).chainPath(base_dir)).asNormalizedPath).array; - } - string base_filename(string fn_src) { - return fn_src.baseName.stripExtension; - } - string skel_file() { - return ((base_pth.chainPath(doc_matters.src.doc_uid_out ~ ".skel")).asNormalizedPath).array; - } - string dirtop() { - return "".chainPath("").array; - } - } - return _PathsStruct(); - } -} diff --git a/src/sisudoc/io_out/rgx.d b/src/sisudoc/io_out/rgx.d deleted file mode 100644 index 384222c..0000000 --- a/src/sisudoc/io_out/rgx.d +++ /dev/null @@ -1,159 +0,0 @@ -/+ -- Name: SisuDoc Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 (continuously updated, current 2026) Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -/++ - regex: regular expressions used in sisu document parser -+/ -module sisudoc.io_out.rgx; -@safe: -static template spineRgxOut() { - static struct RgxO { - static make_breakpage = ctRegex!(`new=(?P<breakpage>.+?)(?:;|$)`); - static make_breakcolumn = ctRegex!(`break=(?P<breakcolumn>.+?)(?:;|$)`,); - static newline = ctRegex!("\n", "mg"); - static space = ctRegex!(`[ ]`, "mg"); - static spaces_keep = ctRegex!(`(?P<keep_spaces>^[ ]+|[ ]{2,})`, "mg"); // code, verse, block - static spaces_line_start = ctRegex!(`^(?P<opening_spaces>[ ]+)`, "mg"); - static nbsp_char = ctRegex!(`░`, "mg"); - static nbsp_chars = ctRegex!(`[░]+`, "mg"); - static middle_dot = ctRegex!(`·`, "mg"); - static src_pth_sst_or_ssm = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.](?P<extension>ss[tm]))$`); - static src_pth_pod_sst_or_ssm = ctRegex!(`^(?P<podpath>[/]?(?:[a-zA-Z0-9._-]+/)*)media/text/[a-z]{2}/(?P<filename>[a-zA-Z0-9][a-zA-Z0-9._-]*?[.]ss[tm])$`); - static src_pth_contents = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9][a-zA-Z0-9._-]*)/pod[.]manifest$`); - static src_pth_zip = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]zip)$`); - static src_pth_types = ctRegex!(`^(?P<path>[/]?[a-zA-Z0-9._-]+/)*(?P<gotfile>(?P<filename>[a-zA-Z0-9._-]+[.]ss[tm])|(?P<filelist>[a-zA-Z0-9._-]+/pod[.]manifest)|(?P<filezip>[a-zA-Z0-9._-]+[.]zip))$`); - static src_fn = ctRegex!(`^([/]?(?:[a-zA-Z0-9._-]+/)*)(?P<fn_src>(?P<fn_base>[a-zA-Z0-9._-]+)[.](?P<fn_src_suffix>ss[tm]))$`); - static src_fn_master = ctRegex!(`^(?P<path>/?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]ssm)$`); - static src_fn_find_inserts = ctRegex!(`^(?P<path>/?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]ss[im])$`); - static insert_src_fn_ssi_or_sst = ctRegex!(`^<<\s*(?P<path>[a-zA-Z0-9._-]+/)*(?P<filename>[a-zA-Z0-9._-]+[.]ss[ti])$`); - static src_base_parent_dir_name = ctRegex!(`[/](?P<dir>(?:[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure - static src_formalised_file_path_parts = ctRegex!(`(?P<pth>(?:[/a-zA-Z0-9._-]+?)(?P<dir>[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure - /+ line breaks +/ - static br_empty_line = ctRegex!(`\n[ ]*\n`, "mg"); - static br_linebreaks_newlines = ctRegex!(`[\n┘┙]`, "mg"); - static br_linebreaks = ctRegex!(`[┘┙]`, "mg"); - static br_line = ctRegex!(`\s*┘\s*`, "mg"); - static br_line_inline = ctRegex!(`\s*┙\s*`, "mg"); - static br_line_spaced = ctRegex!(`\s*┚\s*`, "mg"); - /+ quotation marks +/ - static quotes_open_and_close = ctRegex!(`[“”]`, "mg"); - /+ inline markup footnotes endnotes +/ - static inline_notes_al = ctRegex!(`【(?:[*+]\s+|\s*)(.+?)】`, "mg"); - static inline_notes_al_special = ctRegex!(`【(?:[*+]\s+)(.+?)】`, "mg"); // TODO remove match when special footnotes are implemented - static inline_notes_al_gen = ctRegex!(`【.+?】`, "m"); - static inline_notes_al_gen_text = ctRegex!(`【(?P<text>.+?)】`, "m"); - static inline_notes_al_all_note = ctRegex!(`【(?P<num>\d+|(?:[*]|[+])+)\s+(?P<note>.+?)\s*】`, "mg"); - static inline_notes_al_regular_number_note = ctRegex!(`【(?P<num>\d+)\s+(?P<note>.+?)\s*】`, "mg"); - static inline_notes_al_special_char_note = ctRegex!(`【(?P<char>(?:[*]|[+])+)\s+(?P<note>.+?)】`, "mg"); - static inline_al_delimiter_open_regular = ctRegex!(`【\s`, "m"); - static inline_al_delimiter_open_symbol_star = ctRegex!(`【[*]\s`, "m"); - static inline_al_delimiter_open_symbol_plus = ctRegex!(`【[+]\s`, "m"); - static inline_text_and_note_al_ = ctRegex!(`(.+?(?:【[*+]*\s+.+?】|.+))`, "mg"); - static endnote_section_note = ctRegex!(`┥\s*⑆\^┨(?P<notenumber>\d+)\.┣\^┝┤(?P<link>¤?.+?)├.+`, "mg"); - /+ inline markup links +/ - static inline_image = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>\d+)h(?P<height>\d+))\s*(?P<post>.*?┝┤.*?├)`, "mg"); - static inline_image_without_dimensions = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>0)h(?P<height>0))\s*(?P<post>.*?┝┤.*?├)`, "mg"); - static inline_image_info = ctRegex!(`☼?(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>\d+)h(?P<height>\d+)`, "mg"); - static inline_link_anchor = ctRegex!(`┃(?P<anchor>\S+?)┃`, "mg"); // TODO *~text_link_anchor - static inline_link = ctRegex!(`┥(?P<text>.+?)┝┤(?P<link>#?(\S+?))├`, "mg"); - static inline_link_empty = ctRegex!(`┥(?P<text>.+?)┝┤├`, "mg"); - static inline_link_number = ctRegex!(`┥(?P<text>.+?)┝┤(?P<num>[0-9]+)├`, "mg"); // not used - static inline_link_number_only = ctRegex!(`(?P<linked_text>┥.+?┝)┤(?P<num>[0-9]+)├`, "mg"); - static inline_link_stow_uri = ctRegex!(`┥(?P<text>.+?)┝┤(?P<link>[^ 0-9#┥┝┤├][^ 0-9┥┝┤├]+)├`, "mg"); // will not stow (stowed links) or object number internal links - static inline_link_hash = ctRegex!(`┥(?P<text>.+?)┝┤(?P<link>#(?P<hash>\S+?))├`, "mg"); - static inline_link_seg_and_hash = ctRegex!(`┥(?P<text>.+?)┝┤(?P<link>(?P<seg>[^/#├]*)#(?P<hash>.+?))├`, "mg"); - static inline_link_clean = ctRegex!(`┤(?:.+?)├|[┥┝]`, "mg"); - static inline_link_toc_to_backmatter = ctRegex!(`┤#(?P<link>endnotes|bibliography|bookindex|glossary|blurb)├`, "mg"); - static find_bookindex_ocn_link_and_comma = ctRegex!(`[, ]*┥.+?┝┤#?\S+?├`, "mg"); - static url = ctRegex!(`https?://`, "mg"); - static uri = ctRegex!(`(?:https?|git)://`, "mg"); - static uri_identify_components = ctRegex!(`(?P<type>(?:https?|git)://)(?P<path>\S+?/)(?P<file>[^/]+)$`, "mg"); - static inline_link_subtoc = ctRegex!(`^(?P<level>[5-7])~ ┥(?P<text>.+?)┝┤(?P<link>.+?)├`, "mg"); - static inline_link_fn_suffix = ctRegex!(`¤(.+?)(\.fnSuffix)`, "mg"); - static inline_seg_link = ctRegex!(`(¤)(?:.+?)\.fnSuffix`, "mg"); - static mark_internal_site_lnk = ctRegex!(`¤`, "mg"); - static quotation_mark_sql_insert_delimiter = ctRegex!("[']", "mg"); - /+ inline markup font face mod +/ - static inline_emphasis = ctRegex!(`⑆[*]┨(?P<text>.+?)┣[*]`, "mg"); - static inline_bold = ctRegex!(`⑆[!]┨(?P<text>.+?)┣[!]`, "mg"); - static inline_underscore = ctRegex!(`⑆[_]┨(?P<text>.+?)┣[_]`, "mg"); - static inline_italics = ctRegex!(`⑆[/]┨(?P<text>.+?)┣[/]`, "mg"); - static inline_superscript = ctRegex!(`⑆\^┨(?P<text>.+?)┣\^`, "mg"); - static inline_subscript = ctRegex!(`⑆[,]┨(?P<text>.+?)┣[,]`, "mg"); - static inline_strike = ctRegex!(`⑆[-]┨(?P<text>.+?)┣[-]`, "mg"); - static inline_insert = ctRegex!(`⑆[+]┨(?P<text>.+?)┣[+]`, "mg"); - static inline_mono = ctRegex!(`⑆[■]┨(?P<text>.+?)┣[■]`, "mg"); - static inline_cite = ctRegex!(`⑆[‖]┨(?P<text>.+?)┣[‖]`, "mg"); - /+ table delimiters +/ - static table_delimiter_col = ctRegex!("[ ]*[┊][ ]*", "mg"); - static table_delimiter_row = ctRegex!("[ ]*\n", "mg"); - /+ paragraph operators +/ - static grouped_para_indent_1 = ctRegex!(`^_1[ ]`, "m"); - static grouped_para_indent_2 = ctRegex!(`^_2[ ]`, "m"); - static grouped_para_indent_3 = ctRegex!(`^_3[ ]`, "m"); - static grouped_para_indent_4 = ctRegex!(`^_4[ ]`, "m"); - static grouped_para_indent_5 = ctRegex!(`^_5[ ]`, "m"); - static grouped_para_indent_6 = ctRegex!(`^_6[ ]`, "m"); - static grouped_para_indent_7 = ctRegex!(`^_7[ ]`, "m"); - static grouped_para_indent_8 = ctRegex!(`^_8[ ]`, "m"); - static grouped_para_indent_9 = ctRegex!(`^_9[ ]`, "m"); - static grouped_para_bullet = ctRegex!(`^_[*] `, "m"); - static grouped_para_bullet_indent_1 = ctRegex!(`^_1[*] `, "m"); - static grouped_para_bullet_indent_2 = ctRegex!(`^_2[*] `, "m"); - static grouped_para_bullet_indent_3 = ctRegex!(`^_3[*] `, "m"); - static grouped_para_bullet_indent_4 = ctRegex!(`^_4[*] `, "m"); - static grouped_para_bullet_indent_5 = ctRegex!(`^_5[*] `, "m"); - static grouped_para_bullet_indent_6 = ctRegex!(`^_6[*] `, "m"); - static grouped_para_bullet_indent_7 = ctRegex!(`^_7[*] `, "m"); - static grouped_para_bullet_indent_8 = ctRegex!(`^_8[*] `, "m"); - static grouped_para_bullet_indent_9 = ctRegex!(`^_9[*] `, "m"); - static grouped_para_bullet_indent = ctRegex!(`^_(?P<indent>[1-9])[*] `, "m"); - static grouped_para_indent_hang = ctRegex!(`^_(?P<hang>[0-9])_(?P<indent>[0-9])[ ]`, "m"); - } -} diff --git a/src/sisudoc/io_out/rgx_latex.d b/src/sisudoc/io_out/rgx_latex.d deleted file mode 100644 index 1ae6147..0000000 --- a/src/sisudoc/io_out/rgx_latex.d +++ /dev/null @@ -1,68 +0,0 @@ -/+ -- Name: SisuDoc Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 (continuously updated, current 2026) Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -/++ - regex: regular expressions used in sisu document parser -+/ -module sisudoc.io_out.rgx_latex; -@safe: -static template spineRgxLSC() { - static struct RgxLSC { - static latex_special_char = ctRegex!(`([%${}_#&\\])`); - static latex_special_char_for_escape = ctRegex!(`([%${}_#\\])`); - static latex_special_char_for_escape_and_braces = ctRegex!(`([&])`); - static latex_special_char_for_escape_url = ctRegex!(`([%])`); - static latex_special_char_escaped = ctRegex!(`\\([%${}_#\\])`); - static latex_special_char_escaped_braced = ctRegex!(`[{]\\([&])[}]`); - static latex_identify_inline_link = ctRegex!(`┥.+?┝┤\S+?├`, "mg"); - static latex_identify_inline_fontface = ctRegex!(`\\([_#$]┨.+?┣)\\([_#$])`, "mg"); - static latex_clean_internal_link = ctRegex!(`^(?:#|¤\S+?#)`, "m"); - static latex_clean_bookindex_linebreak = ctRegex!(`\s*\\\\\\\\\s*`, "m"); - } -} diff --git a/src/sisudoc/io_out/rgx_xhtml.d b/src/sisudoc/io_out/rgx_xhtml.d deleted file mode 100644 index b1b1004..0000000 --- a/src/sisudoc/io_out/rgx_xhtml.d +++ /dev/null @@ -1,63 +0,0 @@ -/+ -- Name: SisuDoc Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 (continuously updated, current 2026) Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -/++ - regex: regular expressions used in sisu document parser -+/ -module sisudoc.io_out.rgx_xhtml; -@safe: -static template spineRgxXHTML() { - static struct RgxXHTML { - static ampersand = ctRegex!(`[&]`, "m"); // & - static quotation = ctRegex!(`["]`, "m"); // " - static less_than = ctRegex!(`[<]`, "m"); // < - static greater_than = ctRegex!(`[>]`, "m"); // > - static line_break = ctRegex!(` [\\]{2}`, "m"); // <br /> - } -} diff --git a/src/sisudoc/io_out/skel.d b/src/sisudoc/io_out/skel.d deleted file mode 100644 index 92e0d52..0000000 --- a/src/sisudoc/io_out/skel.d +++ /dev/null @@ -1,268 +0,0 @@ -/+ -- Name: SisuDoc Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 (continuously updated, current 2026) Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -module sisudoc.io_out.skel; -@safe: -template outputSkel() { - template munge() { - import std.stdio; - import std.conv; - void puts(string _obj_is) { - writeln(__FILE__, ":", __LINE__, ": ", _obj_is); - } - string newline = "\n"; - string newlines = "\n\n"; - string toc(O)(O obj) { - // puts(obj.metainfo.is_a); - // return "toc\n"; - return obj.text ~ newline; - } - string heading(O)(O obj) { - /+ - +/ - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - return obj.text ~ newline ~ "「" ~ obj.metainfo.ocn.to!string ~ "」" ~ newlines; - } - string para(O)(O obj) { - /+ - +/ - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - return obj.text ~ newline ~ "「" ~ obj.metainfo.ocn.to!string ~ "」" ~ newlines; - } - string group(O)(O obj) { - /+ - The "group" is different from the "block" mark in that "group" does not - preserve whitespace, the "block" mark does. The text falling within the - block is a single object. - +/ - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - return obj.text ~ newline ~ "「" ~ obj.metainfo.ocn.to!string ~ "」" ~ newlines; - } - string block(O)(O obj) { - /+ - The "block" is different from the "group" mark in that the "block" mark - (like the "poem" mark) preserves whitespace, the "group" mark does not. - The text falling within the "block" is a single object, which is different - from the "poem" mark where each identified verse is an object. - +/ - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - return obj.text ~ newline ~ "「" ~ obj.metainfo.ocn.to!string ~ "」" ~ newlines; - } - string poem(O)(O obj) { - /+ - The "poem" mark like the "block" preserves whitespace. Text followed by - two newlines are identified as verse and each verse is an object i.e. a - poem may consist of multiple verse each of which is identified as an - object, unlike a text "block" which is identified as a single object. - +/ - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - // return obj.text ~ newline ~ "「" ~ obj.metainfo.ocn.to!string ~ "」" ~ newlines; - return obj.text ~ newlines; - } - string verse(O)(O obj) { - /+ - See description of poem, the poem is demarkated but the verse is the - object. - +/ - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - return obj.text ~ newline ~ "「" ~ obj.metainfo.ocn.to!string ~ "」" ~ newlines; - } - string code(O)(O obj) { - /+ - "Code" blocks are a single text object, in which the original text is - preserved. - +/ - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - return obj.text ~ newline ~ "「" ~ obj.metainfo.ocn.to!string ~ "」" ~ newlines; - } - string quote(O)(O obj) { - /+ - +/ - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - return obj.text ~ newline ~ "「" ~ obj.metainfo.ocn.to!string ~ "」" ~ newlines; - } - string table(O)(O obj) { - /+ - +/ - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - return obj.text ~ newline ~ "「" ~ obj.metainfo.ocn.to!string ~ "」" ~ newlines; - } - string endnote(O)(O obj) { - /+ - +/ - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - return obj.text ~ newlines; - } - string bookindex(O)(O obj) { - /+ - +/ - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - return obj.text ~ newlines; - } - string bibliography(O)(O obj) { - /+ - +/ - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - return obj.text ~ newlines; - } - string glossary(O)(O obj) { - /+ - +/ - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - return obj.text ~ newlines; - } - string blurb(O)(O obj) { - /+ - +/ - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - return obj.text ~ newlines; - } - string comment(O)(O obj) { - /+ - +/ - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - return obj.text ~ newlines; - } - } - template theDocument() { - import std.stdio; - import sisudoc.io_out; - // static auto rgx = RgxO(); - string skel_head(M)( - M doc_matters, - ) { - return "head"; - } - string skel_body(D,M)( - const D doc_abstraction, - M doc_matters, - ) { - string doc_object = ""; - foreach (section; doc_matters.has.keys_seq.scroll) { - foreach (obj; doc_abstraction[section]) { - if (obj.metainfo.is_a == "toc") { doc_object ~= munge!().toc(obj); } - if (obj.metainfo.is_a == "heading") { doc_object ~= munge!().heading(obj); } - if (obj.metainfo.is_a == "para") { doc_object ~= munge!().para(obj); } - if (obj.metainfo.is_a == "group") { doc_object ~= munge!().group(obj); } - if (obj.metainfo.is_a == "block") { doc_object ~= munge!().block(obj); } - if (obj.metainfo.is_a == "poem") { doc_object ~= munge!().poem(obj); } - if (obj.metainfo.is_a == "verse") { doc_object ~= munge!().verse(obj); } - if (obj.metainfo.is_a == "code") { doc_object ~= munge!().code(obj); } - if (obj.metainfo.is_a == "quote") { doc_object ~= munge!().quote(obj); } - if (obj.metainfo.is_a == "table") { doc_object ~= munge!().table(obj); } - if (obj.metainfo.is_a == "endnote") { doc_object ~= munge!().endnote(obj); } - if (obj.metainfo.is_a == "bookindex") { doc_object ~= munge!().bookindex(obj); } - if (obj.metainfo.is_a == "bibliography") { doc_object ~= munge!().bibliography(obj); } - if (obj.metainfo.is_a == "glossary") { doc_object ~= munge!().glossary(obj); } - if (obj.metainfo.is_a == "blurb") { doc_object ~= munge!().blurb(obj); } - if (obj.metainfo.is_a == "comment") { doc_object ~= munge!().comment(obj); } - } - } - return doc_object; - } - string skel_tail(M)( - M doc_matters, - ) { - return "tail"; - } - } - void outputSkel(D,M) ( - const D doc_abstraction, - M doc_matters, - ) { - import std.stdio; - import sisudoc.io_out; - void skel_out(D,M)( - const D doc_abstraction, - M doc_matters, - ) { - struct Skel { - string head; - string content; - string tail; - } - auto skel = Skel(); - skel.head = theDocument!().skel_head(doc_matters); - skel.content = theDocument!().skel_body(doc_abstraction, doc_matters); - skel.tail = theDocument!().skel_tail(doc_matters); - auto pth_skel = spinePathsSkel(doc_matters); - try { - import std.file; - if (!exists(pth_skel.base_pth)) { - (pth_skel.base_pth).mkdirRecurse; - } - } catch (ErrnoException ex) { - } - if (doc_matters.opt.action.vox_gt_1) { - writeln(" ", pth_skel.skel_file); - } - // writeln(pth_skel.base_pth); - auto f = File(pth_skel.skel_file, "w"); - f.writeln(skel.head); - f.writeln(skel.content); - f.writeln(skel.tail); - } - skel_out(doc_abstraction, doc_matters); - } -} diff --git a/src/sisudoc/io_out/source_pod.d b/src/sisudoc/io_out/source_pod.d deleted file mode 100644 index b015a04..0000000 --- a/src/sisudoc/io_out/source_pod.d +++ /dev/null @@ -1,544 +0,0 @@ -/+ -- Name: SisuDoc Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 (continuously updated, current 2026) Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -module sisudoc.io_out.source_pod; -@system: // is not @safe: use: @system: or @trusted: -template spinePod() { - import std.digest.sha; - import std.file; - import std.outbuffer; - import std.zip; - import std.conv : to; - import sisudoc.meta.rgx_files; - import sisudoc.io_out; - import sisudoc.io_out.create_zip_file; - import sisudoc.io_out.xmls; - void spinePod(T)(T doc_matters) { - debug(asserts) { - // static assert(is(typeof(doc_matters) == tuple)); - } - mixin spineRgxFiles; - string pwd = doc_matters.env.pwd; - auto 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)); - if (doc_matters.opt.action.source_or_pod) { - try { - /+ ↓ clean slate: remove per-document pod directory before regeneration, - but only on the first language of a multi-language document, - so that subsequent languages' files are not wiped +/ - if (doc_matters.src.language == doc_matters.pod.manifest_list_of_languages[0]) { - string doc_pod_dir = pths_pod.base_filesystem_(doc_matters.src.filename); - if (exists(doc_pod_dir) && doc_pod_dir.isDir) { - doc_pod_dir.rmdirRecurse; - } - } - { - podArchive_directory_tree(doc_matters, pths_pod); - } - { - struct STsrcDigests { - std.zip.ZipArchive zip; - string fn_pod; - string[string][string] digests; - } - STsrcDigests _st; - _st = pod_zipMakeReady(doc_matters, pths_pod, _st); - { - zipArchive(doc_matters, _st.fn_pod, _st.zip); - if (doc_matters.src.language == doc_matters.pod.manifest_list_of_languages[$-1]) { - zipArchiveDigest(doc_matters, _st.fn_pod, _st.digests); - } - } - } - } catch (ErrnoException ex) { - // Handle error - } - } - } - void podArchive_directory_tree(M,P)(M doc_matters, P pths_pod) { // 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_gt_1) { 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 (doc_matters.opt.action.pod2) { - if (!exists(pths_pod.abstraction_root(doc_matters.src.filename).filesystem_open_zpod)) { - pths_pod.abstraction_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse; - } - } - if (!exists(pths_pod.image_root(doc_matters.src.filename).filesystem_open_zpod)) { - pths_pod.image_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse; - } - if (!exists(pths_pod.doc_lng(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod)) { - pths_pod.doc_lng(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod.mkdirRecurse; - } - } - if (!exists(pths_pod.pod_dir_() ~ "/index.html")) { - import sisudoc.io_out.html_snippet; - mixin htmlSnippet; - auto f = File(pths_pod.pod_dir_() ~"/index.html", "w"); - f.writeln(format_html_blank_page_guide_home( - "../../css/html_scroll.css", - (doc_matters.opt.action.webserver_url_doc_root.length > 0) - ? doc_matters.opt.action.webserver_url_doc_root - : doc_matters.conf_make_meta.conf.w_srv_data_root_url, - "../../index.html", - )); - } - } - auto pod_zipMakeReady(M,P,S)(M doc_matters, P pths_pod, S _st) { - auto pth_dr_doc_src = doc_matters.src_path_info; - if (doc_matters.opt.action.vox_gt_3) { // correct - writeln(__LINE__, ":", __FILE__, ":\n", - doc_matters.src.filename, " -> ", - pths_pod.fn_doc(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod - ); - } - auto zip = new ZipArchive(); // needed - auto fn_pod = pths_pod.pod_filename(doc_matters.src.filename).zpod; - string[string][string] _digests; - { // bundle images - get digest - foreach (image; doc_matters.srcs.image_list) { - if (doc_matters.opt.action.vox_gt_3) { - 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); } - { // take DIGEST write to pod file digests.txt - auto data = (cast(byte[]) (fn_src_in).read); - _digests["shared"]["images"] ~= data.sha256Of.toHexString ~ "::" ~ data.length.to!string ~ " - " ~ image ~ "\n"; - // writeln(data.sha256Of.toHexString, "::", data.length, " - ", image); - } - if (doc_matters.opt.action.source_or_pod) { - fn_src_in.copy(fn_src_out_filesystem); - } - if (doc_matters.opt.action.source_or_pod) { - zip = podArchive("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_gt_2) { - writeln("WARNING (io) src out NOT found (image): ", fn_src_in); - } - } - } - } { // bundle abstraction .ssp file (only for --pod2) - if (doc_matters.opt.action.pod2) { - if (doc_matters.src.language == doc_matters.pod.manifest_list_of_languages[$-1]) { // wait until all language versions of .ssp generated - import sisudoc.io_out.paths_output; - /+ doc_uid_out for any language follows the same pattern, differing - only in the trailing ".{lng}". Strip the current language to - reuse the base across all languages. +/ - string _doc_uid_base - = doc_matters.src.doc_uid_out[0 .. $ - doc_matters.src.lng.length]; - foreach (_lang; doc_matters.pod.manifest_list_of_languages) { // do for all language versions - auto out_pth_lng = spineOutPaths!()(doc_matters.output_path, _lang); - string abstraction_dir = ((out_pth_lng.output_base.chainPath("abstraction")).asNormalizedPath).array; - string ssp_filename = _doc_uid_base ~ _lang ~ ".ssp"; - string fn_src_in = ((abstraction_dir.chainPath(ssp_filename)).asNormalizedPath).array.to!string; - auto fn_src_out_pod_zip_base - = pths_pod.abstraction_root(doc_matters.src.filename).zpod.to!string - ~ "/" ~ ssp_filename; - auto fn_src_out_filesystem - = pths_pod.abstraction_root(doc_matters.src.filename).filesystem_open_zpod.to!string - ~ "/" ~ ssp_filename; - if (exists(fn_src_in)) { - debug(io) { writeln("(io debug) src out found: ", fn_src_in); } - { // take DIGEST write to pod file digests.txt - auto data = (cast(byte[]) (fn_src_in).read); - _digests[_lang]["ssp"] ~= data.sha256Of.toHexString - ~ "::" ~ data.length.to!string ~ " - " ~ ssp_filename ~ "\n"; - } - fn_src_in.copy(fn_src_out_filesystem); - zip = podArchive("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_gt_2) { - writeln("WARNING (io) src out NOT found (abstraction): ", 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.source_or_pod) { - zip = podArchive("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_gt_2) { - 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_gt_2) { - 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.source_or_pod) { - zip = podArchive("string", _pm, fn_src_out_pod_zip_base, zip); - } - } - } - } { // bundle primary file (.ssm/.sst) - get digest - 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 (doc_matters.src.language == doc_matters.pod.manifest_list_of_languages[$-1]) { // wait until all language versions of .ssm parsed - foreach (_lang; doc_matters.pod.manifest_list_of_languages) { // do for all language versions - string fn_src_out_filesystem_lng - = pths_pod.fn_doc(doc_matters.src.filename, _lang).filesystem_open_zpod.to!string; - string _sstm = (doc_matters.pod.manifest_path ~ "/media/text/" ~ _lang ~ "/" ~ doc_matters.src.filename); - string _pth_file_sstm; - if (exists(_sstm)) { _pth_file_sstm = _sstm; - } else if (exists(fn_src_in)) { _pth_file_sstm = fn_src_in; - } - if (exists(_pth_file_sstm)) { // what of language? - debug(io) { writeln("(io debug) src in found: ", _pth_file_sstm); } - { // take DIGEST write to pod file digests.txt - auto data = (cast(byte[]) (_pth_file_sstm).read); - _digests[_lang]["sstm"] ~= data.sha256Of.toHexString ~ "::" ~ data.length.to!string ~ " - " ~ doc_matters.src.filename ~ " - [" ~ _lang ~ "]"; - // writeln(data.sha256Of.toHexString, "::", data.length, " - ", doc_matters.src.filename); - } - 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/" ~ _lang ~ "/" ~ doc_matters.src.filename; - if (doc_matters.opt.action.source_or_pod) { - _pth_file_sstm.copy(fn_src_out_filesystem_lng); - } - if (doc_matters.opt.action.source_or_pod) { - auto _rgx_sstm = regex(r"(?P<path_to_pod>\S+?)(?P<podname>[a-z_-]+)/(?P<from_root>media/text/)(?P<language>\S+?)/(?P<filename>\S+?\.ss[mt])"); - if (auto _x = _pth_file_sstm.match(_rgx_sstm)){ - if (doc_matters.src.lng == doc_matters.pod.manifest_list_of_languages[$-1]) { // again wait until all language versions of .ssm parsed - 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"]; // .ssi inserts expected to have same name across languages - string _filename = _x.captures["filename"]; - foreach (_lang1; doc_matters.pod.manifest_list_of_languages) { // do for all language versions - string _pth_mkup_src_in = _path_to_pod ~ _podname ~ "/" ~ _root_to_lang ~ _lang1 ~ "/" ~ _filename; - string _pth_mkup_src_out = "pod/" ~ _root_to_lang ~ _lang1 ~ "/" ~ _filename; - // writeln("\nin: ", _pth_mkup_src_in, "\nout: ", _pth_mkup_src_out); // DEBUG, REMOVE - zip = podArchive("file_path_text", _pth_mkup_src_in, _pth_mkup_src_out, zip); - } - } - } else { - zip = podArchive("file_path_text", _pth_file_sstm, fn_src_out_pod_zip_base, zip); - } - } - } else { - if (doc_matters.opt.action.debug_do_pod && doc_matters.opt.action.vox_gt_2) { - writeln("WARNING (io) src in NOT found (markup source): \n", _sstm, "or in", fn_src_in); - } - } - } - } - } { // bundle insert files (.ssi) - get digest - if (doc_matters.srcs.file_insert_list.length > 0) { - auto _rgx_ssi = regex(r"(?P<path_to_pod>\S+?)(?P<podname>[a-z_-]+)/(?P<from_root>media/text/)(?P<language>\S+?)/(?P<filename>\S+?\.ss[i])"); - foreach (insert_file; doc_matters.srcs.file_insert_list) { - debug(pod) { - writeln( - insert_file, " -> ", - pths_pod.fn_doc_insert( - doc_matters.src.filename, - insert_file, - doc_matters.src.language, - ).zpod - ); - } - if (auto _x = insert_file.match(_rgx_ssi)){ - 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; - { // take DIGEST write to pod file digests.txt - auto data = (cast(byte[]) (_pth_mkup_src_in).read); - _digests[_language]["ssi"] ~= data.sha256Of.toHexString ~ "::" ~ data.length.to!string ~ " - " ~ _filename ~ " - [" ~ _lang ~ "]" ~ "\n"; - // writeln(data.sha256Of.toHexString, "::", data.length, " - ", _filename, " - [", _lang, "]"); - } - 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.source_or_pod) { - zip = podArchive("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_gt_2) { - writeln("WARNING (io) src out NOT found (insert file): ", _pth_mkup_src_in); - } - } - } - } - } else { - auto fn_src_in = insert_file; - { // take DIGEST write to pod file digests.txt // FIX likely bug insert_file includes path, not what you wish to write - auto data = (cast(byte[]) (fn_src_in).read); - _digests["en"]["ssi"] ~= data.sha256Of.toHexString ~ "::" ~ data.length.to!string ~ " - " ~ insert_file ~ "\n"; - // writeln(data.sha256Of.toHexString, "::", data.length, " - ", 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.source_or_pod) { - zip = podArchive("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_gt_2) { - writeln("WARNING (io) src out NOT found (insert file): ", fn_src_in); - } - } - } - } - } - } - { - _st.zip = zip; - _st.fn_pod = fn_pod; - _st.digests = _digests; - } - return _st; - } - @system auto podArchive(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; - } - void zipArchive(M,F,Z)(M doc_matters, F fn_pod, Z zip) { - auto fn_src_in = doc_matters.src.filename; - if (doc_matters.opt.action.pod) { - if (exists(doc_matters.src.file_with_absolute_path)) { - try { - createZipFile!()(fn_pod, zip.build()); - } catch (ErrnoException ex) { - // Handle errors - } - } 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); } - } - } - void zipArchiveDigest(M,F,D)(M doc_matters, F fn_pod, D _digests) { - import sisudoc.io_out.paths_output; - auto pths_pod = spinePathsPods!()(doc_matters); - char[] _zip_digest; - try { - 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; - } - } catch (ErrnoException ex) { - // Handle error - } - try { - // if (doc_matters.opt.action.vox_gt_2) { writeln(" ", pths_pod.pod_dir_(), "/", doc_matters.src.filename_base, ".digests.txt"); } - string _digest_fn = pths_pod.pod_dir_() ~ "/" ~ doc_matters.src.filename_base ~ ".digests.txt"; - // if (doc_matters.opt.action.vox_gt_2) { writeln(_digest_fn); } - auto f = File(_digest_fn, "w"); - if (exists(fn_pod)) { - try { - auto data = (cast(byte[]) (fn_pod).read); - // if (doc_matters.opt.action.vox_gt_2) { writeln(" ", doc_matters.src.filename, " > ", doc_matters.src.filename_base, ".zip"); } - if (doc_matters.opt.action.pod) { - _zip_digest = (data.sha256Of.toHexString ~ "::" ~ data.length.to!string ~ " - " ~ doc_matters.src.filename_base ~ ".zip"); - if (doc_matters.opt.action.vox_gt_1) { writeln(" ", _zip_digest); } - if (doc_matters.opt.action.vox_gt_1) { writeln(" ", pths_pod.pod_dir_(), "/", doc_matters.src.filename_base, "/"); } - if (doc_matters.opt.action.vox_gt_1) { writeln(" ", _digest_fn); } - f.writeln(_zip_digest); - } - } catch (ErrnoException ex) { - // Handle errors - } - } - foreach (_lang; doc_matters.pod.manifest_list_of_languages) { - if (_lang in _digests) { - if (("sstm" in _digests[_lang]) && (_digests[_lang]["sstm"].length > 0)) { - // if (doc_matters.opt.action.vox_gt_2) { writeln(_digests[_lang]["sstm"]); } - f.writeln(_digests[_lang]["sstm"]); - } - if (("ssi" in _digests[_lang]) && (_digests[_lang]["ssi"].length > 0)) { - // if (doc_matters.opt.action.vox_gt_2) { writeln(_digests[_lang]["ssi"]); } - f.writeln(_digests[_lang]["ssi"]); - } - if (("ssp" in _digests[_lang]) && (_digests[_lang]["ssp"].length > 0)) { - f.writeln(_digests[_lang]["ssp"]); - } - } - } - if ("shared" in _digests) { - if (("images" in _digests["shared"]) && (_digests["shared"]["images"].length > 0)) { - // if (doc_matters.opt.action.vox_gt_2) { writeln(_digests["shared"]["images"]); } - f.writeln(_digests["shared"]["images"]); - } - } - } catch (ErrnoException ex) { - // Handle error - } - } -} diff --git a/src/sisudoc/io_out/sqlite.d b/src/sisudoc/io_out/sqlite.d deleted file mode 100644 index 4ce5e0d..0000000 --- a/src/sisudoc/io_out/sqlite.d +++ /dev/null @@ -1,1761 +0,0 @@ -/+ -- Name: SisuDoc Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 (continuously updated, current 2026) Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -module sisudoc.io_out.sqlite; -import sisudoc.io_out; -import sisudoc.io_out.rgx; -import sisudoc.io_out.rgx_xhtml; -import std.file; -import std.uri; -// import std.digest.sha; -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)(D doc) { - 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) { - stderr.writeln("FATAL: cannot create --sqlite-db-path directory: ", pth_sqlite.base); - stderr.writeln(" (", ex.msg, ")"); - import core.runtime; - core.runtime.Runtime.terminate(); - } - } - template SQLiteDbStatementComposite() { - void SQLiteDbStatementComposite(Db,D)( - Db db, - D doc - ) { - 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) { - stderr.writeln("FATAL: cannot create --sqlite-db-path directory: ", pth_sqlite.base); - stderr.writeln(" (", ex.msg, ")"); - import core.runtime; - core.runtime.Runtime.terminate(); - } - } - _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.SQLiteInsertDocObjectsLoop!(); - 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_gt_1) { - writeln(" ", pth_sqlite.sqlite_file); - } - } - } - try { - auto db = Database(pth_sqlite.sqlite_file); - SQLiteDbStatementComposite!()(db, doc); - } - 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)(D doc) { - 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) { - stderr.writeln("FATAL: cannot create --sqlite-db-path directory: ", pth_sqlite.base); - stderr.writeln(" (", ex.msg, ")"); - import core.runtime; - core.runtime.Runtime.terminate(); - } - } - auto db = Database(pth_sqlite.sqlite_file(doc.matters.src.filename)); - template SQLiteDiscreteDbStatementComposite() { - void SQLiteDiscreteDbStatementComposite(Db,D)( - Db db, - D doc - ) { - try { - { - string _db_statement; - _db_statement ~= SQLiteTablesReCreate!()(); - _db_statement ~= SQLiteInsertMetadata!()(doc.matters); - _db_statement ~= SQLiteInsertMetadataTopics!()(doc.matters); - _db_statement ~= doc.SQLiteInsertDocObjectsLoop!(); - 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_gt_1) { - writeln(" ", pth_sqlite.sqlite_file(doc.matters.src.filename)); - } - } - } - SQLiteDiscreteDbStatementComposite!()(db, doc); - } -} -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_gt_3) { - 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, "<br />") - .replaceAll(rgx.br_line, "<br />") - .replaceAll(rgx.br_line_spaced, "<br /><br />") - .replaceAll(rgx_xhtml.line_break, "<br />"); - return _txt; - } - string _html_font_face(string _txt){ - _txt = _txt - .replaceAll(rgx.inline_emphasis, "<em>$1</em>") - .replaceAll(rgx.inline_bold, "<b>$1</b>") - .replaceAll(rgx.inline_underscore, "<u>$1</u>") - .replaceAll(rgx.inline_italics, "<i>$1</i>") - .replaceAll(rgx.inline_superscript, "<sup>$1</sup>") - .replaceAll(rgx.inline_subscript, "<sub>$1</sub>") - .replaceAll(rgx.inline_strike, "<del>$1</del>") - .replaceAll(rgx.inline_insert, "<ins>$1</ins>") - .replaceAll(rgx.inline_mono, "<tt>$1</tt>") - .replaceAll(rgx.inline_cite, "<cite>$1</cite>"); - return _txt; - } - string _notes; - string _urls; - string _txt = _html_font_face(_html_special_characters(obj.text)); - { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite) { - writeln(_txt, "\n"); - } - } - return _txt; - } - string html_special_characters(string _txt){ - _txt = _txt - .replaceAll(rgx_xhtml.ampersand, "&") - .replaceAll(rgx_xhtml.quotation, """) - .replaceAll(rgx_xhtml.less_than, "<") - .replaceAll(rgx_xhtml.greater_than, ">") - .replaceAll(rgx.nbsp_char, " ") - .replaceAll(rgx.br_line_inline, "<br />") - .replaceAll(rgx.br_line, "<br />") - .replaceAll(rgx.br_line_spaced, "<br /><br />") - .replaceAll(rgx_xhtml.line_break, "<br />"); - return _txt; - } - string html_special_characters_code(string _txt){ - _txt = _txt - .replaceAll(rgx_xhtml.ampersand, "&") - .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, "<em>$1</em>") - .replaceAll(rgx.inline_bold, "<b>$1</b>") - .replaceAll(rgx.inline_underscore, "<u>$1</u>") - .replaceAll(rgx.inline_italics, "<i>$1</i>") - .replaceAll(rgx.inline_superscript, "<sup>$1</sup>") - .replaceAll(rgx.inline_subscript, "<sub>$1</sub>") - .replaceAll(rgx.inline_strike, "<del>$1</del>") - .replaceAll(rgx.inline_insert, "<ins>$1</ins>") - .replaceAll(rgx.inline_mono, "<tt>$1</tt>") - .replaceAll(rgx.inline_cite, "<cite>$1</cite>"); - return _txt; - } - string inline_grouped_text_bullets_indents(M,O)( - M doc_matters, - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "seg", - ) { - static auto rgx = RgxO(); - static auto rgx_xhtml = RgxXHTML(); - if (obj.metainfo.is_a == "group") { - _txt = (_txt) - .replaceAll(rgx.grouped_para_indent_1, - " ") - .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<img src=\"" - ~ _img_pth - ~ "$3\" width=\"$4\" height=\"$5\" naturalsizeflag=\"0\" align=\"bottom\" border=\"0\" /> $6")); - } - return _txt; - } - string inline_links(M,O)( - M doc_matters, - const O obj, - string _txt, - string _xml_type = "seg", - ) { - if (obj.has.inline_links) { - if (obj.metainfo.is_a != "code") { - _txt = replaceAll!(m => - m["linked_text"] ~ "┤" ~ to!string((obj.stow.link[m["num"].to!ulong])).encode ~ "├" - )(_txt, rgx.inline_link_number_only); - } - if ((_txt.match(rgx.mark_internal_site_lnk)) - && (_xml_type == "scroll")) { // conditions reversed to avoid: gdc compiled program run segfault - _txt = _txt.replaceAll( - rgx.inline_seg_link, - "$1"); - } - auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language); - if (_xml_type == "seg") { - foreach (m; _txt.matchAll(rgx.inline_link_seg_and_hash)) { - if (m.captures["hash"] in doc_matters.has.tag_associations) { - if (m.captures["hash"] == doc_matters.has.tag_associations[(m.captures["hash"])]["seg_lv4"]) { - _txt = _txt.replaceFirst( - rgx.inline_link_seg_and_hash, - "┥$1┝┤" - ~ doc_matters.conf_make_meta.conf.w_srv_data_root_url_html - ~ "/" - ~ pth_html.tail_fn_seg(doc_matters.src.filename, "$2.html") - ~ "├" - ); - } else { - _txt = _txt.replaceFirst( - rgx.inline_link_seg_and_hash, - "┥$1┝┤" - ~ doc_matters.conf_make_meta.conf.w_srv_data_root_url_html - ~ "/" - ~ doc_matters.src.filename_base - ~ "/" - ~ doc_matters.has.tag_associations[(m.captures["hash"])]["seg_lv4"] - ~ ".html" - ~ "#" ~ m.captures["hash"] - ~ "├" - ); - } - } else { - if (doc_matters.opt.action.vox_gt_1) { - writeln( - "WARNING on internal document links, anchor to link <<" - ~ m.captures["hash"] - ~ ">> not found in document, " - ~ "anchor: " ~ m.captures["hash"] - ~ " document: " ~ doc_matters.src.filename - ); - } - } - } - } else { - if (auto m = _txt.match(rgx.inline_link_seg_and_hash)) { - _txt = _txt.replaceFirst( - rgx.inline_link_seg_and_hash, - "┥$1┝┤" - ~ doc_matters.conf_make_meta.conf.w_srv_data_root_url_html - ~ "/" - ~ pth_html.tail_fn_scroll(doc_matters.src.filename) - ~ "#" ~ m.captures["hash"] - ~ "├" - ); - } - } - _txt = _txt - .replaceAll( - rgx.inline_link_fn_suffix, - ("$1.html")) - .replaceAll( - rgx.inline_link, - ("<a href=\"$2\">$1</a>")) - .replaceAll( - rgx.mark_internal_site_lnk, - ""); - } - debug(markup_links) { - if (_txt.match(rgx.inline_link)) { - writeln(__LINE__, - " (missed) markup link identified (", - obj.has.inline_links, - "): ", obj.metainfo.is_a, ": ", - obj.text - ); - } - // if (obj.metainfo.is_a == "bookindex") { // DEBUG LINE - // if (_txt.match(regex(r"<a href"))) { - // writeln(__LINE__, " ", - // doc_matters.conf_make_meta.conf.w_srv_data_root_url_html, - // "/", - // doc_matters.src.filename_base, - // "\n", - // _txt - // ); - // } - // } - } - debug(markup) { - if (_txt.match(rgx.inline_link)) { - writeln(__LINE__, - " (missed) markup link identified (", - obj.has.inline_links, - "): ", obj.metainfo.is_a, ": ", - obj.text - ); - } - } - return _txt; - } - string inline_notes_scroll(M,O)( - M doc_matters, - const O obj, - string _txt, - ) { - if (obj.has.inline_notes_reg) { - string[] _endnotes; - foreach(m; _txt.matchAll(rgx.inline_notes_al_regular_number_note)) { - _endnotes ~= "<p class=\"endnote\">" - ~ "<sup>" ~ m.captures["num"] ~ ".</sup>" - ~ m.captures["note"] - ~ "</p>"; - } - _txt = replaceAll!(m => - (" " ~ "<sup>" ~ m["num"] ~ "</sup>")) - (_txt, rgx.inline_notes_al_regular_number_note) - ~ _endnotes.join("\n"); - } - debug(markup_endnotes) { - if (_txt.match(rgx.inline_notes_al_regular_number_note)) { - writeln(__LINE__, " (missed) markup endnote: ", obj.metainfo.is_a, ": ", obj.text); - } - } - debug(markup) { - if (_txt.match(rgx.inline_notes_al_regular_number_note)) { - writeln(__LINE__, " (missed) markup endnote: ", obj.metainfo.is_a, ": ", obj.text); - } - } - return _txt; - } - string xml_type="seg"; /+ set html document type to be linked to here (seg|scroll) +/ - string inline_markup(M,O)( - M doc_matters, - const O obj, - string _txt, - ) { - if (obj.metainfo.is_a == "group") { - _txt = inline_grouped_text_bullets_indents(doc_matters, obj, _txt, xml_type); - } - _txt = inline_images(doc_matters, obj, _txt, xml_type); - _txt = inline_links(doc_matters, obj, _txt, xml_type); - _txt = inline_notes_scroll(doc_matters, obj, _txt); - return _txt; - } - string html_heading(M,O)( - M doc_matters, - const O obj, - ) { - assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter"); - assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb"); - assert(obj.metainfo.is_of_type == "para"); - assert(obj.metainfo.is_a == "heading"); - string _txt = munge_html(doc_matters, obj); - _txt = inline_markup(doc_matters, obj, _txt); - string o = format(q"┃<p class="%s"><b> - %s - </b></p>┃", - obj.metainfo.is_a, - _txt, - ); - return o; - } - string html_para(M,O)( - M doc_matters, - const O obj, - ) { - assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter"); - assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb"); - assert(obj.metainfo.is_of_type == "para"); - assert(obj.metainfo.is_a == "para" || "toc" || "endnote" || "glossary" || "bibliography" || "bookindex" || "blurb"); - string _txt = munge_html(doc_matters, obj); - _txt = (obj.attrib.bullet) ? ("●  " ~ _txt) : _txt; - _txt = inline_markup(doc_matters, obj, _txt); - string o = format(q"┃<p class="%s" indent="h%si%s"> - %s - </p>┃", - obj.metainfo.is_a, - obj.attrib.indent_hang, - obj.attrib.indent_base, - _txt - ); - return o; - } - string html_quote(M,O)( - M doc_matters, - const O obj, - ) { - assert(obj.metainfo.is_of_part == "body"); - assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); - assert(obj.metainfo.is_of_type == "block"); - assert(obj.metainfo.is_a == "quote"); - string _txt = munge_html(doc_matters, obj); - string o = format(q"┃<p class="%s"> - %s - </p>┃", - obj.metainfo.is_a, - _txt - ); - return o; - } - string html_group(M,O)( - M doc_matters, - const O obj, - ) { - assert(obj.metainfo.is_of_part == "body"); - assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); - assert(obj.metainfo.is_of_type == "block"); - assert(obj.metainfo.is_a == "group"); - string _txt = munge_html(doc_matters, obj); - _txt = inline_markup(doc_matters, obj, _txt); - string o = format(q"┃<p class="%s"> - %s - </p>┃", - obj.metainfo.is_a, - _txt - ); - return o; - } - string html_block(M,O)( - M doc_matters, - const O obj, - ) { - assert(obj.metainfo.is_of_part == "body"); - assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); - assert(obj.metainfo.is_of_type == "block"); - assert(obj.metainfo.is_a == "block"); - string _txt = munge_html(doc_matters, obj); - _txt = inline_markup(doc_matters, obj, _txt); - string o = format(q"┃ - <p class="%s">%s</p>┃", - obj.metainfo.is_a, - _txt.stripRight - ); - return o; - } - string html_verse(M,O)( - M doc_matters, - const O obj, - ) { - assert(obj.metainfo.is_of_part == "body"); - assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); - assert(obj.metainfo.is_of_type == "block"); - assert(obj.metainfo.is_a == "verse"); - string _txt = munge_html(doc_matters, obj); - string o = format(q"┃<p class="%s">%s</p>┃", - obj.metainfo.is_a, - _txt - ); - return o; - } - string html_code(O)( - const O obj, - ) { - assert(obj.metainfo.is_of_part == "body"); - assert(obj.metainfo.is_of_section == "body"); - assert(obj.metainfo.is_of_type == "block"); - assert(obj.metainfo.is_a == "code"); - string _txt = html_special_characters_code(obj.text); - string o = format(q"┃<p class="%s">%s</p>┃", - obj.metainfo.is_a, - _txt - ); - return o; - } - string html_table(M,O)( - M doc_matters, - const O obj, - ) { - assert(obj.metainfo.is_of_part == "body"); - assert(obj.metainfo.is_of_section == "body"); - assert(obj.metainfo.is_of_type == "block"); - assert(obj.metainfo.is_a == "table"); - Tuple!(string, string) _tablarize(O)( - const O obj, - string _txt, - ) { - string[] _table_rows = _txt.split(rgx.table_delimiter_row); - string[] _table_cols; - string _table; - string _tablenote; - foreach(row_idx, row; _table_rows) { - _table_cols = row.split(rgx.table_delimiter_col); - _table ~= "<tr>"; - foreach(col_idx, cell; _table_cols) { - if ((_table_cols.length == 1) - && (_table_rows.length <= row_idx+2)) { // check row_idx+2 (rather than == ++row_idx) - _tablenote ~= cell; - } else { - string _col_is = (row_idx == 0 && obj.table.heading) ? "th" : "td"; - string _align = ("style=\"text-align:" - ~ ((obj.table.column_aligns[col_idx] == "l") - ? "left\"" : "right\"")); - _table ~= "<" - ~ _col_is - ~ " width=\"" - ~ obj.table.column_widths[col_idx].to!string - ~ "%\" " - ~ _align - ~ ">"; - _table ~= cell; - _table ~= "</" - ~ _col_is - ~ ">"; - } - } - _table ~= "</tr>"; - } - Tuple!(string, string) t = tuple( - _table, - _tablenote, - ); - return t; - } - string _txt = munge_html(doc_matters, obj); - Tuple!(string, string) t = _tablarize(obj, _txt); - _txt = t[0]; - string _note = t[1]; - string o = format(q"┃<p class="%s"> - <table summary="normal text css" width="95%%" border="0" cellpadding="2" align="center"> - %s - </table> - %s - </p>┃", - obj.metainfo.is_a, - _txt, - _note - ); - return o; - } - string sqlite_load_string(M,O)( - M doc_matters, - const O obj, - ) { - string o; - return o; - } - string sqlite_statement(O)( - const O obj, - string _txt, - string _html, - ) { - void _sql_exe(O)( - string _sql, - ) { - writeln(_html); - writeln(_sql); - } - string _sql; - return _sql; - } - string[string] heading(M,O)( - M doc_matters, - const O obj, - ) { - string[string] obj_txt = [ - "text": generic_munge_sanitize_text_for_search(obj.text), - "html": html_heading(doc_matters, obj) - ]; - { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite) { - debug(sql_txt) { - writeln(obj_txt["text"]); - } - debug(sql_html) { - writeln(obj_txt["html"]); - } - } else { - // load sql - } - } - return obj_txt; - } - string[string] para(M,O)( - M doc_matters, - const O obj, - ) { - string[string] obj_txt = [ - "text": generic_munge_sanitize_text_for_search(obj.text), - "html": html_para(doc_matters, obj) - ]; - { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite) { - debug(sql_txt) { - writeln(obj_txt["text"]); - } - debug(sql_html) { - writeln(obj_txt["html"]); - } - } else { - // load sql - } - } - return obj_txt; - } - string[string] quote(M,O)( - M doc_matters, - const O obj, - ) { - string[string] obj_txt = [ - "text": generic_munge_sanitize_text_for_search(obj.text), - "html": html_quote(doc_matters, obj) - ]; - { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite) { - debug(sql_txt) { - writeln(obj_txt["text"]); - } - debug(sql_html) { - writeln(obj_txt["html"]); - } - } else { - // load sql - } - } - return obj_txt; - } - string[string] group(M,O)( - M doc_matters, - const O obj, - ) { - string[string] obj_txt = [ - "text": generic_munge_sanitize_text_for_search(obj.text), - "html": html_group(doc_matters, obj) - ]; - { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite) { - debug(sql_txt) { - writeln(obj_txt["text"]); - } - debug(sql_html) { - writeln(obj_txt["html"]); - } - } else { - // load sql - } - } - return obj_txt; - } - string[string] block(M,O)( - M doc_matters, - const O obj, - ) { - string[string] obj_txt = [ - "text": generic_munge_sanitize_text_for_search(obj.text), - "html": html_block(doc_matters, obj) - ]; - { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite) { - debug(sql_txt) { - writeln(obj_txt["text"]); - } - debug(sql_html) { - writeln(obj_txt["html"]); - } - } else { - // load sql - } - } - return obj_txt; - } - string[string] verse(M,O)( - M doc_matters, - const O obj, - ) { - string[string] obj_txt = [ - "text": generic_munge_sanitize_text_for_search(obj.text), - "html": html_verse(doc_matters, obj) - ]; - { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite) { - debug(sql_txt) { - writeln(obj_txt["text"]); - } - debug(sql_html) { - writeln(obj_txt["html"]); - } - } else { - // load sql - } - } - return obj_txt; - } - string[string] code(M,O)( - M doc_matters, - const O obj, - ) { - string[string] obj_txt = [ - "text": generic_munge_sanitize_text_for_search(obj.text), - "html": html_code(obj) - ]; - { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite) { - debug(sql_txt) { - writeln(obj_txt["text"]); - } - debug(sql_html) { - writeln(obj_txt["html"]); - } - } else { - // load sql - } - } - return obj_txt; - } - string[string] table(M,O)( - M doc_matters, - const O obj, - ) { - string[string] obj_txt = [ - "text": generic_munge_sanitize_text_for_search(obj.text), - "html": html_table(doc_matters, obj) - ]; - { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite) { - debug(sql_txt) { - writeln(obj_txt["text"]); - } - debug(sql_html) { - writeln(obj_txt["html"]); - } - } else { - // load sql - } - } - return obj_txt; - } - } - return sqlite_format_and_load_objects(); - } -} -template SQLiteTablesReCreate() { - string SQLiteTablesReCreate()() { - string _sql_instruct; - _sql_instruct = format(q"┃ - DROP INDEX IF EXISTS idx_ocn; - DROP INDEX IF EXISTS idx_uid; - DROP INDEX IF EXISTS idx_digest_clean; - DROP INDEX IF EXISTS idx_digest_all; - DROP INDEX IF EXISTS idx_clean; - DROP INDEX IF EXISTS idx_title; - DROP INDEX IF EXISTS idx_author; - DROP INDEX IF EXISTS src_filename_base; - DROP INDEX IF EXISTS idx_language_document_char; - DROP INDEX IF EXISTS idx_classify_topic_register; - DROP INDEX IF EXISTS idx_topic_list; - DROP TABLE IF EXISTS metadata_and_text; - DROP TABLE IF EXISTS topic_register; - DROP TABLE IF EXISTS doc_objects; - DROP TABLE IF EXISTS urls; - CREATE TABLE IF NOT EXISTS metadata_and_text ( - uid VARCHAR(256) UNIQUE, -- filename, language char, pod/txt (decide on delimiter [,;:/]) - src_composite_id_per_txt VARCHAR(256) NOT NULL, -- UNIQUE, z pod name if any + src filename + language code - src_composite_id_per_pod VARCHAR(256) NOT NULL, -- z pod name if any + src filename - title VARCHAR(800) NOT NULL, - title_main VARCHAR(400) NOT NULL, - title_sub VARCHAR(400) NULL, - title_short VARCHAR(400) NULL, - title_edition VARCHAR(10) NULL, - title_language VARCHAR(100) NULL, - title_language_char VARCHAR(6) NULL, - creator_author VARCHAR(600) NOT NULL, - creator_author_last_first VARCHAR(600) NOT NULL, - creator_author_email VARCHAR(100) NULL, - creator_author_hon VARCHAR(100) NULL, - creator_author_nationality VARCHAR(100) NULL, - creator_editor VARCHAR(600) NULL, - creator_contributor VARCHAR(600) NULL, - creator_illustrator VARCHAR(600) NULL, - creator_photographer VARCHAR(600) NULL, - creator_translator VARCHAR(600) NULL, - creator_prepared_by VARCHAR(600) NULL, - creator_digitized_by VARCHAR(600) NULL, - creator_audio VARCHAR(600) NULL, - creator_video VARCHAR(600) NULL, - language_document VARCHAR(100) NULL, - language_document_char VARCHAR(6) NOT NULL, - language_original VARCHAR(100) NULL, - language_original_char VARCHAR(6) NULL, - date_added_to_site VARCHAR(10) NULL, - date_available VARCHAR(10) NULL, - date_created VARCHAR(10) NULL, - date_issued VARCHAR(10) NULL, - date_modified VARCHAR(10) NULL, - date_published VARCHAR(10) NULL, - date_valid VARCHAR(10) NULL, - date_translated VARCHAR(10) NULL, - date_original_publication VARCHAR(10) NULL, - date_generated VARCHAR(10) NULL, - original_title VARCHAR(800) NULL, - original_publisher VARCHAR(600) NULL, - original_language VARCHAR(100) NULL, - original_language_char VARCHAR(6) NULL, - original_source VARCHAR(600) NULL, - original_institution VARCHAR(600) NULL, - original_nationality VARCHAR(100) NULL, - rights_copyright VARCHAR(2500) NULL, - rights_copyright_audio VARCHAR(2500) NULL, - rights_copyright_cover VARCHAR(2500) NULL, - rights_copyright_illustrations VARCHAR(2500) NULL, - rights_copyright_photographs VARCHAR(2500) NULL, - rights_copyright_text VARCHAR(2500) NULL, - rights_copyright_translation VARCHAR(2500) NULL, - rights_copyright_video VARCHAR(2500) NULL, - rights_license VARCHAR(2500) NULL, - identifier_oclc VARCHAR(30) NULL, - identifier_isbn VARCHAR(16) NULL, - classify_topic_register VARCHAR(2500) NULL, - classify_subject VARCHAR(600) NULL, - classify_loc VARCHAR(30) NULL, - classify_dewey VARCHAR(30) NULL, - classify_keywords VARCHAR(600) NULL, - notes_abstract TEXT NULL, - notes_description TEXT NULL, - notes_comment TEXT NULL, - notes_coverage VARCHAR(200) NULL, - notes_relation VARCHAR(200) NULL, - notes_history VARCHAR(600) NULL, - notes_type VARCHAR(600) NULL, - notes_format VARCHAR(600) NULL, - notes_prefix TEXT NULL, - notes_prefix_a TEXT NULL, - notes_prefix_b TEXT NULL, - notes_suffix TEXT NULL, - publisher VARCHAR(600) NULL, - src_filename_base VARCHAR(256) NOT NULL, - src_filename_suffix VARCHAR(6) NOT NULL, - src_fingerprint VARCHAR(256) NULL, - src_filesize VARCHAR(10) NULL, - src_wordcount VARCHAR(10) NULL, - pod_name VARCHAR(256) NULL, -- zipped pod, work to be done here - pod_fingerprint VARCHAR(256) NULL, -- zipped pod, work to be done here - pod_size VARCHAR(10) NULL, -- zipped pod, work to be done here - site_url_doc_root VARCHAR(256) NULL, -- url path to doc root - site_url_html_toc VARCHAR(256) NULL, - site_url_html_scroll VARCHAR(256) NULL, - site_url_epub VARCHAR(256) NULL, - links TEXT NULL - ); - CREATE TABLE IF NOT EXISTS topic_register ( - -- tid BIGINT PRIMARY KEY, - uid_metadata_and_text VARCHAR(256) REFERENCES metadata_and_text(uid) ON DELETE CASCADE, - -- src_composite_id_per_txt VARCHAR(256) NOT NULL, - UNIQUE, - z pod name if any + src filename + language code - -- src_composite_id_per_pod VARCHAR(256) NOT NULL, - z pod name if any + src filename - topic_register VARCHAR(250) NOT NULL, - site_url_doc_root VARCHAR(256) NULL, -- url path to doc root - site_url_html_toc VARCHAR(256) NULL, - site_url_html_scroll VARCHAR(256) NULL - ); - CREATE TABLE IF NOT EXISTS doc_objects ( - lid BIGINT PRIMARY KEY, - uid_metadata_and_text VARCHAR(256) REFERENCES metadata_and_text(uid) ON DELETE CASCADE, - ocn SMALLINT, - obj_id VARCHAR(6) NULL, - clean TEXT NULL, - body TEXT NULL, - seg VARCHAR(256) NULL, - lev_an VARCHAR(1), - is_of_type VARCHAR(16), - is_a VARCHAR(16), - lev SMALLINT NULL, - node VARCHAR(16) NULL, - parent VARCHAR(16) NULL, - last_descendant VARCHAR(16) NULL, -- headings only - digest_clean CHAR(256), - digest_all CHAR(256), - seg_name CHAR(256), - types CHAR(1) NULL - ); - CREATE INDEX IF NOT EXISTS idx_ocn ON doc_objects(ocn); - CREATE INDEX IF NOT EXISTS idx_digest_clean ON doc_objects(digest_clean); - CREATE INDEX IF NOT EXISTS idx_digest_all ON doc_objects(digest_all); - CREATE INDEX IF NOT EXISTS idx_clean ON doc_objects(clean); - CREATE INDEX IF NOT EXISTS idx_title ON metadata_and_text(title); - CREATE INDEX IF NOT EXISTS idx_author ON metadata_and_text(creator_author_last_first); - CREATE INDEX IF NOT EXISTS idx_uid ON metadata_and_text(uid); - CREATE INDEX IF NOT EXISTS idx_filename ON metadata_and_text(src_filename_base); - CREATE INDEX IF NOT EXISTS idx_language ON metadata_and_text(language_document_char); - CREATE INDEX IF NOT EXISTS idx_topics ON metadata_and_text(classify_topic_register); - CREATE INDEX IF NOT EXISTS idx_topic_list ON topic_register(topic_register); - ┃",); - return _sql_instruct; - } -} -template SQLiteDeleteDocument() { - string SQLiteDeleteDocument(M)(M doc_matters) { - string _uid = doc_matters.src.doc_uid; - string _delete_uid = format(q"┃ - DELETE FROM metadata_and_text - WHERE uid = '%s'; - DELETE FROM doc_objects - WHERE uid_metadata_and_text = '%s'; - ┃", - _uid, - _uid, - ); - return _delete_uid; - } -} -template SQLiteInsertMetadata() { - string SQLiteInsertMetadata(M)(M doc_matters) { - string _uid = SQLinsertDelimiter!()(doc_matters.src.doc_uid); - string _insert_metadata = format(q"┃ - INSERT INTO metadata_and_text ( - uid, - src_filename_base, - src_filename_suffix, - src_composite_id_per_txt, - src_composite_id_per_pod, - title, - title_main, - title_sub, - title_short, - title_edition, - title_language, - creator_author, - creator_author_last_first, - creator_author_email, - creator_illustrator, - creator_translator, - language_document, - language_document_char, - date_added_to_site, - date_available, - date_created, - date_issued, - date_modified, - date_published, - date_valid, - rights_copyright, - rights_copyright_audio, - rights_copyright_cover, - rights_copyright_illustrations, - rights_copyright_photographs, - rights_copyright_text, - rights_copyright_translation, - rights_copyright_video, - rights_license, - identifier_oclc, - identifier_isbn, - classify_dewey, - classify_keywords, - classify_loc, - classify_subject, - classify_topic_register, - original_title, - original_publisher, - original_language, - original_language_char, - original_source, - notes_abstract, - notes_description, - publisher, - site_url_doc_root - ) - VALUES ( - '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' - ); - ┃", - _uid, - SQLinsertDelimiter!()(doc_matters.src.filename_base), - SQLinsertDelimiter!()(doc_matters.src.filename_extension), - SQLinsertDelimiter!()(doc_matters.src.docname_composite_unique_per_src_doc), - SQLinsertDelimiter!()(doc_matters.src.docname_composite_unique_per_src_pod), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_full), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_main), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_subtitle), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_short), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_edition), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_language), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.creator_author), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.creator_author_surname_fn), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.creator_author_email), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.creator_illustrator), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.creator_translator), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.language_document), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.language_document_char), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_added_to_site), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_available), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_created), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_issued), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_modified), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_published), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_valid), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_audio), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_cover), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_illustrations), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_photographs), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_text), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_translation), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_video), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_license), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.identifier_oclc), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.identifier_isbn), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_dewey), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_keywords), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_loc), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_subject), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_topic_register), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.notes_abstract), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.notes_description), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_title), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_publisher), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_language), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_language_char), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_source), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.publisher), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.conf.w_srv_data_root_url_html) - ); - return _insert_metadata; - } -} -template SQLiteInsertMetadataTopics() { - string SQLiteInsertMetadataTopics(M)(M doc_matters) { - string _uid = SQLinsertDelimiter!()(doc_matters.src.doc_uid); - string[] _insert_topics; - foreach (topic_line; doc_matters.conf_make_meta.meta.classify_topic_register_expanded_arr) { - // writeln(topic_line); - _insert_topics ~= format(q"┃ - INSERT INTO topic_register ( - uid_metadata_and_text, - topic_register - ) - VALUES ( - '%s', - '%s' - ); - ┃", - _uid, - SQLinsertDelimiter!()(topic_line) - ); - } - return _insert_topics.join.to!(char[]).toUTF8; - } -} -template SQLiteInsertDocObjectsLoop() { - string SQLiteInsertDocObjectsLoop(D)(D doc) { - 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_gt_3) { - writeln("db name: ", db_filename); - writeln("db path: ", db_path); - writeln("db name & path: ", db_path, "/", db_filename); - } - if (opt_action.vox_gt_2) { - 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) { - stderr.writeln("FATAL: cannot create --sqlite-db-path directory: ", pth_sqlite.base); - stderr.writeln(" (", ex.msg, ")"); - import core.runtime; - core.runtime.Runtime.terminate(); - } - } - auto db = Database(pth_sqlite.sqlite_file); - { - _db_statement ~= SQLiteTablesReCreate!()(); - } - SQLiteDbRun!()(db, _db_statement, opt_action, "TABLE RE-CREATE"); - } else { - writeln("must provide db name & output root path either on the command line or in configuration file"); - writeln("db name: ", db_filename); - writeln("db path: ", db_path); - } - } - } - catch (FileException e) { - writeln("Failed (FileException): ", e.msg); - writeln(e.file, " line: ", e.line); - import core.runtime; - core.runtime.Runtime.terminate(); - } - catch (ErrnoException e) { - writeln("Failed (ErrnoException): ", e.msg); - writeln(e.file, " line: ", e.line); - import core.runtime; - core.runtime.Runtime.terminate(); - } - catch (Exception e) { - writeln("Failed (Exception): ", e.msg); - writeln(e.file, " line: ", e.line); - import core.runtime; - core.runtime.Runtime.terminate(); - } - catch (Throwable) { - import core.runtime; - core.runtime.Runtime.terminate(); - } - } -} -template SQLiteDbDrop() { - void SQLiteDbDrop(O,C)(O opt_action, C config) { - writeln("db drop"); - if ((opt_action.sqlite_db_drop)) { - string db_filename = (opt_action.sqliteDB_filename.length > 0) - ? opt_action.sqliteDB_filename - : (config.conf.w_srv_db_sqlite_filename.length > 0) - ? config.conf.w_srv_db_sqlite_filename - : ""; - string db_path = (opt_action.sqliteDB_path.length > 0) // - ? opt_action.sqliteDB_path - : (config.conf.w_srv_db_sqlite_path.length > 0) - ? config.conf.w_srv_db_sqlite_path - : ""; - if (db_filename.length > 0 && db_path.length > 0) { - auto pth_sqlite = spinePathsSQLite!()(db_filename, db_path); - writeln("remove(", pth_sqlite.sqlite_file, ")"); - try { - remove(pth_sqlite.sqlite_file); - } catch (FileException ex) { - // handle error - } - } else { - writeln("must provide db name & output root path either on the command line or in configuration file"); - writeln("db name: ", db_filename); - writeln("db path: ", db_path); - } - } - } -} diff --git a/src/sisudoc/io_out/text.d b/src/sisudoc/io_out/text.d deleted file mode 100644 index 7c4315a..0000000 --- a/src/sisudoc/io_out/text.d +++ /dev/null @@ -1,470 +0,0 @@ -/+ -- Name: SisuDoc Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 (continuously updated, current 2026) Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -module sisudoc.io_out.text; -@safe: -template outputText() { - template munge() { - import sisudoc.io_out; - import sisudoc.io_out.rgx; - import std.stdio; - import std.conv; - import std.conv : to; - import std.typecons : Nullable; - mixin spineRgxOut; - static auto rgx = RgxO(); - void puts(string _obj_is) { - writeln(__FILE__, ":", __LINE__, ": ", _obj_is); - } - string newline = "\n"; - string newlines = "\n\n"; - template special_characters_and_font_face() { - string code(string _txt){ - _txt = _txt.replaceAll(rgx.nbsp_char, " "); - return _txt; - } - string general(string _txt) { - _txt = _txt - .replaceAll(rgx.nbsp_char, " ") - .replaceAll(rgx.br_line, "\n") - .replaceAll(rgx.br_line_inline, "\n") - .replaceAll(rgx.br_line_spaced, "\n\n") - .replaceAll(rgx.inline_strike, "-{$1}-") - .replaceAll(rgx.inline_insert, "+{$1}+") - .replaceAll(rgx.inline_cite, "\"{$1}\"") - .replaceAll(rgx.inline_emphasis, "!{$1}!") - .replaceAll(rgx.inline_bold, "*{$1}*") - .replaceAll(rgx.inline_italics, "/{$1}/") - .replaceAll(rgx.inline_underscore, "_{$1}_") - .replaceAll(rgx.inline_superscript, "^{$1}^") - .replaceAll(rgx.inline_subscript, ",{$1},") - .replaceAll(rgx.inline_mono, "#{$1}#"); - return _txt; - } - string links_and_images(string _txt){ - if (_txt.match(rgx.inline_link)) { - foreach (m; _txt.matchAll(rgx.inline_link)) { - _txt = (m.captures[3] == "0") - ? _txt.replaceFirst(rgx.inline_link, (m.captures[1])) - : _txt.replaceFirst(rgx.inline_link, (m.captures[1] ~ " ≫" ~ m.captures[3])); - } - } - if (_txt.matchFirst(rgx.inline_image)) { - foreach (m; _txt.matchAll(rgx.inline_image)) { - _txt = _txt.replaceFirst(rgx.inline_image, (m.captures[3])); - } - } - return _txt; - } - } - string generalMunge(O,M)(O obj, M doc_matters) { - string _txt = obj.text; - string _notes; - string _ocn; - string general_munge; - _ocn = (obj.metainfo.ocn == 0 || doc_matters.opt.action.ocn_off) - ? "" : "「" ~ obj.metainfo.ocn.to!string ~ "」" ~ newline; - if (_txt.matchFirst(rgx.inline_notes_al_gen)) { - foreach (m; _txt.matchAll(rgx.inline_notes_al_regular_number_note)) { - _notes ~= newlines ~ m["num"] ~ ". " - ~ special_characters_and_font_face!().general(m["note"].replaceAll(rgx.inline_link, ("$1"))); - } - } - _txt = _txt.replaceAll(rgx.inline_notes_al_regular_number_note, "[$1]"); - _txt = (obj.metainfo.is_a == "code") - ? special_characters_and_font_face!().code(_txt) - : special_characters_and_font_face!().general(_txt); - _txt = special_characters_and_font_face!().links_and_images(_txt); - general_munge = (obj.metainfo.is_a == "heading") - ? newline ~ _txt ~ _notes ~ newline ~ _ocn ~ newline - : _txt ~ _notes ~ newline ~ _ocn ~ newline; - return general_munge; - } - string toc(O,M)(O obj, M doc_matters) { - // puts(obj.metainfo.is_a); - // return "toc\n"; - // _txt = _special_characters_and_font_face(obj.text); - string _txt = special_characters_and_font_face!().general(obj.text); - string _spaces; - switch (obj.attrib.indent_hang) { - case 1: _spaces = ""; - break; - case 2: _spaces = ":"; - break; - case 3: _spaces = "∴"; - break; - case 4: _spaces = " "; - break; - case 5: _spaces = " "; - break; - case 6: _spaces = " "; - break; - case 7: _spaces = " "; - break; - case 8: _spaces = " "; - break; - default: - break; - } - _txt = (doc_matters.opt.action.ocn_off) - ? _txt.replaceAll(rgx.inline_link, (_spaces ~ "$1")) - : _txt.replaceAll(rgx.inline_link, (_spaces ~ "$1 ≫ $3")); - return _txt ~ newline; - } - string heading(O,M)(O obj, M doc_matters) { - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - string _general_munge = generalMunge(obj,doc_matters); - return _general_munge; - } - string para(O,M)(O obj, M doc_matters) { - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - string _general_munge = generalMunge(obj,doc_matters); - return _general_munge; - } - string group(O,M)(O obj, M doc_matters) { - /+ - The "group" is different from the "block" mark in that "group" does not - preserve whitespace, the "block" mark does. The text falling within the - block is a single object. - +/ - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - string _general_munge = generalMunge(obj,doc_matters); - return _general_munge; - } - string block(O,M)(O obj, M doc_matters) { - /+ - The "block" is different from the "group" mark in that the "block" mark - (like the "poem" mark) preserves whitespace, the "group" mark does not. - The text falling within the "block" is a single object, which is different - from the "poem" mark where each identified verse is an object. - +/ - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - string _general_munge = generalMunge(obj,doc_matters); - return _general_munge; - } - string poem(O,M)(O obj, M doc_matters) { // LATER - /+ - The "poem" mark like the "block" preserves whitespace. Text followed by - two newlines are identified as verse and each verse is an object i.e. a - poem may consist of multiple verse each of which is identified as an - object, unlike a text "block" which is identified as a single object. - +/ - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - return obj.text ~ newlines; - } - string verse(O,M)(O obj, M doc_matters) { - /+ - See description of poem, the poem is demarkated but the verse is the - object. - +/ - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - string _general_munge = generalMunge(obj,doc_matters); - return _general_munge; - } - string code(O,M)(O obj, M doc_matters) { - /+ - "Code" blocks are a single text object, in which the original text is - preserved. - +/ - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - string _general_munge = generalMunge(obj,doc_matters); - return _general_munge; - } - string quote(O,M)(O obj, M doc_matters) { // LATER - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - return obj.text ~ newline ~ "「" ~ obj.metainfo.ocn.to!string ~ "」" ~ newlines; - } - string table(O,M)(O obj, M doc_matters) { - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - auto tablarize(O)( - string _txt, - const O obj, - ) { - string[] _table_rows = (_txt).split(rgx.table_delimiter_row); - string[] _table_cols; - string _table = ""; - string _tablenote = ""; - int[] _col_width; - _col_width.length = obj.table.number_of_columns.to!ulong; - 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))) { - if (_col_width[col_idx] < (cell.length.to!int)) { - _col_width[col_idx] = cell.length.to!int; - } - } - } - } - foreach(row_idx, row; _table_rows) { - _table_cols = row.split(rgx.table_delimiter_col); - 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 ~ newline; - } else { - if (obj.table.column_aligns[col_idx] == "l") { - _table ~= format(q"┃%-*s%s┃", - _col_width[col_idx], - cell, - (_table_cols.length > (col_idx + 1)) ? " ┊ " : "" - ); - } else { - _table ~= format(q"┃%*s%s┃", - _col_width[col_idx], - cell, - (_table_cols.length > (col_idx + 1)) ? " ┊ " : "" - ); - } - _table = _table - .replaceAll(regex("\\s*$"), ""); - } - } - _table ~= newline; - } - Tuple!(string, string) t = tuple( - _table, - _tablenote, - ); - return t; - } - // string _txt = obj.text; - // writeln(obj.table.column_widths); - auto _t = tablarize(obj.text, obj); - string _txt = _t[0]; - string _tablenote = _t[1]; - return _txt ~ _tablenote ~ "「" ~ obj.metainfo.ocn.to!string ~ "」" ~ newlines; - } - string endnote(O,M)(O obj, M doc_matters) { - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - string _ocn; - _ocn = "「" ~ obj.metainfo.ocn.to!string ~ "」"; - string _txt = obj.text; - string _parent_ocn; - _txt = _txt - .replaceAll(rgx.inline_link, ("$1")) // consider - .replaceFirst(rgx.inline_superscript, ("$1")); - _parent_ocn = (obj.metainfo.parent_ocn == 0 || doc_matters.opt.action.ocn_off) - ? "" : " ≫" ~ obj.metainfo.parent_ocn.to!string; - _txt = special_characters_and_font_face!().general(_txt) ~ _parent_ocn; - return _txt ~ newlines; - } - string bookindex(O,M)(O obj, M doc_matters) { - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - string _txt = obj.text; - _txt = (doc_matters.opt.action.ocn_off) - ? _txt.replaceAll(rgx.find_bookindex_ocn_link_and_comma, "") - .replaceAll(regex("\\s*\\\\"), "") - : _txt.replaceAll(rgx.inline_link, ("≫$1")) - .replaceAll(regex("\\s*\\\\"), ""); - _txt = special_characters_and_font_face!().general(_txt); - return _txt ~ newlines; - } - string bibliography(O,M)(O obj, M doc_matters) { - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - string _txt = obj.text; - _txt = special_characters_and_font_face!().general(_txt); - return _txt ~ newlines; - // ALT: - // string _general_munge = generalMunge(obj,doc_matters); - // return _general_munge; - } - string glossary(O,M)(O obj, M doc_matters) { - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - string _txt = obj.text; - _txt = special_characters_and_font_face!().general(_txt); - return _txt; - } - string blurb(O,M)(O obj, M doc_matters) { - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - string _general_munge = generalMunge(obj,doc_matters); - return _general_munge; - } - string comment(O,M)(O obj, M doc_matters) { // LATER - /+ - +/ - // puts(obj.metainfo.is_a); - // return obj.metainfo.is_a; - return obj.text ~ newlines; - } - } - template theDocument() { - import std.stdio; - import sisudoc.io_out; - string text_head(M)( - M doc_matters, - ) { - return "head"; - } - string text_body(D,M)( - const D doc_abstraction, - M doc_matters, - ) { - string doc_object = ""; - foreach (section; doc_matters.has.keys_seq.scroll) { - foreach (obj; doc_abstraction[section]) { - if (obj.metainfo.is_a == "toc") { doc_object ~= munge!().toc(obj, doc_matters); } - if (obj.metainfo.is_a == "heading") { doc_object ~= munge!().heading(obj, doc_matters); } - if (obj.metainfo.is_a == "para") { doc_object ~= munge!().para(obj, doc_matters); } - if (obj.metainfo.is_a == "group") { doc_object ~= munge!().group(obj, doc_matters); } - if (obj.metainfo.is_a == "block") { doc_object ~= munge!().block(obj, doc_matters); } - if (obj.metainfo.is_a == "poem") { doc_object ~= munge!().poem(obj, doc_matters); } // CHECK - if (obj.metainfo.is_a == "verse") { doc_object ~= munge!().verse(obj, doc_matters); } // CHECK - if (obj.metainfo.is_a == "code") { doc_object ~= munge!().code(obj, doc_matters); } - if (obj.metainfo.is_a == "quote") { doc_object ~= munge!().quote(obj, doc_matters); } // LATER - if (obj.metainfo.is_a == "table") { doc_object ~= munge!().table(obj, doc_matters); } - if (obj.metainfo.is_a == "endnote") { doc_object ~= munge!().endnote(obj, doc_matters); } - if (obj.metainfo.is_a == "bookindex") { doc_object ~= munge!().bookindex(obj, doc_matters); } // CHECK - if (obj.metainfo.is_a == "bibliography") { doc_object ~= munge!().bibliography(obj, doc_matters); } // CHECK - if (obj.metainfo.is_a == "glossary") { doc_object ~= munge!().glossary(obj, doc_matters); } // CHECK - if (obj.metainfo.is_a == "blurb") { doc_object ~= munge!().blurb(obj, doc_matters); } // CHECK - if (obj.metainfo.is_a == "comment") { doc_object ~= munge!().comment(obj, doc_matters); } // LATER - } - } - return doc_object; - } - string text_tail(M)( - M doc_matters, - ) { - string metadata_; - 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: ", doc_matters.conf_make_meta.meta.rights_license); - } - if (!(doc_matters.conf_make_meta.meta.title_full.empty)) { - metadata_ ~= "Title: " ~ doc_matters.conf_make_meta.meta.title_full ~ "\n\n"; - } else if (doc_matters.opt.action.debug_do || doc_matters.opt.action.vox_gt_3) { - 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_surname.translate([' ' : "_"]) - ~ doc_matters.conf_make_meta.meta.creator_author ~ "\n\n"; - } else { - metadata_ ~= "Author: " - ~ doc_matters.conf_make_meta.meta.creator_author ~ "\n\n"; - } - } else if (doc_matters.opt.action.debug_do || doc_matters.opt.action.vox_gt_3) { - writeln("ERROR no Author information provided in document header ", doc_matters.src.filename_base); - } - metadata_ ~= "Published: " ~ doc_matters.conf_make_meta.meta.date_published ~ "\n\n"; - if (!(doc_matters.conf_make_meta.meta.rights_copyright.empty)) { - metadata_ ~= "Copyright: " ~ doc_matters.conf_make_meta.meta.rights_copyright ~ "\n\n"; - } else if (doc_matters.opt.action.debug_do || doc_matters.opt.action.vox_gt_3) { - 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: " ~ doc_matters.conf_make_meta.meta.rights_license ~ "\n\n"; - } else if (doc_matters.opt.action.debug_do || doc_matters.opt.action.vox_gt_3) { - writeln("WARNING no License information provided in document header ", doc_matters.src.filename_base); - } - metadata_ ~= doc_matters.generator_program.project_name.strip ~ "\n"; - metadata_ ~= doc_matters.generator_program.url_home.strip; - return metadata_; - } - } - void outputText(D,M) ( - const D doc_abstraction, - M doc_matters, - ) { - import std.stdio; - import sisudoc.io_out; - void text_out(D,M)( - const D doc_abstraction, - M doc_matters, - ) { - struct Text { - string head; - string content; - string tail; - } - auto text = Text(); - // text.head = theDocument!().text_head(doc_matters); - text.content = theDocument!().text_body(doc_abstraction, doc_matters); - text.tail = theDocument!().text_tail(doc_matters); - auto pth_text = spinePathsText(doc_matters); - try { - import std.file; - if (!exists(pth_text.base_pth)) { - (pth_text.base_pth).mkdirRecurse; - } - } catch (ErrnoException ex) { - } - if (doc_matters.opt.action.vox_gt_1) { - writeln(" ", pth_text.text_file); - } - // writeln(pth_text.base_pth); - auto f = File(pth_text.text_file, "w"); - // f.writeln(text.head); - f.writeln(text.content); - f.writeln(text.tail); - } - text_out(doc_abstraction, doc_matters); - } -} diff --git a/src/sisudoc/io_out/xmls.d b/src/sisudoc/io_out/xmls.d deleted file mode 100644 index 7b503dd..0000000 --- a/src/sisudoc/io_out/xmls.d +++ /dev/null @@ -1,1422 +0,0 @@ -/+ -- Name: SisuDoc Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 (continuously updated, current 2026) Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -module sisudoc.io_out.xmls; -@safe: -template outputXHTMLs() { - import std.file; - import std.outbuffer; - import std.uri; - import std.conv : to; - import sisudoc.io_out; - import sisudoc.io_out.rgx; - import sisudoc.meta.rgx_files; - import sisudoc.io_out.rgx_xhtml; - import sisudoc.io_out.create_zip_file; - import sisudoc.io_out.xmls; - import sisudoc.io_out.xmls_css; - mixin spineRgxOut; - mixin spineRgxXHTML; - struct outputXHTMLs { - static auto rgx = RgxO(); - static auto rgx_xhtml = RgxXHTML(); - string div_delimit( - string section, - return ref string previous_section - ) { - string delimit = ""; - string delimit_ = ""; - if (section != previous_section) { - switch (section) { - case "head": - delimit_ ~= "\n<div class=\"doc_title\">\n" ; - break; - case "toc": - delimit_ ~= "\n<div class=\"doc_toc\">\n" ; - break; - case "bookindex": - delimit_ ~= "\n<div class=\"doc_bookindex\">\n" ; - break; - default: - delimit_ ~= "\n<div class=\"doc_" ~ section ~ "\">\n" ; - break; - } - if (previous_section.length > 0) { - delimit ~= "\n</div>"; - } - previous_section = section; - delimit ~= delimit_; - } - // you also need to close the last div, introduce a footer? - return delimit; - } - string special_characters_text(string _txt) { - _txt = _txt - .replaceAll(rgx_xhtml.ampersand, "&") // "&" - .replaceAll(rgx_xhtml.quotation, """) // """ - .replaceAll(rgx_xhtml.less_than, "<") // "<" - .replaceAll(rgx_xhtml.greater_than, ">") // ">" - .replaceAll(rgx.br_line, "<br />") - .replaceAll(rgx.br_line_inline, "<br />") - .replaceAll(rgx.br_line_spaced, "<br />\n<br />") - .replaceAll(rgx.nbsp_char, " "); - return _txt; - } - string special_characters_date(string _txt) { - _txt = _txt - .replaceAll(regex(r"(?:-00)+"), "") - .replaceAll(rgx.br_line, "<br />") - .replaceAll(rgx.br_line_inline, "<br />") - .replaceAll(rgx.br_line_spaced, "<br />\n<br />") - .replaceAll(rgx.nbsp_char, " "); - return _txt; - } - string special_characters_breaks_indents_bullets(O)( - const O obj, - ) { - string _txt = special_characters_text(obj.text); - if (obj.metainfo.is_a == "group") { - _txt = (_txt) - .replaceAll(rgx.grouped_para_indent_1, - " ") - .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, "<br />"); - } - return _txt; - } - string font_face(string _txt) { - _txt = _txt - .replaceAll(rgx.inline_emphasis, ("<em>$1</em>")) - .replaceAll(rgx.inline_bold, ("<b>$1</b>")) - .replaceAll(rgx.inline_underscore, ("<u>$1</u>")) - .replaceAll(rgx.inline_italics, ("<i>$1</i>")) - .replaceAll(rgx.inline_superscript, ("<sup>$1</sup>")) - .replaceAll(rgx.inline_subscript, ("<sub>$1</sub>")) - .replaceAll(rgx.inline_strike, ("<del>$1</del>")) - .replaceAll(rgx.inline_insert, ("<ins>$1</ins>")) - .replaceAll(rgx.inline_mono, ("<tt>$1</tt>")) - .replaceAll(rgx.inline_cite, ("<cite>$1</cite>")); - return _txt; - } - string _xhtml_anchor_tags(O)(O obj) { - string tags=""; - if (obj.tags.anchor_tags.length > 0) { - foreach (tag; obj.tags.anchor_tags) { - if (!(tag.empty)) { - tags ~= "<a name=\"" ~ special_characters_text(tag) ~ "\"></a>"; - } - } - } - return tags; - } - string header_metadata(M)( - M doc_matters, - ) { - string _publisher="Publisher"; // TODO - string o; - o = format(q"┃<!-- spine DocReform header metadata --> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <meta name="dc.title" content="%s" /> - <meta name="dc.author" content="%s" /> - <meta name="dc.publisher" content="%s" /> - <meta name="dc.date" content="%s" /> - <meta name="dc.date.created" content="%s" /> - <meta name="dc.date.issued" content="%syear" /> - <meta name="dc.date.available" content="%syear" /> - <meta name="dc.date.valid" content="%syear" /> - <meta name="dc.date.modified" content="%syear" /> - <meta name="dc.language" content="%s" /> - <meta name="dc.rights" content="%s" /> - <meta name="generator" content="%s" /> - <link rel="generator" href="%s" /> - <!-- spine DocReform header metadata -->┃", - special_characters_text(doc_matters.conf_make_meta.meta.title_full), - special_characters_text(doc_matters.conf_make_meta.meta.creator_author), - _publisher, - special_characters_date(doc_matters.conf_make_meta.meta.date_published), - special_characters_text(doc_matters.conf_make_meta.meta.date_created), - special_characters_text(doc_matters.conf_make_meta.meta.date_issued), - special_characters_text(doc_matters.conf_make_meta.meta.date_available), - special_characters_text(doc_matters.conf_make_meta.meta.date_valid), - special_characters_text(doc_matters.conf_make_meta.meta.date_modified), - doc_matters.src.language, - special_characters_text(doc_matters.conf_make_meta.meta.rights_copyright), - doc_matters.opt.action.generated_by ? special_characters_text(doc_matters.generator_program.name_and_version) : "", - special_characters_text(doc_matters.generator_program.url_home), - ); - return o; - } - string site_info_button(M)( - M doc_matters, - ) { - string _locations; - if (doc_matters.conf_make_meta.make.home_button_text.length > 0) { - _locations = (doc_matters.conf_make_meta.make.home_button_text) - .replaceAll( - rgx.inline_link, - ("<p class=\"tiny_left\"><a href=\"$2\" class=\"lnkicon\">$1</a></p>")) - .replaceAll( - rgx.br_line, "") - .replaceAll( - rgx.br_line_inline, ""); - } else { - _locations = "<p class=\"icons\"><a href=\"https://www.doc-reform.org\" class=\"lnkicon\">spine</a></p>\n<p class=\"icons\"><a href=\"https://git.sisudoc.org/software/spine/\" class=\"lnkicon\">sources / git</a></p>\n<p class=\"icons\"><a href=\"https://www.sisudoc.org\" class=\"lnkicon\">www.sisudoc.org</a></p>"; - } - string o; - o = format(q"┃<div class="flex-menu-option"> - %s - </div>┃", - _locations, - ); - return o; - } - string inline_search_form(M)( - M doc_matters, - ) { - string o; - string _form; - if (doc_matters.opt.action.html_link_search) { - o = format(q"┃ - <div class="flex-menu-option"> - <!-- SiSU Spine Search --> - <form action="%s" target="_top" method="POST" accept-charset="UTF-8" id="searchtxt"> - <font size="2">%s - <input type="text" name="sf" size="24" maxlength="255">%s - <input type="hidden" name="sml" value="1000"> - <input type="hidden" name="ec" value="on"> - <input type="hidden" name="url" value="on"> - <input type="hidden" name="rt" value="txt"> - <button type="submit" form="searchtxt" name="fn" value="%s"> • ⚏ </button> - </font></form> - <!-- SiSU Spine Search --> - </div> - <div class="flex-menu-option"> - <!-- SiSU Spine Search --> - <form action="%s" target="_top" method="POST" accept-charset="UTF-8" id="searchidx"> - <font size="2"> - <input type="text" name="sf" size="24" maxlength="255">%s - <input type="hidden" name="sml" value="1000"> - <input type="hidden" name="ec" value="on"> - <input type="hidden" name="url" value="on"> - <input type="hidden" name="rt" value="idx"> - <button type="submit" form="searchidx" name="fn" value="%s"> • ፨ </button> - <button type="submit" form="searchidx"> ㏈ ፨</button> - </font></form> - <!-- SiSU Spine Search --> - </div>┃", - doc_matters.conf_make_meta.conf.w_srv_cgi_action, - (doc_matters.conf_make_meta.conf.w_srv_db_sqlite_filename.empty) - ? "" - : "\n <a href=\"" - ~ doc_matters.conf_make_meta.conf.w_srv_cgi_action - ~ "\">🔎 </a>", - (doc_matters.conf_make_meta.conf.w_srv_db_sqlite_filename.empty) - ? "" - : "\n <input type=\"hidden\" name=\"db\" value=\"" - ~ doc_matters.conf_make_meta.conf.w_srv_db_sqlite_filename - ~ "\">", - doc_matters.src.filename_base, - doc_matters.conf_make_meta.conf.w_srv_cgi_action, - (doc_matters.conf_make_meta.conf.w_srv_db_sqlite_filename.empty) - ? "" - : "\n <input type=\"hidden\" name=\"db\" value=\"" - ~ doc_matters.conf_make_meta.conf.w_srv_db_sqlite_filename - ~ "\">", - doc_matters.src.filename_base, - ); - } else { - o = ""; - } - return o; - } - string html_head(M)( - M doc_matters, - string type, - ) { - string o; - string metadata_links = ((doc_matters.opt.action.html_link_curate) - ? format(q"┃<p class="icons"><a href="%s" class="lnkicon">⟰ </a> [<a href="%s" class="lnkicon"> %s </a><a href="%sepub/%s.%s.epub" class="lnkicon"> ◆ </a>%s%s<a href="%smetadata.%s.html" class="lnkicon"> ℹ </a>] <a href="%s../../index.html" class="lnkicon"> ≅ </a>|<a href="%s../../authors.html" class="lnkicon"> 🖋 </a>|<a href="%s../../topics.html" class="lnkicon"> ⌘ </a>|</p>┃", - (doc_matters.opt.action.webserver_url_doc_root.length > 0) - ? doc_matters.opt.action.webserver_url_doc_root - : doc_matters.conf_make_meta.conf.w_srv_data_root_url - , // HOME index.html equivalent _cfg.www_url_doc_root, - (type == "seg") - ? "../" ~ doc_matters.src.filename_base ~ ".html" - : "./" ~ doc_matters.src.filename_base ~ "/toc.html", - (type == "seg") ? "▤" : "※", - (type == "seg") ? "../../" : "../", - doc_matters.src.filename_base, - doc_matters.src.lng, - (doc_matters.opt.action.html_link_pdf || doc_matters.opt.action.html_link_pdf_a4) - ? ("<a href=\"" - ~ ((type == "seg") ? "../../../" : "../../") - ~ "pdf/" - ~ doc_matters.src.filename_base - ~ "." - ~ doc_matters.src.lng - ~ ".a4.portrait.pdf\" class=\"lnkicon\"> □ </a>") - : "", - (doc_matters.opt.action.html_link_pdf || doc_matters.opt.action.html_link_pdf_letter) - ? ("<a href=\"" - ~ ((type == "seg") ? "../../../" : "../../") - ~ "pdf/" - ~ doc_matters.src.filename_base - ~ "." - ~ doc_matters.src.lng - ~ ".letter.portrait.pdf\" class=\"lnkicon\"> □ </a>") - : "", - (type == "seg") ? "../" : "", - doc_matters.src.filename_base, - (type == "seg") ? "../" : "", - (type == "seg") ? "../" : "", - (type == "seg") ? "../" : "", - ) - : ""); - o = format(q"┃<!DOCTYPE html> - <html> - <head> - <meta http-equiv="Content-Type" content="text/plain; charset=UTF-8" /> - <title> - %s%s - </title> - <!-- metadata --> - %s - <!-- metadata --> - <link rel="generator" href="https://www.sisudoc.org/" /> - <link rel="shortcut icon" href="%s../../image/dr.ico" /> - <link href="%s" rel="stylesheet" /> - </head> - <body lang="%s"> - <a name="top" id="top"></a> - <div class='delimit headband'> - <div class="flex-menu-bar"> - %s - <div class="flex-menu-option"> - %s - </div>%s - </div> - </div>┃", - special_characters_text(doc_matters.conf_make_meta.meta.title_full), - (doc_matters.conf_make_meta.meta.creator_author.empty) ? "" - : ", " ~ special_characters_text(doc_matters.conf_make_meta.meta.creator_author), - header_metadata(doc_matters), - ((type == "seg") ? "../" : ""), - ((type == "seg") - ? "../../../css/html_seg.css" - : "../../css/html_scroll.css"), - doc_matters.src.language, - site_info_button(doc_matters), - metadata_links, - inline_search_form(doc_matters), - ); - return o; - } - string epub3_seg_head(M)( - M doc_matters, - ) { - string html_base = format(q"┃<!DOCTYPE html> - <html>┃", - ); - string html_simple = format(q"┃<!DOCTYPE html> - <html - xmlns="https://www.w3.org/1999/xhtml" - xmlns:epub="http://www.idpf.org/2007/ops" - lang="%s" xml:lang="%s">┃", - doc_matters.src.language, - doc_matters.src.language, - ); - string html_strict = format(q"┃<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - <html xmlns="https://www.w3.org/1999/xhtml" - xmlns:epub="http://www.idpf.org/2007/ops" - lang="%s" xml:lang="%s">┃", - doc_matters.src.language, - doc_matters.src.language, - ); - string o; - o = format(q"┃%s - <head> - <title> - %s%s - </title> - <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> - <meta name="dc.title" content="%s" /> - <meta name="dc.author" content="%s" /> - <meta name="dc.publisher" content="FIX" /> - <meta name="dc.date" content="%s" /> - <meta name="dc.date.created" content="%s" /> - <meta name="dc.date.issued" content="%s" /> - <meta name="dc.date.available" content="%s" /> - <meta name="dc.date.valid" content="%s" /> - <meta name="dc.date.modified" content="%s" /> - <meta name="dc.language" content="%s" /> - <meta name="dc.rights" content="%s" /> - <meta name="generator" content="%s" /> - <link rel="generator" href="%s" /> - <link rel="shortcut icon" href="../_dr/image/dr.ico" /> - <link rel="stylesheet" href="Styles/epub.css" type="text/css" id="main-css" /> - </head> - <body lang="%s"> - <a name="top" id="top"></a>┃", - html_simple, - special_characters_text(doc_matters.conf_make_meta.meta.title_full), - (doc_matters.conf_make_meta.meta.creator_author.empty) ? "" - : ", " ~ special_characters_text(doc_matters.conf_make_meta.meta.creator_author), - special_characters_text(doc_matters.conf_make_meta.meta.title_full), - (doc_matters.conf_make_meta.meta.creator_author.empty) ? "" - : ", " ~ special_characters_text(doc_matters.conf_make_meta.meta.creator_author), - special_characters_date(doc_matters.conf_make_meta.meta.date_published), - special_characters_text(doc_matters.conf_make_meta.meta.date_created), - special_characters_text(doc_matters.conf_make_meta.meta.date_issued), - special_characters_text(doc_matters.conf_make_meta.meta.date_available), - special_characters_text(doc_matters.conf_make_meta.meta.date_valid), - special_characters_text(doc_matters.conf_make_meta.meta.date_modified), - doc_matters.src.language, - special_characters_text(doc_matters.conf_make_meta.meta.rights_copyright), - special_characters_text(doc_matters.generator_program.name_and_version), - special_characters_text(doc_matters.generator_program.url_home), - doc_matters.src.language, - ); - return o; - } -string dom_close() { - string o; - o = format(q"┃</div>┃"); - return o; -} -string tail(M)(M doc_matters) { - string o; - o = format(q"┃<hr /> - <div class="rights"> - <p class="small" id="copyright"><a name="copyright"></a> - <b>Copyright:</b> %s - </p> - </div> - %s - <div class="rights"> - <p class="small" id="rights"><a name="rights"></a> - %s - </p> - </div> - <hr /> - <div class="generator"> - <p class="small_center" id="sisu_spine"><a name="sisu_spine"></a> - <a href="https://sisudoc.org" class="lnkicon">≅ SiSU Spine ፨</a> (object numbering & object search) - </p> - <p class="small_center" id="sisu_spine"><a name="sisu_spine"></a> - (web 1993, object numbering 1997, object search 2002 ...) 2026 - </p> - </div> - <a name="bottom" id="bottom"></a> - <a name="end" id="end"></a> -</body> -</html> -┃", - special_characters_text(doc_matters.conf_make_meta.meta.rights_copyright), - ((doc_matters.conf_make_meta.meta.rights_license).empty) ? "" : "<br />", - ((doc_matters.conf_make_meta.meta.rights_license).empty) ? "" - : "<b>License:</b> " ~ special_characters_text(doc_matters.conf_make_meta.meta.rights_license) - ); - return o; -} - string inline_images(O,M)( - string _txt, - const O obj, - M doc_matters, - string _suffix = ".html", - string _xml_type = "seg", - ) { - string _img_pth; - switch (_xml_type) { - case "epub": _img_pth = "image/"; break; - case "scroll": _img_pth = format(q"┃%s/image/┃", "../.."); break; - case "seg": _img_pth = format(q"┃%s/image/┃", "../../.."); break; - default: break; - } - if (_txt.match(rgx.inline_image)) { - _txt = _txt - .replaceAll(rgx.inline_image, - ("$1<img src=\"" - ~ _img_pth - ~ "$3\" width=\"$4\" height=\"$5\" naturalsizeflag=\"0\" align=\"bottom\" border=\"0\" /> $6")) - .replaceAll( - rgx.inline_link_empty, - ("$1")); - } - return _txt; - } - string inline_links(O,M)( - string _txt, - const O obj, - M doc_matters, - string _suffix = ".html", - string _xml_type = "seg", - ) { - string seg_lvs; - if (obj.has.inline_links) { - if (obj.metainfo.is_a != "code") { - _txt = replaceAll!(m => - m[1] ~ "┤" - ~ (replaceAll!(n => - n["type"] ~ n["path"] ~ (n["file"].encodeComponent) - )((obj.stow.link[m["num"].to!ulong]).to!string, rgx.uri_identify_components)) - ~ "├" - )(_txt, rgx.inline_link_number_only); - } - if ((_txt.match(rgx.mark_internal_site_lnk)) - && (_xml_type == "scroll")) { // conditions reversed to avoid: gdc compiled program run segfault - _txt = _txt.replaceAll( - rgx.inline_seg_link, - "$1"); - } - if (_xml_type == "seg" || _xml_type == "epub") { - seg_lvs = (_xml_type == "epub") ? "seg_lv1to4" : "seg_lv4"; - foreach (m; _txt.match(rgx.inline_link_hash)) { - if (m.captures["hash"] in doc_matters.has.tag_associations) { - if ( - m.captures["hash"] - == doc_matters.has.tag_associations[(m.captures["hash"])][seg_lvs] - ) { - _txt = _txt.replaceFirst( - rgx.inline_link_hash, - "┥$1┝┤$3" ~ _suffix ~ "├" - ); - } else { - _txt = _txt.replaceFirst( - rgx.inline_link_hash, - "┥$1┝┤" - ~ doc_matters.has.tag_associations[(m.captures["hash"])][seg_lvs] - ~ _suffix ~ "#" ~ "$3" - ~ "├" - ); - } - } else { - if (doc_matters.opt.action.vox_gt_1) { - writeln( - "WARNING on internal document links, anchor to link <<" - ~ m.captures["hash"] - ~ ">> not found in document, " - ~ "anchor: " ~ m.captures["hash"] - ~ " document: " ~ doc_matters.src.filename - ); - } - } - } - } - _txt = _txt - .replaceAll( - rgx.inline_link_fn_suffix, - ("$1" ~ _suffix)) - .replaceAll( - rgx.inline_link, - ("<a href=\"$2\">$1</a>")) - .replaceAll( - rgx.mark_internal_site_lnk, - ""); - } - debug(markup_links) { - if (_txt.match(rgx.inline_link)) { - writeln(__LINE__, - " (missed) markup link identified (", - obj.has.inline_links, - "): ", obj.metainfo.is_a, ": ", - obj.text - ); - } - } - debug(markup) { - if (_txt.match(rgx.inline_link)) { - writeln(__LINE__, - " (missed) markup link identified (", - obj.has.inline_links, - "): ", obj.metainfo.is_a, ": ", - obj.text - ); - } - } - return _txt; - } - string inline_notes_scroll(O,M)( - string _txt, - const O obj, - M doc_matters, - ) { - if (obj.has.inline_notes_reg) { - _txt = font_face(_txt); - _txt = _txt.replaceAll( - rgx.inline_notes_al_regular_number_note, - ("<a href=\"#note_$1\"><note id=\"noteref_$1\"> <sup>$1</sup> </note></a>") - ); - } - if (obj.has.inline_notes_star) { - _txt = font_face(_txt); - _txt = _txt.replaceAll( - rgx.inline_notes_al_special_char_note, - ("<a href=\"#note_$1\"><note id=\"noteref_$1\"> <sup>$1</sup> </note></a>") - ); - } - debug(markup_endnotes) { - if (_txt.match(rgx.inline_notes_al_regular_number_note)) { - writeln(__LINE__, " (missed) markup endnote: ", obj.metainfo.is_a, ": ", obj.text); - } - } - debug(markup) { - if (_txt.match(rgx.inline_notes_al_regular_number_note)) { - writeln(__LINE__, " (missed) markup endnote: ", obj.metainfo.is_a, ": ", obj.text); - } - } - return _txt; - } - Tuple!(string, string[]) inline_notes_seg(O,M)( - string _txt, - const O obj, - M doc_matters, - ) { - string[] _endnotes; - if (obj.has.inline_notes_star) { - _txt = font_face(_txt); - /+ need markup for text, and separated footnote +/ - foreach(m; _txt.matchAll(rgx.inline_notes_al_special_char_note)) { - _endnotes ~= format( - "%s%s%s%s\n %s%s%s%s%s %s\n%s", - "<p class=\"endnote\">", - "<a href=\"#noteref_", - m.captures[1], - "\">", - "<note id=\"note_", - m.captures[1], - "\"> <sup>", - m.captures[1], - ".</sup></note></a>", - m.captures[2], - "</p>" - ); - } - _txt = _txt.replaceAll( - rgx.inline_notes_al_special_char_note, - ("<a href=\"#note_$1\"><note id=\"noteref_$1\"> <sup>$1</sup> </note></a>") - ); - } - if (obj.has.inline_notes_reg) { - _txt = font_face(_txt); - /+ need markup for text, and separated footnote +/ - foreach(m; _txt.matchAll(rgx.inline_notes_al_regular_number_note)) { - _endnotes ~= format( - "%s%s%s%s\n %s%s%s%s%s %s\n%s", - "<p class=\"endnote\">", - "<a href=\"#noteref_", - m.captures[1], - "\">", - "<note id=\"note_", - m.captures[1], - "\"> <sup>", - m.captures[1], - ".</sup></note></a>", - m.captures[2], - "</p>" - ); - } - _txt = _txt.replaceAll( - rgx.inline_notes_al_regular_number_note, - ("<a href=\"#note_$1\"><note id=\"noteref_$1\"> <sup>$1</sup> </note></a>") - ); - } else if (_txt.match(rgx.inline_notes_al_regular_number_note)) { - debug(markup) { - writeln(__LINE__, " endnote: ", obj.metainfo.is_a, ": ", obj.text); - } - } - Tuple!(string, string[]) t = tuple( - _txt, - _endnotes, - ); - return t; - } - string inline_markup_scroll(O,M)( - string _txt, - const O obj, - M doc_matters, - string _suffix = ".html", - ) { - if (obj.metainfo.dummy_heading - && (obj.metainfo.is_a == "toc" || obj.metainfo.is_a == "heading")) { - _txt = ""; - } else { - _txt = inline_images(_txt, obj, doc_matters, _suffix, "scroll"); - _txt = inline_links(_txt, obj, doc_matters, _suffix, "scroll"); - _txt = inline_notes_scroll(_txt, obj, doc_matters); - } - return _txt; - } - Tuple!(string, string[]) inline_markup_seg(O,M)( - string _txt, - const O obj, - M doc_matters, - string _suffix = ".html", - string _xml_type = "seg", - ) { - if (obj.metainfo.dummy_heading - && ((_xml_type == "epub" - && (obj.metainfo.is_a == "toc" || obj.metainfo.is_a == "heading")) - || obj.metainfo.is_a == "heading") - ) { - _txt = ""; - } else { - _txt = inline_images(_txt, obj, doc_matters, _suffix, _xml_type); // TODO - _txt = inline_links(_txt, obj, doc_matters, _suffix, _xml_type); // TODO - } - Tuple!(string, string[]) t = inline_notes_seg(_txt, obj, doc_matters); - return t; - } - string lev4_heading_subtoc(O,M)( - const O obj, - M doc_matters, - ) { - char[] lev4_subtoc; - lev4_subtoc ~= " <div class=\"nav\">\n"; - foreach (subtoc; obj.tags.lev4_subtoc) { - if (auto m = subtoc.match(rgx.inline_link_subtoc)) { - auto indent = (m.captures[1].to!int - 3).to!string; // css assumptions based on use of em for left margin & indent - auto text = m.captures[2].to!string; - text = font_face(text); - auto link = m.captures[3].to!string; - lev4_subtoc ~= subtoc.replaceFirst(rgx.inline_link_subtoc, - format(q"┃ <p class="minitoc" indent="h%si%s"> - ۰ <a href="%s">%s</a> - </p> - ┃", - indent, - indent, - link, - text, - )); - } - } - lev4_subtoc ~= " </div>\n"; - return lev4_subtoc.to!string; - } - auto nav_pre_next_svg(O,M)( - const O obj, - M doc_matters, - ) { - string prev, next, toc; - if (obj.tags.segment_anchor_tag_epub == "toc") { - toc = ""; - prev = ""; - } else { - toc = format(q"┃<a href="toc.html" target="_top"> - <div class="toc-button menu"> - <svg viewbox="0 0 100 100"> - <path d="M4,10h24c1.104,0,2-0.896,2-2s-0.896-2-2-2H4C2.896,6,2,6.896,2,8S2.896,10,4,10z M28,14H4c-1.104,0-2,0.896-2,2 s0.896,2,2,2h24c1.104,0,2-0.896,2-2S29.104,14,28,14z M28,22H4c-1.104,0-2,0.896-2,2s0.896,2,2,2h24c1.104,0,2-0.896,2-2 S29.104,22,28,22z" /> - </svg> - </div> - </a>┃", - ); - } - if (obj.tags.segname_prev == "") { - prev = ""; - } else { - prev = format(q"┃<a href="%s.html" target="_top"> - <div class="prev-next-button previous"> - <svg viewbox="0 0 100 100"> - <path class="arrow" d="M 50,0 L 60,10 L 20,50 L 60,90 L 50,100 L 0,50 Z" transform=" translate(15,0)" /> - </svg> - </div> - </a>┃", - obj.tags.segname_prev, - ); - } - if (obj.tags.segname_next == "") { - next = ""; - } else { - next = format(q"┃<a href="%s.html" target="_top"> - <div class="prev-next-button next"> - <svg viewbox="0 0 100 100"> - <path class="arrow" d="M 50,0 L 60,10 L 20,50 L 60,90 L 50,100 L 0,50 Z" transform="translate(85,100) rotate(180)" /> - </svg> - </div> - </a>┃", - obj.tags.segname_next, - ); - } - string _toc_pre_next = format(q"┃ <div class="nav-bar"> - %s - %s - %s - </div>┃", - toc, - prev, - next, - ); - string _pre_next = format(q"┃ <div class="nav-bar"> - %s - %s - </div>┃", - prev, - next, - ); - struct bar { - string toc_pre_next() { - return _toc_pre_next; - } - string pre_next() { - return _pre_next; - } - } - return bar(); - } - string heading(O,M)( - string _txt, - const O obj, - M doc_matters, - string _xml_type = "html", - ) { - assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter"); - assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb"); - assert(obj.metainfo.is_of_type == "para"); - assert(obj.metainfo.is_a == "heading"); - string tags = _xhtml_anchor_tags(obj); - string heading_lev_anchor_tag; - string _horizontal_rule = "<hr />"; - if ((_xml_type != "html") - || (obj.metainfo.heading_lev_markup == 0 || obj.metainfo.heading_lev_markup > 4)) { - _horizontal_rule = ""; - } - _txt = font_face(_txt); - string o; - heading_lev_anchor_tag = (obj.tags.heading_lev_anchor_tag.empty) - ? "" - : "<a name=\"" ~ obj.tags.heading_lev_anchor_tag ~ "\"></a>"; - if (_txt.empty) { - o = format(q"┃%s - ┃", - _horizontal_rule, - ); - } else { - o = ""; - if (obj.metainfo.is_of_section == "toc") { - o ~= format(q"┃ - <div class="substance"> - <p class="small" id="copyright"><a name="copyright"></a> - Copyright: %s - </p> - <!-- <p class="small" id="rights"><a name="rights"></a> - %s - </p> --> - </div>┃", - special_characters_text(doc_matters.conf_make_meta.meta.rights_copyright), - special_characters_text(doc_matters.conf_make_meta.meta.rights_license) - ); - } - } - if (!(obj.metainfo.identifier.empty)) { - o ~= format(q"┃%s - <div class="substance"> - <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> - <h%s class="%s" id="%s"><a name="%s"></a>%s%s - %s - </h%s> - </div>┃", - _horizontal_rule, - obj.metainfo.identifier, - (doc_matters.opt.action.ocn_off) - ? "" : ((obj.metainfo.object_number.empty) - ? "" : obj.metainfo.identifier), - ((_xml_type == "epub" && obj.metainfo.heading_lev_markup == 0) ? 1 - : obj.metainfo.heading_lev_markup), - obj.metainfo.is_a, - obj.metainfo.identifier, - obj.metainfo.identifier, - tags, - heading_lev_anchor_tag, - _txt, - ((_xml_type == "epub" && obj.metainfo.heading_lev_markup == 0) ? 1 - : obj.metainfo.heading_lev_markup), - ); - } else { - o ~= format(q"┃%s - <div class="substance"> - <h%s class="%s">%s%s - %s - </h%s> - </div>┃", - _horizontal_rule, - ((_xml_type == "epub" && obj.metainfo.heading_lev_markup == 0) ? 1 - : obj.metainfo.heading_lev_markup), - obj.metainfo.is_a, - tags, - heading_lev_anchor_tag, - _txt, - ((_xml_type == "epub" && obj.metainfo.heading_lev_markup == 0) ? 1 - : obj.metainfo.heading_lev_markup), - ); - } - return o; - } - string heading_scroll(O,M)( - string _txt, - const O obj, - M doc_matters, - string _suffix = ".html", - ) { - _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); - string o = heading(_txt, obj, doc_matters); - return o; - } - Tuple!(string, string[]) heading_seg(O,M)( - string _txt, - const O obj, - M doc_matters, - string _suffix = ".html", - string _xml_type = "html", - ) { - Tuple!(string, string[]) t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); - _txt = t[0]; - string[] _endnotes = t[1]; - string o = heading(_txt, obj, doc_matters, _xml_type); - Tuple!(string, string[]) u = tuple( - o, - _endnotes, - ); - return u; - } - string para(O,M)( - string _txt, - const O obj, - M doc_matters, - ) { - assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter"); - assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb"); - assert(obj.metainfo.is_of_type == "para"); - assert(obj.metainfo.is_a == "para" || "toc" || "endnote" || "glossary" || "bibliography" || "bookindex" || "blurb"); - string tags = _xhtml_anchor_tags(obj); - _txt = font_face(_txt); - string o; - _txt = (obj.attrib.bullet) ? ("●  " ~ _txt) : _txt; - _txt = _txt.replaceFirst(rgx.inline_link_anchor, - "<a name=\"$1\"></a>"); - if (!(obj.metainfo.identifier.empty)) { - o = format(q"┃ <div class="substance"> - <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> - <p class="%s" indent="h%si%s" id="%s">%s - %s - </p> - </div>┃", - obj.metainfo.identifier, - (doc_matters.opt.action.ocn_off) - ? "" - : ((obj.metainfo.object_number.empty) - ? "" - : obj.metainfo.identifier), - obj.metainfo.is_a, - obj.attrib.indent_hang, - obj.attrib.indent_base, - obj.metainfo.identifier, - tags, - _txt - ); - } else { - o = format(q"┃ <div class="substance"> - <p class="%s" indent="h%si%s">%s - %s - </p> - </div>┃", - obj.metainfo.is_a, - obj.attrib.indent_hang, - obj.attrib.indent_base, - tags, - _txt - ); - } - return o; - } - string para_scroll(O,M)( - string _txt, - const O obj, - M doc_matters, - string _suffix = ".html", - ) { - if (obj.metainfo.is_a == "toc" && _txt.match(rgx.inline_link_toc_to_backmatter)) { - _txt = _txt.replaceAll(rgx.inline_link_toc_to_backmatter, "┤#section_$1├"); - } - _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); - string o = para(_txt, obj, doc_matters); - return o; - } - Tuple!(string, string[]) para_seg(O,M)( - string _txt, - const O obj, - M doc_matters, - string _suffix = ".html", - string _xml_type = "html", - ) { - Tuple!(string, string[]) t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); - _txt = t[0].to!string; - string[] _endnotes = t[1]; - string o = para(_txt, obj, doc_matters); - Tuple!(string, string[]) u = tuple( - o, - _endnotes, - ); - return u; - } - string quote(O,M)( - string _txt, - const O obj, - M doc_matters, - ) { - assert(obj.metainfo.is_of_part == "body"); - assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); - assert(obj.metainfo.is_of_type == "block"); - assert(obj.metainfo.is_a == "quote"); - _txt = font_face(_txt); - string o; - if (!(obj.metainfo.identifier.empty)) { - o = format(q"┃ <div class="substance"> - <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> - <p class="%s" id="%s"> - %s - </p> - </div>┃", - obj.metainfo.identifier, - (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier), - obj.metainfo.is_a, - obj.metainfo.identifier, - _txt - ); - } else { - o = format(q"┃ <div class="substance"> - <p class="%s"> - %s - </p> - </div>┃", - obj.metainfo.is_a, - _txt - ); - } - return o; - } - string quote_scroll(O,M)( - string _txt, - const O obj, - M doc_matters, - string _suffix = ".html", - ) { - _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); - string o = quote(_txt, obj, doc_matters); - return o; - } - Tuple!(string, string[]) quote_seg(O,M)( - string _txt, - const O obj, - M doc_matters, - string _suffix = ".html", - string _xml_type = "html", - ) { - Tuple!(string, string[]) t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); - _txt = t[0].to!string; - string[] _endnotes = t[1]; - string o = quote(_txt, obj, doc_matters); - Tuple!(string, string[]) u = tuple( - o, - _endnotes, - ); - return u; - } - string group(O,M)( - string _txt, - const O obj, - M doc_matters, - ) { - assert(obj.metainfo.is_of_part == "body"); - assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); - assert(obj.metainfo.is_of_type == "block"); - assert(obj.metainfo.is_a == "group"); - _txt = font_face(_txt); - string o; - if (!(obj.metainfo.identifier.empty)) { - o = format(q"┃ <div class="substance"> - <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> - <p class="%s" id="%s"> - %s - </p> - </div>┃", - obj.metainfo.identifier, - (doc_matters.opt.action.ocn_off) ? "" - : ((obj.metainfo.object_number.empty) ? "" - : obj.metainfo.identifier), - obj.metainfo.is_a, - obj.metainfo.identifier, - _txt - ); - } else { - o = format(q"┃ <div class="substance"> - <p class="%s"> - %s - </p> - </div>┃", - obj.metainfo.is_a, - _txt - ); - } - return o; - } - string group_scroll(O,M)( - string _txt, - const O obj, - M doc_matters, - string _suffix = ".html", - string _xml_type = "html", - ) { - _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); - string o = group(_txt, obj, doc_matters); - return o; - } - Tuple!(string, string[]) group_seg(O,M)( - string _txt, - const O obj, - M doc_matters, - string _suffix = ".html", - string _xml_type = "html", - ) { - Tuple!(string, string[]) t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); - _txt = t[0].to!string; - string[] _endnotes = t[1]; - string o = group(_txt, obj, doc_matters); - Tuple!(string, string[]) u = tuple( - o, - _endnotes, - ); - return u; - } - string block(O,M)( - string _txt, - const O obj, - M doc_matters, - ) { - assert(obj.metainfo.is_of_part == "body"); - assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); - assert(obj.metainfo.is_of_type == "block"); - assert(obj.metainfo.is_a == "block"); - _txt = font_face(_txt); - string o; - if (!(obj.metainfo.identifier.empty)) { - o = format(q"┃ <div class="substance"> - <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> - <p class="%s" id="%s">%s</p> - </div>┃", - obj.metainfo.identifier, - (doc_matters.opt.action.ocn_off) ? "" - : ((obj.metainfo.object_number.empty) ? "" - : obj.metainfo.identifier), - obj.metainfo.is_a, - obj.metainfo.identifier, - _txt.stripRight - ); - } else { - o = format(q"┃ <div class="substance"> - <p class="%s">%s</p> - </div>┃", - obj.metainfo.is_a, - _txt.stripRight - ); - } - return o; - } - string block_scroll(O,M)( - string _txt, - const O obj, - M doc_matters, - string _suffix = ".html", - string _xml_type = "html", - ) { - _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); - string o = block(_txt, obj, doc_matters); - return o; - } - Tuple!(string, string[]) block_seg(O,M)( - string _txt, - const O obj, - M doc_matters, - string _suffix = ".html", - string _xml_type = "html", - ) { - Tuple!(string, string[]) t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); - _txt = t[0].to!string; - string[] _endnotes = t[1]; - string o = block(_txt, obj, doc_matters); - Tuple!(string, string[]) u = tuple( - o, - _endnotes, - ); - return u; - } - string verse(O,M)( - string _txt, - const O obj, - M doc_matters, - ) { - assert(obj.metainfo.is_of_part == "body"); - assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); - assert(obj.metainfo.is_of_type == "block"); - assert(obj.metainfo.is_a == "verse"); - _txt = font_face(_txt); - string o; - if (!(obj.metainfo.identifier.empty)) { - o = format(q"┃ <div class="substance"> - <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> - <p class="%s" id="%s">%s</p> - </div>┃", - obj.metainfo.identifier, - (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier), - obj.metainfo.is_a, - obj.metainfo.identifier, - _txt - ); - } else { - o = format(q"┃ <div class="substance"> - <p class="%s">%s</p> - </div>┃", - obj.metainfo.is_a, - _txt - ); - } - return o; - } - string verse_scroll(O,M)( - string _txt, - const O obj, - M doc_matters, - string _suffix = ".html", - string _xml_type = "html", - ) { - _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); - string o = verse(_txt, obj, doc_matters); - return o; - } - Tuple!(string, string[]) verse_seg(O,M)( - string _txt, - const O obj, - M doc_matters, - string _suffix = ".html", - string _xml_type = "html", - ) { - Tuple!(string, string[]) t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); - _txt = t[0].to!string; - string[] _endnotes = t[1]; - string o = verse(_txt, obj, doc_matters); - Tuple!(string, string[]) u = tuple( - o, - _endnotes, - ); - return u; - } - Tuple!(string, string) tablarize(O)( - string _txt, - const O obj, - ) { - string[] _table_rows = (_txt).split(rgx.table_delimiter_row); - string[] _table_cols; - string _table; - string _tablenote; - foreach(row_idx, row; _table_rows) { - _table_cols = row.split(rgx.table_delimiter_col); - _table ~= "<tr>"; - foreach(col_idx, cell; _table_cols) { - if ((_table_cols.length == 1) - && (_table_rows.length <= row_idx+2)) { - _tablenote ~= cell; - } else { - string _col_is = (row_idx == 0 && obj.table.heading) ? "th" : "td"; - string _align = ("style=\"text-align:" - ~ ((obj.table.column_aligns[col_idx] == "l") - ? "left\"" : "right\"")); - _table ~= "<" ~ _col_is ~ " width=\"" ~ obj.table.column_widths[col_idx].to!string ~ "%\" " ~ _align ~ ">"; - _table ~= cell; - _table ~= "</" ~ _col_is ~ ">"; - } - } - _table ~= "</tr>"; - } - Tuple!(string, string) t = tuple( - _table, - _tablenote, - ); - return t; - } - string table(O,M)( - string _txt, - const O obj, - M doc_matters, - ) { - assert(obj.metainfo.is_of_part == "body"); - assert(obj.metainfo.is_of_section == "body"); - assert(obj.metainfo.is_of_type == "block"); - assert(obj.metainfo.is_a == "table"); - string tags = _xhtml_anchor_tags(obj); - _txt = font_face(_txt); - auto t = tablarize(_txt, obj); - _txt = t[0]; - string _note = t[1]; - string o; - o = format(q"┃ <div class="substance"> - <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> - <p class="%s" id="%s">%s - <table summary="normal text css" width="95%%" border="0" cellpadding="2" align="center"> - %s - </table> - %s - </p> - </div>┃", - obj.metainfo.object_number, - (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier), - obj.metainfo.is_a, - obj.metainfo.object_number, - tags, - _txt, - _note - ); - return o; - } - string code(O,M)( - string _txt, - const O obj, - M doc_matters, - ) { - assert(obj.metainfo.is_of_part == "body"); - assert(obj.metainfo.is_of_section == "body"); - assert(obj.metainfo.is_of_type == "block"); - assert(obj.metainfo.is_a == "code"); - string o; - string codelines(string _txt) { - string _codelines; - if (obj.code_block.linenumbers) { - string[] _block_lines = (_txt).split(rgx.br_linebreaks_newlines); - _codelines = " <pre class=\"codeline\">\n"; - foreach (k, _line; _block_lines) { - if (k == 1) { - _codelines ~= format(q"┃ <span class="tr first-row"><span class="th"></span><codeline>%s</codeline></span> - ┃", - _line, - ); - } else { - _codelines ~= format(q"┃ <span class="tr"><span class="th"></span><codeline>%s</codeline></span> - ┃", - _line, - ); - } - } - _codelines ~= " </pre>"; - } else { - _codelines = " <pre class=\"codeline\">\n"; - _codelines ~= _txt; - _codelines ~= " </pre>"; - } - return _codelines; - } - if (!(obj.metainfo.identifier.empty)) { - o = format(q"┃ <div class="substance"> - <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> - <p class="%s" id="%s">%s</p> - </div>┃", - obj.metainfo.identifier, - (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier), - obj.metainfo.is_a, - obj.metainfo.identifier, - codelines(_txt) - ); - } else { - o = format(q"┃ <div class="substance"> - <p class="%s">%s</p> - </div>┃", - obj.metainfo.is_a, - codelines(_txt) - ); - } - return o; - } - } -} diff --git a/src/sisudoc/io_out/xmls_css.d b/src/sisudoc/io_out/xmls_css.d deleted file mode 100644 index cdada08..0000000 --- a/src/sisudoc/io_out/xmls_css.d +++ /dev/null @@ -1,4651 +0,0 @@ -/+ -- Name: SisuDoc Spine, Doc Reform [a part of] - - Description: documents, structuring, processing, publishing, search - - static content generator - - - Author: Ralph Amissah - [ralph.amissah@gmail.com] - - - Copyright: (C) 2015 (continuously updated, current 2026) Ralph Amissah, All Rights Reserved. - - - License: AGPL 3 or later: - - Spine (SiSU), a framework for document structuring, publishing and - search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU AFERO General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see [https://www.gnu.org/licenses/]. - - If you have Internet connection, the latest version of the AGPL should be - available at these locations: - [https://www.fsf.org/licensing/licenses/agpl.html] - [https://www.gnu.org/licenses/agpl.html] - - - Spine (by Doc Reform, related to SiSU) uses standard: - - docReform markup syntax - - standard SiSU markup syntax with modified headers and minor modifications - - docReform object numbering - - standard SiSU object citation numbering & system - - - Homepages: - [https://www.sisudoc.org] - [https://www.doc-reform.org] - - - Git - [https://git.sisudoc.org/] - -+/ -/++ - default css settings -+/ -module sisudoc.io_out.xmls_css; -@safe: -template spineCss() { - import std.format; - auto spineCss(M)(M doc_matters) { - string _css_indent = format(q"┃ -/* indent */ -p.norm { } -p.i1 { padding-left : 1em; } -p.i2 { padding-left : 2em; } -p.i3 { padding-left : 3em; } -p.i4 { padding-left : 4em; } -p.i5 { padding-left : 5em; } -p.i6 { padding-left : 6em; } -p.i7 { padding-left : 7em; } -p.i8 { padding-left : 8em; } -p.i9 { padding-left : 9em; } -/* hanging indent */ -p[indent="h0i0"] { - padding-left : 0em; - text-indent : 0em; -} -p[indent="h0i1"] { - padding-left : 1em; - text-indent : -1em; -} -p[indent="h0i2"] { - padding-left : 2em; - text-indent : -2em; -} -p[indent="h0i3"] { - padding-left : 3em; - text-indent : -3em; -} -p[indent="h0i4"] { - padding-left : 4em; - text-indent : -4em; -} -p[indent="h0i5"] { - padding-left : 5em; - text-indent : -5em; -} -p[indent="h0i6"] { - padding-left : 6em; - text-indent : -6em; -} -p[indent="h0i7"] { - padding-left : 7em; - text-indent : -7em; -} -p[indent="h0i8"] { - padding-left : 8em; - text-indent : -8em; -} -p[indent="h0i9"] { - padding-left : 9em; - text-indent : -9em; -} -p[indent="h1i0"] { - padding-left : 0em; - text-indent : 1em; -} -p[indent="h1i1"] { - padding-left : 1em; - text-indent : 0em; -} -p[indent="h1i2"] { - padding-left : 2em; - text-indent : -1em; -} -p[indent="h1i3"] { - padding-left : 3em; - text-indent : -2em; -} -p[indent="h1i4"] { - padding-left : 4em; - text-indent : -3em; -} -p[indent="h1i5"] { - padding-left : 5em; - text-indent : -4em; -} -p[indent="h1i6"] { - padding-left : 6em; - text-indent : -5em; -} -p[indent="h1i7"] { - padding-left : 7em; - text-indent : -6em; -} -p[indent="h1i8"] { - padding-left : 8em; - text-indent : -7em; -} -p[indent="h1i9"] { - padding-left : 9em; - text-indent : -8em; -} -p[indent="h2i0"] { - padding-left : 0em; - text-indent : 2em; -} -p[indent="h2i1"] { - padding-left : 1em; - text-indent : 1em; -} -p[indent="h2i2"] { - padding-left : 2em; - text-indent : 0em; -} -p[indent="h2i3"] { - padding-left : 3em; - text-indent : -1em; -} -p[indent="h2i4"] { - padding-left : 4em; - text-indent : -2em; -} -p[indent="h2i5"] { - padding-left : 5em; - text-indent : -3em; -} -p[indent="h2i6"] { - padding-left : 6em; - text-indent : -4em; -} -p[indent="h2i7"] { - padding-left : 7em; - text-indent : -5em; -} -p[indent="h2i8"] { - padding-left : 8em; - text-indent : -6em; -} -p[indent="h2i9"] { - padding-left : 9em; - text-indent : -7em; -} -p[indent="h3i0"] { - padding-left : 0em; - text-indent : 3em; -} -p[indent="h3i1"] { - padding-left : 1em; - text-indent : 2em; -} -p[indent="h3i2"] { - padding-left : 2em; - text-indent : 1em; -} -p[indent="h3i3"] { - padding-left : 3em; - text-indent : 0em; -} -p[indent="h3i4"] { - padding-left : 4em; - text-indent : -1em; -} -p[indent="h3i5"] { - padding-left : 5em; - text-indent : -2em; -} -p[indent="h3i6"] { - padding-left : 6em; - text-indent : -3em; -} -p[indent="h3i7"] { - padding-left : 7em; - text-indent : -4em; -} -p[indent="h3i8"] { - padding-left : 8em; - text-indent : -5em; -} -p[indent="h3i9"] { - padding-left : 9em; - text-indent : -6em; -} -p[indent="h4i0"] { - padding-left : 0em; - text-indent : 4em; -} -p[indent="h4i1"] { - padding-left : 1em; - text-indent : 3em; -} -p[indent="h4i2"] { - padding-left : 2em; - text-indent : 2em; -} -p[indent="h4i3"] { - padding-left : 3em; - text-indent : 1em; -} -p[indent="h4i4"] { - padding-left : 4em; - text-indent : 0em; -} -p[indent="h4i5"] { - padding-left : 5em; - text-indent : -1em; -} -p[indent="h4i6"] { - padding-left : 6em; - text-indent : -2em; -} -p[indent="h4i7"] { - padding-left : 7em; - text-indent : -3em; -} -p[indent="h4i8"] { - padding-left : 8em; - text-indent : -4em; -} -p[indent="h4i9"] { - padding-left : 9em; - text-indent : -5em; -} -p[indent="h5i0"] { - padding-left : 0em; - text-indent : 5em; -} -p[indent="h5i1"] { - padding-left : 1em; - text-indent : 4em; -} -p[indent="h5i2"] { - padding-left : 2em; - text-indent : 3em; -} -p[indent="h5i3"] { - padding-left : 3em; - text-indent : 2em; -} -p[indent="h5i4"] { - padding-left : 4em; - text-indent : 1em; -} -p[indent="h5i5"] { - padding-left : 5em; - text-indent : 0em; -} -p[indent="h5i6"] { - padding-left : 6em; - text-indent : -1em; -} -p[indent="h5i7"] { - padding-left : 7em; - text-indent : -2em; -} -p[indent="h5i8"] { - padding-left : 8em; - text-indent : -3em; -} -p[indent="h5i9"] { - padding-left : 9em; - text-indent : -4em; -} -p[indent="h6i0"] { - padding-left : 0em; - text-indent : 6em; -} -p[indent="h6i1"] { - padding-left : 1em; - text-indent : 5em; -} -p[indent="h6i2"] { - padding-left : 2em; - text-indent : 4em; -} -p[indent="h6i3"] { - padding-left : 3em; - text-indent : 3em; -} -p[indent="h6i4"] { - padding-left : 4em; - text-indent : 2em; -} -p[indent="h6i5"] { - padding-left : 5em; - text-indent : 1em; -} -p[indent="h6i6"] { - padding-left : 6em; - text-indent : 0em; -} -p[indent="h6i7"] { - padding-left : 7em; - text-indent : -1em; -} -p[indent="h6i8"] { - padding-left : 8em; - text-indent : -2em; -} -p[indent="h6i9"] { - padding-left : 9em; - text-indent : -3em; -} -p[indent="h7i0"] { - padding-left : 0em; - text-indent : 7em; -} -p[indent="h7i1"] { - padding-left : 1em; - text-indent : 6em; -} -p[indent="h7i2"] { - padding-left : 2em; - text-indent : 5em; -} -p[indent="h7i3"] { - padding-left : 3em; - text-indent : 4em; -} -p[indent="h7i4"] { - padding-left : 4em; - text-indent : 3em; -} -p[indent="h7i5"] { - padding-left : 5em; - text-indent : 2em; -} -p[indent="h7i6"] { - padding-left : 6em; - text-indent : 1em; -} -p[indent="h7i7"] { - padding-left : 7em; - text-indent : 0em; -} -p[indent="h7i8"] { - padding-left : 8em; - text-indent : -1em; -} -p[indent="h7i9"] { - padding-left : 9em; - text-indent : -2em; -} -p[indent="h8i0"] { - padding-left : 0em; - text-indent : 8em; -} -p[indent="h8i1"] { - padding-left : 1em; - text-indent : 7em; -} -p[indent="h8i2"] { - padding-left : 2em; - text-indent : 6em; -} -p[indent="h8i3"] { - padding-left : 3em; - text-indent : 5em; -} -p[indent="h8i4"] { - padding-left : 4em; - text-indent : 4em; -} -p[indent="h8i5"] { - padding-left : 5em; - text-indent : 3em; -} -p[indent="h8i6"] { - padding-left : 6em; - text-indent : 2em; -} -p[indent="h8i7"] { - padding-left : 7em; - text-indent : 1em; -} -p[indent="h8i8"] { - padding-left : 8em; - text-indent : 0em; -} -p[indent="h8i9"] { - padding-left : 9em; - text-indent : -1em; -} -p[indent="h9i0"] { - padding-left : 0em; - text-indent : 9em; -} -p[indent="h9i1"] { - padding-left : 1em; - text-indent : 8em; -} -p[indent="h9i2"] { - padding-left : 2em; - text-indent : 7em; -} -p[indent="h9i3"] { - padding-left : 3em; - text-indent : 6em; -} -p[indent="h9i4"] { - padding-left : 4em; - text-indent : 5em; -} -p[indent="h9i5"] { - padding-left : 5em; - text-indent : 4em; -} -p[indent="h9i6"] { - padding-left : 6em; - text-indent : 3em; -} -p[indent="h9i7"] { - padding-left : 7em; - text-indent : 2em; -} -p[indent="h9i8"] { - padding-left : 8em; - text-indent : 1em; -} -p[indent="h9i9"] { - padding-left : 9em; - text-indent : 0em; -} -┃"); -string _color_ocn_light = (doc_matters.opt.action.ocn_hidden) ? "#FFFFFF" : "#777777"; -string _color_ocn_dark = (doc_matters.opt.action.ocn_hidden) ? "#000000" : "#BBBBBB"; - string _css_light_html_seg = format(q"┃ -html { - font-size : 62.5%%; -} -*{ - padding : 0px; - margin : 0px; -} -body { - height : 100vh; - font-size : 1.6rem; - background-color : #FFFFFF; - color : #000000; - background : #FFFFFF; - background-color : #FFFFFF; -} -a:link { - color : #003399; - text-decoration : none; -} -a:visited { - color : #003399; - text-decoration : none; -} -a:hover { - color : #000000; - background-color : #F9F9AA; -} -a.lnkocn:link { - color : %s; - text-decoration : none; -} -a.lnkocn:visited { - color : #32CD32; - text-decoration : none; -} -a.lnkocn:hover { - color : #777777; - font-size : 1.8rem; -} -a.lnkicon:link { - text-decoration : none; -} -a.lnkicon:visited { - text-decoration : none; -} -a.lnkicon:hover { - font-size : 160%%; -} -a:hover img { - background-color : #FFFFFF; -} -a:active { - color : #003399; - text-decoration : underline; -} -input { - color : #000000; - background-color : #FFFFFF; -} -div { - margin-left : 0; - margin-right : 0; -} -div.p { - margin-left : 5%%; - margin-right : 1%%; -} -div.substance { - width : 100%%; - background-color : #FFFFFF; -} -div.ocn { - width : 5%%; - float : right; - top : 0; - background-color : #FFFFFF; -} -div.endnote { - width : 95%%; - background-color : #FFFFFF; -} -div.toc { - position : absolute; - float : left; - margin : 0; - padding : 0; - padding-top : 0.5em; - border : 0; - width : 13em; - background-color : #EEEEEE; - margin-right : 1em; -} -div.summary { - margin : 0; - padding : 0; - border-left : 13em solid #EEEEEE; - padding-left : 1em; - background-color : #EEEEEE; -} -div.content, div.main_column { - margin : 0; - padding : 0; - border-left : 13em solid #FFFFFF; - padding-left : 1em; - padding-right : 1em; -} -div.content0, div.main_column0 { - margin : 0; - padding : 0; - border-left : 0%% solid #FFFFFF; - padding-left : 5%%; -} -div.scroll { - margin : 0; - padding : 0; - padding-left : 1em; - padding-right : 1em; -} -div.content:after { - content : ' '; - clear : both; - display : block; - height : 0; - overflow : hidden; -} -div.footer { - clear : left; - padding : 0.5em; - font-size : 1.4rem; - margin : 0; -} -div.toc ul { - list-style : none; - padding : 0; - margin : 0; -} -div.toc li ul a, li ul span.currentlink -{ - font-weight : normal; - font-size : 1.5rem; - padding-left : 2em; - background-color : #EEEEEE; -} -div.toc a, span.currentlink{ - display : block; - text-decoration : none; - padding-left : 0.5em; - color : #0000aa; -} -hr { - width : 90%%; - margin-left : 5%%; - margin-right : 2em; - margin-top : 1.8em; - margin-bottom : 1.8em; -} -span.currentlink { - text-decoration : none; - background-color : #AAAAAA; -} -div.toc a:visited { - color : #0000aa; -} -div.toc a:hover { - color : #000000; - background-color : #F9F9AA; -} -nav#toc ol { - list-style-type : none; -} -.norm, .bold, .verse, .group, .block, .alt { - line-height : 133%%; - margin-top : 12px; - margin-bottom : 0px; - padding-left : 0em; - text-indent : 0em; -} -p, h0, h1, h2, h3, h4, h5, h6, h7, ul, li { - display : block; - font-family : verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman; - margin-left : 5%%; - margin-right : 2em; -} -p { - font-size : 1.6rem; - font-weight : normal; - line-height : 133%%; - text-align : justify; - text-indent : 0mm; - margin-top : 0.8em; - margin-bottom : 0.8em; -} -img { - max-width : 100%%; - height : auto; -} -pre { - width : auto; - display : block; - clear : both; - color : #555555; -} -pre.codeline { - display : table; - clear : both; - table-layout : fixed; - margin-left : 5%%; - margin-right : 5%%; - width : 90%%; - white-space : pre-wrap; - border-style : none; - border-radius : 5px 5px 5px 5px; - box-shadow : 0 2px 5px #AAAAAA inset; - margin-bottom : 1em; - padding : 0.5em 1em; - page-break-inside : avoid; - word-wrap : break-word; - font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace; - white-space : pre; - white-space : pre-wrap; - white-space : -moz-pre-wrap; - white-space : -o-pre-wrap; - background-color : #EEEEEE; - color : #000000; - font-size : 1.5rem; - line-height : 100%%; -} -pre.codeline::before { - counter-reset : linenum; -} -pre.codeline span.tr { - display : table-row; - counter-increment : linenum; -} -pre.codeline span.th { - display : table-cell; - user-select : none; - -moz-user-select : none; - -webkit-user-select : none; - padding : 0.5em 0.5em; - /* background-color : #666666; */ -} -pre.codeline span.th::before { - content : counter(linenum) "."; - color : #999999; - text-align : right; - display : block; -} -pre.codeline span.th { - width : 4em; -} -pre.codeline code { - display : table-cell; -} -p.code { - border-style : none; -} -p.spaced { white-space : pre; } -p.block { - white-space : pre; -} -p.group { } -p.alt { } -p.verse { - white-space : pre; - margin-bottom : 6px; -} -p.caption { - text-align : left; - font-size : 1.4rem; - display : inline; -} -p.endnote { - font-size : 1.55rem; - line-height : 120%%; - text-align : left; - margin-right : 15mm; - padding-left : 1em; - text-indent : -1em; -} -p.center { - text-align : center; -} -p.bold { - font-weight : bold; -} -p.bold_left { - font-weight : bold; - text-align : left; -} -p.centerbold { - text-align : center; - font-weight : bold; -} -p.em { - font-weight : bold; - font-style : normal; - background : #FFF3B6; -} -.small, .small_center { - font-size : 1.4rem; - margin-top : 0px; - margin-bottom : 0px; - margin-right : 6px; -} -p.small { - text-align : left; -} -p.small_center { - margin-left : 0px; - margin-right : 0px; - text-align : center; -} -.tiny, .tiny_left, .tiny_right, .tiny_center { - font-size : 1.2rem; - margin-top : 0px; - margin-bottom : 0px; - color : #777777; - margin-right : 6px; - text-align : left; -} -p.tiny { } -p.tiny_left { - margin-left : 0px; - margin-right : 0px; - text-align : left; -} -p.tiny_right { - margin-right : 1em; - text-align : right; -} -p.tiny_center { - margin-left : 0px; - margin-right : 0px; - text-align : center; -} -p.icons, .icons_center { - font-size : 100%%; - margin-top : 0px; - margin-bottom : 0px; - margin-right : 6px; -} -p.icons { - text-align : left; -} -p.concordance_word { - line-height : 150%%; - font-weight : bold; - display : inline; - margin-top : 4px; - margin-bottom : 1px; -} -p.concordance_count { - font-size : 1.4rem; - color : #777777; - display : inline; - margin-left : 0em; -} -p.concordance_object { - font-size : 1.4rem; - line-height : 120%%; - text-align : left; - margin-left : 3em; - margin-top : 1px; - margin-bottom : 3px; -} -p.book_index_lev1 { - line-height : 100%%; - margin-top : 4px; - margin-bottom : 1px; -} -p.book_index_lev2 { - line-height : 100%%; - text-align : left; - margin-left : 3em; - margin-top : 1px; - margin-bottom : 3px; -} -tt { - font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace; - background-color : #EEEEEE; - color : #000000; -} -%s -note { white-space : pre; } -label.ocn { - width : 2%%; - float : right; - top : 0; - font-size : 1.4rem; - margin-top : 0px; - margin-bottom : 6px; - margin-right : 6px; - text-align : right; - color : %s; - -khtml-user-select : none; - -moz-user-select : none; - -ms-user-select : none; - -o-user-select : none; - -webkit-user-select : none; - user-select : none; -} -table { - display : block; - margin-left : 5%%; - margin-right : 2em; - background-color : inherit; -} -tr { } -th,td { - vertical-align : top; - text-align : left; -} -th { - font-weight : bold; -} -em { - font-weight : bold; - font-style : italic; -} -p.left,th.left,td.left { - text-align : left; -} -p.small_left,th.small_left,td.small_left { - text-align : left; - font-size : 1.4rem; -} -p.right,th.right,td.right { - text-align : right; -} -ul, li { - list-style-type : none; - list-style : none; - padding-left : 20px; - font-weight : normal; - line-height : 150%%; - text-align : left; - text-indent : 0mm; - margin-left : 1em; - margin-right : 2em; - margin-top : 3px; - margin-bottom : 3px; -} -li { - background : url(../image_sys/bullet_09.png) no-repeat 0px 6px; -} -ul { } -h0, h1, h2, h3, h4, h5, h6, h7 { - font-weight : bold; - line-height : 120%%; - text-align : left; - margin-top : 20px; - margin-bottom : 10px; -} -h4.norm, h5.norm, h6.norm, h7.norm { - margin-top : 10px; - margin-bottom : 0px; -} -h0 { font-size : 1.85rem; } -h1 { font-size : 1.8rem; } -h2 { font-size : 1.75rem; } -h3 { font-size : 1.7rem; } -h4 { font-size : 1.65rem; } -h5 { font-size : 1.6rem; } -h6 { font-size : 1.55rem; } -h7 { font-size : 1.5rem; } -h0, h1, h2, h3, h4, h5, h6, h7 { - text-shadow : .2em .2em .3em #808080; -} -h1.i { margin-left : 2em; } -h2.i { margin-left : 3em; } -h3.i { margin-left : 4em; } -h4.i { margin-left : 5em; } -h5.i { margin-left : 6em; } -h6.i { margin-left : 7em; } -h7.i { margin-left : 8em; } -h8.i { margin-left : 9em; } -h9.i { margin-left : 10em; } -.toc { - font-weight : normal; - margin-top : 6px; - margin-bottom : 6px; -} -h0.toc { - margin-left : 1em; - font-size : 1.85rem; - line-height : 150%%; -} -h1.toc { - margin-left : 1em; - font-size : 1.8rem; - line-height : 150%%; -} -h2.toc { - margin-left : 2em; - font-size : 1.75rem; - line-height : 140%%; -} -h3.toc { - margin-left : 3em; - font-size : 1.7rem; - line-height : 120%%; -} -h4.toc { - margin-left : 4em; - font-size : 1.65rem; - line-height : 120%%; -} -h5.toc { - margin-left : 5em; - font-size : 1.6rem; - line-height : 110%%; -} -h6.toc { - margin-left : 6em; - font-size : 1.55rem; - line-height : 110%%; -} -h7.toc { - margin-left : 7em; - font-size : 1.5rem; - line-height : 100%%; -} -.subtoc { - margin-right : 34%%; - font-weight : normal; -} -h5.subtoc { - margin-left : 2em; - font-size : 1.45rem; - margin-top : 2px; - margin-bottom : 2px; -} -h6.subtoc { - margin-left : 3em; - font-size : 1.4rem; - margin-top : 0px; - margin-bottom : 0px; -} -h7.subtoc { - margin-left : 4em; - font-size : 1.35rem; - margin-top : 0px; - margin-bottom : 0px; -} -input, select, textarea { - font-size : 2.2rem; -} -input[type="text"] { - font-size : 1.8rem; - line-height : 120%%; -} -button[type="submit"] { - font-size : 1.8rem; - line-height : 120%%; -} -p.form { - font-size : 2.2rem; - line-height : 150%%; -} -.icon-bar { - width : 100%%; - overflow : auto; - margin : 0em 0em 0em; -} -.left-bar { - width : 85%%; - float : left; - display : inline; - overflow : auto; -} -.toc-button { - position : absolute; - top : 8px; - width : 3em; - height : 3em; - border-radius : 50%%; - background : #CCCCCC; - fill : #333333; - box-shadow : 0 2px 5px #AAAAAA inset; -} -.toc-button svg { - position : relative; - left : 25%%; - top : 25%%; - width : 150%%; - height : 150%%; -} -.toc-button p { - vertical-align : center; - font-size : 1.8rem; -} -.prev-next-button { - position : absolute; - top : 8px; - width : 3em; - height : 3em; - border-radius : 50%%; - background : #CCCCCC; - box-shadow : 0 2px 5px #AAAAAA inset; -} -.prev-next-button svg { - position : relative; - left : 20%%; - top : 20%%; - width : 60%%; - height : 60%%; -} -.menu { - right : 8em; - } -.previous { - right : 4em; - } -.next { - right : 0em; - } -.arrow { - fill : #333333; -} -.minitoc { - line-height : 120%%; - font-size : 1.6rem; - margin-top : 6px; - margin-bottom : 0px; - padding-left : 0em; - text-indent : 0em; - -khtml-user-select : none; - -moz-user-select : none; - -ms-user-select : none; - -o-user-select : none; - -webkit-user-select : none; - user-select : none; -} -/* flex */ -.flex-menu-bar { - display : -webkit-flex; - display : flex; - -webkit-flex-wrap : wrap; - -webkit-align-items : center; - align-items : center; - width : 100%%; - margin-left : 5%%; - margin-right : 2%%; - background-color : #FFFFFF; -} -.flex-menu-option { - background-color : #FFFFFF; - margin-right : 4px; -} -.flex-list { - display : -webkit-flex; - display : flex; - -webkit-align-items : center; - display : block; - align-items : center; - width : 100%%; - background-color : #FFFFFF; -} -.flex-list-item { - background-color : #FFFFFF; - margin : 4px; -} -/* grid */ -.wrapper { - display : grid; - grid-template-columns : 100%%; - grid-template-areas : - "headband" - "doc_header" - "doc_title" - "doc_toc" - "doc_prefix" - "doc_intro" - "doc_body" - "doc_endnotes" - "doc_glossary" - "doc_biblio" - "doc_bookindex" - "doc_blurb" - "doc_suffix"; - margin : 0px; - padding : 0px; - background-color : #FFFFFF; -} -.delimit { - border-style : none; - border-color : #FFFFFF; - padding : 10px; -} -.headband { - grid-area : headband; - background-color : #FFFFFF; -} -.doc_header { - grid-area : doc_header; -} -.doc_title { - grid-area : doc_title; -} -.doc_toc { - grid-area : doc_toc; -} -.doc_prefix { - grid-area : doc_prefix; -} -.doc_intro { - grid-area : doc_intro; -} -.doc_body { - grid-area : doc_body; -} -.doc_endnotes { - grid-area : doc_endnotes; -} -.doc_glossary { - grid-area : doc_glossary; -} -.doc_biblio { - grid-area : doc_biblio; -} -.doc_bookindex { - grid-area : doc_bookindex; -} -.doc_blurb { - grid-area : doc_blurb; -} -.doc_suffix { - grid-area : doc_suffix; -} -.nav-ul { - list-style : none; - float : left; -} -.nav-li { - float : left; - padding-right : 0.7em; -} -.nav-li a { - text-decoration : none; - color : #FFFFFF; -} -footer { - background-color : #00704E; -} -/* ------------------------------------------------------------------ */ -/* Homepage / body-flow HTML5 markup */ -/* <ul>/<li> and <details>/<summary> aligned with <p> and headings. */ -/* Scoped to direct body children to avoid affecting div.toc lists. */ -/* ------------------------------------------------------------------ */ -body > ul, -body > ol { - margin-left : 5%%; - margin-right : 2em; - margin-top : 0.8em; - margin-bottom : 0.8em; - padding-left : 1.5em; - list-style-position : outside; -} -body > ul { list-style-type : disc; } -body > ol { list-style-type : decimal; } -body > ul li, -body > ol li { - margin-left : 0; - margin-right : 0; - margin-top : 0.3em; - margin-bottom : 0.3em; - line-height : 133%%; - background : none; - text-align : left; - text-indent : 0; -} -details { - margin-top : 1em; - margin-bottom : 0.5em; -} -summary { - margin-left : 5%%; - margin-right : 2em; - padding-left : 0.2em; - padding-top : 0.4em; - padding-bottom : 0.4em; - font-size : 1.6rem; - line-height : 133%%; - cursor : pointer; -} -details > ul, -details > ol { - margin-left : 5%%; - padding-left : 1.5em; -} -details > ul li, -details > ol li { - margin-left : 0; -} -┃", - _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; -} -/* ------------------------------------------------------------------ */ -/* Homepage / body-flow HTML5 markup */ -/* <ul>/<li> and <details>/<summary> aligned with <p> and headings. */ -/* Scoped to direct body children to avoid affecting div.toc lists. */ -/* ------------------------------------------------------------------ */ -body > ul, -body > ol { - margin-left : 5%%; - margin-right : 2em; - margin-top : 0.8em; - margin-bottom : 0.8em; - padding-left : 1.5em; - list-style-position : outside; -} -body > ul { list-style-type : disc; } -body > ol { list-style-type : decimal; } -body > ul li, -body > ol li { - margin-left : 0; - margin-right : 0; - margin-top : 0.3em; - margin-bottom : 0.3em; - line-height : 133%%; - background : none; - text-align : left; - text-indent : 0; -} -details { - margin-top : 1em; - margin-bottom : 0.5em; -} -summary { - margin-left : 5%%; - margin-right : 2em; - padding-left : 0.2em; - padding-top : 0.4em; - padding-bottom : 0.4em; - font-size : 1.6rem; - line-height : 133%%; - cursor : pointer; -} -details > ul, -details > ol { - margin-left : 5%%; - padding-left : 1.5em; -} -details > ul li, -details > ol li { - margin-left : 0; -} -┃", - _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; -} -/* ------------------------------------------------------------------ */ -/* Homepage / body-flow HTML5 markup */ -/* <ul>/<li> and <details>/<summary> aligned with <p> and headings. */ -/* Scoped to direct body children to avoid affecting div.toc lists. */ -/* ------------------------------------------------------------------ */ -body > ul, -body > ol { - margin-left : 5%%; - margin-right : 2em; - margin-top : 0.8em; - margin-bottom : 0.8em; - padding-left : 1.5em; - list-style-position : outside; -} -body > ul { list-style-type : disc; } -body > ol { list-style-type : decimal; } -body > ul li, -body > ol li { - margin-left : 0; - margin-right : 0; - margin-top : 0.3em; - margin-bottom : 0.3em; - line-height : 133%%; - background : none; - text-align : left; - text-indent : 0; -} -details { - margin-top : 1em; - margin-bottom : 0.5em; -} -summary { - margin-left : 5%%; - margin-right : 2em; - padding-left : 0.2em; - padding-top : 0.4em; - padding-bottom : 0.4em; - font-size : 1.6rem; - line-height : 133%%; - cursor : pointer; -} -details > ul, -details > ol { - margin-left : 5%%; - padding-left : 1.5em; -} -details > ul li, -details > ol li { - margin-left : 0; -} -┃", - _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; -} -/* ------------------------------------------------------------------ */ -/* Homepage / body-flow HTML5 markup */ -/* <ul>/<li> and <details>/<summary> aligned with <p> and headings. */ -/* Scoped to direct body children to avoid affecting div.toc lists. */ -/* ------------------------------------------------------------------ */ -body > ul, -body > ol { - margin-left : 5%%; - margin-right : 2em; - margin-top : 0.8em; - margin-bottom : 0.8em; - padding-left : 1.5em; - list-style-position : outside; -} -body > ul { list-style-type : disc; } -body > ol { list-style-type : decimal; } -body > ul li, -body > ol li { - margin-left : 0; - margin-right : 0; - margin-top : 0.3em; - margin-bottom : 0.3em; - line-height : 133%%; - background : none; - text-align : left; - text-indent : 0; -} -details { - margin-top : 1em; - margin-bottom : 0.5em; -} -summary { - margin-left : 5%%; - margin-right : 2em; - padding-left : 0.2em; - padding-top : 0.4em; - padding-bottom : 0.4em; - font-size : 1.6rem; - line-height : 133%%; - cursor : pointer; -} -details > ul, -details > ol { - margin-left : 5%%; - padding-left : 1.5em; -} -details > ul li, -details > ol li { - margin-left : 0; -} -┃", - _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; - } -} |
