aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc_reform/io_out/epub3.d
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2021-08-29 19:06:01 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2021-09-09 22:03:12 -0400
commit2cdc5d2a7c62e54009e915d6f6a9da87905e2699 (patch)
treeacb5e8af2cccc20546effef9722fe5526064f947 /src/doc_reform/io_out/epub3.d
parentconfig nix (diff)
xmls, epub3 toc_nav.xhtml toc.ncx
Diffstat (limited to 'src/doc_reform/io_out/epub3.d')
-rw-r--r--src/doc_reform/io_out/epub3.d297
1 files changed, 170 insertions, 127 deletions
diff --git a/src/doc_reform/io_out/epub3.d b/src/doc_reform/io_out/epub3.d
index 1a8d924..b38fe3e 100644
--- a/src/doc_reform/io_out/epub3.d
+++ b/src/doc_reform/io_out/epub3.d
@@ -63,6 +63,16 @@ template outputEPub3() {
doc_reform.io_out.xmls_css;
mixin InternalMarkup;
mixin outputXHTMLs;
+ static auto rgx = RgxO();
+ @safe string special_characters_text(string _txt) {
+ _txt = _txt
+ .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;
+ }
@safe string epub3_mimetypes() {
string o;
o = format(q"┃application/epub+zip┃") ~ "\n";
@@ -70,7 +80,7 @@ template outputEPub3() {
}
@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>
@@ -83,14 +93,13 @@ template outputEPub3() {
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"?>
+ <package version="3.0" xmlns="http://www.idpf.org/2007/opf" unique-identifier="uid" prefix="rendition: http://www.idpf.org/vocab/rendition/#">
<metadata
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xmlns:dcterms="https://purl.org/dc/terms/"
xmlns:dc="https://purl.org/dc/elements/1.1/"
unique-identifier="urn:uuid:%s" version="2.0">
- <!-- <dc:title id="title">%s</dc:title> -->
<dc:title id="title">%s</dc:title>
<meta refines="#title" property="title-type">main</meta>
<dc:title id="subtitle">%s</dc:title>
@@ -101,18 +110,13 @@ template outputEPub3() {
<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),
@@ -127,13 +131,10 @@ template outputEPub3() {
? "" : 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" />
┃",
@@ -181,88 +182,111 @@ template outputEPub3() {
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;
}
@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,
@@ -281,70 +305,89 @@ template outputEPub3() {
<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;
}
-
@system void outputEPub3(D,I)(
const D doc_abstraction,
I doc_matters,
@@ -400,7 +443,7 @@ template outputEPub3() {
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");
+ 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;
@@ -409,12 +452,12 @@ template outputEPub3() {
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");
+ 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:
- auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "epub");
+ 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;
@@ -438,13 +481,14 @@ template outputEPub3() {
}
} else {
assert(part == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
+ Tuple!(string, string[]) t;
switch (obj.metainfo.is_of_part) {
case "frontmatter": assert(part == "head" || "toc");
switch (obj.metainfo.is_of_type) {
case "para":
switch (obj.metainfo.is_a) {
case "toc":
- auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
+ 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;
@@ -473,7 +517,7 @@ template outputEPub3() {
case "para":
switch (obj.metainfo.is_a) {
case "para":
- auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
+ 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;
@@ -490,24 +534,24 @@ template outputEPub3() {
case "block":
switch (obj.metainfo.is_a) {
case "quote":
- auto t = xhtml_format.quote_seg(_txt, obj, doc_matters, suffix, "epub");
+ 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");
+ 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");
+ 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");
+ 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;
@@ -544,26 +588,26 @@ template outputEPub3() {
case "para":
switch (obj.metainfo.is_a) {
case "endnote": assert(part == "endnotes");
- auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
+ 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");
+ 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");
+ 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");
+ 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");
+ 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;
@@ -604,25 +648,25 @@ template outputEPub3() {
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,
@@ -630,13 +674,13 @@ template outputEPub3() {
);
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,
@@ -858,5 +902,4 @@ template outputEPub3() {
}
}
}
-
}