diff options
Diffstat (limited to 'src/doc_reform/io_out')
-rw-r--r-- | src/doc_reform/io_out/create_zip_file.d | 17 | ||||
-rw-r--r-- | src/doc_reform/io_out/defaults.d | 135 | ||||
-rw-r--r-- | src/doc_reform/io_out/epub3.d | 814 | ||||
-rw-r--r-- | src/doc_reform/io_out/html.d | 536 | ||||
-rw-r--r-- | src/doc_reform/io_out/hub.d | 135 | ||||
-rw-r--r-- | src/doc_reform/io_out/latex.d | 1204 | ||||
-rw-r--r-- | src/doc_reform/io_out/odt.d | 2076 | ||||
-rw-r--r-- | src/doc_reform/io_out/package.d | 22 | ||||
-rw-r--r-- | src/doc_reform/io_out/paths_output.d | 531 | ||||
-rw-r--r-- | src/doc_reform/io_out/rgx.d | 114 | ||||
-rw-r--r-- | src/doc_reform/io_out/source_pod.d | 374 | ||||
-rw-r--r-- | src/doc_reform/io_out/sqlite.d | 1561 | ||||
-rw-r--r-- | src/doc_reform/io_out/xmls.d | 1215 | ||||
-rw-r--r-- | src/doc_reform/io_out/xmls_css.d | 4185 |
14 files changed, 12919 insertions, 0 deletions
diff --git a/src/doc_reform/io_out/create_zip_file.d b/src/doc_reform/io_out/create_zip_file.d new file mode 100644 index 0000000..09b481a --- /dev/null +++ b/src/doc_reform/io_out/create_zip_file.d @@ -0,0 +1,17 @@ +module doc_reform.io_out.create_zip_file; +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/doc_reform/io_out/defaults.d b/src/doc_reform/io_out/defaults.d new file mode 100644 index 0000000..887c1be --- /dev/null +++ b/src/doc_reform/io_out/defaults.d @@ -0,0 +1,135 @@ +/++ + default settings ++/ +module doc_reform.io_out.defaults; + +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_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_nl = "┙"; + string br_paragraph = "┚"; + 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 on_o = "「"; auto on_c = "」"; + string mk_bullet = "● "; + static string indent_by_spaces_provided(int indent, string _indent_spaces ="░░") { + _indent_spaces = replicate(_indent_spaces, indent); + return _indent_spaces; + } + static string repeat_character_by_number_provided(C,N)(C _character ="-", N number=10) { + _character = replicate(_character, number); + return _character; + } + } +} +template spineLanguageCodes() { + /+ language codes +/ + struct Lang { + static string[string][string] codes() { + auto _lang_codes = [ + "am": [ "c": "am", "n": "Amharic", "t": "Amharic", "xlp": "amharic" ], + "bg": [ "c": "bg", "n": "Bulgarian", "t": "Български (Bəlgarski)", "xlp": "bulgarian" ], + "bn": [ "c": "bn", "n": "Bengali", "t": "Bengali", "xlp": "bengali" ], + "br": [ "c": "br", "n": "Breton", "t": "Breton", "xlp": "breton" ], + "ca": [ "c": "ca", "n": "Catalan", "t": "catalan", "xlp": "catalan" ], + "cs": [ "c": "cs", "n": "Czech", "t": "česky", "xlp": "czech" ], + "cy": [ "c": "cy", "n": "Welsh", "t": "Welsh", "xlp": "welsh" ], + "da": [ "c": "da", "n": "Danish", "t": "dansk", "xlp": "danish" ], + "de": [ "c": "de", "n": "German", "t": "Deutsch", "xlp": "german" ], + "el": [ "c": "el", "n": "Greek", "t": "Ελληνικά (Ellinika)", "xlp": "greek" ], + "en": [ "c": "en", "n": "English", "t": "English", "xlp": "english" ], + "eo": [ "c": "eo", "n": "Esperanto", "t": "Esperanto", "xlp": "esperanto" ], + "es": [ "c": "es", "n": "Spanish", "t": "español", "xlp": "spanish" ], + "et": [ "c": "et", "n": "Estonian", "t": "Estonian", "xlp": "estonian" ], + "eu": [ "c": "eu", "n": "Basque", "t": "basque", "xlp": "basque" ], + "fi": [ "c": "fi", "n": "Finnish", "t": "suomi", "xlp": "finnish" ], + "fr": [ "c": "fr", "n": "French", "t": "français", "xlp": "french" ], + "ga": [ "c": "ga", "n": "Irish", "t": "Irish", "xlp": "irish" ], + "gl": [ "c": "gl", "n": "Galician", "t": "Galician", "xlp": "galician" ], + "he": [ "c": "he", "n": "Hebrew", "t": "Hebrew", "xlp": "hebrew" ], + "hi": [ "c": "hi", "n": "Hindi", "t": "Hindi", "xlp": "hindi" ], + "hr": [ "c": "hr", "n": "Croatian", "t": "Croatian", "xlp": "croatian" ], + "hy": [ "c": "hy", "n": "Armenian", "t": "Armenian", "xlp": "armenian" ], + "ia": [ "c": "ia", "n": "Interlingua", "t": "Interlingua", "xlp": "interlingua" ], + "is": [ "c": "is", "n": "Icelandic", "t": "Icelandic", "xlp": "icelandic" ], + "it": [ "c": "it", "n": "Italian", "t": "Italiano", "xlp": "italian" ], + "ja": [ "c": "ja", "n": "Japanese", "t": "日本語 (Nihongo)", "xlp": "japanese" ], + "ko": [ "c": "ko", "n": "Korean", "t": "Korean", "xlp": "korean" ], + "la": [ "c": "la", "n": "Latin", "t": "Latin", "xlp": "latin" ], + "lo": [ "c": "lo", "n": "Lao", "t": "Lao", "xlp": "lao" ], + "lt": [ "c": "lt", "n": "Lithuanian", "t": "Lithuanian", "xlp": "lithuanian" ], + "lv": [ "c": "lv", "n": "Latvian", "t": "Latvian", "xlp": "latvian" ], + "ml": [ "c": "ml", "n": "Malayalam", "t": "Malayalam", "xlp": "malayalam" ], + "mr": [ "c": "mr", "n": "Marathi", "t": "Marathi", "xlp": "marathi" ], + "nl": [ "c": "nl", "n": "Dutch", "t": "Nederlands", "xlp": "dutch" ], + "no": [ "c": "no", "n": "Norwegian", "t": "norsk", "xlp": "norsk" ], + "nn": [ "c": "nn", "n": "Norwegian Nynorsk", "t": "nynorsk", "xlp": "nynorsk" ], + "oc": [ "c": "oc", "n": "Occitan", "t": "Occitan", "xlp": "occitan" ], + "pl": [ "c": "pl", "n": "Polish", "t": "polski", "xlp": "polish" ], + "pt": [ "c": "pt", "n": "Portuguese", "t": "Português", "xlp": "portuges" ], + "pt_BR": [ "c": "pt_BR", "n": "Portuguese Brazil", "t": "Brazilian Português", "xlp": "brazilian" ], + "ro": [ "c": "ro", "n": "Romanian", "t": "română", "xlp": "romanian" ], + "ru": [ "c": "ru", "n": "Russian", "t": "Русский (Russkij)", "xlp": "russian" ], + "sa": [ "c": "sa", "n": "Sanskrit", "t": "Sanskrit", "xlp": "sanskrit" ], + "se": [ "c": "se", "n": "Sami", "t": "Samin", "xlp": "samin" ], + "sk": [ "c": "sk", "n": "Slovak", "t": "slovensky", "xlp": "slovak" ], + "sl": [ "c": "sl", "n": "Slovenian", "t": "Slovenian", "xlp": "slovenian" ], + "sq": [ "c": "sq", "n": "Albanian", "t": "Albanian", "xlp": "albanian" ], + "sr": [ "c": "sr", "n": "Serbian", "t": "Serbian", "xlp": "serbian" ], + "sv": [ "c": "sv", "n": "Swedish", "t": "svenska", "xlp": "swedish" ], + "ta": [ "c": "ta", "n": "Tamil", "t": "Tamil", "xlp": "tamil" ], + "te": [ "c": "te", "n": "Telugu", "t": "Telugu", "xlp": "telugu" ], + "th": [ "c": "th", "n": "Thai", "t": "Thai", "xlp": "thai" ], + "tk": [ "c": "tk", "n": "Turkmen", "t": "Turkmen", "xlp": "turkmen" ], + "tr": [ "c": "tr", "n": "Turkish", "t": "Türkçe", "xlp": "turkish" ], + "uk": [ "c": "uk", "n": "Ukranian", "t": "українська (ukrajins\"ka)", "xlp": "ukrainian" ], + "ur": [ "c": "ur", "n": "Urdu", "t": "Urdu", "xlp": "urdu" ], + "us": [ "c": "en", "n": "English (American)","t": "English", "xlp": "english" ], + "vi": [ "c": "vi", "n": "Vietnamese", "t": "Vietnamese", "xlp": "vietnamese" ], + "zh": [ "c": "zh", "n": "Chinese", "t": "中文", "xlp": "chinese" ], + "en": [ "c": "en", "n": "English", "t": "English", "xlp": "english" ], + "xx": [ "c": "xx", "n": "Default", "t": "English", "xlp": "english" ], + ]; + return _lang_codes; + } + static string[] code_arr_ptr() { + string[] _lang_codes = ["am", "bg", "bn", "br", "ca", "cs", "cy", "da", "de", "el", "en", "eo", "es", "et", "eu", "fi", "fr", "ga", "gl", "he", "hi", "hr", "hy", "ia", "is", "it", "ja", "ko", "la", "lo", "lt", "lv", "ml", "mr", "nl", "no", "nn", "oc", "pl", "pt", "pt_BR", "ro", "ru", "sa", "se", "sk", "sl", "sq", "sr", "sv", "ta", "te", "th", "tk", "tr", "uk", "ur", "us", "vi", "zh", "en", "xx",]; + return _lang_codes; + } + static string[] code_arr() { + string[] _lang_codes = ["am", "bg", "bn", "br", "ca", "cs", "cy", "da", "de", "el", "en", "eo", "es", "et", "eu", "fi", "fr", "ga", "gl", "he", "hi", "hr", "hy", "ia", "is", "it", "ja", "ko", "la", "lo", "lt", "lv", "ml", "mr", "nl", "no", "nn", "oc", "pl", "pt", "pt_BR", "ro", "ru", "sa", "se", "sk", "sl", "sq", "sr", "sv", "ta", "te", "th", "tk", "tr", "uk", "ur", "vi", "zh"]; + return _lang_codes; + } + static auto codes_() { + return "(" ~ join(code_arr,"|") ~ ")"; + } + static auto codes_regex() { + return regex(codes_); + } + } +} diff --git a/src/doc_reform/io_out/epub3.d b/src/doc_reform/io_out/epub3.d new file mode 100644 index 0000000..14038a8 --- /dev/null +++ b/src/doc_reform/io_out/epub3.d @@ -0,0 +1,814 @@ +module doc_reform.io_out.epub3; +template outputEPub3() { + import doc_reform.io_out; + import + std.digest.sha, + std.file, + std.outbuffer, + std.uri, + std.zip, + std.conv : to; + import + doc_reform.io_out.create_zip_file, + doc_reform.io_out.xmls, + doc_reform.io_out.xmls_css; + mixin InternalMarkup; + mixin outputXHTMLs; + string epub3_mimetypes() { + string o; + o = format(q"┃application/epub+zip┃") ~ "\n"; + return o; + } + string epub3_container_xml() { + string o; + o = format(q"┃<?xml version='1.0' encoding='utf-8'?>┃") ~ "\n"; + o ~= format(q"┃<container version="1.0" + xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> + <rootfiles> + <rootfile full-path="OEBPS/content.opf" + media-type="application/oebps-package+xml" /> + </rootfiles>┃") ~ "\n</container>\n"; + return o; + } + string epub3_oebps_content(D,M,P)(D doc_abstraction, M doc_matters, P parts) { + auto xhtml_format = outputXHTMLs(); + auto pth_epub3 = spinePathsEPUB!()(doc_matters.output_path, doc_matters.src.language); + string _uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO sort uuid in doc_matters! + string content = format(q"┃ <?xml version='1.0' encoding='utf-8'?> + <package xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="EPB-UUID"> + <metadata + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:dcterms="http://purl.org/dc/terms/" + xmlns:dc="http://purl.org/dc/elements/1.1/" + unique-identifier="urn:uuid:%s" version="2.0"> + <!-- <dc:title id="title">%s</dc:title> --> + <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> + <!-- <dc:identifier id="EPB-UUID">urn:uuid:%s</dc:identifier> --> + </metadata> + <manifest> + <!-- NCX epub2 navigation --> + <item id="ncx" href="toc.ncx" media-type="application/x-dtbncx+xml" /> + <!-- CSS Style Sheets --> + <link rel="stylesheet" href="%s" type="text/css" id="main-css" /> + <!-- nav epub3 navigation --> + <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_full), + 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_text(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, + _uuid, + (pth_epub3.fn_oebps_css).chompPrefix("OEBPS/"), + ); + content ~= " " ~ "<!-- Content Documents -->" ~ "\n "; + content ~= parts["manifest_documents"]; + // TODO sort jpg & png + content ~= " " ~ "<!-- Images -->" ~ "\n "; + 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 toc=\"ncx\">" ~ "\n "; + content ~= parts["spine"]; + content ~= " " ~ "</spine>" ~ "\n "; + content ~= " " ~ "<guide>" ~ "\n "; + content ~= parts["guide"]; + content ~= " " ~ "</guide>" ~ "\n "; + content ~= "" ~ "</package>"; + debug(epubmanifest) { + foreach (part; doc_matters.has.keys_seq.seg) { // TODO + foreach (obj; doc_abstraction[part]) { + if (obj.metainfo.is_a == "heading") { + if (obj.metainfo.heading_lev_markup == 4) { + writefln( + "%s~ [%s.xhtml] %s", + obj.marked_up_level, + obj.tags.segment_anchor_tag_epub, + obj.text + ); + } else if (obj.metainfo.heading_lev_markup > 4) { + writefln( + "%s~ [%s.xhtml#%s] %s", + obj.marked_up_level, + obj.tags.segment_anchor_tag_epub, + obj.metainfo.object_number, + obj.text + ); + } + } + } + } + } + return content; + } + string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) { + enum DomTags { none, open, close, close_and_open, open_still, } + auto markup = InlineMarkup(); + auto rgx = Rgx(); + string toc =format("<html xmlns=\"http://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\">\n", + doc_matters.conf_make_meta.meta.title_full, + ); + foreach (sect; doc_matters.has.keys_seq.seg) { + foreach (obj; doc_abstraction[sect]) { + if (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.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"; + if (obj.metainfo.heading_lev_markup < 4) { + toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "<li>" ~ "\n" + ~ markup.indent_by_spaces_provided((n + 2), " ") + ~ "<a href=\"" ~ obj.tags.segment_anchor_tag_epub ~ ".xhtml" ~ "\">" + ~ _txt + ~ "</a>" ~ "\n"; + } else { + string hashtag =(obj.metainfo.heading_lev_markup == 4) + ? "" + : ("#" ~ obj.metainfo.ocn.to!string); + toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "<li>" ~ "\n" + ~ markup.indent_by_spaces_provided((n + 2), " ") + ~ "<a href=\"" ~ obj.tags.segment_anchor_tag_epub ~ ".xhtml" ~ hashtag ~ "\">" + ~ _txt + ~ "</a>" ~ "\n"; + } + break; + case DomTags.open : + toc ~= markup.indent_by_spaces_provided(n, " ") ~ "<ol>" ~ "\n"; + if (obj.metainfo.heading_lev_markup < 4) { + toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "<li>" ~ "\n" + ~ markup.indent_by_spaces_provided((n + 2), " ") + ~ "<a href=\"" ~ obj.tags.segment_anchor_tag_epub ~ ".xhtml" ~ "\">" + ~ _txt + ~ "</a>" ~ "\n"; + } else { + string hashtag =(obj.metainfo.heading_lev_markup == 4) + ? "" + : ("#" ~ obj.metainfo.ocn.to!string); + toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "<li>" ~ "\n" + ~ markup.indent_by_spaces_provided((n + 2), " ") + ~ "<a href=\"" ~ obj.tags.segment_anchor_tag_epub ~ ".xhtml" ~ hashtag ~ "\">" + ~ _txt + ~ "</a>" ~ "\n"; + } + break; + default : + break; + } + } + } + } + } + toc ~="</nav> + </section> + </body> + </html>\n"; + return toc; + } + string epub2_oebps_toc_ncx(D,I)(D doc_abstraction, I doc_matters) { + int counter = 0; + string _uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO shared elsewhere + auto markup = InlineMarkup(); + auto rgx = Rgx(); + enum DomTags { none, open, close, close_and_open, open_still, } + string toc = format(q"┃<?xml version='1.0' encoding='utf-8'?> + <ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1"> + <head> + <!-- four required metadata items (for all NCX documents, + (including the relaxed constraints of OPS 2.0) --> + <title>%s%s</title> + <link rel="stylesheet" href="css/epub.css" type="text/css" id="main-css" /> + <meta name="dtb:uid" content="urn:uuid:%s" /> + <!-- <meta name="epub-creator" content="spine http://www.jus.uio.no/sisu (this copy)" /> --> + <meta name="dtb:depth" content="%s" /> + <meta name="dtb:totalPageCount" content="0" /> + <meta name="dtb:maxPageNumber" content="0" /> + </head> + <docTitle> + <text>%s</text> + </docTitle> + <docAuthor> + <text>%s</text> + </docAuthor> + <navMap>┃", + doc_matters.conf_make_meta.meta.title_full, // title + (doc_matters.conf_make_meta.meta.creator_author.empty) ? "" + : " by " ~ doc_matters.conf_make_meta.meta.creator_author, // author + _uuid, // uuid + "3", // content depth + doc_matters.conf_make_meta.meta.title_full, // title + (doc_matters.conf_make_meta.meta.creator_author.empty) ? "" + : doc_matters.conf_make_meta.meta.creator_author, // author + ); + foreach (sect; doc_matters.has.keys_seq.seg) { + foreach (obj; doc_abstraction[sect]) { + if (obj.metainfo.is_a == "heading") { + string _txt = obj.text.replaceAll(rgx.inline_notes_al_gen, "").strip; + string hashtag =(obj.metainfo.heading_lev_markup <= 4) ? "" : ("#" ~ obj.metainfo.ocn.to!string); + foreach_reverse (k; 0 .. 7) { + switch (obj.metainfo.dom_structure_markedup_tags_status[k]) { + case DomTags.close : + toc ~= "\n </navPoint>"; + break; + case DomTags.close_and_open : + ++counter; + toc ~= "\n </navPoint>"; + toc ~= format(q"┃ + <navPoint class="chapter" id="navpoint" playOrder="%s"> + <navLabel> + <text>%s</text> + </navLabel> + <content src="%s.xhtml%s" />┃", + counter, + _txt, + obj.tags.segment_anchor_tag_epub, + hashtag, + ); + break; + case DomTags.open : + ++counter; + toc ~= format(q"┃ + <navPoint class="chapter" id="navpoint" playOrder="%s"> + <navLabel> + <text>%s</text> + </navLabel> + <content src="%s.xhtml%s" />┃", + counter, + _txt, + obj.tags.segment_anchor_tag_epub, + hashtag, + ); + break; + default : + break; + } + } + } + } + } + toc ~= format(q"┃ + </navPoint> + </navPoint> + </navPoint> + </navMap> + </ncx>┃"); + return toc; + } + + void outputEPub3(D,I)( + const D doc_abstraction, + I doc_matters, + ) { + mixin spineOutputRgxInit; + auto xhtml_format = outputXHTMLs(); + auto rgx = Rgx(); + string[] doc; + string segment_filename; + string[] top_level_headings = ["","","",""]; + string[string] oepbs_content_parts; + string suffix = ".xhtml"; + struct writeOut { /+ epub specific documents +/ + /+ fixed output +/ + string mimetypes; + string meta_inf_container_xml; + string oebps_toc_ncx; + 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 (part; doc_matters.has.keys_seq.seg) { + foreach (obj; doc_abstraction[part]) { + string _txt = xhtml_format.special_characters(obj); + if (obj.metainfo.is_a == "heading") { + assert(part == "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); + auto 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); + auto 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: + auto 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 + && doc_matters.opt.action.verbose) { + 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 + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); + } + } + break; + } + } else { + assert(part == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); + 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 "toc": + auto 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 + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + } + break; + } + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } + } + break; + } + break; + case "body": assert(part == "body"); + switch (obj.metainfo.is_of_type) { + case "para": + switch (obj.metainfo.is_a) { + case "para": + auto 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 + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + } + break; + } + break; + case "block": + switch (obj.metainfo.is_a) { + case "quote": + auto 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": + auto 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": + auto 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": + auto 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 + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + } + break; + } + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } + } + 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 "endnote": assert(part == "endnotes"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); + epubWrite.doc_epub3[segment_filename] ~= t[0]; + break; + case "glossary": assert(part == "glossary"); + auto 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(part == "bibliography"); + auto 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(part == "bookindex"); + auto 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(part == "blurb"); + auto 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 + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + } + break; + } + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } + } + break; + } + break; + case "comment": + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); + } + } + break; + } + } + if (obj.metainfo.is_a == "heading") { + assert(obj.text.length > 0); + 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_ncx = doc_abstraction.epub2_oebps_toc_ncx(doc_matters); + epubWrite.oebps_toc_nav_xhtml = doc_abstraction.epub3_oebps_toc_nav_xhtml(doc_matters); + epubWrite.oebps_content_opf = doc_abstraction.epub3_oebps_content(doc_matters, oepbs_content_parts); + epubWrite.epub3_write_output_files(doc_matters); + } + 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_toc_ncx) == string)); + static assert(is(typeof(epub_write.oebps_content_opf) == string)); + } + static auto rgx = Rgx(); + 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) + ? 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; + } + { /+ debug +/ + if (doc_matters.opt.action.debug_do) { + 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) { + 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); + } + } + 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.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) { + 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) { + 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) { + 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/toc.ncx (navigation toc epub2) +/ + { /+ debug +/ + if (doc_matters.opt.action.debug_do) { + fn_dbg = pth_epub3.dbg_fn_oebps_toc_ncx(doc_matters.src.filename); + File(fn_dbg, "w").writeln(epub_write.oebps_toc_ncx); + } + } + fn = pth_epub3.fn_oebps_toc_ncx; + EPUBzip(epub_write.oebps_toc_ncx, fn); + } + { /+ OEBPS/content.opf (doc manifest) +/ + { /+ debug +/ + if (doc_matters.opt.action.debug_do) { + 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) { + if (doc_matters.opt.action.very_verbose) { + 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) { + 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.quiet)) { + writeln(" ", fn_epub); + } + debug(epub_archive) { + if (exists(fn_epub)) { + try { + auto zipped = new ZipArchive((fn_epub).read); + foreach (filename, member; zipped.directory) { + auto data = zipped.expand(member); + writeln(filename, " length ", data.length); + } + } catch (ZipException ex) { + // Handle errors + } + } + } + } + +} diff --git a/src/doc_reform/io_out/html.d b/src/doc_reform/io_out/html.d new file mode 100644 index 0000000..36e0219 --- /dev/null +++ b/src/doc_reform/io_out/html.d @@ -0,0 +1,536 @@ +module doc_reform.io_out.html; +template outputHTML() { + import doc_reform.io_out; + import + std.digest.sha, + std.file, + std.outbuffer, + std.uri, + std.zip, + std.conv : to; + import + doc_reform.io_out.create_zip_file, + doc_reform.io_out.xmls, + doc_reform.io_out.xmls_css; + mixin outputXHTMLs; + void scroll(D,M)( + const D doc_abstraction, + M doc_matters, + ) { + mixin spineOutputRgxInit; + auto xhtml_format = outputXHTMLs(); + auto rgx = Rgx(); + string[] doc_html; + string[] doc; + string suffix = ".html"; + string previous_part = ""; + string delimit = ""; + foreach (part; doc_matters.has.keys_seq.scroll) { + foreach (obj; doc_abstraction[part]) { + delimit = xhtml_format.div_delimit(part, previous_part); + string _txt = xhtml_format.special_characters(obj); + 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": + 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 + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + } + break; + } + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } + } + break; + } + break; + case "body": assert(part == "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 + && doc_matters.opt.action.verbose) { + 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 + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + } + break; + } + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } + } + 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": + doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc_matters, suffix); + break; + case "endnote": assert(part == "endnotes"); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); + break; + case "glossary": assert(part == "glossary"); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); + break; + case "bibliography": assert(part == "bibliography"); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); + break; + case "bookindex": assert(part == "bookindex"); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); + break; + case "blurb": assert(part == "blurb"); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + } + break; + } + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } + } + break; + } + break; + case "comment": + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + writeln(__FILE__, ":", __LINE__, ": ", obj.text); + } + } + break; + } + } + } + doc = xhtml_format.html_head(doc_matters, "scroll") ~ doc_html ~ xhtml_format.tail; + scroll_write_output(doc, doc_matters); + } + void scroll_write_output(D,M)( + D doc, + M doc_matters, + ) { + debug(asserts) { + static assert(is(typeof(doc) == string[])); + } + auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language); + try { + if (!exists(pth_html.base)) { + pth_html.base.mkdirRecurse; + } + auto f = File(pth_html.fn_scroll(doc_matters.src.filename), "w"); + foreach (o; doc) { + f.writeln(o); + } + } catch (ErrnoException ex) { + // Handle error + } + if (!(doc_matters.opt.action.quiet)) { + writeln(" ", pth_html.fn_scroll(doc_matters.src.filename)); + } + } + void seg(D,M)( + const D doc_abstraction, + M doc_matters, + ) { + mixin spineOutputRgxInit; + auto rgx = Rgx(); + auto xhtml_format = outputXHTMLs(); + string[][string] doc_html; + string[][string] doc_html_endnotes; + string[] doc; + string segment_filename; + string[] top_level_headings = ["","","",""]; + string previous_seg_filename = ""; + string suffix = ".html"; + string previous_part = ""; + string delimit = ""; + foreach (part; doc_matters.has.keys_seq.seg) { + foreach (obj; doc_abstraction[part]) { + delimit = xhtml_format.div_delimit(part, previous_part); + string _txt = xhtml_format.special_characters(obj); + if (obj.metainfo.is_a == "heading") { + assert(part == "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: + auto 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; + } + auto 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: + auto 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 + && doc_matters.opt.action.verbose) { + 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 + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); + } + } + break; + } + } else { + assert(part == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); + 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 "toc": + auto 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 + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + } + break; + } + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + } + break; + } + break; + case "body": assert(part == "body"); + switch (obj.metainfo.is_of_type) { + case "para": + switch (obj.metainfo.is_a) { + case "para": + auto 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 + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + } + break; + } + break; + case "block": + switch (obj.metainfo.is_a) { + case "quote": + auto t = xhtml_format.quote_seg(_txt, obj, doc_matters, suffix, "seg"); + doc_html[segment_filename] ~= t[0].to!string; + doc_html_endnotes[segment_filename] ~= t[1]; + break; + case "group": + auto t = xhtml_format.group_seg(_txt, obj, doc_matters, suffix, "seg"); + doc_html[segment_filename] ~= t[0].to!string; + doc_html_endnotes[segment_filename] ~= t[1]; + break; + case "block": + auto t = xhtml_format.block_seg(_txt, obj, doc_matters, suffix, "seg"); + doc_html[segment_filename] ~= t[0].to!string; + doc_html_endnotes[segment_filename] ~= t[1]; + break; + case "poem": + break; + case "verse": + auto t = xhtml_format.verse_seg(_txt, obj, doc_matters, suffix, "seg"); + doc_html[segment_filename] ~= t[0].to!string; + doc_html_endnotes[segment_filename] ~= t[1]; + break; + 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: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + } + break; + } + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } + } + 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 "endnote": assert(part == "endnotes"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); + doc_html[segment_filename] ~= t[0]; + break; + case "glossary": assert(part == "glossary"); + auto 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(part == "bibliography"); + auto 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(part == "bookindex"); + auto 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(part == "blurb"); + auto 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 + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + } + break; + } + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } + } + break; + } + break; + case "comment": + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); + } + } + break; + } + } + } + } + seg_write_output(doc_html, doc_html_endnotes, doc_matters); + } + void seg_write_output(D,E,M)( + D doc_html, + E doc_html_endnotes, + M doc_matters, + ) { + debug(asserts) { + static assert(is(typeof(doc_html) == string[][string])); + } + mixin spineOutputRgxInit; + auto rgx = Rgx(); + auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language); + auto xhtml_format = outputXHTMLs(); + auto m = doc_matters.src.filename.matchFirst(rgx.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); + } + } catch (ErrnoException ex) { + // handle error + } + if (!(doc_matters.opt.action.quiet)) { + 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); + } catch (ErrnoException ex) { + // Handle error + } + } + void images_cp(M)( + M doc_matters, + ) { + { /+ (copy html images) +/ + + auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language); + if (!exists(pth_html.image)) { + pth_html.image.mkdirRecurse; + } + foreach (image; doc_matters.srcs.image_list) { + auto fn_src_in = doc_matters.src.image_dir_path ~ "/" ~ image; + auto fn_src_out = pth_html.image ~ "/" ~ image; + debug(images_html) { + writeln(fn_src_in, " -> ", fn_src_out); + } + if (exists(fn_src_in)) { + fn_src_in.copy(fn_src_out); + } else { + if (!(doc_matters.opt.action.quiet)) { + writeln("WARNING image not found: ", fn_src_in); + } + } + } + } + } +} diff --git a/src/doc_reform/io_out/hub.d b/src/doc_reform/io_out/hub.d new file mode 100644 index 0000000..8de07d8 --- /dev/null +++ b/src/doc_reform/io_out/hub.d @@ -0,0 +1,135 @@ +/++ + output hub<BR> + check & generate output types requested ++/ +module doc_reform.io_out.hub; +template outputHub() { + import doc_reform.io_out, + doc_reform.io_out.xmls, + doc_reform.io_out.odt, + doc_reform.io_out.create_zip_file, + doc_reform.io_out.paths_output; + import std.parallelism; + void outputHub(D,I)(const D doc_abstraction, I doc_matters) { + mixin spineOutputRgxInit; + mixin Msg; + auto msg = Msg!()(doc_matters); + static auto rgx = Rgx(); + enum outTask { source_or_pod, sqlite, sqlite_multi, latex, odt, epub, html_scroll, html_seg, html_stuff } + void Scheduled(D,I)(int sched, D doc_abstraction, I doc_matters) { + auto msg = Msg!()(doc_matters); + if (sched == outTask.source_or_pod) { + if (doc_matters.opt.action.source) { + msg.v("spine (doc reform) source processing... "); + } + if (doc_matters.opt.action.pod) { + msg.v("spine (doc reform) source pod processing... "); + } + import doc_reform.io_out.source_pod; + spinePod!()(doc_matters); + if (doc_matters.opt.action.source) { + msg.vv("spine (doc reform) source done"); + } + if (doc_matters.opt.action.pod) { + msg.vv("spine (doc reform) source pod done"); + } + } + if (sched == outTask.epub) { + msg.v("epub3 processing... "); + import doc_reform.io_out.epub3; + doc_abstraction.outputEPub3!()(doc_matters); + msg.vv("epub3 done"); + } + if (sched == outTask.html_scroll) { + msg.v("html scroll processing... "); + import doc_reform.io_out.html; + outputHTML!().scroll(doc_abstraction, doc_matters); + msg.vv("html scroll done"); + } + if (sched == outTask.html_seg) { + msg.v("html seg processing... "); + import doc_reform.io_out.html; + outputHTML!().seg(doc_abstraction, doc_matters); + msg.vv("html seg done"); + } + if (sched == outTask.html_stuff) { + import doc_reform.io_out.html; + outputHTML!().css(doc_matters); + outputHTML!().images_cp(doc_matters); + msg.vv("html css & images done"); + } + if (sched == outTask.latex) { + msg.v("latex processing... (available for downstream processing & pdf output"); + import doc_reform.io_out.latex; + outputLaTeX!()(doc_abstraction, doc_matters); + msg.vv("latex done"); + } + if (sched == outTask.odt) { + msg.v("odf:odt processing... "); + import doc_reform.io_out.odt; + outputODT!()(doc_abstraction, doc_matters); + msg.vv("odf:odt done"); + } + if (sched == outTask.sqlite) { + msg.v("sqlite processing... "); + import doc_reform.io_out.sqlite; + doc_abstraction.SQLiteHubDiscreteBuildTablesAndPopulate!()(doc_matters); + msg.vv("sqlite done"); + } + } + if (!(doc_matters.opt.action.quiet)) { + writeln(" ", doc_matters.src.filename_base); + } + if (!(doc_matters.opt.action.parallelise_subprocesses)) { + foreach(schedule; doc_matters.opt.action.output_task_scheduler) { + Scheduled!()(schedule, doc_abstraction, doc_matters); + } + } else { + foreach(schedule; parallel(doc_matters.opt.action.output_task_scheduler)) { + Scheduled!()(schedule, doc_abstraction, doc_matters); + } + } + if (doc_matters.opt.action.sqlite_update) { + msg.v("sqlite update processing..."); + import doc_reform.io_out.sqlite; + doc_abstraction.SQLiteHubBuildTablesAndPopulate!()(doc_matters); + msg.vv("sqlite update done"); + } else if (doc_matters.opt.action.sqlite_delete) { + msg.v("sqlite delete processing..."); + import doc_reform.io_out.sqlite; + doc_abstraction.SQLiteHubBuildTablesAndPopulate!()(doc_matters); + msg.vv("sqlite delete done"); + } + } +} +template outputHubOp() { + import doc_reform.io_out, + doc_reform.io_out.xmls, + doc_reform.io_out.odt, + doc_reform.io_out.create_zip_file, + doc_reform.io_out.paths_output; + void outputHubOp(E,O)(E env, O opt_action) { + mixin spineOutputRgxInit; + static auto rgx = Rgx(); + if ((opt_action.sqlite_db_drop)) { + if ((opt_action.verbose)) { + writeln("sqlite drop db..."); + } + import doc_reform.io_out.sqlite; + SQLiteDbDrop!()(opt_action); + if ((opt_action.very_verbose)) { + writeln("sqlite drop db done"); + } + } + if ((opt_action.sqlite_db_create)) { + if ((opt_action.verbose)) { + writeln("sqlite create table..."); + } + import doc_reform.io_out.sqlite; + SQLiteTablesCreate!()(env, opt_action); + if ((opt_action.very_verbose)) { + writeln("sqlite create table done"); + } + } + } +} diff --git a/src/doc_reform/io_out/latex.d b/src/doc_reform/io_out/latex.d new file mode 100644 index 0000000..6e651dd --- /dev/null +++ b/src/doc_reform/io_out/latex.d @@ -0,0 +1,1204 @@ +module doc_reform.io_out.latex; +template outputLaTeX() { + import doc_reform.io_out; + import + std.digest.sha, + std.file, + std.outbuffer, + std.uri, + std.conv : to; + mixin InternalMarkup; // watch + mixin spineOutputRgxInit; + auto rgx = Rgx(); + mixin spineLanguageCodes; + auto lang = Lang(); + auto paper() { + struct PaperType { + auto a4() { + struct A4 { + auto portrait() { + struct V { + uint w = 160; + uint h = 228; + uint img_px = 450; + } + return V(); + } + auto landscape() { + struct H { + uint w = 238; + uint h = 160; + uint img_px = 300; + } + return H(); + } + } + return A4(); + } + auto a5() { + struct A5 { + auto portrait() { + struct V { + uint w = 112; + uint h = 162; + uint img_px = 280; + } + return V(); + } + auto landscape() { + struct H { + uint w = 152; + uint h = 100; + uint img_px = 190; + } + return H(); + } + } + return A5(); + } + auto b4() { + struct B4 { + auto portrait() { + struct V { + uint w = 140; + uint h = 204; + uint img_px = 356; + } + return V(); + } + auto landscape() { + struct H { + uint w = 200; + uint h = 130; + uint img_px = 260; + } + return H(); + } + } + return B4(); + } + auto letter() { + struct Letter { + auto portrait() { + struct V { + uint w = 166; + uint h = 212; + uint img_px = 468; + } + return V(); + } + auto landscape() { + struct H { + uint w = 226; + uint h = 166; + uint img_px = 290; + } + return H(); + } + } + return Letter(); + } + auto legal() { + struct Legal { + auto portrait() { + struct V { + uint w = 168; + uint h = 286; + uint img_px = 474; + } + return V(); + } + auto landscape() { + struct H { + uint w = 296; + uint h = 166; + uint img_px = 420; + } + return H(); + } + } + return Legal(); + } + } + return PaperType(); + } + string sp_char_esc(O)( + string _txt, + const O obj, + ) { + string _unescape_sp_char_esc()(string _txt) { + _txt = _txt + .replaceAll(rgx.latex_special_char_escaped, + format(q"┃%s┃", "$1")) + .replaceAll(rgx.latex_special_char_escaped_braced, + format(q"┃%s┃", "$1")); + return _txt; + } + string _unescape_fontface_esc()(string _txt) { + _txt = _txt.replaceAll(rgx.latex_identify_inline_fontface, + format(q"┃%s%s┃", "$1", "$2")); + return _txt; + } + if (obj.metainfo.is_a != "code") { + _txt = replaceAll!(m => "\\" ~ m[1])(_txt, rgx.latex_special_char_for_escape); + _txt = replaceAll!(m => "{\\" ~ m[1] ~ "}")(_txt, rgx.latex_special_char_for_escape_and_braces); + _txt = replaceAll!(m => _unescape_sp_char_esc(m[0]))(_txt, rgx.latex_identify_inline_link); + _txt = replaceAll!(m => _unescape_fontface_esc(m[0]))(_txt, rgx.latex_identify_inline_fontface); + } + return _txt; + } + string sp_char_esc_txt()( + string _txt, + ) { + string _unescape_sp_char_esc()(string _txt) { + _txt = _txt + .replaceAll(rgx.latex_special_char_escaped, + format(q"┃%s┃", "$1")) + .replaceAll(rgx.latex_special_char_escaped_braced, + format(q"┃%s┃", "$1")); + return _txt; + } + string _unescape_fontface_esc()(string _txt) { + _txt = _txt.replaceAll(rgx.latex_identify_inline_fontface, + format(q"┃%s%s┃", "$1", "$2")); + return _txt; + } + _txt = replaceAll!(m => "\\" ~ m[1])(_txt, rgx.latex_special_char_for_escape); + _txt = replaceAll!(m => "{\\" ~ m[1] ~ "}")(_txt, rgx.latex_special_char_for_escape_and_braces); + _txt = replaceAll!(m => _unescape_sp_char_esc(m[0]))(_txt, rgx.latex_identify_inline_link); + _txt = replaceAll!(m => _unescape_fontface_esc(m[0]))(_txt, rgx.latex_identify_inline_fontface); + 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"┃$$^{\textrm{%s}}$$┃", "$1")) + .replaceAll(rgx.inline_subscript, format(q"┃$$_{\textrm{%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, "\\hardspace "); + 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)) { + _txt = _txt.replaceAll(rgx.nbsp_char, "\\hardspace "); + } + return _txt; + } + string nbsp_char_to_space()(string _txt) { + if (_txt.match(rgx.nbsp_char)) { + _txt = _txt.replaceAll(rgx.nbsp_char, " "); + } + return _txt; + } + string links_and_images(O,M)( + string _txt, + const O obj, + M doc_matters, + ) { + if (obj.has.inline_links) { // TODO some images do not have inline links ... image without link + string _width_adjust(string _width) { + if (_width.to!int > 300) { _width = "300"; } // will need to vary max with papersize & orientation + return _width; + } + string _latex_image_path(string _image_path) { + auto pth_latex = spinePathsLaTeX(doc_matters); + _image_path = pth_latex.latex_path_stuff ~ "/" ~ _image_path; + return _image_path; + } + string _if_images(string _linked_content) { + if (_linked_content.match(rgx.inline_image_info)) { + _linked_content = replaceAll!(m => + format(q"┃\includegraphics*[width=%spt]{%s}%s┃", + _width_adjust(m[2]), _latex_image_path(m[1]), " \\\\\n") + )(_linked_content, rgx.inline_image_info); + } + return _linked_content; + } + string _check_link(string _link) { + _link = _link + .replaceFirst(rgx.latex_clean_internal_link, "") + .replaceAll(rgx.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))) + ? format(q"┃\begin{scriptsize}\lefthalfcap\url{%s}\righthalfcup\end{scriptsize}┃", _check_link(m[1])) + : (m[2].match(rgx.uri)) // ERROR + ? format(q"┃%s\href{%s}%s{%s}┃", "\\\\\n", _check_link(m[2]), "\n", _if_images(m[1])) + : format(q"┃\hyperlink{%s}{%s}┃", _check_link(m[2]), _if_images(m[1])) + )(_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.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"┃\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}%s┃"; + _txt = format(_tex_para, + obj.metainfo.object_number, + 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.latex_clean_bookindex_linebreak, "\n") ~ "\n\\\\\n" + ); + } + return _txt; + } + string heading(O,M)( + string _txt, + O obj, + M doc_matters, + string _part = "" + ) { + if (obj.metainfo.is_a == "heading") { + string _tex_para; + 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\\\\\n\\begin{multicols}{2}"; + _pg_break = "\\clearpage\n"; + _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 = " \\\n"; + _title_add = ""; + goto default; + case 6: // 3 == subsubsection + _pg_break = ""; + // _pg_break = "newpage"; // doubt this is necessary + _sect = "subsubsection"; + _post = " \\\n"; + _title_add = ""; + goto default; + default: + if (obj.metainfo.heading_lev_markup == 0) { + _tex_para = q"┃\begin{document} +\title{%s} +\author{ \textnormal{%s}} +\date{\begin{tiny}%s\end{tiny}} +\pagenumbering{roman}\maketitle +\pagestyle{fancy} +\newpage +\markboth{%s}{%s} +\\\\[3]\ \linebreak Copyright {\begin{small}{\copyright\end{small}} %s \\ +%s +\pagestyle{fancy} +\clearpage┃"; + _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.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_full).sp_char_esc_txt, + (doc_matters.conf_make_meta.meta.rights_copyright).sp_char_esc_txt, + (doc_matters.conf_make_meta.meta.rights_license).sp_char_esc_txt, + ); + } else if (obj.metainfo.heading_lev_markup < 4) { + _tex_para = q"┃%s\part*{\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}%s} +\addcontentsline{toc}{part}{%s} +\markboth{%s}┃"; + _txt = format(_tex_para, + _pg_break, + obj.metainfo.object_number, + 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{none} +\setcounter{page}{1} +\setlength{\parskip}{1ex plus0.5ex minus0.2ex} +\part*{\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{1}{1}\end{tiny}}}%s \newline %s} + +\clearpage +\markboth{%s}{%s} +\pagenumbering{gobble} +\renewcommand{\contentsname}{} +\tableofcontents +\markboth{%s}{%s} + +\clearpage +\pagenumbering{arabic} +\setcounter{page}{1} +\markboth{%s}{%s} +%% \null +\clearpage +\setcounter{page}{1}┃"; + _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_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.title_full).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*{\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}%s} +\addcontentsline{toc}{%s}{%s%s}%s%s┃"; + _txt = format(_tex_para, + _pg_break, + _sect.strip, + obj.metainfo.object_number, + 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*{\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}%s} +\addcontentsline{toc}{%s}{%s%s}%s┃"; + _txt = format(_tex_para, + _pg_break, + _sect.strip, + obj.metainfo.object_number, + obj.metainfo.object_number, + _txt.footnotes.strip, + _sect, + _txt.remove_footnotes.strip, + _post, + _title_add, + ); + } + } + break; + } + } + return _txt.strip; + } +string group(O,M)( + string _txt, + O obj, + M doc_matters, +) { + if (obj.metainfo.is_a == "group") { + string _tex_para; + _tex_para = q"┃\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}\setlength{\parskip}{0.5ex plus0.2ex minus0.1ex} +\begin{footnotesize} +%s +\end{footnotesize} +┃"; + _txt = format(_tex_para, + obj.metainfo.object_number, + obj.metainfo.object_number, + _txt.footnotes.strip + ).strip; + } + return _txt; +} +string block(O,M)( + string _txt, + O obj, + M doc_matters, +) { + if (obj.metainfo.is_a == "block") { + // _txt = _txt.nbsp_char; + string _tex_para; + _tex_para = q"┃\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}\setlength{\parskip}{0.5ex plus0.2ex minus0.1ex} +\begin{footnotesize} +%s +\end{footnotesize} +\setlength{\parskip}{1ex plus0.5ex minus0.2ex} +┃"; // \hardspace + /+ try both: +/ + _txt = _txt.split(rgx.br_newlines_linebreaks).join("\n\n"); // _txt = _txt.split(rgx.br_newlines_linebreaks).join(" \\\n"); + _txt = format(_tex_para, + obj.metainfo.object_number, + obj.metainfo.object_number, + _txt.nbsp_char.footnotes.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"┃\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}\setlength{\parskip}{0.1ex plus0.1ex minus0.1ex} +\begin{footnotesize} + +%s + +\end{footnotesize} +\setlength{\parskip}{1ex plus0.5ex minus0.2ex} +\linebreak +┃"; // \hardspace + _txt = format(_tex_para, + obj.metainfo.object_number, + obj.metainfo.object_number, + _txt.nbsp_char.footnotes.split("\n").join("\n\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"┃\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}\setlength{\parskip}{0.5ex plus0.2ex minus0.1ex}\begin{Codeblock} +\begin{lstlisting} +%s +\end{lstlisting} +\end{Codeblock} +\setlength{\parskip}{1ex plus0.5ex minus0.2ex} +┃"; + _txt = format(_tex_para, + obj.metainfo.object_number, + 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 ~= "\\\\"; + } + auto t = tuple( + _table, + _tablenote, + ); + return t; +} +string table(O,M)( + string _txt, + O obj, + M doc_matters, +) { + if (obj.metainfo.is_a == "table") { + auto _t = _txt.tablarize(obj); + string _table = _t[0]; + string _t_n = _t[1]; + string papertype = "a4"; + uint pw = 0; + switch (papertype) { + case "a4": pw = (paper.a4.portrait.w - 20); break; + case "a5": pw = (paper.a5.portrait.w - 20); break; + case "b4": pw = (paper.b4.portrait.w - 20); break; + case "letter": pw = (paper.letter.portrait.w - 20); break; + case "legal": pw = (paper.legal.portrait.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"┃\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}} +\setlength{\LTleft}{0pt} +\setlength{\LTright}{\fill} +\begin{tiny} +\begin{longtable}{%s} +%s +\end{longtable} +\end{tiny} +┃"; + _txt = format(_tex_para, + obj.metainfo.object_number, + 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}$\txtbullet$\hspace{\enspace}%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 + ).strip; + } + return _txt; + } + string latex_head(M)( + M doc_matters, + ) { + struct paperType { + string a4_portrait; + string a4_landscape; + string us_letter_portrait; + string us_letter_landscape; + } + auto paper = paperType(); + string _footer(M)(M doc_matters) { + string _ft = "\\lfoot[\\textrm{\\thepage}]"; + string _ft_1 = format(q"┃{\tiny \href{%s}{%s}}┃", "http://sisudoc.org", "SiSU",); + string _ft_2 = format(q"┃ + \cfoot{\href{%s}{%s}}┃", "http://git.sisudoc.org", "git",); + if (doc_matters.conf_make_meta.make.footer.length > 0) { + if (doc_matters.conf_make_meta.make.footer.length > 0) { + if (doc_matters.conf_make_meta.make.footer[0].matchAll(rgx.inline_link)) { + _ft ~= doc_matters.conf_make_meta.make.footer[0] + .replace(rgx.inline_link, "{\\tiny \\href{$2}{$1}}"); + } else { + _ft ~= _ft_1; + } + } + if (doc_matters.conf_make_meta.make.footer.length > 1) { + if (doc_matters.conf_make_meta.make.footer[1].matchAll(rgx.inline_link)) { + _ft ~= doc_matters.conf_make_meta.make.footer[1] + .replace(rgx.inline_link, "\n\\cfoot{\\href{$2}{$1}}"); + } else { + _ft ~= _ft_2; + } + } + } else { + _ft ~= _ft_1; + _ft ~= _ft_2; + } + return _ft; + } + paper.a4_portrait = format(q"┃ +\documentclass[12pt,a4paper,titlepage]{scrartcl} +\setlength{\textheight}{228mm} \setlength{\textwidth}{160mm} +┃", + ); + paper.a4_landscape = format(q"┃ +\documentclass[11pt,a4paper,landscape,titlepage,twocolumn]{scrartcl} +\setlength{\textheight}{160mm} \setlength{\textwidth}{238mm} +┃", + ); + paper.us_letter_portrait = format(q"┃ +\documentclass[12pt,letterpaper,titlepage]{scrartcl} +\setlength{\textheight}{212mm} \setlength{\textwidth}{166mm} +┃", + ); + paper.us_letter_landscape = format(q"┃ +\documentclass[11pt,letterpaper,landscape,titlepage,twocolumn]{scrartcl} +\setlength{\textheight}{166mm} \setlength{\textwidth}{226mm} +┃", + ); + struct paperMargins { + string portrait; + string landscape; + } + auto margins = paperMargins(); + margins.portrait = format(q"┃ +\setlength{\oddsidemargin}{0mm} \setlength{\evensidemargin}{0mm} +\setlength{\topmargin}{-12pt} \setlength{\headheight}{12pt} +\setlength{\headsep}{35pt} +┃", + ); + margins.landscape = format(q"┃ +\setlength{\oddsidemargin}{6mm} \setlength{\evensidemargin}{6mm} +\setlength{\topmargin}{-12mm} \setlength{\headheight}{12pt} +\setlength{\headsep}{20pt} +┃", + ); + struct columnsMulti { + string portrait; + string landscape; + } + auto multicol = columnsMulti(); + multicol.portrait = format(q"┃ +\usepackage{multicol} +┃", + ); + multicol.landscape = ""; + struct colorLinks { + string mono; + string color; + } + auto links = colorLinks(); + links.mono = format(q"┃ +\usepackage[xetex, + colorlinks=true, + urlcolor=myblack, + filecolor=myblack, + linkcolor=myblack, +┃", + ); + links.color = format(q"┃ +\usepackage[xetex, + colorlinks=true, + urlcolor=myblue, %% \href{...}{...} external url + filecolor=mygreen, %% \href{...} local file + linkcolor=myred, %% \href{...} and \pageref{...} + ┃", + ); + string _latex_head = format(q"┃%%%% spine LaTeX output +%%%% Generated by: %s +%%%% D version: %s +%%%% LaTeX output last Generated on: %s +%%%% %s %s + +%s +%s +\setlength{\marginparsep}{4mm} +\setlength{\marginparwidth}{8mm} +%s +\usepackage{polyglossia, ucs, fontspec, xltxtra, xunicode} +\setmainlanguage{%s} +\setotherlanguage{%s} +\setmainfont{Liberation Sans} +\setmonofont[Scale=0.85]{Liberation Mono} +\usepackage{alltt} +\usepackage{thumbpdf} +%s + pdftitle={%s}, + pdfauthor={%s}, + pdfsubject={%s}, + pdfkeywords={}, + pageanchor=true, + plainpages=true, + pdfpagelabels=true, + pagebackref, + bookmarks=true, + bookmarksopen=true, + pdfmenubar=true, + pdfpagemode=UseOutline, + pdffitwindow=true, + pdfwindowui=true, + plainpages=false, + pdfstartview=FitH +] +{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{url} +\urlstyle{sf} +\usepackage{textcomp} +\usepackage[parfill]{parskip} +\usepackage[normalem]{ulem} +\usepackage{soul} +\usepackage{longtable} +\usepackage[tc]{titlepic} +\usepackage{graphicx} +\makeatletter +\parindent0pt +\usepackage{amssymb} +\usepackage{listings} +\usepackage{color} +\usepackage{textcomp} +\setcounter{secnumdepth}{2} +\setcounter{tocdepth}{4} +\makeatletter +\usepackage[multiple,ragged]{footmisc} +\setlength\footnotemargin{12pt} +\usepackage[para]{manyfoot} +\DeclareNewFootnote{A} +\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[] +} +{\end{list}} +\usepackage{fancyhdr} +\lhead{} +\renewcommand{\part}{\@startsection + {part}{1}{-2mm}%% + {-\baselineskip}{0.5\baselineskip}%% + {\bfseries\large\upshape\raggedright}} +\renewcommand{\section}{\@startsection + {section}{2}{-2mm}%% + {-\baselineskip}{0.5\baselineskip}%% + {\bfseries\large\upshape\raggedright}} +\renewcommand{\subsection}{\@startsection + {subsection}{3}{-2mm}%% + {-\baselineskip}{0.5\baselineskip}%% + {\bfseries\large\upshape\raggedright}} +\renewcommand{\subsubsection}{\@startsection + {subsubsection}{4}{-2mm}%% + {-\baselineskip}{0.5\baselineskip}%% + {\normalfont\normalsize\bfseries\raggedright}} +\renewcommand{\paragraph}{\@startsection + {paragraph}{5}{-2mm}%% + {-\baselineskip}{0.5\baselineskip}%% + {\normalfont\normalsize\itshape\raggedright}} +\renewcommand{\subparagraph}{\@startsection + {subparagraph}%%{6}%%{-2mm}%% + {-\baselineskip}{0.5\baselineskip}%% + {\normalfont\normalsize\itshape\raggedright}} +\selectlanguage{%s} +\lhead[ ]{ } +\chead[ \fancyplain{} \bfseries \footnotesize \leftmark ]{ \fancyplain{} \bfseries \footnotesize \rightmark } +\rhead[ ]{ } +%s +\rfoot[\tiny \href{}{}]{\textrm{\thepage}} +\tolerance=300 +\clubpenalty=300 +\widowpenalty=300 +\makeatother +\makeatother +\chardef\txtbullet="2022 +\chardef\tilde="7E +\def\asterisk{{\rm \char42} } +\definecolor{Light}{gray}{.92} +\newcommand{\Codeblock}[1]{\normaltext\raggedright\small\ttfamily\texbackslash#1} +\newcommand{\monosp}[1]{\normaltext\ttfamily\texbackslash#1} +\newcommand{\parasep}{\\ \begin{center}*\hspace{2em}*\hspace{2em}*\end{center} \\} +\newcommand{\hardspace}{{~}} +\newcommand{\caret}{{\^{~}}} +\newcommand{\pipe}{{\textbar}} +\newcommand{\curlyopen}{{} +\newcommand{\curlyclose}{}} +\newcommand{\lt}{{UseTextSymbol{OML}{<}}} +\newcommand{\gt}{{UseTextSymbol{OML}{>}}} +\newcommand{\slash}{{/}} +\newcommand{\underscore}{\_} +\newcommand{\exclaim}{\Verbatim{!}} +\definecolor{listinggray}{gray}{0.9} +\definecolor{lbcolor}{rgb}{0.9,0.9,0.9} +\lstset{ + backgroundcolor=\color{lbcolor}, + tabsize=4, + rulecolor=, + language=, + basicstyle=\scriptsize, + upquote=true, + aboveskip={1.5\baselineskip}, + 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}, +} + ┃", + doc_matters.opt.action.debug_do ? "" : doc_matters.generator_program.name_and_version.strip, + doc_matters.opt.action.debug_do ? "" : doc_matters.generator_program.compiler.strip, + doc_matters.opt.action.debug_do ? "" : doc_matters.generator_program.stime.strip, + doc_matters.generator_program.project_name.strip, + doc_matters.generator_program.url_home.strip, + paper.a4_portrait.strip, + margins.portrait.strip, + multicol.portrait.strip, + lang.codes[doc_matters.src.language]["xlp"], + "english", + links.mono.strip, // links.color.strip, + 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, + lang.codes[doc_matters.src.language]["xlp"], + _footer(doc_matters), + ); + return _latex_head.strip; + } + string latex_body(D,M)( + const D doc_abstraction, + M doc_matters, + ) { + 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); + 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); + goto default; + case "para": + _txt = _txt.para(obj) + .bullets_and_indentation(obj) + .links_and_images(obj, doc_matters); + goto default; + default: + _latex_body ~= _txt ~ "\n\n"; + _txt = ""; + break; + } + break; + case "block": + switch (obj.metainfo.is_a) { + case "quote": + goto default; // TODO + case "group": + /+ (hardspaces not honored) [remove any hardspace marker] +/ + _txt = _txt.group(obj, doc_matters) + .links_and_images(obj, doc_matters); + goto default; + case "block": + /+ (hardspace honored) \hardspace +/ + _txt = _txt.block(obj, doc_matters) + .links_and_images(obj, doc_matters); + goto default; + case "verse": + /+ (hardspace honored) \hardspace +/ + _txt = _txt.verse(obj, doc_matters) + .links_and_images(obj, doc_matters); + goto default; + case "code": + /+ (hardspace honored) \begin{lstlisting} clear hardspace marker +/ + _txt = _txt.codeblock(obj, doc_matters); + goto default; + case "table": + _txt = _txt.table(obj, doc_matters); + 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, part); + goto default; + case "endnote": assert(part == "endnotes"); + _txt = _txt.para(obj) + .bullets_and_indentation(obj) + .links_and_images(obj, doc_matters); + goto default; + 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 + && doc_matters.opt.action.verbose) { + 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 _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, + ) { + auto pth_latex = spinePathsLaTeX(doc_matters); + try { + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + 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.quiet)) { + writeln(" ", pth_latex.latex_file_with_path); + } + auto f = File(pth_latex.latex_file_with_path, "w"); + f.writeln(latex_content.head); + f.writeln(latex_content.content); + f.writeln(latex_content.tail); + foreach (image; doc_matters.srcs.image_list) { + auto fn_src_in = doc_matters.src.image_dir_path ~ "/" ~ image; + auto fn_src_out_file = pth_latex.latex_path_stuff ~ "/" ~ image; + if (exists(fn_src_in)) { + fn_src_in.copy(fn_src_out_file); + } + } + } catch (ErrnoException ex) { + // handle error + } + } + void outputLaTeX(D,M)( + const D doc_abstraction, + M doc_matters, + ) { + struct LaTeX { + string head; + string content; + string tail; + } + auto latex = LaTeX(); + latex.head = latex_head(doc_matters); + latex.content = latex_body(doc_abstraction, doc_matters); + latex.tail = latex_tail(doc_matters); + latex.writeOutputLaTeX(doc_matters); + } +} diff --git a/src/doc_reform/io_out/odt.d b/src/doc_reform/io_out/odt.d new file mode 100644 index 0000000..dbb8e5d --- /dev/null +++ b/src/doc_reform/io_out/odt.d @@ -0,0 +1,2076 @@ +module doc_reform.io_out.odt; +template formatODT() { + import doc_reform.io_out; + import + std.digest.sha, + std.file, + std.outbuffer, + std.uri, + std.zip, + std.conv : to; + import + doc_reform.io_out.create_zip_file, + doc_reform.io_out.xmls, + doc_reform.io_out.xmls_css; + mixin spineOutputRgxInit; + struct formatODT { + static auto rgx = Rgx(); + 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 = Rgx(); + _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" || "endnotes" || "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_newlines_linebreaks); + _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_newlines_linebreaks); + _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_newlines_linebreaks); + _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_newlines_linebreaks); + 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; + } + auto 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>"; + } + auto 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); + auto 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 doc_reform.io_out; + import + std.digest.sha, + std.file, + std.outbuffer, + std.uri, + std.zip, + std.conv : to; + import + doc_reform.io_out.create_zip_file, + doc_reform.io_out.xmls, + doc_reform.io_out.xmls_css; + mixin InternalMarkup; + mixin spineOutputRgxInit; + auto rgx = Rgx(); + // 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="http://www.w3.org/1999/xlink" xmlns:dc="http://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="http://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="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:tableooo="http://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="http://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.verbose) { + 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="http://www.doc_reform.org">www.doc_reform.org</text:a>> and <<text:a xl:type="simple" xl:href="http://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) +/ + 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="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:grddl="http://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, + ) { + 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; + } + // 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="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> + <rdf:Description rdf:about="styles.xml"> + <rdf:type rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/odf#StylesFile"/> + </rdf:Description> + <rdf:Description rdf:about=""> + <ns0:hasPart xmlns:ns0="http://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="http://docs.oasis-open.org/ns/office/1.2/meta/odf#ContentFile"/> + </rdf:Description> + <rdf:Description rdf:about=""> + <ns0:hasPart xmlns:ns0="http://docs.oasis-open.org/ns/office/1.2/meta/pkg#" rdf:resource="content.xml"/> + </rdf:Description> + <rdf:Description rdf:about=""> + <rdf:type rdf:resource="http://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="http://www.w3.org/1999/xlink" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://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="http://www.w3.org/1999/xlink" xmlns:dc="http://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="http://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="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:css3t="http://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; + } + + 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)); + zip_arc_member_file.expandedData = zip_data.toBytes(); + zip.addMember(zip_arc_member_file); + createZipFile!()(fn_odt, zip.build()); + } + } + } + } + if (!(doc_matters.opt.action.quiet)) { + writeln(" ", pth_odt.odt_file); + } + } catch (ErrnoException ex) { + // Handle error + } + if (doc_matters.opt.action.debug_do) { + pth_odt.mimetype("fs"); /+ (mimetype) +/ + pth_odt.manifest_rdf("fs"); /+ (manifest.rdf) +/ + pth_odt.settings_xml("fs"); /+ (settings.xml) +/ + pth_odt.styles_xml("fs"); /+ (styles_xml) +/ + + pth_odt.content_xml("fs"); + pth_odt.manifest_xml("fs"); + pth_odt.meta_xml("fs"); + } + } + void outputODT(D,I)( + const D doc_abstraction, + I doc_matters, + ) { + struct ODT { + /+ fixed output +/ + string mimetype; + string manifest_rdf; + string settings_xml; + string styles_xml; + /+ variable output +/ + string content_xml; // substantive content + string manifest_xml; // image list changes + string meta_xml; // time stamp + } + // auto pth_odt = spinePathsODT!()(doc_matters); + auto odt = ODT(); + odt.mimetype = mimetype; + odt.manifest_rdf = manifest_rdf; + odt.settings_xml = settings_xml; + odt.styles_xml = styles_xml; + odt.content_xml = content_xml(doc_abstraction, doc_matters); + odt.manifest_xml = manifest_xml(doc_matters); + odt.meta_xml = meta_xml(doc_matters); + odt.writeOutputODT(doc_matters); + dirtree(doc_matters); + images_cp(doc_matters); // copy images + } +} diff --git a/src/doc_reform/io_out/package.d b/src/doc_reform/io_out/package.d new file mode 100644 index 0000000..1f11046 --- /dev/null +++ b/src/doc_reform/io_out/package.d @@ -0,0 +1,22 @@ +module doc_reform.io_out; +public import + std.algorithm, + std.array, + std.container, + std.exception, + std.path, + std.process, + std.range, + std.regex, + std.stdio, + std.string, + std.traits, + std.typecons, + // std.uni, + std.utf; +public import + doc_reform.share.defaults, + doc_reform.io_in.paths_source, + doc_reform.io_out.defaults, + doc_reform.io_out.paths_output, + doc_reform.io_out.rgx; diff --git a/src/doc_reform/io_out/paths_output.d b/src/doc_reform/io_out/paths_output.d new file mode 100644 index 0000000..5f474a6 --- /dev/null +++ b/src/doc_reform/io_out/paths_output.d @@ -0,0 +1,531 @@ +/++ + default settings ++/ +module doc_reform.io_out.paths_output; +import std.array, + std.path, + std.regex, + std.stdio; +import doc_reform.meta.rgx; +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; + } + } + 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 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() { + mixin spineRgxInit; + static auto rgx = Rgx(); + 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_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() { + mixin spineRgxInit; + static auto rgx = Rgx(); + 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 harvest(string fn_harvest) { + return doc_root ~ "/" ~ fn_harvest; + } + 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_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; + mixin spineRgxInit; + static auto rgx = Rgx(); + 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 harvest(string fn_harvest) { + return format(q"┃%s/%s┃", + doc_root, + fn_harvest, + ); + } + 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_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() { + mixin spineRgxInit; + static auto rgx = Rgx(); + auto spinePathsEPUB()( + string output_pth_root, + string lng, + ) { + auto out_pth = spineOutPaths!()(output_pth_root, lng); + string base_dir = "epub"; + struct _PathsStruct { + 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("css")).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("mimetypes")).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("css").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("mimetypes").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() { + mixin spineRgxInit; + static auto rgx = Rgx(); + 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; + } + 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 spinePathsLaTeX() { + mixin spineRgxInit; + static auto rgx = Rgx(); + auto spinePathsLaTeX(M)( + M doc_matters, + ) { + struct _PathsStruct { + string base_filename(string fn_src) { + return fn_src.baseName.stripExtension; + } + string base() { + auto out_pth = spineOutPaths!()(doc_matters.output_path, doc_matters.src.language); + string base_dir = "latex"; + return (((out_pth.output_root).chainPath(base_dir)).asNormalizedPath).array; + } + string latex_path_stuff() { + return ((base.chainPath(base_filename(doc_matters.src.filename))).asNormalizedPath).array; + } + string latex_file_with_path() { + return ((base.chainPath(base_filename(doc_matters.src.filename) ~ "." ~ doc_matters.src.language ~ ".tex")).asNormalizedPath).array; + } + string images() { + string image_dir = "image"; + return (((base).chainPath(image_dir)).asNormalizedPath).array; + } + } + return _PathsStruct(); + } +} +template spinePathsSQLiteDiscrete() { + mixin spineRgxInit; + static auto rgx = Rgx(); + 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() { + mixin spineRgxInit; + static auto rgx = Rgx(); + auto spinePathsSQLite(DbN, Po)( + DbN db_name, + Po 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 = "sqlite"; + return (((out_pth.output_root).chainPath(base_dir)).asNormalizedPath).array; + } + string sqlite_file() { + return ((base.chainPath(base_filename(db_name) ~ ".sql.db")).asNormalizedPath).array; + } + } + return _PathsStruct(); + } +} diff --git a/src/doc_reform/io_out/rgx.d b/src/doc_reform/io_out/rgx.d new file mode 100644 index 0000000..4d0801c --- /dev/null +++ b/src/doc_reform/io_out/rgx.d @@ -0,0 +1,114 @@ +/++ + regex: regular expressions used in sisu document parser ++/ +module doc_reform.io_out.rgx; +static template spineOutputRgxInit() { + import doc_reform.io_out.defaults; + static struct Rgx { + 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 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_newlines_linebreaks = ctRegex!(`[\n┘┙]`, "mg"); + static br_line = ctRegex!(`┘`, "mg"); + static br_nl = 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_regular = ctRegex!(`【(.+?)】`, "mg"); + static inline_notes_al_gen_text = ctRegex!(`【(?P<text>.+?)】`, "m"); + static inline_notes_al_gen_ref = ctRegex!(`【(?P<ref>[*+]\s+)\s*(?P<text>.+?)】`, "mg"); + static inline_notes_al_all_note = ctRegex!(`【(?P<num>\d+|(?:[*]|[+])+)\s+(?P<note>.+?)\s*】`, "mg"); + static inline_notes_al_regular_number_note = ctRegex!(`【(?P<num>\d+)\s+(?P<note>.+?)\s*】`, "mg"); + static inline_notes_al_special_char_note = ctRegex!(`【(?P<char>(?:[*]|[+])+)\s+(?P<note>.+?)】`, "mg"); + static inline_al_delimiter_open_regular = ctRegex!(`【\s`, "m"); + static inline_al_delimiter_open_symbol_star = ctRegex!(`【[*]\s`, "m"); + static inline_al_delimiter_open_symbol_plus = ctRegex!(`【[+]\s`, "m"); + static inline_text_and_note_al_ = ctRegex!(`(.+?(?:【[*+]*\s+.+?】|$))`, "mg"); + /+ inline markup links +/ + static inline_image = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>\d+)h(?P<height>\d+))\s*(?P<post>.*?┝┤.*?├)`, "mg"); + static inline_image_without_dimensions = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>0)h(?P<height>0))\s*(?P<post>.*?┝┤.*?├)`, "mg"); + static inline_image_info = ctRegex!(`☼?(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>\d+)h(?P<height>\d+)`, "mg"); + static inline_link_anchor = ctRegex!(`┃(?P<anchor>\S+?)┃`, "mg"); // TODO *~text_link_anchor + static inline_link = ctRegex!(`┥(?P<text>.+?)┝┤(?P<link>#?(\S+?))├`, "mg"); + static inline_link_empty = ctRegex!(`┥(?P<text>.+?)┝┤├`, "mg"); + static inline_link_number = ctRegex!(`┥(?P<text>.+?)┝┤(?P<num>[0-9]+)├`, "mg"); // not used + static inline_link_number_only = ctRegex!(`(┥.+?┝)┤(?P<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<segname>\S+?))├`, "mg"); + static inline_link_clean = ctRegex!(`┤(?:.+?)├|[┥┝]`, "mg"); + static inline_link_toc_to_backmatter = ctRegex!(`┤#(?P<link>endnotes|bibliography|bookindex|glossary|blurb)├`, "mg"); + static url = ctRegex!(`https?://`, "mg"); + static uri = ctRegex!(`(?:https?|git)://`, "mg"); + static uri_identify_components = ctRegex!(`(?P<type>(?:https?|git)://)(?P<path>\S+?/)(?P<file>[^/]+)$`, "mg"); + static inline_link_subtoc = ctRegex!(`^(?P<level>[5-7])~ ┥(?P<text>.+?)┝┤(?P<link>.+?)├`, "mg"); + static inline_link_fn_suffix = ctRegex!(`¤(.+?)(\.fnSuffix)`, "mg"); + static inline_seg_link = ctRegex!(`(¤)(?:.+?)\.fnSuffix`, "mg"); + static mark_internal_site_lnk = ctRegex!(`¤`, "mg"); + static quotation_mark_sql_insert_delimiter = ctRegex!("[']", "mg"); + /+ inline markup font face mod +/ + static inline_mark_emphasis = ctRegex!(`(?P<mark>[*])\{(?P<text>.+?)\}[*]`, "mg"); + static inline_mark_bold = ctRegex!(`(?P<mark>[!])\{(?P<text>.+?)\}[!]`, "mg"); + static inline_mark_underscore = ctRegex!(`(?P<mark>[_])\{(?P<text>.+?)\}[_]`, "mg"); + static inline_mark_italics = ctRegex!(`(?P<mark>[/])\{(?P<text>.+?)\}[/]`, "mg"); + static inline_mark_superscript = ctRegex!(`(?P<mark>\^)\{(?P<text>.+?)\}\^`, "mg"); + static inline_mark_subscript = ctRegex!(`(?P<mark>[,])\{(?P<text>.+?)\}[,]`, "mg"); + static inline_mark_strike = ctRegex!(`(?P<mark>[-])\{(?P<text>.+?)\}[-]`, "mg"); + static inline_mark_insert = ctRegex!(`(?P<mark>[+])\{(?P<text>.+?)\}[+]`, "mg"); + static inline_mark_mono = ctRegex!(`(?P<mark>[#])\{(?P<text>.+?)\}[#]`, "mg"); + static inline_mark_cite = ctRegex!(`(?P<mark>["])\{(?P<text>.+?)\}["]`, "mg"); + static inline_faces_line = ctRegex!(`^[*!/_]_ (?P<text>.+?)((?: [\\]{2}|[~]#){0,2}$)`); + static inline_emphasis_line = ctRegex!(`^\*_ (?P<text>.+?)(?P<tail>(?: [\\]{2}|[~]#){0,2}$)`); + static inline_bold_line = ctRegex!(`^!_ (?P<text>.+?)(?P<tail>(?: [\\]{2}|[~]#){0,2}$)`); + static inline_italics_line = ctRegex!(`^/_ (?P<text>.+?)(?P<tail>(?: [\\]{2}|[~]#){0,2}$)`); + static inline_underscore_line = ctRegex!(`^__ (?P<text>.+?)(?P<tail>(?: [\\]{2}|[~]#){0,2}$)`); + /+ 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_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"); + static inline_fontface_clean = ctRegex!(`[*!_/^,+■‖-]┨|┣[*!_/^,+■‖-]`, "mg"); + /+ table delimiters +/ + static table_delimiter_col = ctRegex!("[ ]*[┊][ ]*", "mg"); + static table_delimiter_row = ctRegex!("[ ]*\n", "mg"); + static xhtml_ampersand = ctRegex!(`[&]`, "m"); // & + static xhtml_quotation = ctRegex!(`["]`, "m"); // " + static xhtml_less_than = ctRegex!(`[<]`, "m"); // < + static xhtml_greater_than = ctRegex!(`[>]`, "m"); // > + static xhtml_line_break = ctRegex!(` [\\]{2}`, "m"); // <br /> + 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_clean_internal_link = ctRegex!(`^(?:#|¤\S+?#)`, "m"); + static latex_identify_inline_fontface = ctRegex!(`\\([_#$]┨.+?┣)\\([_#$])`, "mg"); + static latex_clean_bookindex_linebreak = ctRegex!(`\s*\\\\\\\\\s*`, "m"); + } +} diff --git a/src/doc_reform/io_out/source_pod.d b/src/doc_reform/io_out/source_pod.d new file mode 100644 index 0000000..31c0b45 --- /dev/null +++ b/src/doc_reform/io_out/source_pod.d @@ -0,0 +1,374 @@ +module doc_reform.io_out.source_pod; +template spinePod() { + import doc_reform.io_out; + import + std.digest.sha, + std.file, + std.outbuffer, + std.zip, + std.conv : to; + import + doc_reform.io_out.create_zip_file, + doc_reform.io_out.xmls; + void spinePod(T)(T doc_matters) { + debug(asserts) { + // static assert(is(typeof(doc_matters) == tuple)); + } + mixin spineOutputRgxInit; + string pwd = doc_matters.env.pwd; + auto src_path_info = doc_matters.src_path_info; + auto pth_dr_doc_src = doc_matters.src_path_info; + auto pths_pod = spinePathsPods!()(doc_matters); + mixin spineLanguageCodes; + auto lang = Lang(); + static auto rgx = Rgx(); + assert (doc_matters.src.filename.match(rgx.src_fn)); + auto pod_archive(Z)( + string _source_type, + string _data_in, + string _pth_out, + Z zip + ) { + auto zip_arc_member_file = new ArchiveMember(); + zip_arc_member_file.name = _pth_out; + auto zip_data = new OutBuffer(); + switch (_source_type) { + case "file_path_bin": + zip_data.write(cast(char[]) ((_data_in).read)); + goto default; + case "file_path_text": + zip_data.write((_data_in).readText); + goto default; + case "string": + zip_data.write(_data_in); + goto default; + default: + zip_arc_member_file.expandedData = zip_data.toBytes(); + zip.addMember(zip_arc_member_file); + } + return zip; + } + try { + /+ create directory structure +/ + if (!exists(pths_pod.pod_dir_())) { + // used both by pod zipped (& pod filesystem (unzipped) which makes its own recursive dirs) + pths_pod.pod_dir_().mkdirRecurse; + } + if (doc_matters.opt.action.source) { + if (!(doc_matters.opt.action.quiet)) { + writeln(" ", pths_pod.fn_pod_filelist(doc_matters.src.filename).filesystem_open_zpod); + } + if (!exists(pths_pod.text_root(doc_matters.src.filename).filesystem_open_zpod)) { + pths_pod.text_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse; + } + if (!exists(pths_pod.conf_root(doc_matters.src.filename).filesystem_open_zpod)) { + pths_pod.conf_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse; + } + if (!exists(pths_pod.media_root(doc_matters.src.filename).filesystem_open_zpod)) { + pths_pod.media_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse; + } + if (!exists(pths_pod.css(doc_matters.src.filename).filesystem_open_zpod)) { + pths_pod.css(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse; + } + if (!exists(pths_pod.image_root(doc_matters.src.filename).filesystem_open_zpod)) { + pths_pod.image_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse; + } + if (!exists(pths_pod.doc_lng(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod)) { + pths_pod.doc_lng(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod.mkdirRecurse; + } + } + debug(pod) { + writeln(__LINE__, ": ", + doc_matters.src.filename, " -> ", + pths_pod.fn_doc(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod + ); + } + auto zip = new ZipArchive(); + auto fn_pod = pths_pod.pod_filename(doc_matters.src.filename).zpod; + { /+ bundle images +/ + foreach (image; doc_matters.srcs.image_list) { + debug(podimages) { + writeln( + pth_dr_doc_src.image_root.to!string, "/", image, " -> ", + pths_pod.image_root(doc_matters.src.filename).zpod, "/", image + ); + } + auto fn_src_in = doc_matters.src.image_dir_path ~ "/" ~ image; + auto fn_src_out_pod_zip_base + = pths_pod.image_root(doc_matters.src.filename).zpod.to!string + ~ "/" ~ image; + auto fn_src_out_filesystem + = pths_pod.image_root(doc_matters.src.filename).filesystem_open_zpod.to!string + ~ "/" ~ image; + if (exists(fn_src_in)) { + debug(io) { + writeln("(io debug) src out found: ", fn_src_in); + } + if (doc_matters.opt.action.source) { + fn_src_in.copy(fn_src_out_filesystem); + } + if (doc_matters.opt.action.pod) { + zip = pod_archive("file_path_bin", fn_src_in, fn_src_out_pod_zip_base, zip); + } + } else { + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln("WARNING (io) src out NOT found (image): ", fn_src_in); + } + } + } + } { /+ bundle dr_document_make +/ + auto fn_src_in = ((doc_matters.src.is_pod) + ? doc_matters.src.conf_dir_path + : pth_dr_doc_src.conf_root).to!string + ~ "/" ~ "dr_document_make"; + auto fn_src_out_pod_zip_base + = pths_pod.conf_root(doc_matters.src.filename).zpod.to!string ~ "/" ~ "dr_document_make"; + auto fn_src_out_filesystem + = pths_pod.conf_root(doc_matters.src.filename).filesystem_open_zpod.to!string + ~ "/" ~ "dr_document_make"; + if (exists(fn_src_in)) { + debug(io) { + writeln("(io debug) src out found: ", fn_src_in); + } + if (doc_matters.opt.action.source) { + fn_src_in.copy(fn_src_out_filesystem); + } + if (doc_matters.opt.action.pod) { + zip = pod_archive("file_path_text", fn_src_in, fn_src_out_pod_zip_base, zip); + } + } else { + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + 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 + && doc_matters.opt.action.verbose) { + _pmy = Loader.fromString(_pm).load(); + 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) { + pod_filelist_yaml_string.writeln(_pm); + } + if (doc_matters.opt.action.pod) { + zip = pod_archive("string", _pm, fn_src_out_pod_zip_base, zip); + } + } + } + } { /+ bundle primary file (.ssm/.sst) +/ + auto fn_src_in = doc_matters.src.file_with_absolute_path.to!string; + auto fn_src_out_pod_zip_base + = pths_pod.fn_doc(doc_matters.src.filename, doc_matters.src.language).zpod.to!string; + auto fn_src_out_filesystem + = pths_pod.fn_doc(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod.to!string; // needed without root path: + auto fn_src_out_inside_pod + = pths_pod.fn_doc(doc_matters.src.filename, doc_matters.src.language).zpod.to!string; // needed without root path: + string[] filelist_src_out_pod_arr; + string[] filelist_src_zpod_arr; + if (exists(fn_src_in)) { + debug(io) { + writeln("(io debug) src in found: ", fn_src_in); + } + filelist_src_out_pod_arr ~= fn_src_out_pod_zip_base; + filelist_src_zpod_arr ~= fn_src_out_inside_pod; + string _pod_to_markup_file = doc_matters.src.pod_name ~ "/" ~ "media/text/" ~ doc_matters.src.language ~ "/" ~ doc_matters.src.filename; + if (doc_matters.opt.action.source) { + fn_src_in.copy(fn_src_out_filesystem); + } + if (doc_matters.opt.action.pod) { + auto _rgx = regex(r"(?P<path_to_pod>\S+?)(?P<podname>[a-z_-]+)/(?P<from_root>media/text/)(?P<language>\S+?)/(?P<filename>\S+?\.ss[mt])"); + if (auto _x = fn_src_in.match(_rgx)){ + if (doc_matters.src.lng == doc_matters.pod.manifest_list_of_languages[$-1]) { + string _path_to_pod = _x.captures["path_to_pod"]; + string _podname = _x.captures["podname"]; + string _root_to_lang = _x.captures["from_root"]; + string _language = _x.captures["language"]; + string _filename = _x.captures["filename"]; + foreach (_lang; doc_matters.pod.manifest_list_of_languages) { + string _pth_mkup_src_in = _path_to_pod ~ _podname ~ "/" ~ _root_to_lang ~ _lang ~ "/" ~ _filename; + string _pth_mkup_src_out = "pod/" ~ _root_to_lang ~ _lang ~ "/" ~ _filename; + zip = pod_archive("file_path_text", _pth_mkup_src_in, _pth_mkup_src_out, zip); + } + } + } else { + zip = pod_archive("file_path_text", fn_src_in, fn_src_out_pod_zip_base, zip); + } + } + } else { + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln("WARNING (io) src in NOT found (markup source): ", fn_src_in); + } + } + } { /+ bundle insert files (.ssi) +/ + if (doc_matters.srcs.file_insert_list.length > 0) { + auto _rgx = regex(r"(?P<path_to_pod>\S+?)(?P<podname>[a-z_-]+)/(?P<from_root>media/text/)(?P<language>\S+?)/(?P<filename>\S+?\.ss[i])"); + foreach (insert_file; doc_matters.srcs.file_insert_list) { + debug(pod) { + writeln( + insert_file, " -> ", + pths_pod.fn_doc_insert( + doc_matters.src.filename, + insert_file, + doc_matters.src.language, + ).zpod + ); + } + if (auto _x = insert_file.match(_rgx)){ + if (doc_matters.src.lng == doc_matters.pod.manifest_list_of_languages[$-1]) { + string _path_to_pod = _x.captures["path_to_pod"]; + string _podname = _x.captures["podname"]; + string _root_to_lang = _x.captures["from_root"]; + string _language = _x.captures["language"]; + string _filename = _x.captures["filename"]; + foreach (_lang; doc_matters.pod.manifest_list_of_languages) { + string _pth_mkup_src_in = _path_to_pod ~ _podname ~ "/" ~ _root_to_lang ~ _lang ~ "/" ~ _filename; + string _pth_mkup_src_out = "pod/" ~ _root_to_lang ~ _lang ~ "/" ~ _filename; + if (exists(_pth_mkup_src_in)) { + if (doc_matters.opt.action.source) { + auto fn_src_out_filesystem // you need to change language sources + = pths_pod.fn_doc_insert( + doc_matters.src.filename, // doc_matters.src.filename + _pth_mkup_src_in, // insert_file + _lang, + ).filesystem_open_zpod.to!string; + _pth_mkup_src_in.copy(fn_src_out_filesystem); // check why here, thought dealt with elsewhere + } + if (doc_matters.opt.action.pod) { + zip = pod_archive("file_path_text", _pth_mkup_src_in, _pth_mkup_src_out, zip); + } + } else { + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln("WARNING (io) src out NOT found (insert file): ", _pth_mkup_src_in); + } + } + } + } + } else { + auto fn_src_in = insert_file; + auto fn_src_out_pod_zip_base + = pths_pod.fn_doc_insert( + doc_matters.src.filename, + insert_file, + doc_matters.src.language, + ).zpod.to!string; + auto fn_src_out_filesystem + = pths_pod.fn_doc_insert( + doc_matters.src.filename, + insert_file, + doc_matters.src.language, + ).filesystem_open_zpod.to!string; + if (exists(fn_src_in)) { + debug(io) { + writeln("(io debug) src out found: ", fn_src_in); + } + if (doc_matters.opt.action.source) { + fn_src_in.copy(fn_src_out_filesystem); + } + if (doc_matters.opt.action.pod) { + zip = pod_archive("file_path_text", fn_src_in, fn_src_out_pod_zip_base, zip); + } + } else { + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln("WARNING (io) src out NOT found (insert file): ", fn_src_in); + } + } + } + } + } + } { + auto fn_src_in = doc_matters.src.filename; + if (doc_matters.opt.action.pod) { + if (exists(doc_matters.src.file_with_absolute_path)) { + createZipFile!()(fn_pod, zip.build()); + } else { + writeln("WARNING check missing source file(s): ", doc_matters.opt.action.pod); + } + if (!(exists(fn_pod))) { + writeln("WARNING failed to create pod zip archive: ", fn_pod); + } + } + } + if (exists(fn_pod)) { + try { + if (!(doc_matters.opt.action.quiet) + && doc_matters.opt.action.pod) { + auto data = (cast(byte[]) (fn_pod).read); + if (doc_matters.opt.action.verbose) { + writeln(" ", doc_matters.src.filename, " > "); + } + if (doc_matters.opt.action.pod) { + writefln(" %s\n %s %-(%02x%)", fn_pod, "sha256", data.sha256Of); + } + } + debug(pod) { + try { + auto zipped = new ZipArchive((fn_pod).read); + foreach (filename, member; zipped.directory) { + auto data = zipped.expand(member); + writeln("> ", filename, " length ", data.length); + } + } catch (ZipException ex) { + // Handle errors + } + if (doc_matters.src.filename == "dr_doc/media/text/en/the_wealth_of_networks.yochai_benkler.sst") { + assert( + ((data).sha256Of).toHexString + == "626F83A31ED82F42CF528E922C1643498A137ABA3F2E5AFF8A379EA79EA22A1E", + "\npod: sha256 value for " + ~ doc_matters.src.filename + ~ " has changed, is now: " + ~ ((data).sha256Of).toHexString + ); + } + if (doc_matters.src.filename == "dr_doc/media/text/en/sisu_markup_stress_test.sst") { + assert( + ((data).sha256Of).toHexString + == "AAE0C87AB3F6D5F7385AEEA6EE661F56D40475CFE87AD930C78C9FE07FFB0D91", + "\npod: sha256 value for " + ~ doc_matters.src.filename + ~ " has changed, is now: " + ~ ((data).sha256Of).toHexString + ); + } + } + } catch (ErrnoException ex) { + // Handle errors + } + } + + } catch (ErrnoException ex) { + // Handle error + } + } +} diff --git a/src/doc_reform/io_out/sqlite.d b/src/doc_reform/io_out/sqlite.d new file mode 100644 index 0000000..0995fe1 --- /dev/null +++ b/src/doc_reform/io_out/sqlite.d @@ -0,0 +1,1561 @@ +module doc_reform.io_out.sqlite; +import doc_reform.io_out; +import + std.file, + std.uri, + std.conv : to; +import d2sqlite3; +import std.typecons : Nullable; +mixin spineOutputRgxInit; +mixin InternalMarkup; +static auto rgx = Rgx(); +static auto mkup = InlineMarkup(); +long _metadata_tid_lastrowid; +template SQLiteHubBuildTablesAndPopulate() { + void SQLiteHubBuildTablesAndPopulate(D,M)( + const D doc_abstraction, + M doc_matters, + ) { + auto pth_sqlite = spinePathsSQLite!()(doc_matters.sqlite.filename, doc_matters.output_path); + pth_sqlite.base.mkdirRecurse; + auto db = Database(pth_sqlite.sqlite_file); + template SQLiteDbStatementComposite() { + void SQLiteDbStatementComposite(Db,D,M)( + Db db, + const D doc_abstraction, + M doc_matters, + ) { + { + string _db_statement; + { + if ((doc_matters.opt.action.sqlite_db_create)) { + auto pth_sqlite = spinePathsSQLite!()(doc_matters.sqlite.filename, doc_matters.output_path); + pth_sqlite.base.mkdirRecurse; + _db_statement ~= SQLiteTablesReCreate!()(); + SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "TABLE RE-CREATE"); + } + if (doc_matters.opt.action.sqlite_delete) { + _db_statement ~= SQLiteDeleteDocument!()(doc_matters); + SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "DELETE Document"); + } + if (doc_matters.opt.action.sqlite_update) { + _db_statement ~= SQLiteDeleteDocument!()(doc_matters); + SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "DELETE Document"); + _db_statement ~= SQLiteInsertMetadata!()(doc_matters); + SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "INSERT MetaData"); + /+ get tid (lastrowid or max) for use in doc_objects table +/ + _db_statement ~= doc_abstraction.SQLiteInsertDocObjectsLoop!()(doc_matters); + SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "INSERT DocObjects"); + } + } + db.close; + } + if (!(doc_matters.opt.action.quiet)) { + writeln(" ", pth_sqlite.sqlite_file); + } + } + } + SQLiteDbStatementComposite!()(db, doc_abstraction, doc_matters); + } +} +template SQLiteHubDiscreteBuildTablesAndPopulate() { + void SQLiteHubDiscreteBuildTablesAndPopulate(D,M)( + const D doc_abstraction, + M doc_matters, + ) { + auto url_html = spineUrlsHTML!()(doc_matters.conf_make_meta.conf.webserv_url_doc_root, doc_matters.src.language); + auto pth_sqlite = spinePathsSQLiteDiscrete!()(doc_matters.output_path, doc_matters.src.language); + pth_sqlite.base.mkdirRecurse; + auto db = Database(pth_sqlite.sqlite_file(doc_matters.src.filename)); + template SQLiteDiscreteDbStatementComposite() { + void SQLiteDiscreteDbStatementComposite(Db,D,M)( + Db db, + const D doc_abstraction, + M doc_matters, + ) { + { + string _db_statement; + { + _db_statement ~= SQLiteTablesReCreate!()(); + _db_statement ~= SQLiteInsertMetadata!()(doc_matters); + _db_statement ~= doc_abstraction.SQLiteInsertDocObjectsLoop!()(doc_matters); + SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "table CREATE Tables, INSERT DocObjects"); + } + db.close; + } + if (!(doc_matters.opt.action.quiet)) { + writeln(" ", pth_sqlite.sqlite_file(doc_matters.src.filename)); + } + } + } + SQLiteDiscreteDbStatementComposite!()(db, doc_abstraction, doc_matters); + } +} +template SQLiteDbRun() { + void SQLiteDbRun(Db,St,O)( + Db db, + St db_statement, + O opt_action, + string note, + ) { + debug(sql_statement) { + writeln(db_statement); + } + try { + db.run( + "\nBEGIN;\n" ~ + db_statement ~ + "\nCOMMIT;\n" + ); + if (!(opt_action.sqlite_discrete) + && !(opt_action.sqlite_db_create) + ) { + } + } catch (ErrnoException ex) { + writeln("ERROR SQLite : ", ex); + } catch (Exception ex) { + writeln("ERROR SQLite : ", ex); + } + { /+ debug +/ + if (opt_action.debug_do + && opt_action.verbose) { + writeln(note); + if (opt_action.very_verbose) { + writeln(db_statement); + } + } + } + } +} +template SQLinsertDelimiter() { + auto 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 spineOutputRgxInit; + 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 + && doc_matters.opt.action.verbose) { + 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.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)); + 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_ref, "<sup>$1</sup> "); + } + if (_notes.length > 0) { + _txt ~= _notes; + } + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + 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.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_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[1] ~ "┤" ~ to!string((obj.stow.link[m[2].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.match(rgx.inline_link_hash)) { + if (m.captures[3] in doc_matters.has.tag_associations) { + if (m.captures[3] == doc_matters.has.tag_associations[(m.captures[3])]["seg_lv4"]) { + _txt = _txt.replaceFirst( + rgx.inline_link_hash, + "┥$1┝┤" + ~ doc_matters.conf_make_meta.conf.webserv_url_doc_root + ~ "/" + ~ pth_html.tail_fn_seg(doc_matters.src.filename, "$3.html") + ~ "├" + ); + } else { + _txt = _txt.replaceFirst( + rgx.inline_link_hash, + "┥$1┝┤" + ~ doc_matters.conf_make_meta.conf.webserv_url_doc_root + ~ "/" + ~ doc_matters.has.tag_associations[(m.captures[3])]["seg_lv4"] + ~ ".html" + ~ "#" ~ "$3" + ~ "├" + ); + } + } else { + if (!(doc_matters.opt.action.quiet)) { + writeln( + "WARNING on internal document links, anchor to link <<" + ~ m.captures[3] + ~ ">> not found in document, " + ~ "anchor: " ~ m.captures[3] + ~ " document: " ~ doc_matters.src.filename + ); + } + } + } + } else { + if (auto m = _txt.match(rgx.inline_link_hash)) { + _txt = _txt.replaceFirst( + rgx.inline_link_hash, + "┥$1┝┤" + ~ doc_matters.conf_make_meta.conf.webserv_url_doc_root + ~ "/" + ~ pth_html.tail_fn_scroll(doc_matters.src.filename) + ~ "#" ~ "$3" + ~ "├" + ); + } + } + _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 + ); + } + } + 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) { + // _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>") + ); + } + 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; + } + auto inline_notes_seg(M,O)( + M doc_matters, + const O obj, + string _txt, + ) { + string[] _endnotes; + if (obj.has.inline_notes_reg) { + /+ 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\n %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); + } + } + auto t = tuple( + _txt, + _endnotes, + ); + return t; + } + 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, + ) { + _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" || "endnotes" || "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); + 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); + 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"); + auto _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>"; + } + auto t = tuple( + _table, + _tablenote, + ); + return t; + } + string _txt = munge_html(doc_matters, obj); + auto 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" bgcolor="white" 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 postgresql_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 + && doc_matters.opt.action.verbose) { + 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 + && doc_matters.opt.action.verbose) { + 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 + && doc_matters.opt.action.verbose) { + 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 + && doc_matters.opt.action.verbose) { + 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 + && doc_matters.opt.action.verbose) { + 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 + && doc_matters.opt.action.verbose) { + 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 + && doc_matters.opt.action.verbose) { + 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 + && doc_matters.opt.action.verbose) { + 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_creator_author; + DROP INDEX IF EXISTS src_filename; + DROP INDEX IF EXISTS idx_language_document_char; + DROP INDEX IF EXISTS idx_classify_topic_register; + 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 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_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 VARCHAR(256) 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 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_lv0 VARCHAR(250) NOT NULL, + topic_register_lv1 VARCHAR(250) NULL, + topic_register_lv2 VARCHAR(250) NULL, + topic_register_lv3 VARCHAR(250) NULL, + topic_register_lv4 VARCHAR(250) 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 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_decendant VARCHAR(16) NULL, -- headings only + digest_clean CHAR(256), + digest_all CHAR(256), + html_seg_url CHAR(256), + types CHAR(1) NULL + ); + CREATE INDEX idx_ocn ON doc_objects(ocn); + CREATE INDEX idx_digest_clean ON doc_objects(digest_clean); + CREATE INDEX idx_digest_all ON doc_objects(digest_all); + CREATE INDEX idx_clean ON doc_objects(clean); + CREATE INDEX idx_title ON metadata_and_text(title); + CREATE INDEX idx_author ON metadata_and_text(creator_author); + CREATE INDEX idx_uid ON metadata_and_text(uid); + CREATE INDEX idx_filename ON metadata_and_text(src_filename); + CREATE INDEX idx_language ON metadata_and_text(language_document_char); + CREATE INDEX idx_topics ON metadata_and_text(classify_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, + 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_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' + ); + ┃", + _uid, + SQLinsertDelimiter!()(doc_matters.src.filename), + 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_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.webserv_url_doc_root) + ); + if (doc_matters.conf_make_meta.meta.classify_topic_register_arr.length > 0) { + + string _insert_topics; + foreach (topic; doc_matters.conf_make_meta.meta.classify_topic_register_arr) { + string[] subject_tree = topic.split(mkup.sep); + _insert_topics ~= format(q"┃ + INSERT INTO topic_register ( + uid_metadata_and_text, + topic_register_lv0, + topic_register_lv1, + topic_register_lv2, + topic_register_lv3, + topic_register_lv4 + ) + VALUES ( + '%s', '%s', '%s', '%s', '%s', '%s' + ); + ┃", + _uid, + (subject_tree.length > 0) ? subject_tree[0] : "", + (subject_tree.length > 1) ? subject_tree[1] : "", + (subject_tree.length > 2) ? subject_tree[2] : "", + (subject_tree.length > 3) ? subject_tree[3] : "", + (subject_tree.length > 4) ? subject_tree[4] : "" + ); + } + } + return _insert_metadata; + } +} +template SQLiteInsertDocObjectsLoop() { + string SQLiteInsertDocObjectsLoop(D,M)( + const D doc_abstraction, + M doc_matters, + ) { + string _uid = SQLinsertDelimiter!()(doc_matters.src.doc_uid); + auto url_html = spineUrlsHTML!()(doc_matters.conf_make_meta.conf.webserv_url_doc_root, 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, + html_seg_url + ) + 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, + url_html.fn_seg_obj_num(doc_matters.src.filename, obj.tags.html_segment_anchor_tag_is, obj.metainfo.identifier), + ); + 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 + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + } + break; + } + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + 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 + && doc_matters.opt.action.verbose) { + 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 + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + } + break; + } + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + 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 + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + } + break; + } + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } + } + break; + } + break; + case "comment": + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + 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.very_verbose)) { + 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)(E env, O opt_action) { + 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_creator_author; + DROP INDEX IF EXISTS src_filename; + DROP INDEX IF EXISTS idx_language_document_char; + DROP INDEX IF EXISTS idx_classify_topic_register; + 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 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_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 VARCHAR(256) 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 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_lv0 VARCHAR(250) NOT NULL, + topic_register_lv1 VARCHAR(250) NULL, + topic_register_lv2 VARCHAR(250) NULL, + topic_register_lv3 VARCHAR(250) NULL, + topic_register_lv4 VARCHAR(250) 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 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_decendant VARCHAR(16) NULL, -- headings only + digest_clean CHAR(256), + digest_all CHAR(256), + html_seg_url CHAR(256), + types CHAR(1) NULL + ); + CREATE INDEX idx_ocn ON doc_objects(ocn); + CREATE INDEX idx_digest_clean ON doc_objects(digest_clean); + CREATE INDEX idx_digest_all ON doc_objects(digest_all); + CREATE INDEX idx_clean ON doc_objects(clean); + CREATE INDEX idx_title ON metadata_and_text(title); + CREATE INDEX idx_author ON metadata_and_text(creator_author); + CREATE INDEX idx_uid ON metadata_and_text(uid); + CREATE INDEX idx_filename ON metadata_and_text(src_filename); + CREATE INDEX idx_language ON metadata_and_text(language_document_char); + CREATE INDEX idx_topics ON metadata_and_text(classify_topic_register); + ┃",); + return _sql_instruct; + } + } + if (opt_action.sqlite_db_create) { + string _db_statement; + auto pth_sqlite = spinePathsSQLite!()(opt_action.sqlite_filename, opt_action.output_dir_set); + pth_sqlite.base.mkdirRecurse; + auto db = Database(pth_sqlite.sqlite_file); + { + _db_statement ~= SQLiteTablesReCreate!()(); + } + SQLiteDbRun!()(db, _db_statement, opt_action, "TABLE RE-CREATE"); + } + } +} +template SQLiteDbDrop() { + void SQLiteDbDrop(O)(O opt_action) { + writeln("db drop"); + if ((opt_action.sqlite_db_drop)) { + auto pth_sqlite = spinePathsSQLite!()(opt_action.sqlite_filename, opt_action.output_dir_set); + writeln("remove(", pth_sqlite.sqlite_file, ")"); + try { + remove(pth_sqlite.sqlite_file); + } catch (FileException ex) { + // handle error + } + } + } +} diff --git a/src/doc_reform/io_out/xmls.d b/src/doc_reform/io_out/xmls.d new file mode 100644 index 0000000..a906d89 --- /dev/null +++ b/src/doc_reform/io_out/xmls.d @@ -0,0 +1,1215 @@ +module doc_reform.io_out.xmls; +template outputXHTMLs() { + import doc_reform.io_out; + import + std.digest.sha, + std.file, + std.outbuffer, + std.uri, + std.zip, + std.conv : to; + import + doc_reform.io_out.create_zip_file, + doc_reform.io_out.xmls, + doc_reform.io_out.xmls_css; + mixin spineOutputRgxInit; + struct outputXHTMLs { + static auto rgx = Rgx(); + string div_delimit( + string part, + return ref string previous_part + ){ + string delimit = ""; + string delimit_ = ""; + if (part != previous_part) { + switch (part) { + 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_" ~ part ~ "\">\n" ; + break; + } + if (previous_part.length > 0) { + delimit ~= "\n</div>"; + } + previous_part = part; + 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.nbsp_char, " "); + return _txt; + } + string special_characters(O)( + const O obj, + ){ + string _txt = special_characters_text(obj.text); + 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) { + 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 header_metadata(M)( + M doc_matters, + ) { + string _publisher="Publisher"; // TODO + string o; + o = format(q"┃<!-- spine 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 header metadata -->┃", + doc_matters.conf_make_meta.meta.title_full, + doc_matters.conf_make_meta.meta.creator_author, + _publisher, + doc_matters.conf_make_meta.meta.date_published, + doc_matters.conf_make_meta.meta.date_created, + doc_matters.conf_make_meta.meta.date_issued, + doc_matters.conf_make_meta.meta.date_available, + doc_matters.conf_make_meta.meta.date_valid, + doc_matters.conf_make_meta.meta.date_modified, + doc_matters.src.language, + doc_matters.conf_make_meta.meta.rights_copyright, + doc_matters.opt.action.debug_do ? "" : doc_matters.generator_program.name_and_version, + 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\">$1</a></p>")) + .replaceAll( + rgx.br_line, "") + .replaceAll( + rgx.br_nl, ""); + } else { + _locations = "<p class=\"tiny_left\"><a href=\"http://www.doc-reform.org\">spine</a></p>\n<p class=\"tiny_left\"><a href=\"http://git.sisudoc.org/software/spine/\">sources / git</a></p>\n<p class=\"tiny_left\"><a href=\"http://www.sisudoc.org\">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 _action="http://www.sisudoc.org/cgi-bin/search.cgi"; + string _db="spine.7a.manual"; + string o; + string _form; + if (doc_matters.opt.action.workon) { + _form = format(q"┃ + <a name="search"></a> + <form method="get" action="%s" target="_top"> + <font size="2"> + <input type="text" name="s1" size="24" maxlength="255" /> + <input type="hidden" name="db" value="%s" /> + <input type="hidden" name="ltd" value="1000" /> + <input type="hidden" name="off" value="0" /> + <input type="hidden" name="doc" value="live-manual" /><br /> + <input type="submit" name="search" value="search doc" /> + <input type="submit" name="search" value="search db" /> + </font></form> + ┃", + _action, + _db, + ); + } else { + _form = format(q"┃%s┃", + "", + ); + } + o = format(q"┃<div class="flex-menu-option">%s + </div>┃", + _form, + ); + return o; + } + string html_head(M)( + M doc_matters, + string type, + ) { + string _manifest = ""; + if (doc_matters.opt.action.workon) { + _manifest = format(q"┃ + <a href="../../manifest/sisu.en.html" target="_top"> + <font face="verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman" size="2"> + [ document manifest ] + </font> + </a> + ┃", + ); + } + string o; + o = format(q"┃<!DOCTYPE html> + <html> + <head> + <meta charset="utf-8" /> + <title> + %s%s + </title> + <!-- metadata --> + %s + <!-- metadata --> + <link rel="generator" href="http://www.sisudoc.org/" /> + <link rel="shortcut icon" href="%s" /> + <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%s┃", + doc_matters.conf_make_meta.meta.title_full, + (doc_matters.conf_make_meta.meta.creator_author.empty) ? "" + : ", " ~ doc_matters.conf_make_meta.meta.creator_author, + header_metadata(doc_matters), + ((type == "seg") ? "../../../" : "../../") ~ "image/rb7.ico", + ((type == "seg") + ? "../../../css/html_seg.css" + : "../../css/html_scroll.css"), + doc_matters.src.language, + site_info_button(doc_matters), + _manifest, + inline_search_form(doc_matters), + ((type == "seg") ? "" : "\n</div>"), + ); + 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="http://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" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + <html xmlns="http://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/d.ico" /> + <link rel="stylesheet" href="css/epub.css" type="text/css" id="main-css" /> + </head> + <body lang="%s"> + <a name="top" id="top"></a>┃", + html_simple, + doc_matters.conf_make_meta.meta.title_full, + (doc_matters.conf_make_meta.meta.creator_author.empty) ? "" + : ", " ~ doc_matters.conf_make_meta.meta.creator_author, + doc_matters.conf_make_meta.meta.title_full, + (doc_matters.conf_make_meta.meta.creator_author.empty) ? "" + : ", " ~ doc_matters.conf_make_meta.meta.creator_author, + doc_matters.conf_make_meta.meta.date_published, + doc_matters.conf_make_meta.meta.date_created, + doc_matters.conf_make_meta.meta.date_issued, + doc_matters.conf_make_meta.meta.date_available, + doc_matters.conf_make_meta.meta.date_valid, + doc_matters.conf_make_meta.meta.date_modified, + doc_matters.src.language, + doc_matters.conf_make_meta.meta.rights_copyright, + doc_matters.generator_program.name_and_version, + doc_matters.generator_program.url_home, + doc_matters.src.language, + ); + return o; + } + string tail() { + string o; + o = format(q"┃ + <a name="bottom" id="bottom"></a> + <a name="end" id="end"></a> + </body> + </html>┃"); + 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; + 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(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_lv1_to_4" : "seg_lv4"; + foreach (m; _txt.match(rgx.inline_link_hash)) { + if (m.captures[3] in doc_matters.has.tag_associations) { + if ( + m.captures[3] + == doc_matters.has.tag_associations[(m.captures[3])][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[3])][seg_lvs] + ~ _suffix ~ "#" ~ "$3" + ~ "├" + ); + } + } else { + if (!(doc_matters.opt.action.quiet)) { + writeln( + "WARNING on internal document links, anchor to link <<" + ~ m.captures[3] + ~ ">> not found in document, " + ~ "anchor: " ~ m.captures[3] + ~ " 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; + } + auto 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\n %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\n %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); + } + } + auto 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; + } + auto 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 + } + auto 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="flex-menu-option"> + <div class="nav-bar"> + %s + %s + %s + </div> + </div> + </div> + </div>┃", + toc, + prev, + next, + ); + string _pre_next = format(q"┃ <div class="flex-menu-option"> + <div class="nav-bar"> + %s + %s + </div> + </div> + </div> + </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 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), + obj.metainfo.heading_lev_markup, + obj.metainfo.is_a, + obj.metainfo.identifier, + obj.metainfo.identifier, + tags, + heading_lev_anchor_tag, + _txt, + 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, + obj.metainfo.heading_lev_markup, + obj.metainfo.is_a, + tags, + heading_lev_anchor_tag, + _txt, + 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; + } + auto heading_seg(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", + string _xml_type = "html", + ) { + auto 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); + auto 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" || "endnotes" || "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; + } + auto para_seg(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", + string _xml_type = "html", + ) { + auto 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); + auto 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; + } + auto quote_seg(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", + string _xml_type = "html", + ) { + auto 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); + auto 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; + } + auto group_seg(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", + string _xml_type = "html", + ) { + auto 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); + auto 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; + } + auto block_seg(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", + string _xml_type = "html", + ) { + auto 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); + auto 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; + } + auto verse_seg(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", + string _xml_type = "html", + ) { + auto 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); + auto u = tuple( + o, + _endnotes, + ); + return u; + } + 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 ~= "<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>"; + } + auto 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" bgcolor="white" 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_newlines_linebreaks); + _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/doc_reform/io_out/xmls_css.d b/src/doc_reform/io_out/xmls_css.d new file mode 100644 index 0000000..2c3eb77 --- /dev/null +++ b/src/doc_reform/io_out/xmls_css.d @@ -0,0 +1,4185 @@ +/++ + default css settings ++/ +module doc_reform.io_out.xmls_css; +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"┃ + *{ + padding : 0px; + margin : 0px; + } + body { + height : 100vh; + background-color : #FFFFFF; + } + 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.lnkocn:link { + color : %s; + text-decoration : none; + } + a.lnkocn:visited { + color : #32CD32; + text-decoration : none; + } + a.lnkocn:hover { + color : #777777; + font-size : 15px; + } + a:hover img { + background-color : #FFFFFF; + } + a:active { + color : #003399; + text-decoration : underline; + } + 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 : 80%%; + 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 : 90%%; + 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 : 100%%; + 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 : 95%%; + line-height : 100%%; + } + pre.codeline::before { + counter-reset : linenum; + } + pre.codeline span.tr { + display : table-row; + counter-increment : linenum; + } + pre.codeline span.th { + display : table-cell; + user-select : none; + -moz-user-select : none; + -webkit-user-select : none; + padding : 0.5em 0.5em; + /* 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 : 80%%; + display : inline; + } + p.endnote { + font-size : 96%%; + line-height : 120%%; + text-align : left; + margin-right : 15mm; + } + p.endnote_indent { + font-size : 96%%; + line-height : 120%%; + text-align : left; + margin-left : 2em; + margin-right : 15mm; + } + p.center { + text-align : center; + } + p.bold { + font-weight : bold; + } + p.bold_left { + font-weight : bold; + text-align : left; + } + p.centerbold { + text-align : center; + font-weight : bold; + } + p.em { + font-weight : bold; + font-style : normal; + background : #FFF3B6; + } + p.small { + font-size : 80%%; + margin-top : 0px; + margin-bottom : 0px; + margin-right : 6px; + text-align : left; + } + .tiny, .tiny_left, .tiny_right, .tiny_center { + font-size : 10px; + margin-top : 0px; + margin-bottom : 0px; + color : #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.concordance_word { + line-height : 150%%; + font-weight : bold; + display : inline; + margin-top : 4px; + margin-bottom : 1px; + } + p.concordance_count { + font-size : 80%%; + color : #777777; + display : inline; + margin-left : 0em; + } + p.concordance_object { + font-size : 80%%; + 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 : 10px; + margin-top : 0px; + margin-bottom : 5px; + margin-right : 5px; + 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 : 80%%; + } + p.right,th.right,td.right { + text-align : right; + } + ul, li { + list-style-type : none; + list-style : none; + padding-left : 20px; + font-weight : normal; + line-height : 150%%; + text-align : left; + text-indent : 0mm; + margin-left : 1em; + margin-right : 2em; + margin-top : 3px; + margin-bottom : 3px; + } + li { + background : 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 : 125%%; } + h1 { font-size : 120%%; } + h2 { font-size : 115%%; } + h3 { font-size : 110%%; } + h4 { font-size : 105%%; } + h5 { font-size : 100%%; } + h6 { font-size : 100%%; } + h7 { font-size : 100%%; } + h0, h1, h2, h3, h4, h5, h6, h7 { + text-shadow : .2em .2em .3em #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 : 120%%; + line-height : 150%%; + } + h1.toc { + margin-left : 1em; + font-size : 115%%; + line-height : 150%%; + } + h2.toc { + margin-left : 2em; + font-size : 110%%; + line-height : 140%%; + } + h3.toc { + margin-left : 3em; + font-size : 105%%; + line-height : 120%%; + } + h4.toc { + margin-left : 4em; + font-size : 100%%; + line-height : 120%%; + } + h5.toc { + margin-left : 5em; + font-size : 95%%; + line-height : 110%%; + } + h6.toc { + margin-left : 6em; + font-size : 90%%; + line-height : 110%%; + } + h7.toc { + margin-left : 7em; + font-size : 85%%; + line-height : 100%%; + } + .subtoc { + margin-right : 34%%; + font-weight : normal; + } + h5.subtoc { + margin-left : 2em; + font-size : 80%%; + margin-top : 2px; + margin-bottom : 2px; + } + h6.subtoc { + margin-left : 3em; + font-size : 75%%; + margin-top : 0px; + margin-bottom : 0px; + } + h7.subtoc { + margin-left : 4em; + font-size : 70%%; + margin-top : 0px; + margin-bottom : 0px; + } + .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 : 2em; + height : 2em; + 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 : 120%%; + } + .prev-next-button { + position : absolute; + top : 8px; + width : 2em; + height : 2em; + 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 : 6em; + } + .previous { + right : 3em; + } + .next { + right : 0em; + } + .arrow { + fill : #333333; + } + .minitoc { + line-height : 100%%; + font-size : 90%%; + margin-top : 6px; + margin-bottom : 0px; + padding-left : 0em; + text-indent : 0em; + -khtml-user-select : none; + -moz-user-select : none; + -ms-user-select : none; + -o-user-select : none; + -webkit-user-select : none; + user-select : none; + } + /* flex */ + .flex-menu-bar { + display : -webkit-flex; + display : flex; + -webkit-flex-wrap : wrap; + -webkit-align-items : center; + align-items : center; + width : 100%%; + margin-left : 5%%; + margin-right : 2%%; + background-color : #FFFFFF; + } + .flex-menu-option { + background-color : #FFFFFF; + margin-right : 4px; + } + .flex-list { + display : -webkit-flex; + display : flex; + -webkit-align-items : center; + display : block; + align-items : center; + width : 100%%; + background-color : #FFFFFF; + } + .flex-list-item { + background-color : #FFFFFF; + margin : 4px; + } + /* grid */ + .wrapper { + display : grid; + grid-template-columns : 100%%; + grid-template-areas : + "headband" + "doc_header" + "doc_title" + "doc_toc" + "doc_prefix" + "doc_intro" + "doc_body" + "doc_endnotes" + "doc_glossary" + "doc_biblio" + "doc_bookindex" + "doc_blurb" + "doc_suffix"; + margin : 0px; + padding : 0px; + background-color : #FFFFFF; + } + .delimit { + border-style : none; + border-color : #FFFFFF; + padding : 10px; + } + .headband { + grid-area : headband; + background-color : #FFFFFF; + } + .doc_header { + grid-area : doc_header; + } + .doc_title { + grid-area : doc_title; + } + .doc_toc { + grid-area : doc_toc; + } + .doc_prefix { + grid-area : doc_prefix; + } + .doc_intro { + grid-area : doc_intro; + } + .doc_body { + grid-area : doc_body; + } + .doc_endnotes { + grid-area : doc_endnotes; + } + .doc_glossary { + grid-area : doc_glossary; + } + .doc_biblio { + grid-area : doc_biblio; + } + .doc_bookindex { + grid-area : doc_bookindex; + } + .doc_blurb { + grid-area : doc_blurb; + } + .doc_suffix { + grid-area : doc_suffix; + } + .nav-ul { + list-style : none; + float : left; + } + .nav-li { + float : left; + padding-right : 0.7em; + } + .nav-li a { + text-decoration : none; + color : #FFFFFF; + } + footer { + background-color : #00704E; + } +┃", + _color_ocn_light, + _css_indent, + _color_ocn_light, +); + string _css_dark_html_seg = format(q"┃ + *{ + padding : 0px; + margin : 0px; + } + body { + height : 100vh; + background-color : #000000; + } + 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.lnkocn:link { + color : %s; + text-decoration : none; + } + a.lnkocn:visited { + color : #9ACD32; + text-decoration : none; + } + a.lnkocn:hover { + color : #BBBBBB; + font-size : 15px; + } + a:hover img { + background-color : #000000; + } + a:active { + color : #888888; + text-decoration : underline; + } + 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 : 80%%; + 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 : 90%%; + 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 : 100%%; + 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 : 95%%; + line-height : 100%%; + } + pre.codeline::before { + counter-reset : linenum; + } + pre.codeline span.tr { + display : table-row; + counter-increment : linenum; + } + pre.codeline span.th { + display : table-cell; + user-select : none; + -moz-user-select : none; + -webkit-user-select : none; + padding : 0.5em 0.5em; + } + pre.codeline span.th::before { + content : counter(linenum) "."; + color : #999999; + text-align : right; + display : block; + } + pre.codeline span.th { + width : 4em; + } + pre.codeline code { + display : table-cell; + } + p.code { + border-style : none; + } + p.spaced { white-space : pre; } + p.block { + white-space : pre; + } + p.group { } + p.alt { } + p.verse { + white-space : pre; + margin-bottom : 6px; + } + p.caption { + text-align : left; + font-size : 80%%; + display : inline; + } + p.endnote { + font-size : 96%%; + line-height : 120%%; + text-align : left; + margin-right : 15mm; + } + p.endnote_indent { + font-size : 96%%; + line-height : 120%%; + text-align : left; + margin-left : 2em; + margin-right : 15mm; + } + p.center { + text-align : center; + } + p.bold { + font-weight : bold; + } + p.bold_left { + font-weight : bold; + text-align : left; + } + p.centerbold { + text-align : center; + font-weight : bold; + } + p.em { + font-weight : bold; + font-style : normal; + background : #FFF3B6; + } + p.small { + font-size : 80%%; + margin-top : 0px; + margin-bottom : 0px; + margin-right : 6px; + text-align : left; + } + .tiny, .tiny_left, .tiny_right, .tiny_center { + font-size : 10px; + margin-top : 0px; + margin-bottom : 0px; + color : #EEEEEE; + margin-right : 6px; + text-align : left; + } + p.tiny { } + p.tiny_left { + margin-left : 0px; + margin-right : 0px; + text-align : left; + } + p.tiny_right { + margin-right : 1em; + text-align : right; + } + p.tiny_center { + margin-left : 0px; + margin-right : 0px; + text-align : center; + } + p.concordance_word { + line-height : 150%%; + font-weight : bold; + display : inline; + margin-top : 4px; + margin-bottom : 1px; + } + p.concordance_count { + font-size : 80%%; + color : #555555; + display : inline; + margin-left : 0em; + } + p.concordance_object { + font-size : 80%%; + 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 : 10px; + margin-top : 0px; + margin-bottom : 5px; + margin-right : 5px; + 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 : 80%%; + } + p.right,th.right,td.right { + text-align : right; + } + ul, li { + list-style-type : none; + list-style : none; + padding-left : 20px; + font-weight : normal; + line-height : 150%%; + text-align : left; + text-indent : 0mm; + margin-left : 1em; + margin-right : 2em; + margin-top : 3px; + margin-bottom : 3px; + } + li { + background : (../image_sys/bullet_09.png) no-repeat 0px 6px; + } + ul { } + h0, h1, h2, h3, h4, h5, h6, h7 { + font-weight : bold; + line-height : 120%%; + text-align : left; + margin-top : 20px; + margin-bottom : 10px; + } + h4.norm, h5.norm, h6.norm, h7.norm { + margin-top : 10px; + margin-bottom : 0px; + } + h0 { font-size : 125%%; } + h1 { font-size : 120%%; } + h2 { font-size : 115%%; } + h3 { font-size : 110%%; } + h4 { font-size : 105%%; } + h5 { font-size : 100%%; } + h6 { font-size : 100%%; } + h7 { font-size : 100%%; } + h0, h1, h2, h3, h4, h5, h6, h7 { + text-shadow : .2em .2em .3em #999999; + } + h1.i { margin-left : 2em; } + h2.i { margin-left : 3em; } + h3.i { margin-left : 4em; } + h4.i { margin-left : 5em; } + h5.i { margin-left : 6em; } + h6.i { margin-left : 7em; } + h7.i { margin-left : 8em; } + h8.i { margin-left : 9em; } + h9.i { margin-left : 10em; } + .toc { + font-weight : normal; + margin-top : 6px; + margin-bottom : 6px; + } + h0.toc { + margin-left : 1em; + font-size : 120%%; + line-height : 150%%; + } + h1.toc { + margin-left : 1em; + font-size : 115%%; + line-height : 150%%; + } + h2.toc { + margin-left : 2em; + font-size : 110%%; + line-height : 140%%; + } + h3.toc { + margin-left : 3em; + font-size : 105%%; + line-height : 120%%; + } + h4.toc { + margin-left : 4em; + font-size : 100%%; + line-height : 120%%; + } + h5.toc { + margin-left : 5em; + font-size : 95%%; + line-height : 110%%; + } + h6.toc { + margin-left : 6em; + font-size : 90%%; + line-height : 110%%; + } + h7.toc { + margin-left : 7em; + font-size : 85%%; + line-height : 100%%; + } + .subtoc { + margin-right : 34%%; + font-weight : normal; + } + h5.subtoc { + margin-left : 2em; + font-size : 80%%; + margin-top : 2px; + margin-bottom : 2px; + } + h6.subtoc { + margin-left : 3em; + font-size : 75%%; + margin-top : 0px; + margin-bottom : 0px; + } + h7.subtoc { + margin-left : 4em; + font-size : 70%%; + margin-top : 0px; + margin-bottom : 0px; + } + .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 : 2em; + height : 2em; + 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 : 120%%; + } + .prev-next-button { + position : absolute; + top : 8px; + width : 2em; + height : 2em; + 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 : 6em; + } + .previous { + right : 3em; + } + .next { + right : 0em; + } + .arrow { + fill : #DDDDDD; + } + .minitoc { + line-height : 100%%; + font-size : 90%%; + margin-top : 6px; + margin-bottom : 0px; + padding-left : 0em; + text-indent : 0em; + -khtml-user-select : none; + -moz-user-select : none; + -ms-user-select : none; + -o-user-select : none; + -webkit-user-select : none; + user-select : none; + } + /* flex */ + .flex-menu-bar { + display : -webkit-flex; + display : flex; + -webkit-flex-wrap : wrap; + -webkit-align-items : center; + align-items : center; + width : 100%%; + margin-left : 5%%; + margin-right : 2%%; + background-color : #000000; + } + .flex-menu-option { + background-color : #000000; + margin-right : 4px; + } + .flex-list { + display : -webkit-flex; + display : flex; + -webkit-align-items : center; + display : block; + align-items : center; + width : 100%%; + background-color : #000000; + } + .flex-list-item { + background-color : #000000; + margin : 4px; + } + /* grid */ + .wrapper { + display : grid; + grid-template-columns : 100%%; + grid-template-areas : + "headband" + "doc_header" + "doc_title" + "doc_toc" + "doc_prefix" + "doc_intro" + "doc_body" + "doc_endnotes" + "doc_glossary" + "doc_biblio" + "doc_bookindex" + "doc_blurb" + "doc_suffix"; + margin : 0px; + padding : 0px; + background-color : #000000; + } + .delimit { + border-style : none; + border-color : #000000; + padding : 10px; + } + .headband { + grid-area : headband; + background-color : #000000; + } + .doc_header { + grid-area : doc_header; + } + .doc_title { + grid-area : doc_title; + } + .doc_toc { + grid-area : doc_toc; + } + .doc_prefix { + grid-area : doc_prefix; + } + .doc_intro { + grid-area : doc_intro; + } + .doc_body { + grid-area : doc_body; + } + .doc_endnotes { + grid-area : doc_endnotes; + } + .doc_glossary { + grid-area : doc_glossary; + } + .doc_biblio { + grid-area : doc_biblio; + } + .doc_bookindex { + grid-area : doc_bookindex; + } + .doc_blurb { + grid-area : doc_blurb; + } + .doc_suffix { + grid-area : doc_suffix; + } + .nav-ul { + list-style : none; + float : left; + } + .nav-li { + float : left; + padding-right : 0.7em; + } + .nav-li a { + text-decoration : none; + color : #000000; + } + footer { + background-color : #FF704E; + } +┃", + _color_ocn_dark, + _css_indent, + _color_ocn_dark, +); + string _css_light_html_scroll = format(q"┃ + *{ + padding : 0px; + margin : 0px; + } + body { + height : 100vh; + background-color : #FFFFFF; + } + 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.lnkocn:link { + color : %s; + text-decoration : none; + } + a.lnkocn:visited { + color : #32CD32; + text-decoration : none; + } + a.lnkocn:hover { + color : #777777; + font-size : 15px; + } + a:hover img { + background-color : #FFFFFF; + } + a:active { + color : #003399; + text-decoration : underline; + } + 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 : 80%%; + 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 : 90%%; + 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 : 100%%; + 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 : 95%%; + line-height : 100%%; + } + pre.codeline::before { + counter-reset : linenum; + } + pre.codeline span.tr { + display : table-row; + counter-increment : linenum; + } + pre.codeline span.th { + display : table-cell; + user-select : none; + -moz-user-select : none; + -webkit-user-select : none; + padding : 0.5em 0.5em; + /* 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 : 80%%; + display : inline; + } + p.endnote { + font-size : 96%%; + line-height : 120%%; + text-align : left; + margin-right : 15mm; + } + p.endnote_indent { + font-size : 96%%; + line-height : 120%%; + text-align : left; + margin-left : 2em; + margin-right : 15mm; + } + p.center { + text-align : center; + } + p.bold { + font-weight : bold; + } + p.bold_left { + font-weight : bold; + text-align : left; + } + p.centerbold { + text-align : center; + font-weight : bold; + } + p.em { + font-weight : bold; + font-style : normal; + background : #FFF3B6; + } + p.small { + font-size : 80%%; + margin-top : 0px; + margin-bottom : 0px; + margin-right : 6px; + text-align : left; + } + .tiny, .tiny_left, .tiny_right, .tiny_center { + font-size : 10px; + margin-top : 0px; + margin-bottom : 0px; + color : #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.concordance_word { + line-height : 150%%; + font-weight : bold; + display : inline; + margin-top : 4px; + margin-bottom : 1px; + } + p.concordance_count { + font-size : 80%%; + color : #777777; + display : inline; + margin-left : 0em; + } + p.concordance_object { + font-size : 80%%; + 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 : 10px; + margin-top : 0px; + margin-bottom : 5px; + margin-right : 5px; + 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 : 80%%; + } + p.right,th.right,td.right { + text-align : right; + } + ul, li { + list-style-type : none; + list-style : none; + padding-left : 20px; + font-weight : normal; + line-height : 150%%; + text-align : left; + text-indent : 0mm; + margin-left : 1em; + margin-right : 2em; + margin-top : 3px; + margin-bottom : 3px; + } + li { + background : 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 : 125%%; } + h1 { font-size : 120%%; } + h2 { font-size : 115%%; } + h3 { font-size : 110%%; } + h4 { font-size : 105%%; } + h5 { font-size : 100%%; } + h6 { font-size : 100%%; } + h7 { font-size : 100%%; } + h0, h1, h2, h3, h4, h5, h6, h7 { + text-shadow : .2em .2em .3em #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 : 120%%; + line-height : 150%%; + } + h1.toc { + margin-left : 1em; + font-size : 115%%; + line-height : 150%%; + } + h2.toc { + margin-left : 2em; + font-size : 110%%; + line-height : 140%%; + } + h3.toc { + margin-left : 3em; + font-size : 105%%; + line-height : 120%%; + } + h4.toc { + margin-left : 4em; + font-size : 100%%; + line-height : 120%%; + } + h5.toc { + margin-left : 5em; + font-size : 95%%; + line-height : 110%%; + } + h6.toc { + margin-left : 6em; + font-size : 90%%; + line-height : 110%%; + } + h7.toc { + margin-left : 7em; + font-size : 85%%; + line-height : 100%%; + } + .subtoc { + margin-right : 34%%; + font-weight : normal; + } + h5.subtoc { + margin-left : 2em; + font-size : 80%%; + margin-top : 2px; + margin-bottom : 2px; + } + h6.subtoc { + margin-left : 3em; + font-size : 75%%; + margin-top : 0px; + margin-bottom : 0px; + } + h7.subtoc { + margin-left : 4em; + font-size : 70%%; + margin-top : 0px; + margin-bottom : 0px; + } + /* flex */ + .flex-menu-bar { + display : -webkit-flex; + display : flex; + -webkit-flex-wrap : wrap; + -webkit-align-items : center; + align-items : center; + width : 100%%; + margin-left : 5%%; + margin-right : 2%%; + background-color : #FFFFFF; + } + .flex-menu-option { + background-color : #FFFFFF; + margin-right : 4px; + } + .flex-list { + display : -webkit-flex; + display : flex; + -webkit-align-items : center; + display : block; + align-items : center; + width : 100%%; + background-color : #FFFFFF; + } + .flex-list-item { + background-color : #FFFFFF; + margin : 4px; + } + /* grid */ + .wrapper { + display : grid; + grid-template-columns : 100%%; + grid-template-areas : + "headband" + "doc_header" + "doc_title" + "doc_toc" + "doc_prefix" + "doc_intro" + "doc_body" + "doc_endnotes" + "doc_glossary" + "doc_biblio" + "doc_bookindex" + "doc_blurb" + "doc_suffix"; + margin : 0px; + padding : 0px; + background-color : #FFFFFF; + } + .delimit { + border-style : none; + border-color : #FFFFFF; + padding : 10px; + } + .headband { + grid-area : headband; + background-color : #FFFFFF; + } + .doc_header { + grid-area : doc_header; + } + .doc_title { + grid-area : doc_title; + } + .doc_toc { + grid-area : doc_toc; + } + .doc_prefix { + grid-area : doc_prefix; + } + .doc_intro { + grid-area : doc_intro; + } + .doc_body { + grid-area : doc_body; + } + .doc_endnotes { + grid-area : doc_endnotes; + } + .doc_glossary { + grid-area : doc_glossary; + } + .doc_biblio { + grid-area : doc_biblio; + } + .doc_bookindex { + grid-area : doc_bookindex; + } + .doc_blurb { + grid-area : doc_blurb; + } + .doc_suffix { + grid-area : doc_suffix; + } + .nav-ul { + list-style : none; + float : left; + } + .nav-li { + float : left; + padding-right : 0.7em; + } + .nav-li a { + text-decoration : none; + color : #FFFFFF; + } + footer { + background-color : #00704E; + } +┃", + _color_ocn_light, + _css_indent, + _color_ocn_light, +); + string _css_dark_html_scroll = format(q"┃ + *{ + padding : 0px; + margin : 0px; + } + body { + height : 100vh; + background-color : #000000; + } + 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.lnkocn:link { + color : %s; + text-decoration : none; + } + a.lnkocn:visited { + color : #9ACD32; + text-decoration : none; + } + a.lnkocn:hover { + color : #BBBBBB; + font-size : 15px; + } + a:hover img { + background-color : #000000; + } + a:active { + color : #888888; + text-decoration : underline; + } + 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 : 80%%; + 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 : 90%%; + 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 : 100%%; + 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 : 95%%; + line-height : 100%%; + } + pre.codeline::before { + counter-reset : linenum; + } + pre.codeline span.tr { + display : table-row; + counter-increment : linenum; + } + pre.codeline span.th { + display : table-cell; + user-select : none; + -moz-user-select : none; + -webkit-user-select : none; + padding : 0.5em 0.5em; + } + pre.codeline span.th::before { + content : counter(linenum) "."; + color : #999999; + text-align : right; + display : block; + } + pre.codeline span.th { + width : 4em; + } + pre.codeline code { + display : table-cell; + } + p.code { + border-style : none; + } + p.spaced { white-space : pre; } + p.block { + white-space : pre; + } + p.group { } + p.alt { } + p.verse { + white-space : pre; + margin-bottom : 6px; + } + p.caption { + text-align : left; + font-size : 80%%; + display : inline; + } + p.endnote { + font-size : 96%%; + line-height : 120%%; + text-align : left; + margin-right : 15mm; + } + p.endnote_indent { + font-size : 96%%; + line-height : 120%%; + text-align : left; + margin-left : 2em; + margin-right : 15mm; + } + p.center { + text-align : center; + } + p.bold { + font-weight : bold; + } + p.bold_left { + font-weight : bold; + text-align : left; + } + p.centerbold { + text-align : center; + font-weight : bold; + } + p.em { + font-weight : bold; + font-style : normal; + background : #FFF3B6; + } + p.small { + font-size : 80%%; + margin-top : 0px; + margin-bottom : 0px; + margin-right : 6px; + text-align : left; + } + .tiny, .tiny_left, .tiny_right, .tiny_center { + font-size : 10px; + margin-top : 0px; + margin-bottom : 0px; + color : #EEEEEE; + margin-right : 6px; + text-align : left; + } + p.tiny { } + p.tiny_left { + margin-left : 0px; + margin-right : 0px; + text-align : left; + } + p.tiny_right { + margin-right : 1em; + text-align : right; + } + p.tiny_center { + margin-left : 0px; + margin-right : 0px; + text-align : center; + } + p.concordance_word { + line-height : 150%%; + font-weight : bold; + display : inline; + margin-top : 4px; + margin-bottom : 1px; + } + p.concordance_count { + font-size : 80%%; + color : #555555; + display : inline; + margin-left : 0em; + } + p.concordance_object { + font-size : 80%%; + 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 : 10px; + margin-top : 0px; + margin-bottom : 5px; + margin-right : 5px; + 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 : 80%%; + } + p.right,th.right,td.right { + text-align : right; + } + ul, li { + list-style-type : none; + list-style : none; + padding-left : 20px; + font-weight : normal; + line-height : 150%%; + text-align : left; + text-indent : 0mm; + margin-left : 1em; + margin-right : 2em; + margin-top : 3px; + margin-bottom : 3px; + } + li { + background : (../image_sys/bullet_09.png) no-repeat 0px 6px; + } + ul { } + h0, h1, h2, h3, h4, h5, h6, h7 { + font-weight : bold; + line-height : 120%%; + text-align : left; + margin-top : 20px; + margin-bottom : 10px; + } + h4.norm, h5.norm, h6.norm, h7.norm { + margin-top : 10px; + margin-bottom : 0px; + } + h0 { font-size : 125%%; } + h1 { font-size : 120%%; } + h2 { font-size : 115%%; } + h3 { font-size : 110%%; } + h4 { font-size : 105%%; } + h5 { font-size : 100%%; } + h6 { font-size : 100%%; } + h7 { font-size : 100%%; } + h0, h1, h2, h3, h4, h5, h6, h7 { + text-shadow : .2em .2em .3em #999999; + } + h1.i { margin-left : 2em; } + h2.i { margin-left : 3em; } + h3.i { margin-left : 4em; } + h4.i { margin-left : 5em; } + h5.i { margin-left : 6em; } + h6.i { margin-left : 7em; } + h7.i { margin-left : 8em; } + h8.i { margin-left : 9em; } + h9.i { margin-left : 10em; } + .toc { + font-weight : normal; + margin-top : 6px; + margin-bottom : 6px; + } + h0.toc { + margin-left : 1em; + font-size : 120%%; + line-height : 150%%; + } + h1.toc { + margin-left : 1em; + font-size : 115%%; + line-height : 150%%; + } + h2.toc { + margin-left : 2em; + font-size : 110%%; + line-height : 140%%; + } + h3.toc { + margin-left : 3em; + font-size : 105%%; + line-height : 120%%; + } + h4.toc { + margin-left : 4em; + font-size : 100%%; + line-height : 120%%; + } + h5.toc { + margin-left : 5em; + font-size : 95%%; + line-height : 110%%; + } + h6.toc { + margin-left : 6em; + font-size : 90%%; + line-height : 110%%; + } + h7.toc { + margin-left : 7em; + font-size : 85%%; + line-height : 100%%; + } + .subtoc { + margin-right : 34%%; + font-weight : normal; + } + h5.subtoc { + margin-left : 2em; + font-size : 80%%; + margin-top : 2px; + margin-bottom : 2px; + } + h6.subtoc { + margin-left : 3em; + font-size : 75%%; + margin-top : 0px; + margin-bottom : 0px; + } + h7.subtoc { + margin-left : 4em; + font-size : 70%%; + margin-top : 0px; + margin-bottom : 0px; + } + /* flex */ + .flex-menu-bar { + display : -webkit-flex; + display : flex; + -webkit-flex-wrap : wrap; + -webkit-align-items : center; + align-items : center; + width : 100%%; + margin-left : 5%%; + margin-right : 2%%; + background-color : #000000; + } + .flex-menu-option { + background-color : #000000; + margin-right : 4px; + } + .flex-list { + display : -webkit-flex; + display : flex; + -webkit-align-items : center; + display : block; + align-items : center; + width : 100%%; + background-color : #000000; + } + .flex-list-item { + background-color : #000000; + margin : 4px; + } + /* grid */ + .wrapper { + display : grid; + grid-template-columns : 100%%; + grid-template-areas : + "headband" + "doc_header" + "doc_title" + "doc_toc" + "doc_prefix" + "doc_intro" + "doc_body" + "doc_endnotes" + "doc_glossary" + "doc_biblio" + "doc_bookindex" + "doc_blurb" + "doc_suffix"; + margin : 0px; + padding : 0px; + background-color : #000000; + } + .delimit { + border-style : none; + border-color : #000000; + padding : 10px; + } + .headband { + grid-area : headband; + background-color : #000000; + } + .doc_header { + grid-area : doc_header; + } + .doc_title { + grid-area : doc_title; + } + .doc_toc { + grid-area : doc_toc; + } + .doc_prefix { + grid-area : doc_prefix; + } + .doc_intro { + grid-area : doc_intro; + } + .doc_body { + grid-area : doc_body; + } + .doc_endnotes { + grid-area : doc_endnotes; + } + .doc_glossary { + grid-area : doc_glossary; + } + .doc_biblio { + grid-area : doc_biblio; + } + .doc_bookindex { + grid-area : doc_bookindex; + } + .doc_blurb { + grid-area : doc_blurb; + } + .doc_suffix { + grid-area : doc_suffix; + } + .nav-ul { + list-style : none; + float : left; + } + .nav-li { + float : left; + padding-right : 0.7em; + } + .nav-li a { + text-decoration : none; + color : #000000; + } + footer { + background-color : #FF704E; + } +┃", + _color_ocn_dark, + _css_indent, + _color_ocn_dark, +); + string _css_light_epub = format(q"┃ + *{ + padding : 0px; + margin : 0px; + } + body { + height : 100vh; + background-color : #FFFFFF; + } + 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.lnkocn:link { + color : %s; + text-decoration : none; + } + a.lnkocn:visited { + color : #32CD32; + text-decoration : none; + } + a.lnkocn:hover { + color : #777777; + font-size : 15px; + } + a:hover img { + background-color : #FFFFFF; + } + a:active { + color : #003399; + text-decoration : underline; + } + 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 : 80%%; + 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 : 90%%; + 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 : 100%%; + 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 : 95%%; + line-height : 100%%; + } + pre.codeline::before { + counter-reset : linenum; + } + pre.codeline span.tr { + display : table-row; + counter-increment : linenum; + } + pre.codeline span.th { + display : table-cell; + user-select : none; + -moz-user-select : none; + -webkit-user-select : none; + padding : 0.5em 0.5em; + /* 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 : 80%%; + display : inline; + } + p.endnote { + font-size : 96%%; + line-height : 120%%; + text-align : left; + margin-right : 15mm; + } + p.endnote_indent { + font-size : 96%%; + line-height : 120%%; + text-align : left; + margin-left : 2em; + margin-right : 15mm; + } + p.center { + text-align : center; + } + p.bold { + font-weight : bold; + } + p.bold_left { + font-weight : bold; + text-align : left; + } + p.centerbold { + text-align : center; + font-weight : bold; + } + p.em { + font-weight : bold; + font-style : normal; + background : #FFF3B6; + } + p.small { + font-size : 80%%; + margin-top : 0px; + margin-bottom : 0px; + margin-right : 6px; + text-align : left; + } + .tiny, .tiny_left, .tiny_right, .tiny_center { + font-size : 10px; + margin-top : 0px; + margin-bottom : 0px; + color : #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.concordance_word { + line-height : 150%%; + font-weight : bold; + display : inline; + margin-top : 4px; + margin-bottom : 1px; + } + p.concordance_count { + font-size : 80%%; + color : #777777; + display : inline; + margin-left : 0em; + } + p.concordance_object { + font-size : 80%%; + 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 : 10px; + margin-top : 0px; + margin-bottom : 5px; + margin-right : 5px; + 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 : 80%%; + } + p.right,th.right,td.right { + text-align : right; + } + ul, li { + list-style-type : none; + list-style : none; + padding-left : 20px; + font-weight : normal; + line-height : 150%%; + text-align : left; + text-indent : 0mm; + margin-left : 1em; + margin-right : 2em; + margin-top : 3px; + margin-bottom : 3px; + } + li { + background : 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 : 125%%; } + h1 { font-size : 120%%; } + h2 { font-size : 115%%; } + h3 { font-size : 110%%; } + h4 { font-size : 105%%; } + h5 { font-size : 100%%; } + h6 { font-size : 100%%; } + h7 { font-size : 100%%; } + h0, h1, h2, h3, h4, h5, h6, h7 { + text-shadow : .2em .2em .3em #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 : 120%%; + line-height : 150%%; + } + h1.toc { + margin-left : 1em; + font-size : 115%%; + line-height : 150%%; + } + h2.toc { + margin-left : 2em; + font-size : 110%%; + line-height : 140%%; + } + h3.toc { + margin-left : 3em; + font-size : 105%%; + line-height : 120%%; + } + h4.toc { + margin-left : 4em; + font-size : 100%%; + line-height : 120%%; + } + h5.toc { + margin-left : 5em; + font-size : 95%%; + line-height : 110%%; + } + h6.toc { + margin-left : 6em; + font-size : 90%%; + line-height : 110%%; + } + h7.toc { + margin-left : 7em; + font-size : 85%%; + line-height : 100%%; + } + .subtoc { + margin-right : 34%%; + font-weight : normal; + } + h5.subtoc { + margin-left : 2em; + font-size : 80%%; + margin-top : 2px; + margin-bottom : 2px; + } + h6.subtoc { + margin-left : 3em; + font-size : 75%%; + margin-top : 0px; + margin-bottom : 0px; + } + h7.subtoc { + margin-left : 4em; + font-size : 70%%; + margin-top : 0px; + margin-bottom : 0px; + } + +┃", + _color_ocn_light, + _css_indent, + _color_ocn_light, +); + string _css_dark_epub = format(q"┃ + *{ + padding : 0px; + margin : 0px; + } + body { + height : 100vh; + background-color : #000000; + } + 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.lnkocn:link { + color : %s; + text-decoration : none; + } + a.lnkocn:visited { + color : #9ACD32; + text-decoration : none; + } + a.lnkocn:hover { + color : #BBBBBB; + font-size : 15px; + } + a:hover img { + background-color : #000000; + } + a:active { + color : #888888; + text-decoration : underline; + } + 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 : 80%%; + 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 : 90%%; + 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 : 100%%; + 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 : 95%%; + line-height : 100%%; + } + pre.codeline::before { + counter-reset : linenum; + } + pre.codeline span.tr { + display : table-row; + counter-increment : linenum; + } + pre.codeline span.th { + display : table-cell; + user-select : none; + -moz-user-select : none; + -webkit-user-select : none; + padding : 0.5em 0.5em; + } + pre.codeline span.th::before { + content : counter(linenum) "."; + color : #999999; + text-align : right; + display : block; + } + pre.codeline span.th { + width : 4em; + } + pre.codeline code { + display : table-cell; + } + p.code { + border-style : none; + } + p.spaced { white-space : pre; } + p.block { + white-space : pre; + } + p.group { } + p.alt { } + p.verse { + white-space : pre; + margin-bottom : 6px; + } + p.caption { + text-align : left; + font-size : 80%%; + display : inline; + } + p.endnote { + font-size : 96%%; + line-height : 120%%; + text-align : left; + margin-right : 15mm; + } + p.endnote_indent { + font-size : 96%%; + line-height : 120%%; + text-align : left; + margin-left : 2em; + margin-right : 15mm; + } + p.center { + text-align : center; + } + p.bold { + font-weight : bold; + } + p.bold_left { + font-weight : bold; + text-align : left; + } + p.centerbold { + text-align : center; + font-weight : bold; + } + p.em { + font-weight : bold; + font-style : normal; + background : #FFF3B6; + } + p.small { + font-size : 80%%; + margin-top : 0px; + margin-bottom : 0px; + margin-right : 6px; + text-align : left; + } + .tiny, .tiny_left, .tiny_right, .tiny_center { + font-size : 10px; + margin-top : 0px; + margin-bottom : 0px; + color : #EEEEEE; + margin-right : 6px; + text-align : left; + } + p.tiny { } + p.tiny_left { + margin-left : 0px; + margin-right : 0px; + text-align : left; + } + p.tiny_right { + margin-right : 1em; + text-align : right; + } + p.tiny_center { + margin-left : 0px; + margin-right : 0px; + text-align : center; + } + p.concordance_word { + line-height : 150%%; + font-weight : bold; + display : inline; + margin-top : 4px; + margin-bottom : 1px; + } + p.concordance_count { + font-size : 80%%; + color : #555555; + display : inline; + margin-left : 0em; + } + p.concordance_object { + font-size : 80%%; + 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 : 10px; + margin-top : 0px; + margin-bottom : 5px; + margin-right : 5px; + 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 : 80%%; + } + p.right,th.right,td.right { + text-align : right; + } + ul, li { + list-style-type : none; + list-style : none; + padding-left : 20px; + font-weight : normal; + line-height : 150%%; + text-align : left; + text-indent : 0mm; + margin-left : 1em; + margin-right : 2em; + margin-top : 3px; + margin-bottom : 3px; + } + li { + background : (../image_sys/bullet_09.png) no-repeat 0px 6px; + } + ul { } + h0, h1, h2, h3, h4, h5, h6, h7 { + font-weight : bold; + line-height : 120%%; + text-align : left; + margin-top : 20px; + margin-bottom : 10px; + } + h4.norm, h5.norm, h6.norm, h7.norm { + margin-top : 10px; + margin-bottom : 0px; + } + h0 { font-size : 125%%; } + h1 { font-size : 120%%; } + h2 { font-size : 115%%; } + h3 { font-size : 110%%; } + h4 { font-size : 105%%; } + h5 { font-size : 100%%; } + h6 { font-size : 100%%; } + h7 { font-size : 100%%; } + h0, h1, h2, h3, h4, h5, h6, h7 { + text-shadow : .2em .2em .3em #999999; + } + h1.i { margin-left : 2em; } + h2.i { margin-left : 3em; } + h3.i { margin-left : 4em; } + h4.i { margin-left : 5em; } + h5.i { margin-left : 6em; } + h6.i { margin-left : 7em; } + h7.i { margin-left : 8em; } + h8.i { margin-left : 9em; } + h9.i { margin-left : 10em; } + .toc { + font-weight : normal; + margin-top : 6px; + margin-bottom : 6px; + } + h0.toc { + margin-left : 1em; + font-size : 120%%; + line-height : 150%%; + } + h1.toc { + margin-left : 1em; + font-size : 115%%; + line-height : 150%%; + } + h2.toc { + margin-left : 2em; + font-size : 110%%; + line-height : 140%%; + } + h3.toc { + margin-left : 3em; + font-size : 105%%; + line-height : 120%%; + } + h4.toc { + margin-left : 4em; + font-size : 100%%; + line-height : 120%%; + } + h5.toc { + margin-left : 5em; + font-size : 95%%; + line-height : 110%%; + } + h6.toc { + margin-left : 6em; + font-size : 90%%; + line-height : 110%%; + } + h7.toc { + margin-left : 7em; + font-size : 85%%; + line-height : 100%%; + } + .subtoc { + margin-right : 34%%; + font-weight : normal; + } + h5.subtoc { + margin-left : 2em; + font-size : 80%%; + margin-top : 2px; + margin-bottom : 2px; + } + h6.subtoc { + margin-left : 3em; + font-size : 75%%; + margin-top : 0px; + margin-bottom : 0px; + } + h7.subtoc { + margin-left : 4em; + font-size : 70%%; + margin-top : 0px; + margin-bottom : 0px; + } + +┃", + _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; + } +} |