aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sdp/output_epub.d
diff options
context:
space:
mode:
Diffstat (limited to 'src/sdp/output_epub.d')
-rw-r--r--src/sdp/output_epub.d32
1 files changed, 13 insertions, 19 deletions
diff --git a/src/sdp/output_epub.d b/src/sdp/output_epub.d
index c7c13ef..4c23600 100644
--- a/src/sdp/output_epub.d
+++ b/src/sdp/output_epub.d
@@ -154,7 +154,6 @@ template outputEPub() {
string[][string] doc_epub;
string[] doc;
string segment_filename;
- string[] seg_filenames;
string[] top_level_headings = ["","","",""];
auto mimetypes = epub_mimetypes;
auto meta_inf_container_xml = epub_container_xml;
@@ -193,7 +192,6 @@ template outputEPub() {
}
break;
case 4:
- seg_filenames ~= obj.segment_anchor_tag;
segment_filename = obj.segment_anchor_tag;
doc_epub[segment_filename] ~= xhtml_format.seg_head(doc_matters.dochead_meta);
foreach (top_level_heading; top_level_headings) {
@@ -307,8 +305,7 @@ template outputEPub() {
}
writeln(doc_matters.keys_seq_seg);
epub_write_output_files(
- doc_matters.source_filename,
- seg_filenames,
+ doc_matters,
doc_epub,
mimetypes,
meta_inf_container_xml,
@@ -316,18 +313,15 @@ template outputEPub() {
oebps_content_opf,
);
}
- void epub_write_output_files(Fn,FnS,De,Mt,Mic,Ot,Oc)(
- Fn fn_src,
- FnS seg_filenames,
- De doc_epub,
+ void epub_write_output_files(C,EpD,Mt,Mic,Ot,Oc)(
+ C doc_matters,
+ EpD doc_epub,
Mt mimetypes,
Mic meta_inf_container_xml,
Ot oebps_toc_ncx,
Oc oebps_content_opf,
) {
debug(asserts){
- static assert(is(typeof(fn_src) == string));
- static assert(is(typeof(seg_filenames) == string[]));
static assert(is(typeof(doc_epub) == string[][string]));
static assert(is(typeof(mimetypes) == string));
static assert(is(typeof(meta_inf_container_xml) == string));
@@ -339,12 +333,12 @@ template outputEPub() {
// doc = xhtml_format.scroll_head ~ doc_epub ~ xhtml_format.tail;
auto xhtml_format = outputXHTMLs();
try {
- mkdirRecurse(pth_epub.doc_meta_inf(fn_src));
- mkdirRecurse(pth_epub.doc_oebps_css(fn_src));
- mkdirRecurse(pth_epub.doc_oebps_image(fn_src));
+ mkdirRecurse(pth_epub.doc_meta_inf(doc_matters.source_filename));
+ mkdirRecurse(pth_epub.doc_oebps_css(doc_matters.source_filename));
+ mkdirRecurse(pth_epub.doc_oebps_image(doc_matters.source_filename));
/+ OEBPS/[segments].xhtml +/
- foreach (seg_filename; seg_filenames) {
- auto f = File(pth_epub.fn_oebps_content_xhtml(fn_src, seg_filename), "w");
+ foreach (seg_filename; doc_matters.segnames) {
+ auto f = File(pth_epub.fn_oebps_content_xhtml(doc_matters.source_filename, seg_filename), "w");
/+ // f.writeln(seg_head); // not needed built and inserted earlier +/
foreach (docseg; doc_epub[seg_filename]) {
f.writeln(docseg);
@@ -352,16 +346,16 @@ template outputEPub() {
f.writeln(xhtml_format.tail); // needed for each lev4
}
/+ mimetypes +/
- auto f = File(pth_epub.fn_mimetypes(fn_src), "w");
+ auto f = File(pth_epub.fn_mimetypes(doc_matters.source_filename), "w");
f.writeln(mimetypes);
/+ META-INF/container.xml +/
- f = File(pth_epub.fn_dmi_container_xml(fn_src), "w");
+ f = File(pth_epub.fn_dmi_container_xml(doc_matters.source_filename), "w");
f.writeln(meta_inf_container_xml);
/+ OEBPS/toc.ncx +/
- f = File(pth_epub.fn_oebps_toc_ncx(fn_src), "w");
+ f = File(pth_epub.fn_oebps_toc_ncx(doc_matters.source_filename), "w");
f.writeln(oebps_toc_ncx);
/+ OEBPS/content.opf +/
- f = File(pth_epub.fn_oebps_content_opf(fn_src), "w");
+ f = File(pth_epub.fn_oebps_content_opf(doc_matters.source_filename), "w");
f.writeln(oebps_content_opf);
}
catch (ErrnoException ex) {