aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sdp/output/epub3.d
diff options
context:
space:
mode:
Diffstat (limited to 'src/sdp/output/epub3.d')
-rw-r--r--src/sdp/output/epub3.d102
1 files changed, 51 insertions, 51 deletions
diff --git a/src/sdp/output/epub3.d b/src/sdp/output/epub3.d
index 2641784..3c8eb4d 100644
--- a/src/sdp/output/epub3.d
+++ b/src/sdp/output/epub3.d
@@ -31,7 +31,7 @@ template outputEPub3() {
}
string epub3_oebps_content(D,I,P)(D doc_abstraction, I doc_matters, P parts) {
auto xhtml_format = outputXHTMLs();
- auto pth_epub3 = SiSUpathsEPUB!()(doc_matters.output_path, doc_matters.language);
+ auto pth_epub3 = SiSUpathsEPUB!()(doc_matters.output_path, doc_matters.src.language);
string uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO sort uuid in doc_matters!
string content = format(q"¶ <?xml version='1.0' encoding='utf-8'?>
<package xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="EPB-UUID">
@@ -70,7 +70,7 @@ template outputEPub3() {
? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.creator_author),
(doc_matters.conf_make_meta.meta.creator_author.empty)
? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.creator_author),
- doc_matters.language, // language, fix (needed in dochead metadata)
+ doc_matters.src.language, // language, fix (needed in dochead metadata)
(doc_matters.conf_make_meta.meta.date_published.empty)
? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.date_published),
(doc_matters.conf_make_meta.meta.rights_copyright.empty)
@@ -78,17 +78,17 @@ template outputEPub3() {
uuid,
uuid,
uuid,
- (pth_epub3.fn_oebps_css(doc_matters.source_filename)).chompPrefix("OEBPS/"),
+ (pth_epub3.fn_oebps_css(doc_matters.src.filename)).chompPrefix("OEBPS/"),
);
content ~= " " ~ "<!-- Content Documents -->" ~ "\n ";
content ~= parts["manifest_documents"];
// TODO sort jpg & png
content ~= " " ~ "<!-- Images -->" ~ "\n ";
- foreach (image; doc_matters.image_list) {
+ foreach (image; doc_matters.src.image_list) {
content ~= format(q"¶ <item id="%s" href="%s/%s" media-type="image/%s" />
¶",
image.baseName.stripExtension,
- (pth_epub3.doc_oebps_image(doc_matters.source_filename)).chompPrefix("OEBPS/"),
+ (pth_epub3.doc_oebps_image(doc_matters.src.filename)).chompPrefix("OEBPS/"),
image,
image.extension.chompPrefix("."),
);
@@ -102,7 +102,7 @@ template outputEPub3() {
content ~= " " ~ "</guide>" ~ "\n ";
content ~= "" ~ "</package>";
debug(epubmanifest) {
- foreach (s; doc_matters.keys_seq.seg) {
+ foreach (s; doc_matters.xml.keys_seq.seg) {
foreach (obj; doc_abstraction[s]) {
if (obj.is_a == "heading") {
if (obj.heading_lev_markup == 4) {
@@ -144,7 +144,7 @@ template outputEPub3() {
<nav epub:type=\"toc\" id=\"toc\">\n",
doc_matters.conf_make_meta.meta.title_full,
);
- foreach (sect; doc_matters.keys_seq.seg) {
+ foreach (sect; doc_matters.xml.keys_seq.seg) {
foreach (obj; doc_abstraction[sect]) {
if (obj.is_a == "heading") {
string _txt = obj.text.replaceAll(rgx.inline_notes_al_gen, "").strip;
@@ -241,7 +241,7 @@ template outputEPub3() {
(doc_matters.conf_make_meta.meta.creator_author.empty) ? ""
: doc_matters.conf_make_meta.meta.creator_author, // author
);
- foreach (sect; doc_matters.keys_seq.seg) {
+ foreach (sect; doc_matters.xml.keys_seq.seg) {
foreach (obj; doc_abstraction[sect]) {
if (obj.is_a == "heading") {
string _txt = obj.text.replaceAll(rgx.inline_notes_al_gen, "").strip;
@@ -307,7 +307,7 @@ template outputEPub3() {
string[string] oepbs_content_parts;
string suffix = ".xhtml";
string[] doc_parts_;
- foreach (part; doc_matters.keys_seq.seg) {
+ foreach (part; doc_matters.xml.keys_seq.seg) {
foreach (obj; doc_abstraction[part]) {
string _txt = xhtml_format.special_characters(obj, obj.text);
if (obj.is_a == "heading") {
@@ -356,13 +356,13 @@ template outputEPub3() {
doc_epub3_endnotes[segment_filename] ~= t[1];
break;
case 8: .. case 9:
- if ((doc_matters.opt_action.debug_do)) {
+ if ((doc_matters.opt.action.debug_do)) {
writeln(__FILE__, ":", __LINE__, ": ", obj.is_a, ": ", obj.heading_lev_markup);
writeln(__FILE__, ":", __LINE__, ": ", obj.text);
}
break;
default:
- if ((doc_matters.opt_action.debug_do)) {
+ if ((doc_matters.opt.action.debug_do)) {
writeln(__FILE__, ":", __LINE__, ": ", obj.is_a, ": ", obj.heading_lev_markup);
}
break;
@@ -380,14 +380,14 @@ template outputEPub3() {
doc_epub3_endnotes[segment_filename] ~= t[1];
break;
default:
- if ((doc_matters.opt_action.debug_do)) {
+ if ((doc_matters.opt.action.debug_do)) {
writeln(__FILE__, ":", __LINE__, ": ", obj.is_a);
}
break;
}
break;
default:
- if ((doc_matters.opt_action.debug_do)) {
+ if ((doc_matters.opt.action.debug_do)) {
writeln(__FILE__, ":", __LINE__, ": ", obj.is_of);
}
break;
@@ -403,7 +403,7 @@ template outputEPub3() {
doc_epub3_endnotes[segment_filename] ~= t[1];
break;
default:
- if ((doc_matters.opt_action.debug_do)) {
+ if ((doc_matters.opt.action.debug_do)) {
writeln(__FILE__, ":", __LINE__, ": ", obj.is_a);
}
break;
@@ -442,14 +442,14 @@ template outputEPub3() {
doc_epub3_endnotes[segment_filename] ~= t[1];
break;
default:
- if ((doc_matters.opt_action.debug_do)) {
+ if ((doc_matters.opt.action.debug_do)) {
writeln(__FILE__, ":", __LINE__, ": ", obj.is_a);
}
break;
}
break;
default:
- if ((doc_matters.opt_action.debug_do)) {
+ if ((doc_matters.opt.action.debug_do)) {
writeln(__FILE__, ":", __LINE__, ": ", obj.is_of);
}
break;
@@ -485,14 +485,14 @@ template outputEPub3() {
doc_epub3_endnotes[segment_filename] ~= t[1];
break;
default:
- if ((doc_matters.opt_action.debug_do)) {
+ if ((doc_matters.opt.action.debug_do)) {
writeln(__FILE__, ":", __LINE__, ": ", obj.is_a);
}
break;
}
break;
default:
- if ((doc_matters.opt_action.debug_do)) {
+ if ((doc_matters.opt.action.debug_do)) {
writeln(__FILE__, ":", __LINE__, ": ", obj.is_of);
}
break;
@@ -501,7 +501,7 @@ template outputEPub3() {
case "comment":
break;
default:
- if ((doc_matters.opt_action.debug_do)) {
+ if ((doc_matters.opt.action.debug_do)) {
writeln(__FILE__, ":", __LINE__, ": ", obj.of_part);
}
break;
@@ -591,10 +591,10 @@ template outputEPub3() {
static assert(is(typeof(oebps_toc_ncx) == string));
static assert(is(typeof(oebps_content_opf) == string));
}
- auto pth_epub3 = SiSUpathsEPUB!()(doc_matters.output_path, doc_matters.language);
+ auto pth_epub3 = SiSUpathsEPUB!()(doc_matters.output_path, doc_matters.src.language);
auto xhtml_format = outputXHTMLs();
/+ zip file +/
- auto fn_epub = pth_epub3.epub_file(doc_matters.source_filename);
+ auto fn_epub = pth_epub3.epub_file(doc_matters.src.filename);
auto zip = new ZipArchive(); // ZipArchive zip = new ZipArchive();
/+ zip archive member files +/
try {
@@ -602,24 +602,24 @@ template outputEPub3() {
pth_epub3.base.mkdirRecurse;
}
debug(epub_output) {
- if (!exists(pth_epub3.dbg_doc_meta_inf(doc_matters.source_filename))) {
- pth_epub3.dbg_doc_meta_inf(doc_matters.source_filename).mkdirRecurse;
+ if (!exists(pth_epub3.dbg_doc_meta_inf(doc_matters.src.filename))) {
+ pth_epub3.dbg_doc_meta_inf(doc_matters.src.filename).mkdirRecurse;
}
- if (!exists(pth_epub3.dbg_doc_oebps_css(doc_matters.source_filename))) {
- pth_epub3.dbg_doc_oebps_css(doc_matters.source_filename).mkdirRecurse;
+ if (!exists(pth_epub3.dbg_doc_oebps_css(doc_matters.src.filename))) {
+ pth_epub3.dbg_doc_oebps_css(doc_matters.src.filename).mkdirRecurse;
}
- if (!exists(pth_epub3.dbg_doc_oebps_image(doc_matters.source_filename))) {
- pth_epub3.dbg_doc_oebps_image(doc_matters.source_filename).mkdirRecurse;
+ if (!exists(pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename))) {
+ pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename).mkdirRecurse;
}
}
{ /+ OEBPS/[segments].xhtml (the document contents) +/
- foreach (seg_filename; doc_matters.segnames_lv_0_to_4) {
- string fn = pth_epub3.fn_oebps_content_xhtml(doc_matters.source_filename, seg_filename);
+ foreach (seg_filename; doc_matters.xml.segnames_lv_0_to_4) {
+ string fn = pth_epub3.fn_oebps_content_xhtml(doc_matters.src.filename, seg_filename);
auto zip_arc_member_file = new ArchiveMember();
zip_arc_member_file.name = fn;
auto zip_data = new OutBuffer();
debug(epub_output) {
- string fn_dbg = pth_epub3.dbg_fn_oebps_content_xhtml(doc_matters.source_filename, seg_filename);
+ string fn_dbg = pth_epub3.dbg_fn_oebps_content_xhtml(doc_matters.src.filename, seg_filename);
auto f = File(fn_dbg, "w");
}
foreach (docseg; doc_epub3[seg_filename]) {
@@ -643,10 +643,10 @@ template outputEPub3() {
File f;
{ /+ mimetypes (identify zip file type) +/
debug(epub_output) {
- fn_dbg = pth_epub3.dbg_fn_mimetypes(doc_matters.source_filename);
+ fn_dbg = pth_epub3.dbg_fn_mimetypes(doc_matters.src.filename);
File(fn_dbg, "w").writeln(mimetypes);
}
- fn = pth_epub3.fn_mimetypes(doc_matters.source_filename);
+ fn = pth_epub3.fn_mimetypes(doc_matters.src.filename);
auto zip_arc_member_file = new ArchiveMember();
zip_arc_member_file.name = fn;
auto zip_data = new OutBuffer();
@@ -657,10 +657,10 @@ template outputEPub3() {
}
{ /+ META-INF/container.xml (identify doc root) +/
debug(epub_output) {
- fn_dbg = pth_epub3.dbg_fn_dmi_container_xml(doc_matters.source_filename);
+ fn_dbg = pth_epub3.dbg_fn_dmi_container_xml(doc_matters.src.filename);
File(fn_dbg, "w").writeln(meta_inf_container_xml);
}
- fn = pth_epub3.fn_dmi_container_xml(doc_matters.source_filename);
+ fn = pth_epub3.fn_dmi_container_xml(doc_matters.src.filename);
auto zip_arc_member_file = new ArchiveMember();
zip_arc_member_file.name = fn;
auto zip_data = new OutBuffer();
@@ -671,10 +671,10 @@ template outputEPub3() {
}
{ /+ OEBPS/toc_nav.xhtml (navigation toc epub3) +/
debug(epub_output) {
- fn_dbg = pth_epub3.dbg_fn_oebps_toc_nav_xhtml(doc_matters.source_filename);
+ fn_dbg = pth_epub3.dbg_fn_oebps_toc_nav_xhtml(doc_matters.src.filename);
File(fn_dbg, "w").writeln(oebps_toc_nav_xhtml);
}
- fn = pth_epub3.fn_oebps_toc_nav_xhtml(doc_matters.source_filename);
+ fn = pth_epub3.fn_oebps_toc_nav_xhtml(doc_matters.src.filename);
auto zip_arc_member_file = new ArchiveMember();
zip_arc_member_file.name = fn;
auto zip_data = new OutBuffer();
@@ -685,10 +685,10 @@ template outputEPub3() {
}
{ /+ OEBPS/toc.ncx (navigation toc epub2) +/
debug(epub_output) {
- fn_dbg = pth_epub3.dbg_fn_oebps_toc_ncx(doc_matters.source_filename);
+ fn_dbg = pth_epub3.dbg_fn_oebps_toc_ncx(doc_matters.src.filename);
File(fn_dbg, "w").writeln(oebps_toc_ncx);
}
- fn = pth_epub3.fn_oebps_toc_ncx(doc_matters.source_filename);
+ fn = pth_epub3.fn_oebps_toc_ncx(doc_matters.src.filename);
auto zip_arc_member_file = new ArchiveMember();
zip_arc_member_file.name = fn;
auto zip_data = new OutBuffer();
@@ -699,10 +699,10 @@ template outputEPub3() {
}
{ /+ OEBPS/content.opf (doc manifest) +/
debug(epub_output) {
- fn_dbg = pth_epub3.dbg_fn_oebps_content_opf(doc_matters.source_filename);
+ fn_dbg = pth_epub3.dbg_fn_oebps_content_opf(doc_matters.src.filename);
File(fn_dbg, "w").writeln(oebps_content_opf);
}
- fn = pth_epub3.fn_oebps_content_opf(doc_matters.source_filename);
+ fn = pth_epub3.fn_oebps_content_opf(doc_matters.src.filename);
auto zip_arc_member_file = new ArchiveMember();
zip_arc_member_file.name = fn;
auto zip_data = new OutBuffer();
@@ -712,25 +712,25 @@ template outputEPub3() {
createZipFile!()(fn_epub, zip.build());
}
{ /+ OEBPS/_sisu/image (images) +/
- foreach (image; doc_matters.image_list) {
+ foreach (image; doc_matters.src.image_list) {
debug(epub_output) {
- if (exists(doc_matters.src_path_info.image_root ~ "/" ~ image)) {
- (doc_matters.src_path_info.image_root ~ "/" ~ image)
- .copy((pth_epub3.dbg_doc_oebps_image(doc_matters.source_filename)) ~ "/" ~ image);
+ if (exists(doc_matters.src.path_info.image_root ~ "/" ~ image)) {
+ (doc_matters.src.path_info.image_root ~ "/" ~ image)
+ .copy((pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename)) ~ "/" ~ image);
}
}
}
- foreach (image; doc_matters.image_list) {
+ foreach (image; doc_matters.src.image_list) {
debug(epub_output) {
debug(epub_images) {
writeln(
- doc_matters.src_path_info.image_root, image, " -> ",
- pth_epub3.dbg_doc_oebps_image(doc_matters.source_filename), "/", image
+ doc_matters.src.path_info.image_root, image, " -> ",
+ pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename), "/", image
);
}
}
- auto fn_src = doc_matters.src_path_info.image_root ~ image;
- auto fn_out = pth_epub3.doc_oebps_image(doc_matters.source_filename).to!string ~ "/" ~ image;
+ auto fn_src = doc_matters.src.path_info.image_root ~ image;
+ auto fn_out = pth_epub3.doc_oebps_image(doc_matters.src.filename).to!string ~ "/" ~ image;
if (exists(fn_src)) {
{
auto zip_arc_member_file = new ArchiveMember();
@@ -747,10 +747,10 @@ template outputEPub3() {
{ /+ OEBPS/epub.css +/
auto css = SiSUcss();
debug(epub_output) {
- fn_dbg = pth_epub3.dbg_fn_oebps_css(doc_matters.source_filename);
+ fn_dbg = pth_epub3.dbg_fn_oebps_css(doc_matters.src.filename);
File(fn_dbg, "w").writeln(css.epub_css);
}
- fn = pth_epub3.fn_oebps_css(doc_matters.source_filename);
+ fn = pth_epub3.fn_oebps_css(doc_matters.src.filename);
auto zip_arc_member_file = new ArchiveMember();
zip_arc_member_file.name = fn;
auto zip_data = new OutBuffer();