aboutsummaryrefslogtreecommitdiffhomepage
path: root/org
diff options
context:
space:
mode:
Diffstat (limited to 'org')
-rw-r--r--org/config_nix.org17
-rw-r--r--org/default_paths.org4
-rw-r--r--org/metaverse.org11
-rw-r--r--org/out_xmls.org1923
4 files changed, 1018 insertions, 937 deletions
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 {
<<shell_packages_nix_related>>
<<shell_packages_d_build_related>>
# <<shell_packages_search_sqlite_related>>
+ # <<shell_packages_xml_and_epub_related>>
]
)];
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();
- <<xhtml_format_objects_0>>
- <<xhtml_format_objects_1>>
- <<xhtml_format_objects_2>>
- <<xhtml_format_objects_3>>
- <<xhtml_format_objects_4>>
- <<xhtml_format_objects_5>>
- <<xhtml_format_objects_6>>
- <<xhtml_format_objects_7>>
- <<xhtml_format_objects_8>>
- <<xhtml_format_objects_9>>
- <<xhtml_format_objects_10>>
- <<xhtml_format_objects_11>>
- <<xhtml_format_objects_12>>
- <<xhtml_format_objects_13>>
- <<xhtml_format_objects_14>>
- <<xhtml_format_objects_15>>
- <<xhtml_format_objects_16>>
- <<xhtml_format_objects_17>>
- <<xhtml_format_objects_18>>
- <<xhtml_format_objects_19>>
- <<xhtml_format_objects_20>>
- <<xhtml_format_objects_21>>
- <<xhtml_format_objects_22>>
- <<xhtml_format_objects_23>>
- <<xhtml_format_objects_24>>
- <<xhtml_format_objects_25>>
- <<xhtml_format_objects_26>>
- <<xhtml_format_objects_27>>
- <<xhtml_format_objects_28>>
- <<xhtml_format_objects_29>>
- <<xhtml_format_objects_30>>
- <<xhtml_format_objects_31>>
- <<xhtml_format_objects_32>>
- <<xhtml_format_objects_33>>
- <<xhtml_format_objects_34>>
- <<xhtml_format_objects_35>>
- <<xhtml_format_objects_36>>
- <<xhtml_format_objects_37>>
- <<xhtml_format_objects_38>>
+ <<xhtml_format_objects_div_delimit>>
+ <<xhtml_format_objects_special_characters_text>>
+ <<xhtml_format_objects_special_characters>>
+ <<xhtml_format_objects_font_face>>
+ <<xhtml_format_objects_xml_anchor_tags>>
+ <<xhtml_format_objects_header_metadata>>
+ <<xhtml_format_objects_site_info_button>>
+ <<xhtml_format_objects_inline_search_form>>
+ <<xhtml_format_objects_html_head>>
+ <<xhtml_format_objects_epub3_seg_head>>
+ <<xhtml_format_objects_tail>>
+ <<xhtml_format_objects_inline_images>>
+ <<xhtml_format_objects_inline_links>>
+ <<xhtml_format_objects_inline_notes_scroll>>
+ <<xhtml_format_objects_inline_notes_seg>>
+ <<xhtml_format_objects_inline_markup_scroll>>
+ <<xhtml_format_objects_inline_markup_seg>>
+ <<xhtml_format_objects_lev4_heading_subtoc>>
+ <<xhtml_format_objects_nav_pre_next_svg>>
+ <<xhtml_format_objects_heading>>
+ <<xhtml_format_objects_heading_scroll>>
+ <<xhtml_format_objects_heading_seg>>
+ <<xhtml_format_objects_para>>
+ <<xhtml_format_objects_para_scroll>>
+ <<xhtml_format_objects_para_seg>>
+ <<xhtml_format_objects_quote>>
+ <<xhtml_format_objects_quote_scroll>>
+ <<xhtml_format_objects_quote_seg>>
+ <<xhtml_format_objects_group>>
+ <<xhtml_format_objects_group_scroll>>
+ <<xhtml_format_objects_group_seg>>
+ <<xhtml_format_objects_block>>
+ <<xhtml_format_objects_block_scroll>>
+ <<xhtml_format_objects_block_seg>>
+ <<xhtml_format_objects_verse>>
+ <<xhtml_format_objects_verse_scroll>>
+ <<xhtml_format_objects_verse_seg>>
+ <<xhtml_format_objects_tablarize>>
+ <<xhtml_format_objects_table>>
<<xhtml_format_objects_code>>
}
}
@@ -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, "&#38;")
- .replaceAll(rgx.xhtml_quotation, "&#34;")
- .replaceAll(rgx.xhtml_less_than, "&#60;")
- .replaceAll(rgx.xhtml_greater_than, "&#62;")
+ .replaceAll(rgx.xhtml_ampersand, "&amp;") // "&#38;"
+ .replaceAll(rgx.xhtml_quotation, "&quot;") // "&#34;"
+ .replaceAll(rgx.xhtml_less_than, "&lt;") // "&#60;"
+ .replaceAll(rgx.xhtml_greater_than, "&gt;") // "&#62;"
.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 ~= "<a name=\"" ~ tag ~ "\"></a>";
+ tags ~= "<a name=\"" ~ special_characters_text(tag) ~ "\"></a>";
}
}
}
@@ -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
<meta name="generator" content="%s" />
<link rel="generator" href="%s" />
<!-- spine DocReform header metadata -->┃",
- doc_matters.conf_make_meta.meta.title_full.replaceAll(regex("\""), "&quot;"),
- 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
<div class="flex-menu-option">
%s
</div>%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
<body lang="%s">
<a name="top" id="top"></a>┃",
html_simple,
- doc_matters.conf_make_meta.meta.title_full.replaceAll(regex("\""), "&quot;"),
+ 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() {
<<output_imports_xml>>
mixin outputXHTMLs;
<<output_html_scroll_0>>
- <<output_html_scroll_1>>
- <<output_html_scroll_2>>
- <<output_html_scroll_3>>
- <<output_html_scroll_4>>
- <<output_html_scroll_5>>
- <<output_html_scroll_6>>
+ <<output_html_scroll_loop_parts>>
+ <<output_html_scroll_is_frontmatter>>
+ <<output_html_scroll_is_body>>
+ <<output_html_scroll_is_backmatter>>
+ <<output_html_scroll_close_is_case>>
+ <<output_html_scroll_scroll_write_output>>
<<output_html_seg_0>>
- <<output_html_seg_1>>
- <<output_html_seg_2>>
- <<output_html_seg_3>>
- <<output_html_seg_4>>
- <<output_html_seg_5>>
- <<output_html_seg_6>>
- <<output_html_seg_7>>
- <<output_html_seg_8>>
+ <<output_html_seg_loop_parts>>
+ <<output_html_seg_is_heading>>
+ <<output_html_seg_is_not_heading_switch>>
+ <<output_html_seg_is_frontmatter>>
+ <<output_html_seg_is_body>>
+ <<output_html_seg_is_backmatter>>
+ <<output_html_seg_close_is_case>>
+ <<output_html_seg_write_output>>
<<output_html_css>>
<<copy_html_images>>
}
@@ -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() {
<<output_imports_epub>>
mixin InternalMarkup;
mixin outputXHTMLs;
- <<output_epub3_fixed_0>>
- <<output_epub3_fixed_1>>
- <<output_epub3_constructs_0>>
- <<output_epub3_constructs_1>>
- <<output_epub3_constructs_2>>
- <<output_epub3_xhtml>>
- <<output_epub3_xhtml_seg_0>>
- <<output_epub3_xhtml_seg_1>>
- <<output_epub3_xhtml_seg_2>>
- <<output_epub3_xhtml_seg_3>>
- <<output_epub3_xhtml_seg_4>>
- <<output_epub3_xhtml_seg_5>>
- <<output_epub3_xhtml_seg_6>>
- <<output_epub3_xhtml_seg_7>>
- <<output_epub3_xhtml_seg_8>>
- <<output_epub3_xhtml_seg_9>>
- <<output_epub3_css>>
+ static auto rgx = RgxO();
+ <<xhtml_format_objects_special_characters_text>>
+ <<output_epub3_fixed_mimetypes>>
+ <<output_epub3_fixed_container_xml>>
+ <<output_epub3_constructs_oebps_content>>
+ <<output_epub3_constructs_oebps_toc_nav_xhtml>>
+ <<output_epub3_constructs_oebps_toc_ncx>>
+ <<output_epub3_xhtml_seg_output>>
+ <<output_epub3_xhtml_seg_output_loop>>
+ <<output_epub3_xhtml_seg_object_is_heading>>
+ <<output_epub3_xhtml_seg_object_is_not_heading>>
+ <<output_epub3_xhtml_seg_object_is_frontmatter>>
+ <<output_epub3_xhtml_seg_object_is_body>>
+ <<output_epub3_xhtml_seg_object_is_backmatter>>
+ <<output_epub3_xhtml_seg_object_is_comment_and_close>>
+ <<output_epub3_xhtml_seg_object_is_heading_set>>
+ <<output_epub3_xhtml_seg_close_ifs_and_write>>
+ <<output_epub3_xhtml_seg_write_output_files>>
+ <<output_epub3_xhtml_seg_debug_extract_zip_dir>>
}
#+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"┃<?xml version="1.0" encoding="UTF-8"?>┃") ~ "\n";
+ 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>
@@ -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
+<package version="2.0" unique-identifier="PrimaryID" xmlns="http://www.idpf.org/2007/opf">
+#+END_SRC
+
+#+NAME: epub3_package_version
+#+BEGIN_SRC d
+<package version="3.0" xmlns="http://www.idpf.org/2007/opf" unique-identifier="uid" prefix="rendition: http://www.idpf.org/vocab/rendition/#">
+#+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"┃ <?xml version="1.0" encoding="UTF-8"?>
-<package version="2.0" xmlns="http://www.idpf.org/2007/opf" unique-identifier="EPB-UUID">
+ string content = format(q"┃<?xml version="1.0" encoding="utf-8"?>
+<<epub3_package_version>>
<metadata
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xmlns:dcterms="https://purl.org/dc/terms/"
xmlns:dc="https://purl.org/dc/elements/1.1/"
unique-identifier="urn:uuid:%s" version="2.0">
- <!-- <dc:title id="title">%s</dc:title> -->
<dc:title id="title">%s</dc:title>
<meta refines="#title" property="title-type">main</meta>
<dc:title id="subtitle">%s</dc:title>
@@ -2340,18 +2350,13 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
<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" />
+ <item id="ncx" href="toc.ncx" media-type="application/x-dtbncx+xml" />
+ <link rel="stylesheet" href="%s" type="text/css" id="main-css" />
+ <item id="nav" href="toc_nav.xhtml" media-type="application/xhtml+xml" properties="nav" />
┃",
_uuid,
- xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.title_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 ~= " " ~ "<!-- 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" />
┃",
@@ -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("<html xmlns=\"https://www.w3.org/1999/xhtml\"
- xmlns:epub=\"http://www.idpf.org/2007/ops\">
+ string toc;
+ string toc_head = format(q"┃<html xmlns="https://www.w3.org/1999/xhtml"
+ xmlns:epub="http://www.idpf.org/2007/ops">
<head>
<title>%s</title>
</head>
<body>
- <section epub:type=\"frontmatter toc\">
- <header>
- <h1>Contents</h1>
- </header>
- <nav epub:type=\"toc\" id=\"toc\">\n",
- doc_matters.conf_make_meta.meta.title_full,
- );
+<section epub:type="frontmatter toc">
+ <header>
+ <h1>Contents</h1>
+ </header>
+ <nav epub:type="toc" id="toc">
+ <ol>
+ <li>┃",
+ (doc_matters.conf_make_meta.meta.title_full).special_characters_text,
+ );
+ string _toc_nav_tail = "";
+ // writeln(doc_matters.has.keys_seq.seg); // DEBUG line
foreach (sect; doc_matters.has.keys_seq.seg) {
foreach (obj; doc_abstraction[sect]) {
- if (obj.metainfo.is_a == "heading") {
+ if ((sect == "head") && (obj.metainfo.is_a == "heading")) {
+ toc = format(q"┃%s
+ <a href="_the_title.xhtml">%s</a>
+ </li>
+┃",
+ toc_head,
+ obj.text.replaceAll(rgx.inline_notes_al_gen, "").strip,
+ );
+ } else if (sect == "tail") { // skip
+ } else if ((sect != "tail") && (obj.metainfo.is_a == "heading")) {
string _txt = obj.text.replaceAll(rgx.inline_notes_al_gen, "").strip;
foreach_reverse (n; 0 .. 7) {
string k = n.to!string;
switch (obj.metainfo.dom_structure_collapsed_tags_status[n]) {
+ case DomTags.none :
+ break;
case DomTags.close :
- toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "</li>" ~ "\n";
- toc ~= markup.indent_by_spaces_provided(n, " ") ~ "</ol>" ~ "\n";
+ toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "</li>" ~ "\n";
+ toc ~= markup.indent_by_spaces_provided(n, " ") ~ "</ol>" ~ "\n";
break;
case DomTags.close_and_open :
- toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "</li>" ~ "\n";
- if (obj.metainfo.heading_lev_markup < 4) {
- toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "<li>" ~ "\n"
- ~ markup.indent_by_spaces_provided((n + 2), " ")
- ~ "<a href=\"" ~ obj.tags.segment_anchor_tag_epub ~ ".xhtml" ~ "\">"
- ~ _txt
- ~ "</a>" ~ "\n";
- } else {
- string hashtag =(obj.metainfo.heading_lev_markup == 4)
- ? ""
- : ("#" ~ obj.metainfo.ocn.to!string);
- toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "<li>" ~ "\n"
- ~ markup.indent_by_spaces_provided((n + 2), " ")
- ~ "<a href=\"" ~ obj.tags.segment_anchor_tag_epub ~ ".xhtml" ~ hashtag ~ "\">"
- ~ _txt
- ~ "</a>" ~ "\n";
- }
- break;
+ toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "</li>" ~ "\n";
+ goto default;
case DomTags.open :
- toc ~= markup.indent_by_spaces_provided(n, " ") ~ "<ol>" ~ "\n";
- if (obj.metainfo.heading_lev_markup < 4) {
- toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "<li>" ~ "\n"
- ~ markup.indent_by_spaces_provided((n + 2), " ")
- ~ "<a href=\"" ~ obj.tags.segment_anchor_tag_epub ~ ".xhtml" ~ "\">"
- ~ _txt
- ~ "</a>" ~ "\n";
- } else {
- string hashtag =(obj.metainfo.heading_lev_markup == 4)
- ? ""
- : ("#" ~ obj.metainfo.ocn.to!string);
- toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "<li>" ~ "\n"
- ~ markup.indent_by_spaces_provided((n + 2), " ")
- ~ "<a href=\"" ~ obj.tags.segment_anchor_tag_epub ~ ".xhtml" ~ hashtag ~ "\">"
- ~ _txt
- ~ "</a>" ~ "\n";
- }
- break;
+ toc ~= markup.indent_by_spaces_provided(n, " ") ~ "<ol>" ~ "\n";
+ goto default;
default :
+ if ((obj.metainfo.dom_structure_collapsed_tags_status[n] == DomTags.close_and_open ||
+ obj.metainfo.dom_structure_collapsed_tags_status[n] == DomTags.open
+ )) {
+ string _hashtag = "";
+ if ((obj.metainfo.heading_lev_markup <= 4) && (obj.metainfo.ocn == 0)) {
+ _hashtag = "#" ~ obj.metainfo.ocn.to!string;
+ }
+ string _href = "<a href=\""
+ ~ obj.tags.segment_anchor_tag_epub ~ ".xhtml"
+ ~ _hashtag
+ ~ "\">";
+ toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "<li>" ~ "\n"
+ ~ markup.indent_by_spaces_provided((n + 2), " ")
+ ~ _href ~ _txt.special_characters_text ~ "</a>" ~ "\n";
+ }
break;
}
+ if (doc_matters.has.keys_seq.seg[doc_matters.has.keys_seq.seg.length - 2] == sect) {
+ // writeln(n, ": ", sect, ": ", _txt, " - ", obj.metainfo.dom_structure_collapsed_tags_status); // DEBUG
+ // read last heading (heading prior to closing) and determine what those instructions imply still need to be done
+ // CLOSE // DomTags { 0 none, 1 open, 2 close, 3 close_and_open, 4 open_still, }
+ if (n == 6) {_toc_nav_tail = "";}
+ switch (obj.metainfo.dom_structure_collapsed_tags_status[n]) {
+ case 0: case 2:
+ // case DomTags.none: case DomTags.close:
+ break;
+ case 1: case 3: case 4:
+ // case DomTags.open: case DomTags.close_and_open: case DomTags.open_still:
+ if (n != 0) {
+ _toc_nav_tail ~= " " ~ markup.indent_by_spaces_provided((n + 1), " ") ~ "</li>" ~ "\n";
+ }
+ _toc_nav_tail ~= " " ~ markup.indent_by_spaces_provided(n, " ") ~ "</ol>" ~ "\n";
+ break;
+ default :
+ break;
+ }
+ if (n == 0) {
+ _toc_nav_tail ~="</nav>
+</section>
+</body>
+</html>\n";
+ }
+ }
}
}
}
}
- toc ~="</nav>
- </section>
- </body>
-</html>\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"┃<?xml version="1.0" encoding="UTF-8"?>
+ string toc;
+ string toc_ = format(q"┃<?xml version="1.0" encoding="utf-8"?>
<ncx xmlns="https://www.daisy.org/z3986/2005/ncx/" version="2005-1">
<head>
<!-- four required metadata items (for all NCX documents,
@@ -2537,67 +2562,87 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
<text>%s</text>
</docAuthor>
<navMap>┃",
- doc_matters.conf_make_meta.meta.title_full, // title
+ (doc_matters.conf_make_meta.meta.title_full).special_characters_text, // title
(doc_matters.conf_make_meta.meta.creator_author.empty) ? ""
- : " by " ~ doc_matters.conf_make_meta.meta.creator_author, // author
+ : " by " ~ (doc_matters.conf_make_meta.meta.creator_author).special_characters_text, // author
_uuid, // uuid
"3", // content depth
- doc_matters.conf_make_meta.meta.title_full, // title
+ (doc_matters.conf_make_meta.meta.title_full).special_characters_text, // title
(doc_matters.conf_make_meta.meta.creator_author.empty) ? ""
- : doc_matters.conf_make_meta.meta.creator_author, // author
+ : (doc_matters.conf_make_meta.meta.creator_author).special_characters_text, // author
);
+ string _toc_ncx_tail = "";
foreach (sect; doc_matters.has.keys_seq.seg) {
foreach (obj; doc_abstraction[sect]) {
+ if (sect == "head") { toc = toc_;
+ }
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);
+ string _txt = obj.text.replaceAll(rgx.inline_notes_al_gen, "").strip.special_characters_text;
+ // writeln(_txt, " --- ", obj.metainfo.dom_structure_collapsed_tags_status); // DEBUG line
+ 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]) {
+ switch (obj.metainfo.dom_structure_collapsed_tags_status[k]) { // for epub may need to construct for levels 1 to 4 only
case DomTags.close :
- toc ~= "\n </navPoint>";
+ if (sect != "head") {
+ toc ~= "\n </navPoint>"; // issue at start of some documents
+ }
break;
case DomTags.close_and_open :
- ++counter;
toc ~= "\n </navPoint>";
- toc ~= format(q"┃
- <navPoint class="chapter" id="navpoint" playOrder="%s">
- <navLabel>
- <text>%s</text>
- </navLabel>
- <content src="%s.xhtml%s" />┃",
- counter,
- _txt,
- obj.tags.segment_anchor_tag_epub,
- hashtag,
- );
- break;
+ goto default;
case DomTags.open :
- ++counter;
- toc ~= format(q"┃
+ goto default;
+ default :
+ string _toc;
+ if ((obj.metainfo.dom_structure_collapsed_tags_status[k] == DomTags.open
+ || obj.metainfo.dom_structure_collapsed_tags_status[k] == DomTags.close_and_open
+ // || obj.metainfo.dom_structure_collapsed_tags_status[k] == DomTags.open_still
+ )) {
+ ++counter_play_order;
+ _toc = format(q"┃
<navPoint class="chapter" id="navpoint" playOrder="%s">
<navLabel>
<text>%s</text>
</navLabel>
<content src="%s.xhtml%s" />┃",
- counter,
- _txt,
- obj.tags.segment_anchor_tag_epub,
- hashtag,
- );
- break;
- default :
+ counter_play_order,
+ _txt,
+ obj.tags.segment_anchor_tag_epub,
+ hashtag,
+ );
+ }
+ if (obj.metainfo.dom_structure_collapsed_tags_status[k] == DomTags.close_and_open) {
+ toc ~= _toc;
+ } else if (obj.metainfo.dom_structure_collapsed_tags_status[k] == DomTags.open) {
+ toc ~= _toc;
+ }
break;
}
+ if (doc_matters.has.keys_seq.seg[doc_matters.has.keys_seq.seg.length - 2] == sect) {
+ if (k == 6) {_toc_ncx_tail = "";}
+ switch (obj.metainfo.dom_structure_collapsed_tags_status[k]) {
+ case 0: case 2:
+ // case DomTags.none: case DomTags.close:
+ break;
+ case 1: case 3: case 4:
+ // case DomTags.open: case DomTags.close_and_open: case DomTags.open_still:
+ if (k != 0) {
+ }
+ _toc_ncx_tail ~= " " ~ markup.indent_by_spaces_provided(k, " ") ~ "</navPoint>" ~ "\n";
+ break;
+ default :
+ break;
+ }
+ if (k == 0) {
+ _toc_ncx_tail ~= format(q"┃ </navMap>
+</ncx>┃");
+ }
+ }
}
}
}
}
- toc ~= format(q"┃
- </navPoint>
- </navPoint>
- </navPoint>
- </navMap>
-</ncx>┃");
+ toc ~= _toc_ncx_tail;
return toc;
}
#+END_SRC
@@ -2605,7 +2650,7 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
** the document contents :seg:
*** ↻ loop & switch (sections & objects) format epub3 xhtml output
-#+NAME: output_epub3_xhtml_seg_0
+#+NAME: output_epub3_xhtml_seg_output
#+BEGIN_SRC d
@system void outputEPub3(D,I)(
const D doc_abstraction,
@@ -2636,7 +2681,7 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
**** ↻ the loop (sections & objects) format output
-#+NAME: output_epub3_xhtml_seg_1
+#+NAME: output_epub3_xhtml_seg_output_loop
#+BEGIN_SRC d
foreach (part; doc_matters.has.keys_seq.seg) {
foreach (obj; doc_abstraction[part]) {
@@ -2645,307 +2690,320 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
***** all headings
-#+NAME: output_epub3_xhtml_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:
- epubWrite.doc_parts ~= obj.tags.segment_anchor_tag_epub;
- epubWrite.doc_epub3[obj.tags.segment_anchor_tag_epub] ~= xhtml_format.epub3_seg_head(doc_matters);
- auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "epub");
- epubWrite.doc_epub3[obj.tags.segment_anchor_tag_epub] ~= t[0];
- epubWrite.doc_epub3_endnotes[obj.tags.segment_anchor_tag_epub] ~= t[1];
- break;
- }
- break;
- case 4:
- segment_filename = obj.tags.segment_anchor_tag_epub;
- epubWrite.doc_epub3[segment_filename] ~= xhtml_format.epub3_seg_head(doc_matters);
- auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "epub");
- epubWrite.doc_epub3[segment_filename] ~= t[0];
- epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
- break;
- case 5: .. case 7:
- auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "epub");
- epubWrite.doc_epub3[segment_filename] ~= t[0];
- epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
- break;
- case 8: .. case 9:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup);
- writeln(__FILE__, ":", __LINE__, ": ", obj.text);
- }
- }
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup);
- }
- }
- break;
- }
+#+NAME: output_epub3_xhtml_seg_object_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:
+ epubWrite.doc_parts ~= obj.tags.segment_anchor_tag_epub;
+ epubWrite.doc_epub3[obj.tags.segment_anchor_tag_epub] ~= xhtml_format.epub3_seg_head(doc_matters);
+ Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[obj.tags.segment_anchor_tag_epub] ~= t[0];
+ epubWrite.doc_epub3_endnotes[obj.tags.segment_anchor_tag_epub] ~= t[1];
+ break;
+ }
+ break;
+ case 4:
+ segment_filename = obj.tags.segment_anchor_tag_epub;
+ epubWrite.doc_epub3[segment_filename] ~= xhtml_format.epub3_seg_head(doc_matters);
+ Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0];
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ case 5: .. case 7:
+ Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0];
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ case 8: .. case 9:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && 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_epub3_xhtml_seg_3
+#+NAME: output_epub3_xhtml_seg_object_is_not_heading
#+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_epub3_xhtml_seg_4
+#+NAME: output_epub3_xhtml_seg_object_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, "epub");
- epubWrite.doc_epub3[segment_filename] ~= t[0];
- epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
- }
- }
- break;
- }
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
- }
- }
- break;
- }
- break;
+case "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, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0];
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
+ }
+ break;
+ }
+ break;
#+END_SRC
****** body
-#+NAME: output_epub3_xhtml_seg_5
+#+NAME: output_epub3_xhtml_seg_object_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, "epub");
- epubWrite.doc_epub3[segment_filename] ~= t[0];
- epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
- }
- }
- break;
- }
- break;
- case "block":
- switch (obj.metainfo.is_a) {
- case "quote":
- auto t = xhtml_format.quote_seg(_txt, obj, doc_matters, suffix, "epub");
- epubWrite.doc_epub3[segment_filename] ~= t[0].to!string;
- epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
- break;
- case "group":
- auto t = xhtml_format.group_seg(_txt, obj, doc_matters, suffix, "epub");
- epubWrite.doc_epub3[segment_filename] ~= t[0].to!string;
- epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
- break;
- case "block":
- auto t = xhtml_format.block_seg(_txt, obj, doc_matters, suffix, "epub");
- epubWrite.doc_epub3[segment_filename] ~= t[0].to!string;
- epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
- break;
- case "poem":
- break;
- case "verse":
- auto t = xhtml_format.verse_seg(_txt, obj, doc_matters, suffix, "epub");
- epubWrite.doc_epub3[segment_filename] ~= t[0].to!string;
- epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
- break;
- case "code":
- epubWrite.doc_epub3[segment_filename] ~= xhtml_format.code(_txt, obj, doc_matters);
- break;
- case "table":
- epubWrite.doc_epub3[segment_filename] ~= xhtml_format.table(_txt, obj, doc_matters);
- epubWrite.doc_epub3_endnotes[segment_filename] ~= "";
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
- }
- }
- break;
- }
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
- }
- }
- break;
- }
- break;
+case "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, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0];
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ case "block":
+ switch (obj.metainfo.is_a) {
+ case "quote":
+ t = xhtml_format.quote_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0].to!string;
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ case "group":
+ t = xhtml_format.group_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0].to!string;
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ case "block":
+ t = xhtml_format.block_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0].to!string;
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ case "poem":
+ break;
+ case "verse":
+ t = xhtml_format.verse_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0].to!string;
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ case "code":
+ epubWrite.doc_epub3[segment_filename] ~= xhtml_format.code(_txt, obj, doc_matters);
+ break;
+ case "table":
+ epubWrite.doc_epub3[segment_filename] ~= xhtml_format.table(_txt, obj, doc_matters);
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= "";
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && 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_epub3_xhtml_seg_6
+#+NAME: output_epub3_xhtml_seg_object_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, "epub");
- epubWrite.doc_epub3[segment_filename] ~= t[0];
- break;
- case "glossary": assert(part == "glossary");
- auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
- epubWrite.doc_epub3[segment_filename] ~= t[0];
- epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
- break;
- case "bibliography": assert(part == "bibliography");
- auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
- epubWrite.doc_epub3[segment_filename] ~= t[0];
- epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
- break;
- case "bookindex": assert(part == "bookindex");
- auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
- epubWrite.doc_epub3[segment_filename] ~= t[0];
- epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
- break;
- case "blurb": assert(part == "blurb");
- auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
- epubWrite.doc_epub3[segment_filename] ~= t[0];
- epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
- }
- }
- break;
- }
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
- }
- }
- break;
- }
- break;
- case "comment":
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part);
- }
- }
- break;
+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, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0];
+ break;
+ case "glossary": assert(part == "glossary");
+ t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0];
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ case "bibliography": assert(part == "bibliography");
+ t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0];
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ case "bookindex": assert(part == "bookindex");
+ t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0];
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ case "blurb": assert(part == "blurb");
+ t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0];
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
}
}
- if (obj.metainfo.is_a == "heading") {
- assert(obj.text.length > 0);
- if (obj.metainfo.heading_lev_markup <= 4) {
- oepbs_content_parts["manifest_documents"] ~=
- format(q"┃ <item id="%s.xhtml" href="%s.xhtml" media-type="application/xhtml+xml" />
-┃",
- obj.tags.segment_anchor_tag_epub,
- obj.tags.segment_anchor_tag_epub,
- );
- oepbs_content_parts["spine"] ~=
- format(q"┃ <itemref idref="%s.xhtml" linear="yes" />
-┃",
- obj.tags.segment_anchor_tag_epub,
- );
- oepbs_content_parts["guide"] ~=
- format(q"┃ <reference type="%s" href="%s" />
-┃",
- obj.tags.segment_anchor_tag_epub,
- obj.tags.segment_anchor_tag_epub,
- );
- } else if (obj.metainfo.heading_lev_markup > 4) {
- oepbs_content_parts["manifest_documents"] ~=
- format(q"┃ <item id="%s.xhtml#%s" href="%s.xhtml#%s" media-type="application/xhtml+xml" />
-┃",
- obj.tags.segment_anchor_tag_epub,
- obj.metainfo.object_number,
- obj.tags.segment_anchor_tag_epub,
- obj.metainfo.object_number,
- );
- oepbs_content_parts["spine"] ~=
- format(q"┃ <itemref idref="%s.xhtml#%s" linear="yes" />
-┃",
- obj.tags.segment_anchor_tag_epub,
- obj.metainfo.object_number,
- );
- oepbs_content_parts["guide"] ~=
- format(q"┃ <reference type="%s#%s" href="%s#%s" />
-┃",
- obj.tags.segment_anchor_tag_epub,
- obj.metainfo.object_number,
- obj.tags.segment_anchor_tag_epub,
- obj.metainfo.object_number,
- );
- }
+ 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
+
+****** comment
+
+#+NAME: output_epub3_xhtml_seg_object_is_comment_and_close
+#+BEGIN_SRC d
+ 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
+
+****** heading
+
+#+NAME: output_epub3_xhtml_seg_object_is_heading_set
+#+BEGIN_SRC d
+if (obj.metainfo.is_a == "heading") {
+ assert(obj.text.length > 0);
+ if (obj.metainfo.heading_lev_markup <= 4) {
+ oepbs_content_parts["manifest_documents"] ~=
+ format(q"┃ <item id="%s.xhtml" href="%s.xhtml" media-type="application/xhtml+xml" />
+ ┃",
+ obj.tags.segment_anchor_tag_epub,
+ obj.tags.segment_anchor_tag_epub,
+ );
+ oepbs_content_parts["spine"] ~=
+ format(q"┃ <itemref idref="%s.xhtml" linear="yes" />
+ ┃",
+ obj.tags.segment_anchor_tag_epub,
+ );
+ oepbs_content_parts["guide"] ~=
+ format(q"┃ <reference type="%s" href="%s" />
+ ┃",
+ obj.tags.segment_anchor_tag_epub,
+ obj.tags.segment_anchor_tag_epub,
+ );
+ } else if (obj.metainfo.heading_lev_markup > 4) {
+ oepbs_content_parts["manifest_documents"] ~=
+ format(q"┃ <item id="%s.xhtml#%s" href="%s.xhtml#%s" media-type="application/xhtml+xml" />
+ ┃",
+ obj.tags.segment_anchor_tag_epub,
+ obj.metainfo.object_number,
+ obj.tags.segment_anchor_tag_epub,
+ obj.metainfo.object_number,
+ );
+ oepbs_content_parts["spine"] ~=
+ format(q"┃ <itemref idref="%s.xhtml#%s" linear="yes" />
+ ┃",
+ obj.tags.segment_anchor_tag_epub,
+ obj.metainfo.object_number,
+ );
+ oepbs_content_parts["guide"] ~=
+ format(q"┃ <reference type="%s#%s" href="%s#%s" />
+ ┃",
+ obj.tags.segment_anchor_tag_epub,
+ obj.metainfo.object_number,
+ obj.tags.segment_anchor_tag_epub,
+ obj.metainfo.object_number,
+ );
+ }
#+END_SRC
***** closings & post loop
-#+NAME: output_epub3_xhtml_seg_7
+#+NAME: output_epub3_xhtml_seg_close_ifs_and_write
#+BEGIN_SRC d
}
}
@@ -2962,7 +3020,10 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
** write output files :write:zip:
-#+NAME: output_epub3_xhtml_seg_8
+zip -0 file.epub mimetype && zip -r -9 file.epub META-INF OEBPS
+(mimetypes should be included but should not be zipped)
+
+#+NAME: output_epub3_xhtml_seg_write_output_files
#+BEGIN_SRC d
@system void epub3_write_output_files(W,M)(
W epub_write,
@@ -3158,7 +3219,7 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
** zip debug, read zip archive :zip:
-#+NAME: output_epub3_xhtml_seg_9
+#+NAME: output_epub3_xhtml_seg_debug_extract_zip_dir
#+BEGIN_SRC d
debug(epub_archive) {
if (exists(fn_epub)) {