From 2cdc5d2a7c62e54009e915d6f6a9da87905e2699 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 29 Aug 2021 19:06:01 -0400 Subject: xmls, epub3 toc_nav.xhtml toc.ncx --- org/config_nix.org | 17 + org/default_paths.org | 4 +- org/metaverse.org | 11 +- org/out_xmls.org | 1923 +++++++++++++++++++++++++------------------------ 4 files changed, 1018 insertions(+), 937 deletions(-) (limited to 'org') diff --git a/org/config_nix.org b/org/config_nix.org index 3e63e9d..2268ac6 100644 --- a/org/config_nix.org +++ b/org/config_nix.org @@ -504,6 +504,7 @@ pkgs.mkShell { <> <> # <> + # <> ] )]; shellHook = '' @@ -546,6 +547,22 @@ ldc sqlite #+END_SRC +***** packages xml epub related + +#+NAME: shell_packages_xml_and_epub_related +#+BEGIN_SRC nix +# xml_and_epub_related +libxml2 +html-tidy +xmlstarlet +epubcheck +ebook_tools +epr +sigil +calibre # (ebook-viewer) +foliate +#+END_SRC + **** misc #+HEADER: :NO-tangle ../shell.nix diff --git a/org/default_paths.org b/org/default_paths.org index 2bf0d14..376201f 100644 --- a/org/default_paths.org +++ b/org/default_paths.org @@ -290,7 +290,7 @@ template PathMatters() { /+ z pod name if any + src filename (without lng code) filename ~ mkup.uid_sep ~ lng - * unique per src pod + ,* unique per src pod used by - pod (multilingual collection) - sqlite discrete index (multilingual collection) @@ -1423,7 +1423,7 @@ template spinePathsEPUB() { 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; + return dbg_doc_oebps(fn_src).chainPath("Styles").array; } string dbg_doc_oebps_image(string fn_src) { return dbg_doc_oebps(fn_src).chainPath("image").array; diff --git a/org/metaverse.org b/org/metaverse.org index 94b5690..0118542 100644 --- a/org/metaverse.org +++ b/org/metaverse.org @@ -715,6 +715,9 @@ scope(exit) { reset_note_numbers = true; lev_anchor_tag = ""; anchor_tag = ""; + // dom_structure_collapsed_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; + // dom_structure_markedup_tags_status_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; + // dom_structure_collapsed_tags_status_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; } #+END_SRC @@ -3236,10 +3239,10 @@ obj_cite_digit_ = 0; html_segnames_ptr = 0; html_segnames_ptr_cntr = 0; content_non_header = "8"; -dom_structure_markedup_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; -dom_structure_markedup_tags_status_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; -dom_structure_collapsed_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; -dom_structure_collapsed_tags_status_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; +dom_structure_markedup_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0,]; +dom_structure_markedup_tags_status_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0,]; +dom_structure_collapsed_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0,]; +dom_structure_collapsed_tags_status_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0,]; lev_anchor_tag = ""; anchor_tag = ""; #+END_SRC diff --git a/org/out_xmls.org b/org/out_xmls.org index 1158ff7..1379276 100644 --- a/org/out_xmls.org +++ b/org/out_xmls.org @@ -32,45 +32,45 @@ template outputXHTMLs() { mixin spineRgxOut; struct outputXHTMLs { static auto rgx = RgxO(); - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> <> } } @@ -113,7 +113,7 @@ import *** misc **** div delimiter -#+NAME: xhtml_format_objects_0 +#+NAME: xhtml_format_objects_div_delimit #+BEGIN_SRC d @safe string div_delimit( string part, @@ -149,14 +149,14 @@ import **** special characters text -#+NAME: xhtml_format_objects_1 +#+NAME: xhtml_format_objects_special_characters_text #+BEGIN_SRC d @safe 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.xhtml_ampersand, "&") // "&" + .replaceAll(rgx.xhtml_quotation, """) // """ + .replaceAll(rgx.xhtml_less_than, "<") // "<" + .replaceAll(rgx.xhtml_greater_than, ">") // ">" .replaceAll(rgx.nbsp_char, " "); return _txt; } @@ -164,7 +164,7 @@ import **** special characters -#+NAME: xhtml_format_objects_2 +#+NAME: xhtml_format_objects_special_characters #+BEGIN_SRC d @safe string special_characters(O)( const O obj, @@ -180,7 +180,7 @@ import **** font_face -#+NAME: xhtml_format_objects_3 +#+NAME: xhtml_format_objects_font_face #+BEGIN_SRC d @safe string font_face(string _txt) { _txt = _txt @@ -200,14 +200,14 @@ import **** anchor tags -#+NAME: xhtml_format_objects_4 +#+NAME: xhtml_format_objects_xml_anchor_tags #+BEGIN_SRC d @safe string _xhtml_anchor_tags(O)(O obj) { string tags=""; if (obj.tags.anchor_tags.length > 0) { foreach (tag; obj.tags.anchor_tags) { if (!(tag.empty)) { - tags ~= ""; + tags ~= ""; } } } @@ -218,7 +218,7 @@ import **** doc head & tails ***** metadata -#+NAME: xhtml_format_objects_5 +#+NAME: xhtml_format_objects_header_metadata #+BEGIN_SRC d @safe string header_metadata(M)( M doc_matters, @@ -241,19 +241,19 @@ import ┃", - doc_matters.conf_make_meta.meta.title_full.replaceAll(regex("\""), """), - doc_matters.conf_make_meta.meta.creator_author, + special_characters_text(doc_matters.conf_make_meta.meta.title_full), + special_characters_text(doc_matters.conf_make_meta.meta.creator_author), _publisher, - doc_matters.conf_make_meta.meta.date_published, - doc_matters.conf_make_meta.meta.date_created, - doc_matters.conf_make_meta.meta.date_issued, - doc_matters.conf_make_meta.meta.date_available, - doc_matters.conf_make_meta.meta.date_valid, - doc_matters.conf_make_meta.meta.date_modified, + special_characters_text(doc_matters.conf_make_meta.meta.date_published), + special_characters_text(doc_matters.conf_make_meta.meta.date_created), + special_characters_text(doc_matters.conf_make_meta.meta.date_issued), + special_characters_text(doc_matters.conf_make_meta.meta.date_available), + special_characters_text(doc_matters.conf_make_meta.meta.date_valid), + special_characters_text(doc_matters.conf_make_meta.meta.date_modified), doc_matters.src.language, - doc_matters.conf_make_meta.meta.rights_copyright, - doc_matters.opt.action.debug_do ? "" : doc_matters.generator_program.name_and_version, - doc_matters.generator_program.url_home, + special_characters_text(doc_matters.conf_make_meta.meta.rights_copyright), + doc_matters.opt.action.debug_do ? "" : special_characters_text(doc_matters.generator_program.name_and_version), + special_characters_text(doc_matters.generator_program.url_home), ); return o; } @@ -261,7 +261,7 @@ import ***** site info button -#+NAME: xhtml_format_objects_6 +#+NAME: xhtml_format_objects_site_info_button #+BEGIN_SRC d @safe string site_info_button(M)( M doc_matters, @@ -291,7 +291,7 @@ import ***** search form -#+NAME: xhtml_format_objects_7 +#+NAME: xhtml_format_objects_inline_search_form #+BEGIN_SRC d @safe string inline_search_form(M)( M doc_matters, @@ -330,7 +330,7 @@ import ***** html head & head banner -#+NAME: xhtml_format_objects_8 +#+NAME: xhtml_format_objects_html_head #+BEGIN_SRC d @safe string html_head(M)( M doc_matters, @@ -367,9 +367,9 @@ import
%s
%s%s┃", - doc_matters.conf_make_meta.meta.title_full, + special_characters_text(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, + : ", " ~ special_characters_text(doc_matters.conf_make_meta.meta.creator_author), header_metadata(doc_matters), ((type == "seg") ? "../" : ""), ((type == "seg") @@ -387,7 +387,7 @@ import ***** epub seg head -#+NAME: xhtml_format_objects_9 +#+NAME: xhtml_format_objects_epub3_seg_head #+BEGIN_SRC d @safe string epub3_seg_head(M)( M doc_matters, @@ -437,22 +437,22 @@ import ┃", html_simple, - doc_matters.conf_make_meta.meta.title_full.replaceAll(regex("\""), """), + special_characters_text(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, + : ", " ~ special_characters_text(doc_matters.conf_make_meta.meta.creator_author), + special_characters_text(doc_matters.conf_make_meta.meta.title_full), (doc_matters.conf_make_meta.meta.creator_author.empty) ? "" - : ", " ~ doc_matters.conf_make_meta.meta.creator_author, - doc_matters.conf_make_meta.meta.date_published, - doc_matters.conf_make_meta.meta.date_created, - doc_matters.conf_make_meta.meta.date_issued, - doc_matters.conf_make_meta.meta.date_available, - doc_matters.conf_make_meta.meta.date_valid, - doc_matters.conf_make_meta.meta.date_modified, + : ", " ~ special_characters_text(doc_matters.conf_make_meta.meta.creator_author), + special_characters_text(doc_matters.conf_make_meta.meta.date_published), + special_characters_text(doc_matters.conf_make_meta.meta.date_created), + special_characters_text(doc_matters.conf_make_meta.meta.date_issued), + special_characters_text(doc_matters.conf_make_meta.meta.date_available), + special_characters_text(doc_matters.conf_make_meta.meta.date_valid), + special_characters_text(doc_matters.conf_make_meta.meta.date_modified), doc_matters.src.language, - doc_matters.conf_make_meta.meta.rights_copyright, - doc_matters.generator_program.name_and_version, - doc_matters.generator_program.url_home, + special_characters_text(doc_matters.conf_make_meta.meta.rights_copyright), + special_characters_text(doc_matters.generator_program.name_and_version), + special_characters_text(doc_matters.generator_program.url_home), doc_matters.src.language, ); return o; @@ -461,7 +461,7 @@ import ***** xhtml tail -#+NAME: xhtml_format_objects_10 +#+NAME: xhtml_format_objects_tail #+BEGIN_SRC d @safe string tail() { string o; @@ -477,7 +477,7 @@ import *** inline markup **** images -#+NAME: xhtml_format_objects_11 +#+NAME: xhtml_format_objects_inline_images #+BEGIN_SRC d @safe string inline_images(O,M)( string _txt, @@ -510,7 +510,7 @@ import **** links ***** scroll, seg, epub -#+NAME: xhtml_format_objects_12 +#+NAME: xhtml_format_objects_inline_links #+BEGIN_SRC d @safe string inline_links(O,M)( string _txt, @@ -608,7 +608,7 @@ import **** notes ***** scroll -#+NAME: xhtml_format_objects_13 +#+NAME: xhtml_format_objects_inline_notes_scroll #+BEGIN_SRC d @safe string inline_notes_scroll(O,M)( string _txt, @@ -645,7 +645,7 @@ import ***** seg -#+NAME: xhtml_format_objects_14 +#+NAME: xhtml_format_objects_inline_notes_seg #+BEGIN_SRC d @safe Tuple!(string, string[]) inline_notes_seg(O,M)( string _txt, @@ -716,7 +716,7 @@ import **** inline markup ***** scroll -#+NAME: xhtml_format_objects_15 +#+NAME: xhtml_format_objects_inline_markup_scroll #+BEGIN_SRC d @safe string inline_markup_scroll(O,M)( string _txt, @@ -738,9 +738,9 @@ import ***** seg -#+NAME: xhtml_format_objects_16 +#+NAME: xhtml_format_objects_inline_markup_seg #+BEGIN_SRC d -@safe auto inline_markup_seg(O,M)( +@safe Tuple!(string, string[]) inline_markup_seg(O,M)( string _txt, const O obj, M doc_matters, @@ -765,7 +765,7 @@ import *** toc **** subtoc -#+NAME: xhtml_format_objects_17 +#+NAME: xhtml_format_objects_lev4_heading_subtoc #+BEGIN_SRC d @safe string lev4_heading_subtoc(O,M)( const O obj, @@ -798,7 +798,7 @@ import **** navigation pre next svg -#+NAME: xhtml_format_objects_18 +#+NAME: xhtml_format_objects_nav_pre_next_svg #+BEGIN_SRC d @safe auto nav_pre_next_svg(O,M)( const O obj, @@ -879,7 +879,7 @@ import *** heading **** heading -#+NAME: xhtml_format_objects_19 +#+NAME: xhtml_format_objects_heading #+BEGIN_SRC d @safe string heading(O,M)( string _txt, @@ -952,7 +952,7 @@ import **** scroll -#+NAME: xhtml_format_objects_20 +#+NAME: xhtml_format_objects_heading_scroll #+BEGIN_SRC d @safe string heading_scroll(O,M)( string _txt, @@ -968,7 +968,7 @@ import **** seg -#+NAME: xhtml_format_objects_21 +#+NAME: xhtml_format_objects_heading_seg #+BEGIN_SRC d @safe Tuple!(string, string[]) heading_seg(O,M)( string _txt, @@ -977,7 +977,7 @@ import string _suffix = ".html", string _xml_type = "html", ) { - auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); + Tuple!(string, string[]) t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0]; string[] _endnotes = t[1]; string o = heading(_txt, obj, doc_matters, _xml_type); @@ -992,7 +992,7 @@ import *** para **** para -#+NAME: xhtml_format_objects_22 +#+NAME: xhtml_format_objects_para #+BEGIN_SRC d @safe string para(O,M)( string _txt, @@ -1048,7 +1048,7 @@ import **** scroll -#+NAME: xhtml_format_objects_23 +#+NAME: xhtml_format_objects_para_scroll #+BEGIN_SRC d @safe string para_scroll(O,M)( string _txt, @@ -1067,7 +1067,7 @@ import **** seg -#+NAME: xhtml_format_objects_24 +#+NAME: xhtml_format_objects_para_seg #+BEGIN_SRC d @safe Tuple!(string, string[]) para_seg(O,M)( string _txt, @@ -1076,7 +1076,7 @@ import string _suffix = ".html", string _xml_type = "html", ) { - auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); + Tuple!(string, string[]) t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; string o = para(_txt, obj, doc_matters); @@ -1091,7 +1091,7 @@ import *** quote **** quote -#+NAME: xhtml_format_objects_25 +#+NAME: xhtml_format_objects_quote #+BEGIN_SRC d @safe string quote(O,M)( string _txt, @@ -1133,7 +1133,7 @@ import **** scroll -#+NAME: xhtml_format_objects_26 +#+NAME: xhtml_format_objects_quote_scroll #+BEGIN_SRC d @safe string quote_scroll(O,M)( string _txt, @@ -1149,7 +1149,7 @@ import **** seg -#+NAME: xhtml_format_objects_27 +#+NAME: xhtml_format_objects_quote_seg #+BEGIN_SRC d @safe Tuple!(string, string[]) quote_seg(O,M)( string _txt, @@ -1158,7 +1158,7 @@ import string _suffix = ".html", string _xml_type = "html", ) { - auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); + Tuple!(string, string[]) t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; string o = quote(_txt, obj, doc_matters); @@ -1173,7 +1173,7 @@ import *** group **** group -#+NAME: xhtml_format_objects_28 +#+NAME: xhtml_format_objects_group #+BEGIN_SRC d @safe string group(O,M)( string _txt, @@ -1217,7 +1217,7 @@ import **** scroll -#+NAME: xhtml_format_objects_29 +#+NAME: xhtml_format_objects_group_scroll #+BEGIN_SRC d @safe string group_scroll(O,M)( string _txt, @@ -1234,7 +1234,7 @@ import **** seg -#+NAME: xhtml_format_objects_30 +#+NAME: xhtml_format_objects_group_seg #+BEGIN_SRC d @safe Tuple!(string, string[]) group_seg(O,M)( string _txt, @@ -1243,7 +1243,7 @@ import string _suffix = ".html", string _xml_type = "html", ) { - auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); + Tuple!(string, string[]) t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; string o = group(_txt, obj, doc_matters); @@ -1258,7 +1258,7 @@ import *** block **** block -#+NAME: xhtml_format_objects_31 +#+NAME: xhtml_format_objects_block #+BEGIN_SRC d @safe string block(O,M)( string _txt, @@ -1298,7 +1298,7 @@ import **** scroll -#+NAME: xhtml_format_objects_32 +#+NAME: xhtml_format_objects_block_scroll #+BEGIN_SRC d @safe string block_scroll(O,M)( string _txt, @@ -1315,7 +1315,7 @@ import **** seg -#+NAME: xhtml_format_objects_33 +#+NAME: xhtml_format_objects_block_seg #+BEGIN_SRC d @safe Tuple!(string, string[]) block_seg(O,M)( string _txt, @@ -1324,7 +1324,7 @@ import string _suffix = ".html", string _xml_type = "html", ) { - auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); + Tuple!(string, string[]) t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; string o = block(_txt, obj, doc_matters); @@ -1339,7 +1339,7 @@ import *** poem verse **** verse -#+NAME: xhtml_format_objects_34 +#+NAME: xhtml_format_objects_verse #+BEGIN_SRC d @safe string verse(O,M)( string _txt, @@ -1377,7 +1377,7 @@ import **** scroll -#+NAME: xhtml_format_objects_35 +#+NAME: xhtml_format_objects_verse_scroll #+BEGIN_SRC d @safe string verse_scroll(O,M)( string _txt, @@ -1394,7 +1394,7 @@ import **** seg -#+NAME: xhtml_format_objects_36 +#+NAME: xhtml_format_objects_verse_seg #+BEGIN_SRC d @safe Tuple!(string, string[]) verse_seg(O,M)( string _txt, @@ -1403,7 +1403,7 @@ import string _suffix = ".html", string _xml_type = "html", ) { - auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); + Tuple!(string, string[]) t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; string o = verse(_txt, obj, doc_matters); @@ -1489,7 +1489,7 @@ align="left|right|center" "style=\"text-align:" ~ "right\"" -#+NAME: xhtml_format_objects_37 +#+NAME: xhtml_format_objects_tablarize #+BEGIN_SRC d @safe Tuple!(string, string) tablarize(O)( string _txt, @@ -1528,7 +1528,7 @@ align="left|right|center" **** table -#+NAME: xhtml_format_objects_38 +#+NAME: xhtml_format_objects_table #+BEGIN_SRC d @safe string table(O,M)( string _txt, @@ -1577,21 +1577,21 @@ template outputHTML() { <> mixin outputXHTMLs; <> - <> - <> - <> - <> - <> - <> + <> + <> + <> + <> + <> + <> <> - <> - <> - <> - <> - <> - <> - <> - <> + <> + <> + <> + <> + <> + <> + <> + <> <> <> } @@ -1618,183 +1618,183 @@ template outputHTML() { **** ↻ the loops & outer switch (sections & objects) format output -#+NAME: output_html_scroll_1 +#+NAME: output_html_scroll_loop_parts #+BEGIN_SRC d - foreach (part; doc_matters.has.keys_seq.scroll) { - foreach (obj; doc_abstraction[part]) { - delimit = xhtml_format.div_delimit(part, previous_part); - string _txt = xhtml_format.special_characters(obj); - switch (obj.metainfo.is_of_part) { +foreach (part; doc_matters.has.keys_seq.scroll) { + foreach (obj; doc_abstraction[part]) { + delimit = xhtml_format.div_delimit(part, previous_part); + string _txt = xhtml_format.special_characters(obj); + switch (obj.metainfo.is_of_part) { #+END_SRC ***** frontmatter -#+NAME: output_html_scroll_2 +#+NAME: output_html_scroll_is_frontmatter #+BEGIN_SRC d - case "frontmatter": assert(part == "head" || "toc"); - switch (obj.metainfo.is_of_type) { - case "para": - switch (obj.metainfo.is_a) { - case "heading": - doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc_matters, suffix); - break; - case "toc": - doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); - break; - default: - { /+ debug +/ - if (doc_matters.opt.action.debug_do - && doc_matters.opt.action.verbose) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); - } - } - break; - } - break; - default: - { /+ debug +/ - if (doc_matters.opt.action.debug_do - && doc_matters.opt.action.verbose) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); - } - } - break; +case "frontmatter": assert(part == "head" || "toc"); + switch (obj.metainfo.is_of_type) { + case "para": + switch (obj.metainfo.is_a) { + case "heading": + doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc_matters, suffix); + break; + case "toc": + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } - break; + } + break; + } + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } + } + break; + } + break; #+END_SRC ***** body -#+NAME: output_html_scroll_3 +#+NAME: output_html_scroll_is_body #+BEGIN_SRC d - case "body": assert(part == "body" || "head"); - switch (obj.metainfo.is_of_type) { - case "para": - switch (obj.metainfo.is_a) { - case "heading": - doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc_matters, suffix); - break; - case "para": - doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); - break; - default: - { /+ debug +/ - if (doc_matters.opt.action.debug_do - && doc_matters.opt.action.verbose) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); - } - } - break; - } - break; - case "block": - switch (obj.metainfo.is_a) { - case "quote": - doc_html ~= xhtml_format.quote_scroll(_txt, obj, doc_matters); - break; - case "group": - doc_html ~= xhtml_format.group_scroll(_txt, obj, doc_matters); - break; - case "block": - doc_html ~= xhtml_format.block_scroll(_txt, obj, doc_matters); - break; - case "poem": - break; - case "verse": - doc_html ~= xhtml_format.verse_scroll(_txt, obj, doc_matters, suffix); - break; - case "code": - doc_html ~= xhtml_format.code(_txt, obj, doc_matters); - break; - case "table": - doc_html ~= xhtml_format.table(_txt, obj, doc_matters); - break; - default: - { /+ debug +/ - if (doc_matters.opt.action.debug_do - && doc_matters.opt.action.verbose) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); - } - } - break; - } - break; - default: - { /+ debug +/ - if (doc_matters.opt.action.debug_do - && doc_matters.opt.action.verbose) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); - } - } - break; +case "body": assert(part == "body" || "head"); + switch (obj.metainfo.is_of_type) { + case "para": + switch (obj.metainfo.is_a) { + case "heading": + doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc_matters, suffix); + break; + case "para": + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + } + break; + } + break; + case "block": + switch (obj.metainfo.is_a) { + case "quote": + doc_html ~= xhtml_format.quote_scroll(_txt, obj, doc_matters); + break; + case "group": + doc_html ~= xhtml_format.group_scroll(_txt, obj, doc_matters); + break; + case "block": + doc_html ~= xhtml_format.block_scroll(_txt, obj, doc_matters); + break; + case "poem": + break; + case "verse": + doc_html ~= xhtml_format.verse_scroll(_txt, obj, doc_matters, suffix); + break; + case "code": + doc_html ~= xhtml_format.code(_txt, obj, doc_matters); + break; + case "table": + doc_html ~= xhtml_format.table(_txt, obj, doc_matters); + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } - break; + } + break; + } + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } + } + break; + } + break; #+END_SRC ***** backmatter -#+NAME: output_html_scroll_4 +#+NAME: output_html_scroll_is_backmatter #+BEGIN_SRC d - case "backmatter": - assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); - switch (obj.metainfo.is_of_type) { - case "para": - switch (obj.metainfo.is_a) { - case "heading": - doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc_matters, suffix); - break; - case "endnote": assert(part == "endnotes"); - doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); - break; - case "glossary": assert(part == "glossary"); - doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); - break; - case "bibliography": assert(part == "bibliography"); - doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); - break; - case "bookindex": assert(part == "bookindex"); - doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); - break; - case "blurb": assert(part == "blurb"); - doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); - break; - default: - { /+ debug +/ - if (doc_matters.opt.action.debug_do - && doc_matters.opt.action.verbose) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); - } - } - break; - } - break; - default: - { /+ debug +/ - if (doc_matters.opt.action.debug_do - && doc_matters.opt.action.verbose) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); - } - } - break; - } - break; - case "comment": - break; - default: - { /+ debug +/ - if (doc_matters.opt.action.debug_do - && doc_matters.opt.action.verbose) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); - writeln(__FILE__, ":", __LINE__, ": ", obj.text); - } +case "backmatter": + assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); + switch (obj.metainfo.is_of_type) { + case "para": + switch (obj.metainfo.is_a) { + case "heading": + doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc_matters, suffix); + break; + case "endnote": assert(part == "endnotes"); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); + break; + case "glossary": assert(part == "glossary"); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); + break; + case "bibliography": assert(part == "bibliography"); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); + break; + case "bookindex": assert(part == "bookindex"); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); + break; + case "blurb": assert(part == "blurb"); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } - break; + } + break; + } + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } + } + break; + } + break; +case "comment": + break; +default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + writeln(__FILE__, ":", __LINE__, ": ", obj.text); + } + } + break; #+END_SRC ***** closings & post loop -#+NAME: output_html_scroll_5 +#+NAME: output_html_scroll_close_is_case #+BEGIN_SRC d } } @@ -1806,7 +1806,7 @@ template outputHTML() { *** write output file -#+NAME: output_html_scroll_6 +#+NAME: output_html_scroll_scroll_write_output #+BEGIN_SRC d @trusted void scroll_write_output(D,M)( D doc, @@ -1858,275 +1858,275 @@ template outputHTML() { **** ↻ the loop (sections & objects) format output -#+NAME: output_html_seg_1 +#+NAME: output_html_seg_loop_parts #+BEGIN_SRC d - foreach (part; doc_matters.has.keys_seq.seg) { - foreach (obj; doc_abstraction[part]) { - delimit = xhtml_format.div_delimit(part, previous_part); - string _txt = xhtml_format.special_characters(obj); +foreach (part; doc_matters.has.keys_seq.seg) { + foreach (obj; doc_abstraction[part]) { + delimit = xhtml_format.div_delimit(part, previous_part); + string _txt = xhtml_format.special_characters(obj); #+END_SRC ***** all headings -#+NAME: output_html_seg_2 -#+BEGIN_SRC d - if (obj.metainfo.is_a == "heading") { - assert(part == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); - switch (obj.metainfo.heading_lev_markup) { - case 0: .. case 3: - /+ fill buffer, and replace with new levels from 1 to 3 +/ - switch (obj.metainfo.heading_lev_markup) { - case 0: - top_level_headings[0] = ""; - top_level_headings[1] = ""; - top_level_headings[2] = ""; - top_level_headings[3] = ""; - goto default; - case 1: - top_level_headings[1] = ""; - top_level_headings[2] = ""; - top_level_headings[3] = ""; - goto default; - case 2: - top_level_headings[2] = ""; - top_level_headings[3] = ""; - goto default; - case 3: - top_level_headings[3] = ""; - goto default; - default: - auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "seg"); - top_level_headings[obj.metainfo.heading_lev_markup] = t[0]; - break; - } - break; - case 4: - segment_filename = obj.tags.segment_anchor_tag_epub; - doc_html[segment_filename] ~= xhtml_format.html_head(doc_matters, "seg"); - auto navigation_bar = xhtml_format.nav_pre_next_svg(obj, doc_matters); - doc_html[segment_filename] ~= navigation_bar.toc_pre_next; - previous_seg_filename = segment_filename; - foreach (top_level_heading; top_level_headings) { - doc_html[segment_filename] ~= top_level_heading; - } - auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "seg"); - doc_html[segment_filename] ~= t[0].to!string; - doc_html[segment_filename] ~= xhtml_format.lev4_heading_subtoc(obj, doc_matters); - doc_html_endnotes[segment_filename] ~= t[1]; - break; - case 5: .. case 7: - auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "seg"); - doc_html[segment_filename] ~= t[0].to!string; - doc_html_endnotes[segment_filename] ~= t[1]; - break; - case 8: .. case 9: - { /+ debug +/ - if (doc_matters.opt.action.debug_do - && doc_matters.opt.action.verbose) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); - writeln(__FILE__, ":", __LINE__, ": ", obj.text); - } - } - break; - default: - { /+ debug +/ - if (doc_matters.opt.action.debug_do - && doc_matters.opt.action.verbose) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); - } - } - break; - } +#+NAME: output_html_seg_is_heading +#+BEGIN_SRC d +if (obj.metainfo.is_a == "heading") { + assert(part == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); + switch (obj.metainfo.heading_lev_markup) { + case 0: .. case 3: + /+ fill buffer, and replace with new levels from 1 to 3 +/ + switch (obj.metainfo.heading_lev_markup) { + case 0: + top_level_headings[0] = ""; + top_level_headings[1] = ""; + top_level_headings[2] = ""; + top_level_headings[3] = ""; + goto default; + case 1: + top_level_headings[1] = ""; + top_level_headings[2] = ""; + top_level_headings[3] = ""; + goto default; + case 2: + top_level_headings[2] = ""; + top_level_headings[3] = ""; + goto default; + case 3: + top_level_headings[3] = ""; + goto default; + default: + Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "seg"); + top_level_headings[obj.metainfo.heading_lev_markup] = t[0]; + break; + } + break; + case 4: + segment_filename = obj.tags.segment_anchor_tag_epub; + doc_html[segment_filename] ~= xhtml_format.html_head(doc_matters, "seg"); + auto navigation_bar = xhtml_format.nav_pre_next_svg(obj, doc_matters); + doc_html[segment_filename] ~= navigation_bar.toc_pre_next; + previous_seg_filename = segment_filename; + foreach (top_level_heading; top_level_headings) { + doc_html[segment_filename] ~= top_level_heading; + } + Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "seg"); + doc_html[segment_filename] ~= t[0].to!string; + doc_html[segment_filename] ~= xhtml_format.lev4_heading_subtoc(obj, doc_matters); + doc_html_endnotes[segment_filename] ~= t[1]; + break; + case 5: .. case 7: + Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "seg"); + doc_html[segment_filename] ~= t[0].to!string; + doc_html_endnotes[segment_filename] ~= t[1]; + break; + case 8: .. case 9: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); + writeln(__FILE__, ":", __LINE__, ": ", obj.text); + } + } + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); + } + } + break; + } #+END_SRC ***** non-heading -#+NAME: output_html_seg_3 +#+NAME: output_html_seg_is_not_heading_switch #+BEGIN_SRC d - } else { - assert(part == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); - switch (obj.metainfo.is_of_part) { +} else { + assert(part == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); + Tuple!(string, string[]) t; + switch (obj.metainfo.is_of_part) { #+END_SRC ****** frontmatter -#+NAME: output_html_seg_4 +#+NAME: output_html_seg_is_frontmatter #+BEGIN_SRC d - case "frontmatter": assert(part == "head" || "toc"); - switch (obj.metainfo.is_of_type) { - case "para": - switch (obj.metainfo.is_a) { - case "toc": - auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); - doc_html[segment_filename] ~= t[0].to!string; - break; - default: - { /+ debug +/ - if (doc_matters.opt.action.debug_do - && doc_matters.opt.action.verbose) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); - } - } - break; - } - break; - default: - { /+ debug +/ - if (doc_matters.opt.action.debug_do - && doc_matters.opt.action.verbose) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); - } - } - break; - } - break; +case "frontmatter": assert(part == "head" || "toc"); + switch (obj.metainfo.is_of_type) { + case "para": + switch (obj.metainfo.is_a) { + case "toc": + t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); + doc_html[segment_filename] ~= t[0].to!string; + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + } + break; + } + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + } + break; + } + break; #+END_SRC ****** body -#+NAME: output_html_seg_5 +#+NAME: output_html_seg_is_body #+BEGIN_SRC d - case "body": assert(part == "body"); - switch (obj.metainfo.is_of_type) { - case "para": - switch (obj.metainfo.is_a) { - case "para": - auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); - doc_html[segment_filename] ~= t[0].to!string; - doc_html_endnotes[segment_filename] ~= t[1]; - break; - default: - { /+ debug +/ - if (doc_matters.opt.action.debug_do - && doc_matters.opt.action.verbose) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); - } - } - break; - } - break; - case "block": - switch (obj.metainfo.is_a) { - case "quote": - auto t = xhtml_format.quote_seg(_txt, obj, doc_matters, suffix, "seg"); - doc_html[segment_filename] ~= t[0].to!string; - doc_html_endnotes[segment_filename] ~= t[1]; - break; - case "group": - auto t = xhtml_format.group_seg(_txt, obj, doc_matters, suffix, "seg"); - doc_html[segment_filename] ~= t[0].to!string; - doc_html_endnotes[segment_filename] ~= t[1]; - break; - case "block": - auto t = xhtml_format.block_seg(_txt, obj, doc_matters, suffix, "seg"); - doc_html[segment_filename] ~= t[0].to!string; - doc_html_endnotes[segment_filename] ~= t[1]; - break; - case "poem": - break; - case "verse": - auto t = xhtml_format.verse_seg(_txt, obj, doc_matters, suffix, "seg"); - doc_html[segment_filename] ~= t[0].to!string; - doc_html_endnotes[segment_filename] ~= t[1]; - break; - case "code": - doc_html[segment_filename] ~= xhtml_format.code(_txt, obj, doc_matters); - break; - case "table": - doc_html[segment_filename] ~= xhtml_format.table(_txt, obj, doc_matters); - doc_html_endnotes[segment_filename] ~= ""; - break; - default: - { /+ debug +/ - if (doc_matters.opt.action.debug_do - && doc_matters.opt.action.verbose) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); - } - } - break; - } - break; - default: - { /+ debug +/ - if (doc_matters.opt.action.debug_do - && doc_matters.opt.action.verbose) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); - } - } - break; - } - break; +case "body": assert(part == "body"); + switch (obj.metainfo.is_of_type) { + case "para": + switch (obj.metainfo.is_a) { + case "para": + t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); + doc_html[segment_filename] ~= t[0].to!string; + doc_html_endnotes[segment_filename] ~= t[1]; + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + } + break; + } + break; + case "block": + switch (obj.metainfo.is_a) { + case "quote": + t = xhtml_format.quote_seg(_txt, obj, doc_matters, suffix, "seg"); + goto default; + case "group": + t = xhtml_format.group_seg(_txt, obj, doc_matters, suffix, "seg"); + goto default; + case "block": + t = xhtml_format.block_seg(_txt, obj, doc_matters, suffix, "seg"); + goto default; + case "poem": + break; + case "verse": + t = xhtml_format.verse_seg(_txt, obj, doc_matters, suffix, "seg"); + goto default; + case "code": + doc_html[segment_filename] ~= xhtml_format.code(_txt, obj, doc_matters); + break; + case "table": + doc_html[segment_filename] ~= xhtml_format.table(_txt, obj, doc_matters); + doc_html_endnotes[segment_filename] ~= ""; + break; + default: + if ((obj.metainfo.is_a == "quote" + || obj.metainfo.is_a == "group" + || obj.metainfo.is_a == "block" + || obj.metainfo.is_a == "verse" + )) { + doc_html[segment_filename] ~= t[0].to!string; + doc_html_endnotes[segment_filename] ~= t[1]; + } else { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } + } + break; + } + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } + } + break; + } + break; #+END_SRC ****** backmatter -#+NAME: output_html_seg_6 +#+NAME: output_html_seg_is_backmatter #+BEGIN_SRC d - case "backmatter": - assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); - switch (obj.metainfo.is_of_type) { - case "para": - switch (obj.metainfo.is_a) { - case "endnote": assert(part == "endnotes"); - auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); - doc_html[segment_filename] ~= t[0]; - break; - case "glossary": assert(part == "glossary"); - auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); - doc_html[segment_filename] ~= t[0]; - doc_html_endnotes[segment_filename] ~= t[1]; - break; - case "bibliography": assert(part == "bibliography"); - auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); - doc_html[segment_filename] ~= t[0]; - doc_html_endnotes[segment_filename] ~= t[1]; - break; - case "bookindex": assert(part == "bookindex"); - auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); - doc_html[segment_filename] ~= t[0]; - doc_html_endnotes[segment_filename] ~= t[1]; - break; - case "blurb": assert(part == "blurb"); - auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); - doc_html[segment_filename] ~= t[0]; - doc_html_endnotes[segment_filename] ~= t[1]; - break; - default: - { /+ debug +/ - if (doc_matters.opt.action.debug_do - && doc_matters.opt.action.verbose) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); - } - } - break; - } - break; - default: - { /+ debug +/ - if (doc_matters.opt.action.debug_do - && doc_matters.opt.action.verbose) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); - } - } - break; - } - break; - case "comment": - break; - default: - { /+ debug +/ - if (doc_matters.opt.action.debug_do - && doc_matters.opt.action.verbose) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); - } - } - break; +case "backmatter": + assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); + switch (obj.metainfo.is_of_type) { + case "para": + switch (obj.metainfo.is_a) { + case "endnote": assert(part == "endnotes"); + t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); + doc_html[segment_filename] ~= t[0]; + break; + case "glossary": assert(part == "glossary"); + t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); + doc_html[segment_filename] ~= t[0]; + doc_html_endnotes[segment_filename] ~= t[1]; + break; + case "bibliography": assert(part == "bibliography"); + t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); + doc_html[segment_filename] ~= t[0]; + doc_html_endnotes[segment_filename] ~= t[1]; + break; + case "bookindex": assert(part == "bookindex"); + t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); + doc_html[segment_filename] ~= t[0]; + doc_html_endnotes[segment_filename] ~= t[1]; + break; + case "blurb": assert(part == "blurb"); + t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); + doc_html[segment_filename] ~= t[0]; + doc_html_endnotes[segment_filename] ~= t[1]; + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } + } + break; + } + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } + } + break; + } + break; +case "comment": + break; +default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); + } + } + break; +} #+END_SRC ***** closings & post loop -#+NAME: output_html_seg_7 +#+NAME: output_html_seg_close_is_case #+BEGIN_SRC d } } @@ -2137,7 +2137,7 @@ template outputHTML() { *** write output files -#+NAME: output_html_seg_8 +#+NAME: output_html_seg_write_output #+BEGIN_SRC d @trusted void seg_write_output(D,E,M)( // @system? D doc_html, @@ -2255,23 +2255,25 @@ template outputEPub3() { <> mixin InternalMarkup; mixin outputXHTMLs; - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> + static auto rgx = RgxO(); + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> } #+END_SRC @@ -2281,7 +2283,7 @@ template outputEPub3() { - mimetype file indicating that zip file contains an EPUB -#+NAME: output_epub3_fixed_0 +#+NAME: output_epub3_fixed_mimetypes #+BEGIN_SRC d @safe string epub3_mimetypes() { string o; @@ -2294,11 +2296,11 @@ template outputEPub3() { - identifies the root package document (so systems can find it), [unchanged from epub2] -#+NAME: output_epub3_fixed_1 +#+NAME: output_epub3_fixed_container_xml #+BEGIN_SRC d @safe string epub3_container_xml() { string o; - o = format(q"┃┃") ~ "\n"; + o = format(q"┃┃") ~ "\n"; o ~= format(q"┃ @@ -2316,20 +2318,28 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> - provides the default reading order - identifies the navigation document -#+NAME: output_epub3_constructs_0 +#+BEGIN_SRC d + +#+END_SRC + +#+NAME: epub3_package_version +#+BEGIN_SRC d + +#+END_SRC + +#+NAME: output_epub3_constructs_oebps_content #+BEGIN_SRC d @safe string epub3_oebps_content(D,M,P)(D doc_abstraction, M doc_matters, P parts) { auto xhtml_format = outputXHTMLs(); auto pth_epub3 = spinePathsEPUB!()(doc_matters.output_path, doc_matters.src.language); string _uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO sort uuid in doc_matters! - string content = format(q"┃ - + string content = format(q"┃ +<> - %s main %s @@ -2340,18 +2350,13 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> Copyright: %s %s urn:uuid:%s - - - - - - - + + + ┃", _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), @@ -2366,13 +2371,10 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> ? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.rights_copyright), _uuid, _uuid, - _uuid, (pth_epub3.fn_oebps_css).chompPrefix("OEBPS/"), ); - content ~= " " ~ "" ~ "\n "; content ~= parts["manifest_documents"]; // TODO sort jpg & png - content ~= " " ~ "" ~ "\n "; foreach (image; doc_matters.srcs.image_list) { content ~= format(q"┃ ┃", @@ -2422,85 +2424,107 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> - toc_nav.xhtml declared as nav file in content.opf (epub3 navigation document) -#+NAME: output_epub3_constructs_1 +#+NAME: output_epub3_constructs_oebps_toc_nav_xhtml #+BEGIN_SRC d @safe string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) { enum DomTags { none, open, close, close_and_open, open_still, } auto markup = InlineMarkup(); static auto rgx = RgxO(); - string toc =format(" + string toc; + string toc_head = format(q"┃ %s -
-
-

Contents

-
- -
- -\n"; + toc ~= _toc_nav_tail; return toc; } #+END_SRC @@ -2510,15 +2534,16 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> - toc.ncx (epub2 navigation document) - (replaced in epub3 by a declared xhtml nav file, in our case toc_nav.xhtml) -#+NAME: output_epub3_constructs_2 +#+NAME: output_epub3_constructs_oebps_toc_ncx #+BEGIN_SRC d @safe string epub2_oebps_toc_ncx(D,I)(D doc_abstraction, I doc_matters) { - int counter = 0; + int counter_play_order = 0; string _uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO shared elsewhere auto markup = InlineMarkup(); static auto rgx = RgxO(); enum DomTags { none, open, close, close_and_open, open_still, } - string toc = format(q"┃ + string toc; + string toc_ = format(q"┃