diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2018-09-10 18:15:02 -0400 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2019-04-10 15:14:15 -0400 |
commit | e95c49b76f4ac7bf72c383ee43a0567dfcbf1603 (patch) | |
tree | b3aec9058f69be0047bb526052f8deefb5d97463 /src/doc_reform/output | |
parent | maker, subprojects arrange, minor (diff) |
0.1.0 renamed doc-reform, doc_reform (& rad)
- from sdp
Diffstat (limited to 'src/doc_reform/output')
-rw-r--r-- | src/doc_reform/output/create_zip_file.d | 17 | ||||
-rw-r--r-- | src/doc_reform/output/defaults.d | 123 | ||||
-rw-r--r-- | src/doc_reform/output/epub3.d | 782 | ||||
-rw-r--r-- | src/doc_reform/output/html.d | 481 | ||||
-rw-r--r-- | src/doc_reform/output/hub.d | 106 | ||||
-rw-r--r-- | src/doc_reform/output/package.d | 22 | ||||
-rw-r--r-- | src/doc_reform/output/paths_output.d | 272 | ||||
-rw-r--r-- | src/doc_reform/output/rgx.d | 106 | ||||
-rw-r--r-- | src/doc_reform/output/source_sisupod.d | 278 | ||||
-rw-r--r-- | src/doc_reform/output/sqlite.d | 1242 | ||||
-rw-r--r-- | src/doc_reform/output/xmls.d | 1036 | ||||
-rw-r--r-- | src/doc_reform/output/xmls_css.d | 2871 |
12 files changed, 7336 insertions, 0 deletions
diff --git a/src/doc_reform/output/create_zip_file.d b/src/doc_reform/output/create_zip_file.d new file mode 100644 index 0000000..fa752ad --- /dev/null +++ b/src/doc_reform/output/create_zip_file.d @@ -0,0 +1,17 @@ +module doc_reform.output.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/output/defaults.d b/src/doc_reform/output/defaults.d new file mode 100644 index 0000000..97ba691 --- /dev/null +++ b/src/doc_reform/output/defaults.d @@ -0,0 +1,123 @@ +/++ + default settings ++/ +module doc_reform.output.defaults; + +template InternalMarkup() { + import std.array; + static struct InlineMarkup { + auto en_a_o = "【"; auto en_a_c = "】"; + auto en_b_o = "〖"; auto en_b_c = "〗"; + auto lnk_o = "┥"; auto lnk_c = "┝"; + auto url_o = "┤"; auto url_c = "├"; + auto mark_internal_site_lnk = "¤"; + auto nbsp = "░"; + auto br_line = "┘"; + auto br_nl = "┙"; + auto br_paragraph = "┚"; + auto br_obj = "break_obj"; + auto br_page_line = "┼"; + auto br_page = "┿"; + auto br_page_new = "╂"; + auto tc_s = "┊"; + auto tc_o = "┏"; + auto tc_c = "┚"; + auto tc_p = "┆"; + auto mono = "■"; + auto img = "☼"; + 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 SiSUlanguageCodes() { + /+ 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() { + auto _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() { + auto _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/output/epub3.d b/src/doc_reform/output/epub3.d new file mode 100644 index 0000000..45e632a --- /dev/null +++ b/src/doc_reform/output/epub3.d @@ -0,0 +1,782 @@ +module doc_reform.output.epub3; +template outputEPub3() { + import doc_reform.output; + import + std.digest.sha, + std.file, + std.outbuffer, + std.zip, + std.conv : to; + import + doc_reform.output.create_zip_file, + doc_reform.output.xmls, + doc_reform.output.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 = SiSUpathsEPUB!()(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(doc_matters.src.filename)).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(doc_matters.src.filename)).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 (s; doc_matters.xml.keys_seq.seg) { + foreach (obj; doc_abstraction[s]) { + 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, + 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, + 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.xml.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 ~ ".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 ~ ".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 ~ ".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 ~ ".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="SiSU 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.xml.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, + 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, + hashtag, + ); + break; + default : + break; + } + } + } + } + } + toc ~= format(q"¶ </navMap> + </ncx>¶"); + return toc; + } + + void outputEPub3(D,I)( + const D doc_abstraction, + I doc_matters, + ) { + mixin SiSUoutputRgxInit; + auto xhtml_format = outputXHTMLs(); + auto rgx = Rgx(); + string[][string] doc_epub3; + string[][string] doc_epub3_endnotes; + string[] doc; + string segment_filename; + string[] top_level_headings = ["","","",""]; + string[string] oepbs_content_parts; + string suffix = ".xhtml"; + string[] doc_parts_; + foreach (part; doc_matters.xml.keys_seq.seg) { + foreach (obj; doc_abstraction[part]) { + string _txt = xhtml_format.special_characters(obj, obj.text); + if (obj.metainfo.is_a == "heading") { + assert(part == "head" || "toc_seg" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "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: + doc_parts_ ~= obj.tags.segment_anchor_tag; + doc_epub3[obj.tags.segment_anchor_tag] ~= xhtml_format.epub3_seg_head(doc_matters); + auto t = xhtml_format.heading_seg(obj, _txt, suffix, "epub"); + doc_epub3[obj.tags.segment_anchor_tag] ~= t[0]; + doc_epub3_endnotes[obj.tags.segment_anchor_tag] ~= t[1]; + break; + } + break; + case 4: + segment_filename = obj.tags.segment_anchor_tag; + doc_epub3[segment_filename] ~= xhtml_format.epub3_seg_head(doc_matters); + auto t = xhtml_format.heading_seg(obj, _txt, suffix, "epub"); + doc_epub3[segment_filename] ~= t[0]; + doc_epub3_endnotes[segment_filename] ~= t[1]; + break; + case 5: .. case 7: + auto t = xhtml_format.heading_seg(obj, _txt, suffix, "epub"); + doc_epub3[segment_filename] ~= t[0]; + doc_epub3_endnotes[segment_filename] ~= t[1]; + break; + case 8: .. case 9: + if ((doc_matters.opt.action.debug_do)) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); + writeln(__FILE__, ":", __LINE__, ": ", obj.text); + } + break; + default: + if ((doc_matters.opt.action.debug_do)) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); + } + break; + } + } else { + assert(part == "head" || "toc_seg" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail"); + switch (obj.metainfo.is_of_part) { + case "frontmatter": assert(part == "head" || "toc_seg"); + switch (obj.metainfo.is_of_type) { + case "para": + switch (obj.metainfo.is_a) { + case "toc": + auto t = xhtml_format.para_seg(obj, _txt, suffix, "epub"); + doc_epub3[segment_filename] ~= t[0]; + doc_epub3_endnotes[segment_filename] ~= t[1]; + break; + default: + if ((doc_matters.opt.action.debug_do)) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + break; + } + break; + default: + if ((doc_matters.opt.action.debug_do)) { + 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(obj, _txt, suffix, "epub"); + doc_epub3[segment_filename] ~= t[0]; + doc_epub3_endnotes[segment_filename] ~= t[1]; + break; + default: + if ((doc_matters.opt.action.debug_do)) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + break; + } + break; + case "block": + switch (obj.metainfo.is_a) { + case "quote": + auto t = xhtml_format.quote_seg(obj, _txt, suffix, "epub"); + doc_epub3[segment_filename] ~= t[0].to!string; + doc_epub3_endnotes[segment_filename] ~= t[1]; + break; + case "group": + auto t = xhtml_format.group_seg(obj, _txt, suffix, "epub"); + doc_epub3[segment_filename] ~= t[0].to!string; + doc_epub3_endnotes[segment_filename] ~= t[1]; + break; + case "block": + auto t = xhtml_format.block_seg(obj, _txt, suffix, "epub"); + doc_epub3[segment_filename] ~= t[0].to!string; + doc_epub3_endnotes[segment_filename] ~= t[1]; + break; + case "poem": + break; + case "verse": + auto t = xhtml_format.verse_seg(obj, _txt, suffix, "epub"); + doc_epub3[segment_filename] ~= t[0].to!string; + doc_epub3_endnotes[segment_filename] ~= t[1]; + break; + case "code": + doc_epub3[segment_filename] ~= xhtml_format.code(obj, _txt); + break; + case "table": + doc_epub3[segment_filename] ~= xhtml_format.table(obj, _txt); + doc_epub3_endnotes[segment_filename] ~= ""; + break; + default: + if ((doc_matters.opt.action.debug_do)) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + break; + } + break; + default: + if ((doc_matters.opt.action.debug_do)) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } + break; + } + break; + case "backmatter": + assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "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(obj, _txt, suffix, "epub"); + doc_epub3[segment_filename] ~= t[0]; + break; + case "glossary": assert(part == "glossary"); + auto t = xhtml_format.para_seg(obj, _txt, suffix, "epub"); + doc_epub3[segment_filename] ~= t[0]; + doc_epub3_endnotes[segment_filename] ~= t[1]; + break; + case "bibliography": assert(part == "bibliography"); + auto t = xhtml_format.para_seg(obj, _txt, suffix, "epub"); + doc_epub3[segment_filename] ~= t[0]; + doc_epub3_endnotes[segment_filename] ~= t[1]; + break; + case "bookindex": assert(part == "bookindex_seg"); + auto t = xhtml_format.para_seg(obj, _txt, suffix, "epub"); + doc_epub3[segment_filename] ~= t[0]; + doc_epub3_endnotes[segment_filename] ~= t[1]; + break; + case "blurb": assert(part == "blurb"); + auto t = xhtml_format.para_seg(obj, _txt, suffix, "epub"); + doc_epub3[segment_filename] ~= t[0]; + doc_epub3_endnotes[segment_filename] ~= t[1]; + break; + default: + if ((doc_matters.opt.action.debug_do)) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + break; + } + break; + default: + if ((doc_matters.opt.action.debug_do)) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } + break; + } + break; + case "comment": + break; + default: + if ((doc_matters.opt.action.debug_do)) { + 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, + obj.tags.segment_anchor_tag, + ); + oepbs_content_parts["spine"] ~= + format(q"¶ <itemref idref="%s.xhtml" linear="yes" /> + ¶", + obj.tags.segment_anchor_tag, + ); + oepbs_content_parts["guide"] ~= + format(q"¶ <reference type="%s" href="%s" /> + ¶", + obj.tags.segment_anchor_tag, + obj.tags.segment_anchor_tag, + ); + } 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, + obj.metainfo.object_number, + obj.tags.segment_anchor_tag, + obj.metainfo.object_number, + ); + oepbs_content_parts["spine"] ~= + format(q"¶ <itemref idref="%s.xhtml#%s" linear="yes" /> + ¶", + obj.tags.segment_anchor_tag, + obj.metainfo.object_number, + ); + oepbs_content_parts["guide"] ~= + format(q"¶ <reference type="%s#%s" href="%s#%s" /> + ¶", + obj.tags.segment_anchor_tag, + obj.metainfo.object_number, + obj.tags.segment_anchor_tag, + obj.metainfo.object_number, + ); + } + } + } + } + /+ epub specific documents +/ + auto mimetypes = epub3_mimetypes; + auto meta_inf_container_xml = epub3_container_xml; + auto oebps_toc_ncx = epub2_oebps_toc_ncx(doc_abstraction, doc_matters); + auto oebps_toc_nav_xhtml = epub3_oebps_toc_nav_xhtml(doc_abstraction, doc_matters); + auto oebps_content_opf = epub3_oebps_content(doc_abstraction, doc_matters, oepbs_content_parts); + epub3_write_output_files( + doc_matters, + doc_epub3, + doc_epub3_endnotes, + mimetypes, + meta_inf_container_xml, + oebps_toc_nav_xhtml, + oebps_toc_ncx, + oebps_content_opf, + doc_parts_, + ); + } + void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)( + M doc_matters, + D doc_epub3, + E doc_epub3_endnotes, + Mt mimetypes, + Mic meta_inf_container_xml, + Otnx oebps_toc_nav_xhtml, + Otn oebps_toc_ncx, + Oc oebps_content_opf, + string[] doc_parts_, + ) { + debug(asserts) { + static assert(is(typeof(doc_epub3) == string[][string])); + static assert(is(typeof(mimetypes) == string)); + static assert(is(typeof(meta_inf_container_xml) == string)); + static assert(is(typeof(oebps_toc_nav_xhtml) == string)); + static assert(is(typeof(oebps_toc_ncx) == string)); + static assert(is(typeof(oebps_content_opf) == string)); + } + auto pth_epub3 = SiSUpathsEPUB!()(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 +/ + try { + if (!exists(pth_epub3.base)) { + pth_epub3.base.mkdirRecurse; + } + debug(epub_output) { + 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.xml.segnames_lv_0_to_4) { + string fn = pth_epub3.fn_oebps_content_xhtml(doc_matters.src.filename, seg_filename); + auto zip_arc_member_file = new ArchiveMember(); + zip_arc_member_file.name = fn; + auto zip_data = new OutBuffer(); + debug(epub_output) { + string fn_dbg = pth_epub3.dbg_fn_oebps_content_xhtml(doc_matters.src.filename, seg_filename); + auto f = File(fn_dbg, "w"); + } + foreach (docseg; doc_epub3[seg_filename]) { + debug(epub_output) { f.writeln(docseg); } + zip_data.write(docseg.dup); + } + foreach (docseg; doc_epub3_endnotes[seg_filename]) { + debug(epub_output) { f.writeln(docseg); } + zip_data.write(docseg.dup); + } + debug(epub_output) { f.writeln(xhtml_format.tail); } + 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; + debug(epub_output) { string fn_dbg; } + File f; + { /+ mimetypes (identify zip file type) +/ + debug(epub_output) { + fn_dbg = pth_epub3.dbg_fn_mimetypes(doc_matters.src.filename); + File(fn_dbg, "w").writeln(mimetypes); + } + fn = pth_epub3.fn_mimetypes(doc_matters.src.filename); + auto zip_arc_member_file = new ArchiveMember(); + zip_arc_member_file.name = fn; + auto zip_data = new OutBuffer(); + zip_data.write(mimetypes.dup); + zip_arc_member_file.expandedData = zip_data.toBytes(); + zip.addMember(zip_arc_member_file); + createZipFile!()(fn_epub, zip.build()); + } + { /+ META-INF/container.xml (identify doc root) +/ + debug(epub_output) { + fn_dbg = pth_epub3.dbg_fn_dmi_container_xml(doc_matters.src.filename); + File(fn_dbg, "w").writeln(meta_inf_container_xml); + } + fn = pth_epub3.fn_dmi_container_xml(doc_matters.src.filename); + auto zip_arc_member_file = new ArchiveMember(); + zip_arc_member_file.name = fn; + auto zip_data = new OutBuffer(); + zip_data.write(meta_inf_container_xml.dup); + zip_arc_member_file.expandedData = zip_data.toBytes(); + zip.addMember(zip_arc_member_file); + createZipFile!()(fn_epub, zip.build()); + } + { /+ OEBPS/toc_nav.xhtml (navigation toc epub3) +/ + debug(epub_output) { + fn_dbg = pth_epub3.dbg_fn_oebps_toc_nav_xhtml(doc_matters.src.filename); + File(fn_dbg, "w").writeln(oebps_toc_nav_xhtml); + } + fn = pth_epub3.fn_oebps_toc_nav_xhtml(doc_matters.src.filename); + auto zip_arc_member_file = new ArchiveMember(); + zip_arc_member_file.name = fn; + auto zip_data = new OutBuffer(); + zip_data.write(oebps_toc_nav_xhtml.dup); + zip_arc_member_file.expandedData = zip_data.toBytes(); + zip.addMember(zip_arc_member_file); + createZipFile!()(fn_epub, zip.build()); + } + { /+ OEBPS/toc.ncx (navigation toc epub2) +/ + debug(epub_output) { + fn_dbg = pth_epub3.dbg_fn_oebps_toc_ncx(doc_matters.src.filename); + File(fn_dbg, "w").writeln(oebps_toc_ncx); + } + fn = pth_epub3.fn_oebps_toc_ncx(doc_matters.src.filename); + auto zip_arc_member_file = new ArchiveMember(); + zip_arc_member_file.name = fn; + auto zip_data = new OutBuffer(); + zip_data.write(oebps_toc_ncx.dup); + zip_arc_member_file.expandedData = zip_data.toBytes(); + zip.addMember(zip_arc_member_file); + createZipFile!()(fn_epub, zip.build()); + } + { /+ OEBPS/content.opf (doc manifest) +/ + debug(epub_output) { + fn_dbg = pth_epub3.dbg_fn_oebps_content_opf(doc_matters.src.filename); + File(fn_dbg, "w").writeln(oebps_content_opf); + } + fn = pth_epub3.fn_oebps_content_opf(doc_matters.src.filename); + auto zip_arc_member_file = new ArchiveMember(); + zip_arc_member_file.name = fn; + auto zip_data = new OutBuffer(); + zip_data.write(oebps_content_opf.dup); + zip_arc_member_file.expandedData = zip_data.toBytes(); + zip.addMember(zip_arc_member_file); + createZipFile!()(fn_epub, zip.build()); + } + { /+ OEBPS/_sisu/image (images) +/ + foreach (image; doc_matters.srcs.image_list) { + debug(epub_output) { + if (exists(doc_matters.src_path_info.image_root ~ "/" ~ image)) { + (doc_matters.src_path_info.image_root ~ "/" ~ image) + .copy((pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename)) ~ "/" ~ image); + } + } + } + foreach (image; doc_matters.srcs.image_list) { + debug(epub_output) { + debug(epub_images) { + writeln( + doc_matters.src.image_dir_path, "/", image, " -> ", + 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(doc_matters.src.filename.to!string) ~ "/" ~ 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 = SiSUcss(); + debug(epub_output) { + fn_dbg = pth_epub3.dbg_fn_oebps_css(doc_matters.src.filename); + File(fn_dbg, "w").writeln(css.epub_css); + } + fn = pth_epub3.fn_oebps_css(doc_matters.src.filename); + auto zip_arc_member_file = new ArchiveMember(); + zip_arc_member_file.name = fn; + auto zip_data = new OutBuffer(); + zip_data.write(css.epub_css.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/output/html.d b/src/doc_reform/output/html.d new file mode 100644 index 0000000..07fe081 --- /dev/null +++ b/src/doc_reform/output/html.d @@ -0,0 +1,481 @@ +module doc_reform.output.html; +template outputHTML() { + import doc_reform.output; + import + std.digest.sha, + std.file, + std.outbuffer, + std.zip, + std.conv : to; + import + doc_reform.output.create_zip_file, + doc_reform.output.xmls, + doc_reform.output.xmls_css; + mixin outputXHTMLs; + void scroll(D,I)( + const D doc_abstraction, + I doc_matters, + ) { + mixin SiSUoutputRgxInit; + auto xhtml_format = outputXHTMLs(); + auto rgx = Rgx(); + string[] doc_html; + string[] doc; + string suffix = ".html"; + string previous_part = ""; + string delimit = ""; + foreach (part; doc_matters.xml.keys_seq.scroll) { + foreach (obj; doc_abstraction[part]) { + delimit = xhtml_format.div_delimit(part, previous_part); + string _txt = xhtml_format.special_characters(obj, obj.text); + switch (obj.metainfo.is_of_part) { + case "frontmatter": assert(part == "head" || "toc_scroll"); + switch (obj.metainfo.is_of_type) { + case "para": + switch (obj.metainfo.is_a) { + case "heading": + doc_html ~= delimit ~ xhtml_format.heading_scroll(obj, _txt, suffix); + break; + case "toc": + doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix); + break; + default: + if ((doc_matters.opt.action.debug_do)) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + break; + } + break; + default: + if ((doc_matters.opt.action.debug_do)) { + 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(obj, _txt, suffix); + break; + case "para": + doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix); + break; + default: + if ((doc_matters.opt.action.debug_do)) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + break; + } + break; + case "block": + switch (obj.metainfo.is_a) { + case "quote": + doc_html ~= xhtml_format.quote_scroll(obj, _txt); + break; + case "group": + doc_html ~= xhtml_format.group_scroll(obj, _txt); + break; + case "block": + doc_html ~= xhtml_format.block_scroll(obj, _txt); + break; + case "poem": + break; + case "verse": + doc_html ~= xhtml_format.verse_scroll(obj, _txt, suffix); + break; + case "code": + doc_html ~= xhtml_format.code(obj, _txt); + break; + case "table": + doc_html ~= xhtml_format.table(obj, _txt); + break; + default: + if ((doc_matters.opt.action.debug_do)) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + break; + } + break; + default: + if ((doc_matters.opt.action.debug_do)) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } + break; + } + break; + case "backmatter": + assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex_scroll" || "blurb" || "tail"); + switch (obj.metainfo.is_of_type) { + case "para": + switch (obj.metainfo.is_a) { + case "heading": + doc_html ~= delimit ~ xhtml_format.heading_scroll(obj, _txt, suffix); + break; + case "endnote": assert(part == "endnotes"); + doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix); + break; + case "glossary": assert(part == "glossary"); + doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix); + break; + case "bibliography": assert(part == "bibliography"); + doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix); + break; + case "bookindex": assert(part == "bookindex_scroll"); + doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix); + break; + case "blurb": assert(part == "blurb"); + doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix); + break; + default: + if ((doc_matters.opt.action.debug_do)) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + break; + } + break; + default: + if ((doc_matters.opt.action.debug_do)) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } + break; + } + break; + case "comment": + break; + default: + if ((doc_matters.opt.action.debug_do)) { + 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_matters, doc); + } + void scroll_write_output(M,C)( + M doc_matters, + C doc, + ) { + debug(asserts) { + static assert(is(typeof(doc) == string[])); + } + auto pth_html = SiSUpathsHTML!()(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 SiSUoutputRgxInit; + 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.xml.keys_seq.seg) { + foreach (obj; doc_abstraction[part]) { + delimit = xhtml_format.div_delimit(part, previous_part); + string _txt = xhtml_format.special_characters(obj, obj.text); + if (obj.metainfo.is_a == "heading") { + assert(part == "head" || "toc_seg" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "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(obj, _txt, suffix, "seg"); + top_level_headings[obj.metainfo.heading_lev_markup] = t[0]; + break; + } + break; + case 4: + segment_filename = obj.tags.segment_anchor_tag; + doc_html[segment_filename] ~= xhtml_format.html_head(doc_matters, "seg"); + auto navigation_bar = xhtml_format.nav_pre_next_svg(obj); + 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(obj, _txt, suffix, "seg"); + doc_html[segment_filename] ~= t[0].to!string; + doc_html[segment_filename] ~= xhtml_format.lev4_heading_subtoc(obj); + doc_html_endnotes[segment_filename] ~= t[1]; + break; + case 5: .. case 7: + auto t = xhtml_format.heading_seg(obj, _txt, suffix, "seg"); + doc_html[segment_filename] ~= t[0].to!string; + doc_html_endnotes[segment_filename] ~= t[1]; + break; + case 8: .. case 9: + if ((doc_matters.opt.action.debug_do)) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); + writeln(__FILE__, ":", __LINE__, ": ", obj.text); + } + break; + default: + if ((doc_matters.opt.action.debug_do)) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); + } + break; + } + } else { + assert(part == "head" || "toc_seg" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail"); + switch (obj.metainfo.is_of_part) { + case "frontmatter": assert(part == "head" || "toc_seg"); + switch (obj.metainfo.is_of_type) { + case "para": + switch (obj.metainfo.is_a) { + case "toc": + auto t = xhtml_format.para_seg(obj, _txt, suffix, "seg"); + doc_html[segment_filename] ~= t[0].to!string; + break; + default: + if ((doc_matters.opt.action.debug_do)) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + break; + } + break; + default: + if ((doc_matters.opt.action.debug_do)) { + 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(obj, _txt, suffix, "seg"); + doc_html[segment_filename] ~= t[0].to!string; + doc_html_endnotes[segment_filename] ~= t[1]; + break; + default: + if ((doc_matters.opt.action.debug_do)) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + break; + } + break; + case "block": + switch (obj.metainfo.is_a) { + case "quote": + auto t = xhtml_format.quote_seg(obj, _txt, 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(obj, _txt, 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(obj, _txt, 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(obj, _txt, 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(obj, _txt); + break; + case "table": + doc_html[segment_filename] ~= xhtml_format.table(obj, _txt); + doc_html_endnotes[segment_filename] ~= ""; + break; + default: + if ((doc_matters.opt.action.debug_do)) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + break; + } + break; + default: + if ((doc_matters.opt.action.debug_do)) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } + break; + } + break; + case "backmatter": + assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "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(obj, _txt, suffix, "seg"); + doc_html[segment_filename] ~= t[0]; + break; + case "glossary": assert(part == "glossary"); + auto t = xhtml_format.para_seg(obj, _txt, 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(obj, _txt, suffix, "seg"); + doc_html[segment_filename] ~= t[0]; + doc_html_endnotes[segment_filename] ~= t[1]; + break; + case "bookindex": assert(part == "bookindex_seg"); + auto t = xhtml_format.para_seg(obj, _txt, 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(obj, _txt, suffix, "seg"); + doc_html[segment_filename] ~= t[0]; + doc_html_endnotes[segment_filename] ~= t[1]; + break; + default: + if ((doc_matters.opt.action.debug_do)) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + break; + } + break; + default: + if ((doc_matters.opt.action.debug_do)) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } + break; + } + break; + case "comment": + break; + default: + if ((doc_matters.opt.action.debug_do)) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); + } + break; + } + } + } + } + seg_write_output(doc_matters, doc_html, doc_html_endnotes); + } + void seg_write_output(M,D,E)( + M doc_matters, + D doc_html, + E doc_html_endnotes, + ) { + debug(asserts) { + static assert(is(typeof(doc_html) == string[][string])); + } + mixin SiSUoutputRgxInit; + auto rgx = Rgx(); + auto pth_html = SiSUpathsHTML!()(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.xml.segnames) { + 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)( + auto ref M doc_matters, + ) { + auto css = SiSUcss(); + auto pth_html = SiSUpathsHTML!()(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_css); + f = File(pth_html.fn_scroll_css, "w"); + f.writeln(css.html_scroll_css); + } catch (ErrnoException ex) { + // Handle error + } + } + void images_cp(M)( + auto ref M doc_matters, + ) { + { /+ (copy html images) +/ + + auto pth_html = SiSUpathsHTML!()(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 { + writeln("WARNING image not found: ", fn_src_in); + } + } + } + } +} diff --git a/src/doc_reform/output/hub.d b/src/doc_reform/output/hub.d new file mode 100644 index 0000000..b40c929 --- /dev/null +++ b/src/doc_reform/output/hub.d @@ -0,0 +1,106 @@ +/++ + output hub<BR> + check & generate output types requested ++/ +module doc_reform.output.hub; +template outputHub() { + import doc_reform.output, + doc_reform.output.epub3, + doc_reform.output.html, + doc_reform.output.sqlite, + doc_reform.output.xmls, + doc_reform.output.source_sisupod, + doc_reform.output.create_zip_file, + doc_reform.output.paths_output; + import std.parallelism; + void outputHub(D,I)(D doc_abstraction, I doc_matters) { + mixin SiSUoutputRgxInit; + mixin Msg; + auto msg = Msg!()(doc_matters); + static auto rgx = Rgx(); + enum outTask { sisupod, source, sqlite, sqlite_multi, 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.sisupod) { + msg.v("sisu source processing... "); + SiSUpod!()(doc_matters); + msg.vv("sisu source done"); + } + if (sched == outTask.sqlite) { + msg.v("sqlite processing... "); + SQLiteHubDiscreteBuildTablesAndPopulate!()(doc_abstraction, doc_matters); + msg.vv("sqlite done"); + } + if (sched == outTask.epub) { + msg.v("epub3 processing... "); + outputEPub3!()(doc_abstraction, doc_matters); + msg.vv("epub3 done"); + } + if (sched == outTask.html_scroll) { + msg.v("html scroll processing... "); + outputHTML!().scroll(doc_abstraction, doc_matters); + msg.vv("html scroll done"); + } + if (sched == outTask.html_seg) { + msg.v("html seg processing... "); + outputHTML!().seg(doc_abstraction, doc_matters); + msg.vv("html seg done"); + } + if (sched == outTask.html_stuff) { + outputHTML!().css(doc_matters); + outputHTML!().images_cp(doc_matters); + msg.vv("html css & images done"); + } + } + if (!(doc_matters.opt.action.pp2)) { + 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..."); + SQLiteHubBuildTablesAndPopulate!()(doc_abstraction, doc_matters); + msg.vv("sqlite update done"); + } else if (doc_matters.opt.action.sqlite_delete) { + msg.v("sqlite delete processing..."); + SQLiteHubBuildTablesAndPopulate!()(doc_abstraction, doc_matters); + msg.vv("sqlite delete done"); + } + } +} +template outputHubOp() { + import doc_reform.output, + doc_reform.output.epub3, + doc_reform.output.html, + doc_reform.output.sqlite, + doc_reform.output.xmls, + doc_reform.output.source_sisupod, + doc_reform.output.create_zip_file, + doc_reform.output.paths_output; + void outputHubOp(E,O)(E env, O opt_action) { + mixin SiSUoutputRgxInit; + static auto rgx = Rgx(); + if ((opt_action.sqlite_db_drop)) { + if ((opt_action.verbose)) { + writeln("sqlite drop db..."); + } + 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..."); + } + SQLiteTablesCreate!()(env, opt_action); + if ((opt_action.very_verbose)) { + writeln("sqlite create table done"); + } + } + } +} diff --git a/src/doc_reform/output/package.d b/src/doc_reform/output/package.d new file mode 100644 index 0000000..5e14e8a --- /dev/null +++ b/src/doc_reform/output/package.d @@ -0,0 +1,22 @@ +module doc_reform.output; +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.source.paths_source, + doc_reform.output.defaults, + doc_reform.output.paths_output, + doc_reform.output.rgx; diff --git a/src/doc_reform/output/paths_output.d b/src/doc_reform/output/paths_output.d new file mode 100644 index 0000000..abd21b6 --- /dev/null +++ b/src/doc_reform/output/paths_output.d @@ -0,0 +1,272 @@ +/++ + default settings ++/ +module doc_reform.output.paths_output; +import std.array, + std.path, + std.regex, + std.stdio; +import doc_reform.meta.rgx; +template SiSUoutPaths() { + auto SiSUoutPaths(Po,Lng)( + Po output_pth_root, + Lng lng, + ) { + struct _PathsStruct { + string output_root() { + return (output_pth_root.length > 0) + ? output_pth_root + : "sisugen"; + } + string output_base() { + return asNormalizedPath(output_root.chainPath(lng)).array; + } + } + return _PathsStruct(); + } +} +template SiSUoutPathSQLite() { + auto SiSUoutPathSQLite(Po)( + Po output_pth_root, + ) { + struct _PathsStruct { + string output_root() { + return (output_pth_root.length > 0) + ? output_pth_root + : "sisugen"; + } + string output_base() { + return asNormalizedPath(output_root).array; + } + } + return _PathsStruct(); + } +} +template SiSUoutPathsFnPd() { + /+ TODO stuff to work out here +/ + auto SiSUoutPathsFnPd(Fn,Pn)( + Fn fn_src_pth, + Pn pod_name + ) { + 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.empty)) { + if (pod_name == _fn_src) { + _output_base_name = _fn_src; + } else { + _output_base_name = pod_name ~ "." ~ _fn_src; + } + } else { + _output_base_name = _fn_src; + } + return _output_base_name; + } + } + return _PathsStruct(); + } +} +template SiSUpathsHTML() { + mixin SiSUrgxInit; + static auto rgx = Rgx(); + auto SiSUpathsHTML(Po,Lng)( + Po output_pth_root, + Lng lng, + ) { + auto out_pth = SiSUoutPaths!()(output_pth_root, lng); + string base_dir = "html"; + string suffix = ".html"; + struct _PathsStruct { + string base_filename(string fn_src) { + return fn_src.baseName.stripExtension; + } + string base() { + return asNormalizedPath((out_pth.output_base).chainPath(base_dir)).array; + } + string image() { + return asNormalizedPath((out_pth.output_root).chainPath("image")).array; + } + string css() { + return asNormalizedPath((out_pth.output_root).chainPath("css")).array; + } + string fn_seg_css() { + return asNormalizedPath(css.chainPath("html_seg.css")).array; + } + string fn_scroll_css() { + return asNormalizedPath(css.chainPath("html_scroll.css")).array; + } + string seg(string fn_src) { + return asNormalizedPath(base.chainPath(base_filename(fn_src))).array; + } + string fn_scroll(string fn_src) { + return asNormalizedPath(base.chainPath(base_filename(fn_src) ~ suffix)).array; + } + string fn_seg(string fn_src, string seg_filename) { + return asNormalizedPath(seg(fn_src).chainPath(seg_filename ~ suffix)).array; + } + } + return _PathsStruct(); + } +} +template SiSUpathsEPUB() { + mixin SiSUrgxInit; + static auto rgx = Rgx(); + auto SiSUpathsEPUB(Po,Lng)( + Po output_pth_root, + Lng lng, + ) { + auto out_pth = SiSUoutPaths!()( output_pth_root, lng); + string base_dir = "epub"; + struct _PathsStruct { + string base() { + return asNormalizedPath((out_pth.output_base).chainPath(base_dir)).array; + } + string base_filename(string fn_src) { + return fn_src.baseName.stripExtension; + } + string epub_file(string fn_src) { + return asNormalizedPath(base.chainPath(base_filename(fn_src) ~ ".epub")).array; + } + string dirtop() { + return "".chainPath("").array; + } + string doc_meta_inf(string fn_src) { + return asNormalizedPath(dirtop.chainPath("META-INF")).array; + } + string doc_oebps(string fn_src) { + return asNormalizedPath(dirtop.chainPath("OEBPS")).array; + } + string doc_oebps_css(string fn_src) { + return asNormalizedPath(doc_oebps(fn_src).chainPath("css")).array; + } + string doc_oebps_image(string fn_src) { + return asNormalizedPath(doc_oebps(fn_src).chainPath("image")).array; + } + string fn_mimetypes(string fn_src) { + return asNormalizedPath(dirtop.chainPath("mimetypes")).array; + } + string fn_dmi_container_xml(string fn_src) { + return asNormalizedPath(doc_meta_inf(fn_src).chainPath("container.xml")).array; + } + string fn_oebps_toc_nav_xhtml(string fn_src) { + return asNormalizedPath(doc_oebps(fn_src).chainPath("toc_nav.xhtml")).array; + } + string fn_oebps_toc_ncx(string fn_src) { + return asNormalizedPath(doc_oebps(fn_src).chainPath("toc.ncx")).array; + } + string fn_oebps_content_opf(string fn_src) { + return asNormalizedPath(doc_oebps(fn_src).chainPath("content.opf")).array; + } + string fn_oebps_content_xhtml(string fn_src, string seg_filename) { + return asNormalizedPath(doc_oebps(fn_src).chainPath(seg_filename ~ ".xhtml")).array; + } + string fn_oebps_css(string fn_src) { + return asNormalizedPath(doc_oebps_css(fn_src).chainPath("epub.css")).array; + } + debug(epub_output) { + 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 SiSUpathsSQLiteDiscrete() { + mixin SiSUrgxInit; + static auto rgx = Rgx(); + auto SiSUpathsSQLiteDiscrete(Po,Lng)( + Po output_pth_root, + Lng lng, + ) { + struct _PathsStruct { + string base_filename(string fn_src) { + return fn_src.baseName.stripExtension; + } + string base() { + auto out_pth = SiSUoutPaths!()(output_pth_root, lng); + string base_dir = "sqlite"; + return asNormalizedPath((out_pth.output_base).chainPath(base_dir)).array; + } + string seg(string fn_src) { + return asNormalizedPath(base.chainPath(base_filename(fn_src))).array; + } + string sqlite_file(string fn_src) { + return asNormalizedPath(base.chainPath(base_filename(fn_src) ~ ".sql.db")).array; + } + } + return _PathsStruct(); + } +} +template SiSUpathsSQLite() { + mixin SiSUrgxInit; + static auto rgx = Rgx(); + auto SiSUpathsSQLite(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 = SiSUoutPathSQLite!()(output_pth_root); // decide whether to have separate files for each language + string base_dir = "sqlite"; + return asNormalizedPath((out_pth.output_root).chainPath(base_dir)).array; + } + string sqlite_file() { + return asNormalizedPath(base.chainPath(base_filename(db_name) ~ ".sql.db")).array; + } + } + return _PathsStruct(); + } +} diff --git a/src/doc_reform/output/rgx.d b/src/doc_reform/output/rgx.d new file mode 100644 index 0000000..0d23f11 --- /dev/null +++ b/src/doc_reform/output/rgx.d @@ -0,0 +1,106 @@ +/++ + regex: regular expressions used in sisu document parser ++/ +module doc_reform.output.rgx; +static template SiSUoutputRgxInit() { + import doc_reform.output.defaults; + static struct Rgx { + static newline = ctRegex!("\n", "mg"); + static strip_br = ctRegex!("^<br>\n|<br>\n*$"); + static space = ctRegex!(`[ ]`, "mg"); + static spaces_line_start = ctRegex!(`^(?P<opening_spaces>[ ]+)`, "mg"); + static spaces_multiple = ctRegex!(`(?P<multiple_spaces>[ ]{2,})`, "mg"); + static two_spaces = ctRegex!(`[ ]{2}`, "mg"); + static nbsp_char = ctRegex!(`░`, "mg"); + static nbsp_chars_line_start = ctRegex!(`^░+`, "mg"); + static nbsp_and_space = ctRegex!(` [ ]`, "mg"); + static nbsp_char_and_space = ctRegex!(`░[ ]`, "mg"); + static special_markup_chars = 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._-]+[.]ss[tm])$`); + static src_pth_contents = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+)/sisupod[.]manifest$`); + static src_pth_pod_root = ctRegex!(`^(?P<podroot>(?:[/]?(?:[a-zA-Z0-9._-]+/)*)(sisupod))$`); + static src_pth_zip = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]zip)$`); + static src_pth_unzip_pod = ctRegex!(`^(?P<path>media/text/[a-z]{2}/)*(?P<filename>[a-zA-Z0-9._-]+[.]ss[im])$`); + 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._-]+/sisupod[.]manifest)|(?P<filezip>[a-zA-Z0-9._-]+[.]zip))$`); + static pod_content_location = + ctRegex!(`^(?P<filename>[a-zA-Z0-9._-]+[.]ss[tm])(?P<languages>(?:\s+[a-z]{2}(?:,|$))+)`, "mg"); + 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_text = ctRegex!(`^(?P<path>[a-zA-Z0-9._-]+/)*(?P<filename>[a-zA-Z0-9._-]+[.]sst)$`); + static src_fn_insert = ctRegex!(`^(?P<path>[a-zA-Z0-9._-]+/)*(?P<filename>[a-zA-Z0-9._-]+[.]ssi)$`); + 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_base_parent_path = 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_line = ctRegex!(`┘`, "mg"); + static br_nl = ctRegex!(`┙`, "mg"); + static br_paragraph = ctRegex!(`┚`, "mg"); + static br_page_line = ctRegex!(`┼`, "mg"); + static br_page = ctRegex!(`┿`, "mg"); + static br_page_new = ctRegex!(`╂`, "mg"); + /+ inline markup footnotes endnotes +/ + static inline_notes_al = ctRegex!(`【(?:[*+]\s+|\s*)(.+?)】`, "mg"); + static inline_notes_al_special = ctRegex!(`【(?:[*+]\s+)(.+?)】`, "mg"); // TODO remove match when special footnotes are implemented + static inline_notes_al_gen = ctRegex!(`【.+?】`, "m"); + static inline_notes_al_gen_text = ctRegex!(`【(?P<text>.+?)】`, "m"); + static inline_notes_al_gen_ref = ctRegex!(`【(?P<ref>[*+]\s+)\s*(?P<text>.+?)】`, "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_al_delimiter_close_regular = ctRegex!(`】`, "m"); + static inline_al_delimiter_open_and_close_regular = ctRegex!(`【|】`, "m"); + static inline_notes_delimiter_al_regular = ctRegex!(`【(.+?)】`, "mg"); + static inline_notes_delimiter_al_regular_number_note = ctRegex!(`【(\d+)\s+(.+?)】`, "mg"); + static inline_al_delimiter_open_asterisk = ctRegex!(`【\*`, "m"); + static inline_al_delimiter_open_plus = ctRegex!(`【\+`, "m"); + static inline_text_and_note_al = ctRegex!(`(?P<text>.+?)【(?:[*+ ]*)(?P<note>.+?)】`, "mg"); + static inline_text_and_note_al_ = ctRegex!(`(.+?(?:【[*+]*\s+.+?】|$))`, "mg"); + /+ inline markup footnotes endnotes +/ + static inline_image = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>\S+?\.(?: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>\S+?\.(?:jpg|gif|png)),w(?P<width>0)h(?P<height>0))\s*(?P<post>.*?┝┤.+?├)`, "mg"); + static inline_link = ctRegex!(`┥(?P<text>.+?)┝┤(?P<link>.+?)├`, "mg"); + static inline_link_clean = ctRegex!(`┤(?:.+?)├|[┥┝]`, "mg"); + static inline_a_url = ctRegex!(`(┤)(\S+?)(├)`, "mg"); + static url = ctRegex!(`https?://`, "mg"); + static inline_link_subtoc = ctRegex!(`^(?P<level>[5-7])~ ┥(?P<text>.+?)┝┤(?P<link>.+?)├`, "mg"); + static fn_suffix = ctRegex!(`\.fnSuffix`, "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"); + static quotation_mark_various = ctRegex!(q"¶['‘’“”"`´¨]¶", "mg"); + /+ inline markup font face mod +/ + static inline_faces = ctRegex!(`(?P<markup>(?P<mod>[*!_^,+#-])\{(?P<text>.+?)\}[*!_^,+#-])`, "mg"); + static inline_emphasis = ctRegex!(`\*\{(?P<text>.+?)\}\*`, "mg"); + static inline_bold = ctRegex!(`!\{(?P<text>.+?)\}!`, "mg"); + static inline_underscore = ctRegex!(`_\{(?P<text>.+?)\}_`, "mg"); + static inline_italics = ctRegex!(`/\{(?P<text>.+?)\}/`, "mg"); + static inline_superscript = ctRegex!(`\^\{(?P<text>.+?)\}\^`, "mg"); + static inline_subscript = ctRegex!(`,\{(?P<text>.+?)\},`, "mg"); + static inline_strike = ctRegex!(`-\{(?P<text>.+?)\}-`, "mg"); + static inline_insert = ctRegex!(`\+\{(?P<text>.+?)\}\+`, "mg"); + static inline_mono = ctRegex!(`#\{(?P<text>.+?)\}#`, "mg"); + static inline_mono_box = ctRegex!(`■\{(?P<text>.+?)\}■`, "mg"); + static inline_cite = ctRegex!(`"\{(?P<text>.+?)\}"`, "mg"); + static inline_faces_line = ctRegex!(`^[*!/_]_ (?P<text>.+?)((?: [\\]{2}|[~]#){0,2}$)`); + static inline_emphasis_line = ctRegex!(`^\*_ (?P<text>.+?)((?: [\\]{2}|[~]#){0,2}$)`); + static inline_bold_line = ctRegex!(`^!_ (?P<text>.+?)((?: [\\]{2}|[~]#){0,2}$)`); + static inline_italics_line = ctRegex!(`^/_ (?P<text>.+?)((?: [\\]{2}|[~]#){0,2}$)`); + static inline_underscore_line = ctRegex!(`^__ (?P<text>.+?)((?: [\\]{2}|[~]#){0,2}$)`); + static inline_fontface_clean = ctRegex!(`[*!_/^,+#■"-]\{|\}[*!_/^,+#■"-]`, "mg"); + static no_header_rgx = ctRegex!(`^=NULL$`); + /+ table delimiters +/ + static table_delimiter_col = ctRegex!("[ ]*[┊][ ]*", "mg"); + static table_delimiter_row = ctRegex!("[ ]*\n", "mg"); + static xhtml_ampersand = ctRegex!(`[&]`); // & + static xhtml_quotation = ctRegex!(`["]`); // " + static xhtml_less_than = ctRegex!(`[<]`); // < + static xhtml_greater_than = ctRegex!(`[>]`); // > + static xhtml_line_break = ctRegex!(` [\\]{2}`); // <br /> + } +} diff --git a/src/doc_reform/output/source_sisupod.d b/src/doc_reform/output/source_sisupod.d new file mode 100644 index 0000000..fa041fd --- /dev/null +++ b/src/doc_reform/output/source_sisupod.d @@ -0,0 +1,278 @@ +module doc_reform.output.source_sisupod; +template SiSUpod() { + import doc_reform.output; + import + std.digest.sha, + std.file, + std.outbuffer, + std.zip, + std.conv : to; + import + doc_reform.output.create_zip_file, + doc_reform.output.xmls; + void SiSUpod(T)(T doc_matters) { + debug(asserts) { + // static assert(is(typeof(doc_matters) == tuple)); + } + mixin SiSUoutputRgxInit; + string pwd = doc_matters.env.pwd; + auto src_path_info = doc_matters.src_path_info; + auto pth_sisudoc_src = doc_matters.src_path_info; + auto pths_sisupod = SiSUpathsSisupods!()(doc_matters); + mixin SiSUlanguageCodes; + auto lang = Lang(); + static auto rgx = Rgx(); + assert (doc_matters.src.filename.match(rgx.src_fn)); + try { + /+ create directory structure +/ + if (!exists(pths_sisupod.sisupod_dir_())) { + // used both by sisupod zipped (& sisupod filesystem (unzipped) which makes its own recursive dirs) + pths_sisupod.sisupod_dir_().mkdirRecurse; + } + if (doc_matters.opt.action.source) { + if (!exists(pths_sisupod.text_root(doc_matters.src.filename).filesystem_open_zpod)) { + pths_sisupod.text_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse; + } + if (!exists(pths_sisupod.conf_root(doc_matters.src.filename).filesystem_open_zpod)) { + pths_sisupod.conf_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse; + } + if (!exists(pths_sisupod.media_root(doc_matters.src.filename).filesystem_open_zpod)) { + pths_sisupod.media_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse; + } + if (!exists(pths_sisupod.css(doc_matters.src.filename).filesystem_open_zpod)) { + pths_sisupod.css(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse; + } + if (!exists(pths_sisupod.image_root(doc_matters.src.filename).filesystem_open_zpod)) { + pths_sisupod.image_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse; + } + if (!exists(pths_sisupod.doc_lng(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod)) { + pths_sisupod.doc_lng(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod.mkdirRecurse; + } + } + debug(sisupod) { + writeln(__LINE__, ": ", + doc_matters.src.filename, " -> ", + pths_sisupod.fn_doc(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod + ); + } + auto zip = new ZipArchive(); + auto fn_sisupod = pths_sisupod.sisupod_filename(doc_matters.src.filename).zpod; + { /+ bundle images +/ + foreach (image; doc_matters.srcs.image_list) { + debug(sisupodimages) { + writeln( + pth_sisudoc_src.image_root.to!string, "/", image, " -> ", + pths_sisupod.image_root(doc_matters.src.filename).zpod, "/", image + ); + } + auto fn_src_in = doc_matters.src.image_dir_path ~ "/" ~ image; + auto fn_src_out_sisupod_zip_base + = pths_sisupod.image_root(doc_matters.src.filename).zpod.to!string + ~ "/" ~ image; + auto fn_src_out_filesystem + = pths_sisupod.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.sisupod) { + auto zip_arc_member_file = new ArchiveMember(); + zip_arc_member_file.name = fn_src_out_sisupod_zip_base; + auto zip_data = new OutBuffer(); + zip_data.write(cast(char[]) ((fn_src_in).read)); + zip_arc_member_file.expandedData = zip_data.toBytes(); + zip.addMember(zip_arc_member_file); + } + } else { + if (doc_matters.opt.action.verbose) { + writeln("WARNING (io) src out NOT found (image): ", fn_src_in); + } + } + } + } { /+ bundle sisu_document_make +/ + auto fn_src_in = ((doc_matters.src.is_pod) + ? doc_matters.src.conf_dir_path + : pth_sisudoc_src.conf_root).to!string + ~ "/" ~ "sisu_document_make"; + auto fn_src_out_sisupod_zip_base + = pths_sisupod.conf_root(doc_matters.src.filename).zpod.to!string ~ "/" ~ "sisu_document_make"; + auto fn_src_out_filesystem + = pths_sisupod.conf_root(doc_matters.src.filename).filesystem_open_zpod.to!string + ~ "/" ~ "sisu_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.sisupod) { + auto zip_arc_member_file = new ArchiveMember(); + zip_arc_member_file.name = fn_src_out_sisupod_zip_base; + auto zip_data = new OutBuffer(); + zip_data.write((fn_src_in).readText); + zip_arc_member_file.expandedData = zip_data.toBytes(); + zip.addMember(zip_arc_member_file); + } + } else { + if (doc_matters.opt.action.verbose + || doc_matters.opt.action.debug_do) { + writeln("WARNING (io) src out NOT found (document make): ", fn_src_in); + } + } + } { /+ bundle primary file +/ + auto fn_src_in = doc_matters.src.file_with_absolute_path.to!string; + auto fn_src_out_sisupod_zip_base + = pths_sisupod.fn_doc(doc_matters.src.filename, doc_matters.src.language).zpod.to!string; + auto fn_src_out_filesystem + = pths_sisupod.fn_doc(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod.to!string; // without root path: + auto fn_src_out_inside_pod + = pths_sisupod.fn_doc(doc_matters.src.filename, doc_matters.src.language).zpod.to!string; // without root path: + string[] filelist_src_out_sisupod_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_sisupod_arr ~= fn_src_out_sisupod_zip_base; + filelist_src_zpod_arr ~= fn_src_out_inside_pod; + if (doc_matters.opt.action.source) { + auto filelist + = File(pths_sisupod.fn_pod_filelist(doc_matters.src.filename).filesystem_open_zpod, "w"); + foreach (source_pth_and_fn; filelist_src_zpod_arr) { + filelist.writeln(source_pth_and_fn); + } + fn_src_in.copy(fn_src_out_filesystem); + } + if (doc_matters.opt.action.sisupod) { + auto zip_arc_member_file = new ArchiveMember(); + zip_arc_member_file.name = fn_src_out_sisupod_zip_base; + auto zip_data = new OutBuffer(); + zip_data.write((fn_src_in).readText); + zip_arc_member_file.expandedData = zip_data.toBytes(); + zip.addMember(zip_arc_member_file); + } + } else { + if (doc_matters.opt.action.verbose + || doc_matters.opt.action.debug_do) { + writeln("WARNING (io) src in NOT found (markup source): ", fn_src_in); + } + } + } { /+ bundle insert files +/ + if (doc_matters.srcs.file_insert_list.length > 0) { + foreach (insert_file; doc_matters.srcs.file_insert_list) { + debug(sisupod) { + writeln( + insert_file, " -> ", + pths_sisupod.fn_doc_insert( + doc_matters.src.filename, + insert_file, + doc_matters.src.language, + ).zpod + ); + } + auto fn_src_in = insert_file; + auto fn_src_out_sisupod_zip_base + = pths_sisupod.fn_doc_insert( + doc_matters.src.filename, + insert_file, + doc_matters.src.language, + ).zpod.to!string; + auto fn_src_out_filesystem + = pths_sisupod.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.sisupod) { + auto zip_arc_member_file = new ArchiveMember(); + zip_arc_member_file.name = fn_src_out_sisupod_zip_base; + auto zip_data = new OutBuffer(); + zip_data.write((fn_src_in).readText); + zip_arc_member_file.expandedData = zip_data.toBytes(); + zip.addMember(zip_arc_member_file); + createZipFile!()(fn_sisupod, zip.build()); + } + } else { + if (doc_matters.opt.action.verbose + || doc_matters.opt.action.debug_do) { + 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.sisupod) { + if (exists(doc_matters.src.file_with_absolute_path)) { + createZipFile!()(fn_sisupod, zip.build()); + } else { + writeln("WARNING check missing source file(s): ", doc_matters.opt.action.sisupod); + } + if (!(exists(fn_sisupod))) { + writeln("WARNING failed to create sisupod zip archive: ", fn_sisupod); + } + } + } + if (exists(fn_sisupod)) { + try { + if (doc_matters.opt.action.verbose) { + auto data = (cast(byte[]) (fn_sisupod).read); + writeln(doc_matters.src.filename, " >> "); + writefln("%-(%02x%) %s", data.sha256Of, fn_sisupod); + } + debug(sisupod) { + try { + auto zipped = new ZipArchive((fn_sisupod).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 == "sisudoc/media/text/en/the_wealth_of_networks.yochai_benkler.sst") { + assert( + ((data).sha256Of).toHexString + == "626F83A31ED82F42CF528E922C1643498A137ABA3F2E5AFF8A379EA79EA22A1E", + "\nsisupod: sha256 value for " + ~ doc_matters.src.filename + ~ " has changed, is now: " + ~ ((data).sha256Of).toHexString + ); + } + if (doc_matters.src.filename == "sisudoc/media/text/en/sisu_markup_stress_test.sst") { + assert( + ((data).sha256Of).toHexString + == "AAE0C87AB3F6D5F7385AEEA6EE661F56D40475CFE87AD930C78C9FE07FFB0D91", + "\nsisupod: 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/output/sqlite.d b/src/doc_reform/output/sqlite.d new file mode 100644 index 0000000..a765fd7 --- /dev/null +++ b/src/doc_reform/output/sqlite.d @@ -0,0 +1,1242 @@ +module doc_reform.output.sqlite; +import doc_reform.output; +import + std.file, + std.conv : to; +import d2sqlite3; +import std.typecons : Nullable; +mixin SiSUoutputRgxInit; +static auto rgx = Rgx(); +long _metadata_tid_lastrowid; +template SQLiteHubBuildTablesAndPopulate() { + void SQLiteHubBuildTablesAndPopulate(D,I)( + D doc_abstraction, + I doc_matters, + ) { + auto pth_sqlite = SiSUpathsSQLite!()(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,I)( + Db db, + D doc_abstraction, + I doc_matters, + ) { + { + string _db_statement; + { + if ((doc_matters.opt.action.sqlite_db_create)) { + auto pth_sqlite = SiSUpathsSQLite!()(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 ~= SQLiteInsertDocObjectsLoop!()(doc_abstraction, 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,I)( + D doc_abstraction, + I doc_matters, + ) { + auto pth_sqlite = SiSUpathsSQLiteDiscrete!()(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,I)( + Db db, + D doc_abstraction, + I doc_matters, + ) { + { + string _db_statement; + { + _db_statement ~= SQLiteTablesReCreate!()(); + _db_statement ~= SQLiteInsertMetadata!()(doc_matters); + _db_statement ~= SQLiteInsertDocObjectsLoop!()(doc_abstraction, 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); + } + if (opt_action.debug_do) { + writeln(note); + if (opt_action.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(I)( + I doc_matters, + ) { + mixin SiSUoutputRgxInit; + struct sqlite_format_and_load_objects { + auto 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; + } + if (doc_matters.opt.action.debug_do) { + writeln(_txt, "\n"); + } + debug(sql_text_clean) { + writeln(_txt); + } + return _txt; + } + auto munge_html(O)( + auto ref 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 (_txt.matchFirst(rgx.inline_link)) { + foreach (m; _txt.matchAll(rgx.inline_link)) { + } + _txt = _txt.replaceAll(rgx.inline_link_clean, ""); + } + if (_notes.length > 0) { + _txt ~= _notes; + } + if (doc_matters.opt.action.debug_do) { + 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; + } + auto html_heading(O)( + auto ref const O obj, + ) { + string _txt = munge_html(obj); + string o = format(q"¶<p class="%s"><b> + %s + </b></p>¶", + obj.metainfo.is_a, + _txt, + ); + return o; + } + auto html_para(O)( + auto ref const O obj, + ) { + string _txt = munge_html(obj); + _txt = (obj.attrib.bullet) ? ("●  " ~ _txt) : _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; + } + auto html_quote(O)( + auto ref const O obj, + ) { + string _txt = munge_html(obj); + string o = format(q"¶<p class="%s"> + %s + </p>¶", + obj.metainfo.is_a, + _txt + ); + return o; + } + auto html_group(O)( + auto ref const O obj, + ) { + string _txt = munge_html(obj); + string o = format(q"¶<p class="%s"> + %s + </p>¶", + obj.metainfo.is_a, + _txt + ); + return o; + } + auto html_block(O)( + auto ref const O obj, + ) { + string _txt = munge_html(obj); + string o = format(q"¶ + <p class="%s">%s</p>¶", + obj.metainfo.is_a, + _txt.stripRight + ); + return o; + } + auto html_verse(O)( + auto ref const O obj, + ) { + string _txt = munge_html(obj); + string o = format(q"¶<p class="%s">%s</p>¶", + obj.metainfo.is_a, + _txt + ); + return o; + } + auto html_code(O)( + auto ref const O obj, + ) { + string _txt = html_special_characters_code(obj.text); + string o = format(q"¶<p class="%s">%s</p>¶", + obj.metainfo.is_a, + _txt + ); + return o; + } + auto html_table(O)( + auto ref const O obj, + ) { + auto _tablarize(O)( + auto ref 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(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; + } + auto sqlite_load_string(O,Dm)( + auto ref const O obj, + auto ref Dm doc_matters, + ) { + string o; + return o; + } + auto postgresql_load_string(O,Dm)( + auto ref const O obj, + auto ref Dm doc_matters, + ) { + string o; + return o; + } + string sqlite_statement(O)( + auto ref const O obj, + string _txt, + string _html, + ) { + void _sql_exe(O)( + string _sql, + ) { + writeln(_html); + writeln(_sql); + } + string _sql; + return _sql; + } + auto heading(O)( + auto ref const O obj, + ) { + string[string] obj_txt = [ + "text": generic_munge_sanitize_text_for_search(obj.text), + "html": html_heading(obj) + ]; + if (doc_matters.opt.action.debug_do) { + debug(sql_txt) { + writeln(obj_txt["text"]); + } + debug(sql_html) { + writeln(obj_txt["html"]); + } + } else { + // load sql + } + return obj_txt; + } + auto para(O)( + auto ref const O obj, + ) { + string[string] obj_txt = [ + "text": generic_munge_sanitize_text_for_search(obj.text), + "html": html_para(obj) + ]; + if (doc_matters.opt.action.debug_do) { + debug(sql_txt) { + writeln(obj_txt["text"]); + } + debug(sql_html) { + writeln(obj_txt["html"]); + } + } else { + // load sql + } + return obj_txt; + } + auto quote(O)( + auto ref const O obj, + ) { + string[string] obj_txt = [ + "text": generic_munge_sanitize_text_for_search(obj.text), + "html": html_quote(obj) + ]; + if (doc_matters.opt.action.debug_do) { + debug(sql_txt) { + writeln(obj_txt["text"]); + } + debug(sql_html) { + writeln(obj_txt["html"]); + } + } else { + // load sql + } + return obj_txt; + } + auto group(O)( + auto ref const O obj, + ) { + string[string] obj_txt = [ + "text": generic_munge_sanitize_text_for_search(obj.text), + "html": html_group(obj) + ]; + if (doc_matters.opt.action.debug_do) { + debug(sql_txt) { + writeln(obj_txt["text"]); + } + debug(sql_html) { + writeln(obj_txt["html"]); + } + } else { + // load sql + } + return obj_txt; + } + auto block(O)( + auto ref const O obj, + ) { + string[string] obj_txt = [ + "text": generic_munge_sanitize_text_for_search(obj.text), + "html": html_block(obj) + ]; + if (doc_matters.opt.action.debug_do) { + debug(sql_txt) { + writeln(obj_txt["text"]); + } + debug(sql_html) { + writeln(obj_txt["html"]); + } + } else { + // load sql + } + return obj_txt; + } + auto verse(O)( + auto ref const O obj, + ) { + string[string] obj_txt = [ + "text": generic_munge_sanitize_text_for_search(obj.text), + "html": html_verse(obj) + ]; + if (doc_matters.opt.action.debug_do) { + debug(sql_txt) { + writeln(obj_txt["text"]); + } + debug(sql_html) { + writeln(obj_txt["html"]); + } + } else { + // load sql + } + return obj_txt; + } + auto code(O)( + auto ref const O obj, + ) { + string[string] obj_txt = [ + "text": generic_munge_sanitize_text_for_search(obj.text), + "html": html_code(obj) + ]; + if (doc_matters.opt.action.debug_do) { + debug(sql_txt) { + writeln(obj_txt["text"]); + } + debug(sql_html) { + writeln(obj_txt["html"]); + } + } else { + // load sql + } + return obj_txt; + } + auto table(O)( + auto ref const O obj, + ) { + string[string] obj_txt = [ + "text": generic_munge_sanitize_text_for_search(obj.text), + "html": html_table(obj) + ]; + if (doc_matters.opt.action.debug_do) { + 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 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_note VARCHAR(2500) 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, + publisher VARCHAR(600) 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, + original_title VARCHAR(800) 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, + 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 */ + src_text TEXT NULL, + fulltext TEXT NULL, + links TEXT 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, + ocnd VARCHAR(6), + ocns VARCHAR(6), + clean TEXT NULL, + body TEXT NULL, + seg VARCHAR(256) NULL, + lev_an VARCHAR(1), + lev SMALLINT NULL, + is_of_type VARCHAR(16), + is_a VARCHAR(16), + node VARCHAR(16) NULL, + parent VARCHAR(16) NULL, + last_decendant VARCHAR(16) NULL, /* headings only */ + digest_clean CHAR(256), + digest_all 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(I)( + I 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(I)( + I 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, + classify_dewey, + classify_keywords, + classify_loc, + classify_subject, + classify_topic_register, + creator_author, + creator_author_email, + creator_illustrator, + creator_translator, + date_added_to_site, + date_available, + date_created, + date_issued, + date_modified, + date_published, + date_valid, + identifier_isbn, + identifier_oclc, + language_document, + language_document_char, + notes_abstract, + notes_description, + original_publisher, + original_language, + original_language_char, + original_source, + original_title, + publisher, + 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 + ) + 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' + ); + ¶", + _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.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.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.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.identifier_isbn), + SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.identifier_oclc), + 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.notes_abstract), + SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.notes_description), + 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.original_title), + SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.publisher), + 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) + ); + return _insert_metadata; + } +} +template SQLiteInsertDocObjectsLoop() { + string SQLiteInsertDocObjectsLoop(D,I)( + D doc_abstraction, + I doc_matters, + ) { + string _uid = SQLinsertDelimiter!()(doc_matters.src.doc_uid); + string insertDocObjectsRow(O)(O obj) { + string _insert_doc_objects_row = format(q"¶ + INSERT INTO doc_objects ( + uid_metadata_and_text, + ocn, + clean, + body, + lev, + is_of_type, + is_a + ) + VALUES ( + '%s', + %s, + '%s', + '%s', + %s, + '%s', + '%s' + ); + ¶", + _uid, + obj.metainfo.ocn, + SQLinsertDelimiter!()(obj_txt["text"]), + SQLinsertDelimiter!()(obj_txt["html"]), + obj.metainfo.heading_lev_markup, + obj.metainfo.is_of_type, + obj.metainfo.is_a, + ); + 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.xml.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(obj); + break; + default: + if ((doc_matters.opt.action.debug_do)) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + break; + } + break; + default: + if ((doc_matters.opt.action.debug_do)) { + 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(obj); + break; + case "para": + obj_txt = format_and_sqlite_load.para(obj); + break; + default: + if ((doc_matters.opt.action.debug_do)) { + 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(obj); + break; + case "group": + obj_txt = format_and_sqlite_load.group(obj); + break; + case "block": + obj_txt = format_and_sqlite_load.block(obj); + break; + case "poem": // double check on keeping both poem & verse + break; + case "verse": + obj_txt = format_and_sqlite_load.verse(obj); + break; + case "code": + obj_txt = format_and_sqlite_load.code(obj); + break; + case "table": + obj_txt = format_and_sqlite_load.table(obj); + break; + default: + if ((doc_matters.opt.action.debug_do)) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + break; + } + break; + default: + if ((doc_matters.opt.action.debug_do)) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } + break; + } + break; + case "backmatter": + assert(part == "glossary" || "bibliography" || "bookindex_seg" || "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(obj); + break; + case "glossary": assert(part == "glossary", part); + obj_txt = format_and_sqlite_load.para(obj); + break; + case "bibliography": assert(part == "bibliography", part); + obj_txt = format_and_sqlite_load.para(obj); + break; + case "bookindex": assert(part == "bookindex_seg", part); + obj_txt = format_and_sqlite_load.para(obj); + break; + case "blurb": assert(part == "blurb", part); + obj_txt = format_and_sqlite_load.para(obj); + break; + default: + if ((doc_matters.opt.action.debug_do)) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + break; + } + break; + default: + if ((doc_matters.opt.action.debug_do)) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } + break; + } + break; + case "comment": + break; + default: + if ((doc_matters.opt.action.debug_do)) { + 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 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_note VARCHAR(2500) 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, + publisher VARCHAR(600) 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, + original_title VARCHAR(800) 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, + 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 */ + src_text TEXT NULL, + fulltext TEXT NULL, + links TEXT 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, + ocnd VARCHAR(6), + ocns VARCHAR(6), + clean TEXT NULL, + body TEXT NULL, + seg VARCHAR(256) NULL, + lev_an VARCHAR(1), + lev SMALLINT NULL, + is_of_type VARCHAR(16), + is_a VARCHAR(16), + node VARCHAR(16) NULL, + parent VARCHAR(16) NULL, + last_decendant VARCHAR(16) NULL, /* headings only */ + digest_clean CHAR(256), + digest_all 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 = SiSUpathsSQLite!()(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 = SiSUpathsSQLite!()(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/output/xmls.d b/src/doc_reform/output/xmls.d new file mode 100644 index 0000000..8428204 --- /dev/null +++ b/src/doc_reform/output/xmls.d @@ -0,0 +1,1036 @@ +module doc_reform.output.xmls; +template outputXHTMLs() { + import doc_reform.output; + import + std.digest.sha, + std.file, + std.outbuffer, + std.zip, + std.conv : to; + import + doc_reform.output.create_zip_file, + doc_reform.output.xmls, + doc_reform.output.xmls_css; + mixin SiSUoutputRgxInit; + 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_seg": + delimit_ ~= "\n<div class=\"doc_toc\">\n" ; + break; + case "toc_scroll": + delimit_ ~= "\n<div class=\"doc_toc\">\n" ; + break; + case "bookindex_seg": + delimit_ ~= "\n<div class=\"doc_bookindex\">\n" ; + break; + case "bookindex_scroll": + 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(O)( + const O obj, + 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, " "); + if (!(obj.metainfo.is_a == "code")) { + _txt = (_txt) + .replaceAll(rgx.xhtml_line_break, "<br />"); + } + return _txt; + } + 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 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(const(string[]) anchor_tags) { + string tags=""; + if (anchor_tags.length > 0) { + foreach (tag; anchor_tags) { + if (!(tag.empty)) { + tags ~= "<a name=\"" ~ tag ~ "\"></a>"; + } + } + } + return tags; + } + auto header_metadata(M)( + M doc_matters, + ) { + string _title="Title"; + string _author="Author"; + string _publisher="Publisher"; + string _date="Date"; + string _date_created="Date"; + string _date_issued="Date"; + string _date_available="Date"; + string _date_valid="Date"; + string _date_modified="Date"; + string _language="en"; + string _rights="Copyright: Copyright (C) year holder"; + string _generator="doc_reform [SiSU 7.1.8 of 2016w08/5 (2016-02-26)] (n*x and D)"; + string _generator_home="http://www.sisudoc.org"; + string o; + o = format(q"¶<!-- SiSU 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" /> + <!-- SiSU header metadata -->¶", + _title, + _author, + _publisher, + _date, + _date_created, + _date_issued, + _date_available, + _date_valid, + _date_modified, + _language, + _rights, + _generator, + _generator_home, + ); + return o; + } + auto 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.sisudoc.org\">SiSU</a></p>\n<p class=\"tiny_left\"><a href=\"http://www.sisudoc.org\">www.sisudoc.org</a></p>\n<p class=\"tiny_left\"><a href=\"http://git.sisudoc.org/gitweb/\">sources / git</a></p>"; + } + string o; + o = format(q"¶<div class="flex-menu-option"> + %s + </div>¶", + _locations, + ); + return o; + } + auto inline_search_form(M)( + M doc_matters, + ) { + string _action="http://www.sisudoc.org/cgi-bin/search.cgi"; + string _db="SiSU.7a.manual"; + string o; + o = format(q"¶<div class="flex-menu-option"> + <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> + </div>¶", + _action, + _db, + ); + return o; + } + auto html_head(M)( + M doc_matters, + string type, + ) { + 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"> + <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> + </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), + inline_search_form(doc_matters), + ((type == "seg") ? "" : "\n</div>"), + ); + return o; + } + auto 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="SiSU http://www.jus.uio.no/sisu (this copy)" /> + <meta name="dc.date" content="year" /> + <meta name="dc.date.created" content="year" /> + <meta name="dc.date.issued" content="year" /> + <meta name="dc.date.available" content="year" /> + <meta name="dc.date.valid" content="year" /> + <meta name="dc.date.modified" content="year" /> + <meta name="dc.language" content="US" /> + <meta name="dc.rights" content="Copyright: Copyright (C) year holder" /> + <meta name="generator" content="doc_reform [SiSU 7.1.8 of 2016w08/5 (2016-02-26)] (n*x and D)" /> + <link rel="generator" href="http://www.sisudoc.org/" /> + <link rel="shortcut icon" href="../_sisu/image/rb7.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.src.language, + ); + return o; + } + auto tail() { + string o; + o = format(q"¶ </div> + <a name="bottom" id="bottom"></a> + <a name="end" id="end"></a> + </body> + </html>¶"); + return o; + } + auto inline_images(O)( + 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( + rgx.inline_image, + ("$1<img src=\"" + ~ _img_pth + ~ "$3\" width=\"$4\" height=\"$5\" naturalsizeflag=\"0\" align=\"bottom\" border=\"0\" /> $6")); + } + return _txt; + } + auto inline_links(O)( + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "seg", + ) { + if (obj.has.inline_links) { + 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"); + } + _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; + } + auto inline_notes_scroll(O)( + const O obj, + string _txt, + ) { + if (obj.has.inline_notes_reg) { + _txt = font_face(_txt); + _txt = (_txt).replaceAll( + rgx.inline_notes_delimiter_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_delimiter_al_regular_number_note)) { + writeln(__LINE__, " (missed) markup endnote: ", obj.metainfo.is_a, ": ", obj.text); + } + } + debug(markup) { + if (_txt.match(rgx.inline_notes_delimiter_al_regular_number_note)) { + writeln(__LINE__, " (missed) markup endnote: ", obj.metainfo.is_a, ": ", obj.text); + } + } + return _txt; + } + auto inline_notes_seg(O)( + const O obj, + string _txt, + ) { + string[] _endnotes; + if (obj.has.inline_notes_reg) { + _txt = font_face(_txt); + /+ need markup for text, and separated footnote +/ + foreach(m; _txt.matchAll(rgx.inline_notes_delimiter_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_delimiter_al_regular_number_note, + ("<a href=\"#note_$1\"><note id=\"noteref_$1\"> <sup>$1</sup> </note></a>") + ); + } else if (_txt.match(rgx.inline_notes_delimiter_al_regular_number_note)) { + debug(markup) { + writeln(__LINE__, " endnote: ", obj.metainfo.is_a, ": ", obj.text); + } + } + auto t = tuple( + _txt, + _endnotes, + ); + return t; + } + auto inline_markup_scroll(O)( + const O obj, + string _txt, + string _suffix = ".html", + ) { + _txt = inline_images(obj, _txt, _suffix, "scroll"); + _txt = inline_links(obj, _txt, _suffix, "scroll"); + _txt = inline_notes_scroll(obj, _txt); + return _txt; + } + auto inline_markup_seg(O)( + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "seg", + ) { + _txt = inline_images(obj, _txt, _suffix, _xml_type); + _txt = inline_links(obj, _txt, _suffix, _xml_type); + auto t = inline_notes_seg(obj, _txt); + return t; + } + string lev4_heading_subtoc(O)( + const O obj, + ) { + 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!string; + 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)( + const O obj, + ) { + string prev, next, toc; + if (obj.tags.segment_anchor_tag == "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(); + } + auto heading(O)( + const O obj, + string _txt, + string _xml_type = "html", + ) { + auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags); + 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; + if (obj.metainfo.object_number.empty) { + o = format(q"¶%s + <div class="substance"> + <h%s class="%s">%s + %s + </h%s> + </div>¶", + _horizontal_rule, + obj.metainfo.heading_lev_markup, + obj.metainfo.is_a, + tags, + _txt, + obj.metainfo.heading_lev_markup, + ); + } else { + 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 + </h%s> + </div>¶", + _horizontal_rule, + obj.metainfo.object_number, + obj.metainfo.object_number, + obj.metainfo.heading_lev_markup, + obj.metainfo.is_a, + obj.metainfo.object_number, + obj.metainfo.object_number, + tags, + _txt, + obj.metainfo.heading_lev_markup, + ); + } + return o; + } + auto heading_scroll(O)( + const O obj, + string _txt, + string _suffix = ".html", + ) { + auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags); + _txt = inline_markup_scroll(obj, _txt, _suffix); + string o = heading(obj, _txt); + return o; + } + auto heading_seg(O)( + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "html", + ) { + auto t = inline_markup_seg(obj, _txt, _suffix, _xml_type); + _txt = t[0]; + string[] _endnotes = t[1]; + string o = heading(obj, _txt, _xml_type); + auto u = tuple( + o, + _endnotes, + ); + return u; + } + auto para(O)( + const O obj, + string _txt, + ) { + auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags); + _txt = font_face(_txt); + string o; + _txt = (obj.attrib.bullet) ? ("●  " ~ _txt) : _txt; + if (obj.metainfo.object_number.empty) { + 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 + ); + } else { + 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.object_number, + obj.metainfo.object_number, + obj.metainfo.is_a, + obj.attrib.indent_hang, + obj.attrib.indent_base, + obj.metainfo.object_number, + tags, + _txt + ); + } + return o; + } + auto para_scroll(O)( + const O obj, + string _txt, + string _suffix = ".html", + ) { + auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags); + _txt = inline_markup_scroll(obj, _txt, _suffix); + string o = para(obj, _txt); + return o; + } + auto para_seg(O)( + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "html", + ) { + auto t = inline_markup_seg(obj, _txt, _suffix, _xml_type); + _txt = t[0].to!string; + string[] _endnotes = t[1]; + string o = para(obj, _txt); + auto u = tuple( + o, + _endnotes, + ); + return u; + } + auto quote(O)( + const O obj, + string _txt, + ) { + _txt = font_face(_txt); + string o; + if (obj.metainfo.object_number.empty) { + o = format(q"¶ <div class="substance"> + <p class="%s"> + %s + </p> + </div>¶", + obj.metainfo.is_a, + _txt + ); + } else { + 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.object_number, + obj.metainfo.object_number, + obj.metainfo.is_a, + obj.metainfo.object_number, + _txt + ); + } + return o; + } + auto quote_scroll(O)( + const O obj, + string _txt, + string _suffix = ".html", + ) { + auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags); + _txt = inline_markup_scroll(obj, _txt, _suffix); + string o = quote(obj, _txt); + return o; + } + auto quote_seg(O)( + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "html", + ) { + auto t = inline_markup_seg(obj, _txt, _suffix, _xml_type); + _txt = t[0].to!string; + string[] _endnotes = t[1]; + string o = quote(obj, _txt); + auto u = tuple( + o, + _endnotes, + ); + return u; + } + auto group(O)( + const O obj, + string _txt, + ) { + _txt = font_face(_txt); + string o; + if (obj.metainfo.object_number.empty) { + o = format(q"¶ <div class="substance"> + <p class="%s"> + %s + </p> + </div>¶", + obj.metainfo.is_a, + _txt + ); + } else { + 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.object_number, + obj.metainfo.object_number, + obj.metainfo.is_a, + obj.metainfo.object_number, + _txt + ); + } + return o; + } + auto group_scroll(O)( + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "html", + ) { + auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags); + _txt = inline_markup_scroll(obj, _txt, _suffix); + string o = group(obj, _txt); + return o; + } + auto group_seg(O)( + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "html", + ) { + auto t = inline_markup_seg(obj, _txt, _suffix, _xml_type); + _txt = t[0].to!string; + string[] _endnotes = t[1]; + string o = group(obj, _txt); + auto u = tuple( + o, + _endnotes, + ); + return u; + } + auto block(O)( + const O obj, + string _txt, + ) { + _txt = font_face(_txt); + string o; + if (obj.metainfo.object_number.empty) { + o = format(q"¶ <div class="substance"> + <p class="%s">%s</p> + </div>¶", + obj.metainfo.is_a, + _txt.stripRight + ); + } else { + 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.object_number, + obj.metainfo.object_number, + obj.metainfo.is_a, + obj.metainfo.object_number, + _txt.stripRight + ); + } + return o; + } + auto block_scroll(O)( + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "html", + ) { + auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags); + _txt = inline_markup_scroll(obj, _txt, _suffix); + string o = block(obj, _txt); + return o; + } + auto block_seg(O)( + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "html", + ) { + auto t = inline_markup_seg(obj, _txt, _suffix, _xml_type); + _txt = t[0].to!string; + string[] _endnotes = t[1]; + string o = block(obj, _txt); + auto u = tuple( + o, + _endnotes, + ); + return u; + } + auto verse(O)( + const O obj, + string _txt, + ) { + _txt = font_face(_txt); + string o; + if (obj.metainfo.object_number.empty) { + o = format(q"¶ <div class="substance"> + <p class="%s">%s</p> + </div>¶", + obj.metainfo.is_a, + _txt + ); + } else { + 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.object_number, + obj.metainfo.object_number, + obj.metainfo.is_a, + obj.metainfo.object_number, + _txt + ); + } + return o; + } + auto verse_scroll(O)( + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "html", + ) { + auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags); + _txt = inline_markup_scroll(obj, _txt, _suffix); + string o = verse(obj, _txt); + return o; + } + auto verse_seg(O)( + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "html", + ) { + auto t = inline_markup_seg(obj, _txt, _suffix, _xml_type); + _txt = t[0].to!string; + string[] _endnotes = t[1]; + string o = verse(obj, _txt); + auto u = tuple( + o, + _endnotes, + ); + return u; + } + 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)) { + _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; + } + auto table(O)( + const O obj, + string _txt, + ) { + auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags); + _txt = font_face(_txt); + auto t = tablarize(obj, _txt); + _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, + obj.metainfo.object_number, + obj.metainfo.is_a, + obj.metainfo.object_number, + tags, + _txt, + _note + ); + return o; + } + auto endnote(O)( + const O obj, + string _txt, + ) { + string o; + 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; + } + auto code(O)( + const O obj, + string _txt, + ) { + string o; + if (obj.metainfo.object_number.empty) { + o = format(q"¶ <div class="substance"> + <p class="%s">%s</p> + </div>¶", + obj.metainfo.is_a, + _txt + ); + } else { + 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.object_number, + obj.metainfo.object_number, + obj.metainfo.is_a, + obj.metainfo.object_number, + _txt + ); + } + return o; + } + } +} diff --git a/src/doc_reform/output/xmls_css.d b/src/doc_reform/output/xmls_css.d new file mode 100644 index 0000000..f3c0545 --- /dev/null +++ b/src/doc_reform/output/xmls_css.d @@ -0,0 +1,2871 @@ +/++ + default css settings ++/ +module doc_reform.output.xmls_css; +template SiSUcss() { + auto SiSUcss() { + string _css_html_seg=" + *{ + padding: 0px; + margin: 0px; + } + body { + height: 100vh; + background-color: #ffffff; + } + body { + color: black; + 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: #777777; + text-decoration: none; + } + 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: #fffffff; + } + 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-top: 1.8em; + margin-bottom: 1.8em; + } + span.currentlink { + text-decoration: none; + background-color: #aaaaf9; + } + 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-left: 0em; + margin-right: 2em; + margin-top: 12px; + margin-bottom: 0px; + padding-left: 0em; + text-indent: 0em; + } + p, h0, h1, h2, h3, h4, h5, h6, h7 { + display: block; + font-family: verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman; + font-size: 100%; + font-weight: normal; + line-height: 133%; + text-align: justify; + margin-left: 0em; + margin-right: 2em; + text-indent: 0mm; + margin-top: 0.8em; + margin-bottom: 0.8em; + } + img { max-width: 100%; height: auto; } + /* spaced */ + p.spaced { white-space: pre; } + p.block { + white-space: pre; + } + p.group { } + p.alt { } + p.verse { + white-space: pre; + margin-bottom: 6px; + } + p.code { + font-family: inconsolata, andale mono, courier new, courier, monospace; + font-size: 90%; + text-align: left; + background-color: #eeeeee; + white-space: pre; + margin-top: 0px; + margin-bottom: 0px; + } + 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, andale mono, courier new, courier, monospace; + background-color: #eeeeee; + } + /* 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; + } + note { white-space: pre; } + label.ocn { + width: 2%; + float: right; + top: 0; + font-size: 10px; + margin-top: 0px; + margin-bottom: 5px; + color: #777777; + margin-right: 5px; + text-align: right; + background-color: #ffffff; + } + table { } + 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; + display: block; + font-family: verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman; + 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 gray; } + 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; + } + .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; + } + .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; } + /* flex */ + .flex-menu-bar { + display: -webkit-flex; + display: flex; + -webkit-flex-wrap: wrap; + -webkit-align-items: center; + align-items: center; + width: 100%; + background-color: #ffffff; + } + .flex-menu-option { + background-color: white; + margin: 8px; + } + .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: white; + 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: white; + 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: white; + } + footer { + background-color: #00704e; + } +"; + string _css_html_scroll=" + *{ + padding: 0px; + margin: 0px; + } + body { + height: 100vh; + background-color: #ffffff; + } + body { + color: black; + 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: #777777; + text-decoration: none; + } + 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: #fffffff; + } + 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-top: 1.8em; + margin-bottom: 1.8em; + } + span.currentlink { + text-decoration: none; + background-color: #aaaaf9; + } + 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-left: 0em; + margin-right: 2em; + margin-top: 12px; + margin-bottom: 0px; + padding-left: 0em; + text-indent: 0em; + } + p, h0, h1, h2, h3, h4, h5, h6, h7 { + display: block; + font-family: verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman; + font-size: 100%; + font-weight: normal; + line-height: 133%; + text-align: justify; + margin-left: 0em; + margin-right: 2em; + text-indent: 0mm; + margin-top: 0.8em; + margin-bottom: 0.8em; + } + img { max-width: 100%; height: auto; } + /* spaced */ + p.spaced { white-space: pre; } + p.block { + white-space: pre; + } + p.group { } + p.alt { } + p.verse { + white-space: pre; + margin-bottom: 6px; + } + p.code { + font-family: inconsolata, andale mono, courier new, courier, monospace; + font-size: 90%; + text-align: left; + background-color: #eeeeee; + white-space: pre; + margin-top: 0px; + margin-bottom: 0px; + } + 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, andale mono, courier new, courier, monospace; + background-color: #eeeeee; + } + /* 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; + } + note { white-space: pre; } + label.ocn { + width: 2%; + float: right; + top: 0; + font-size: 10px; + margin-top: 0px; + margin-bottom: 5px; + color: #777777; + margin-right: 5px; + text-align: right; + background-color: #ffffff; + } + table { } + 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; + display: block; + font-family: verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman; + 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 gray; } + 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%; + background-color: #ffffff; + } + .flex-menu-option { + background-color: white; + margin: 8px; + } + .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: white; + 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: white; + 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: white; + } + footer { + background-color: #00704e; + } +"; + string _css_epub=" + *{ + padding: 0px; + margin: 0px; + } + body { + height: 100vh; + background-color: #ffffff; + } + body { + color: black; + 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: #777777; + text-decoration: none; + } + 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: #fffffff; + } + 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-top: 1.8em; + margin-bottom: 1.8em; + } + span.currentlink { + text-decoration: none; + background-color: #aaaaf9; + } + 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-left: 0em; + margin-right: 2em; + margin-top: 12px; + margin-bottom: 0px; + padding-left: 0em; + text-indent: 0em; + } + p, h0, h1, h2, h3, h4, h5, h6, h7 { + display: block; + font-family: verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman; + font-size: 100%; + font-weight: normal; + line-height: 133%; + text-align: justify; + margin-left: 0em; + margin-right: 2em; + text-indent: 0mm; + margin-top: 0.8em; + margin-bottom: 0.8em; + } + img { max-width: 100%; height: auto; } + /* spaced */ + p.spaced { white-space: pre; } + p.block { + white-space: pre; + } + p.group { } + p.alt { } + p.verse { + white-space: pre; + margin-bottom: 6px; + } + p.code { + font-family: inconsolata, andale mono, courier new, courier, monospace; + font-size: 90%; + text-align: left; + background-color: #eeeeee; + white-space: pre; + margin-top: 0px; + margin-bottom: 0px; + } + 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, andale mono, courier new, courier, monospace; + background-color: #eeeeee; + } + /* 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; + } + note { white-space: pre; } + label.ocn { + width: 2%; + float: right; + top: 0; + font-size: 10px; + margin-top: 0px; + margin-bottom: 5px; + color: #777777; + margin-right: 5px; + text-align: right; + background-color: #ffffff; + } + table { } + 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; + display: block; + font-family: verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman; + 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 gray; } + 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; + } + +"; + struct _css { + auto html_seg_css() { + string _css = "/* SiSU css html seg stylesheet */\n" ~ _css_html_seg; + return _css; + } + auto html_scroll_css() { + string _css = "/* SiSU css html scroll stylesheet */\n" ~ _css_html_scroll; + return _css; + } + auto epub_css() { + string _css = "/* SiSU css epub stylesheet */\n" ~ _css_epub; + return _css; + } + } + return _css(); + } +} |