aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc_reform/io_out/odt.d
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc_reform/io_out/odt.d')
-rw-r--r--src/doc_reform/io_out/odt.d86
1 files changed, 48 insertions, 38 deletions
diff --git a/src/doc_reform/io_out/odt.d b/src/doc_reform/io_out/odt.d
index 8604684..df52149 100644
--- a/src/doc_reform/io_out/odt.d
+++ b/src/doc_reform/io_out/odt.d
@@ -999,6 +999,10 @@ template outputODT() {
if (!exists(pth_odt.base_pth)) {
pth_odt.base_pth.mkdirRecurse;
}
+ if (!exists(pth_odt.base_pth ~ "/index.html")) {
+ auto f = File(pth_odt.base_pth ~"/index.html", "w");
+ f.writeln("");
+ }
// return 0;
}
@safe string mimetype() {
@@ -2049,48 +2053,54 @@ template outputODT() {
if (!exists(pth_odt.base_pth)) { // check
pth_odt.base_pth.mkdirRecurse;
}
- string fn;
- File f;
- { fn = pth_odt.mimetype("zip");
- ODTzip(odt_content.mimetype, fn);
- }
- { fn = pth_odt.manifest_rdf("zip");
- ODTzip(odt_content.manifest_rdf, fn);
- }
- { fn = pth_odt.settings_xml("zip");
- ODTzip(odt_content.settings_xml, fn);
- }
- { fn = pth_odt.styles_xml("zip");
- ODTzip(odt_content.styles_xml, fn);
- }
- { fn = pth_odt.content_xml("zip");
- ODTzip(odt_content.content_xml, fn);
- }
- { fn = pth_odt.manifest_xml("zip");
- ODTzip(odt_content.manifest_xml, fn);
- }
- { fn = pth_odt.meta_xml("zip");
- ODTzip(odt_content.meta_xml, fn);
- }
- { /+ (images) +/
- foreach (image; doc_matters.srcs.image_list) {
- auto fn_src = doc_matters.src.image_dir_path ~ "/" ~ image;
- auto fn_out = pth_odt.image_dir("zip") ~ "/" ~ image;
- if (exists(fn_src)) {
- {
- auto zip_arc_member_file = new ArchiveMember();
- zip_arc_member_file.name = fn_out;
- auto zip_data = new OutBuffer();
- zip_data.write(cast(char[]) ((fn_src).read));
- zip_arc_member_file.expandedData = zip_data.toBytes();
- zip.addMember(zip_arc_member_file);
- createZipFile!()(fn_odt, zip.build());
+ {
+ string fn;
+ File f;
+ { fn = pth_odt.mimetype("zip");
+ ODTzip(odt_content.mimetype, fn);
+ }
+ { fn = pth_odt.manifest_rdf("zip");
+ ODTzip(odt_content.manifest_rdf, fn);
+ }
+ { fn = pth_odt.settings_xml("zip");
+ ODTzip(odt_content.settings_xml, fn);
+ }
+ { fn = pth_odt.styles_xml("zip");
+ ODTzip(odt_content.styles_xml, fn);
+ }
+ { fn = pth_odt.content_xml("zip");
+ ODTzip(odt_content.content_xml, fn);
+ }
+ { fn = pth_odt.manifest_xml("zip");
+ ODTzip(odt_content.manifest_xml, fn);
+ }
+ { fn = pth_odt.meta_xml("zip");
+ ODTzip(odt_content.meta_xml, fn);
+ }
+ { /+ (images) +/
+ foreach (image; doc_matters.srcs.image_list) {
+ auto fn_src = doc_matters.src.image_dir_path ~ "/" ~ image;
+ auto fn_out = pth_odt.image_dir("zip") ~ "/" ~ image;
+ if (exists(fn_src)) {
+ {
+ auto zip_arc_member_file = new ArchiveMember();
+ zip_arc_member_file.name = fn_out;
+ auto zip_data = new OutBuffer();
+ zip_data.write(cast(char[]) ((fn_src).read));
+ zip_arc_member_file.expandedData = zip_data.toBytes();
+ zip.addMember(zip_arc_member_file);
+ createZipFile!()(fn_odt, zip.build());
+ }
}
}
}
+ if (doc_matters.opt.action.vox_gt0) {
+ writeln(" ", pth_odt.odt_file);
+ }
}
- if (doc_matters.opt.action.vox_gt0) {
- writeln(" ", pth_odt.odt_file);
+ if (!exists(pth_odt.base_pth ~ "/index.html")) {
+ auto f = File(pth_odt.base_pth ~"/index.html", "w");
+ f.writeln("");
}
} catch (ErrnoException ex) {
// Handle error