From 9125357297e005a555586c354be18ea03701d342 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 25 Jun 2023 18:18:51 -0400 Subject: replace directory listing, blank index.html --- org/out_odt.org | 86 ++++++++++++++++++++++++++++++++------------------------- 1 file changed, 48 insertions(+), 38 deletions(-) (limited to 'org/out_odt.org') diff --git a/org/out_odt.org b/org/out_odt.org index 170d87e..2f24159 100644 --- a/org/out_odt.org +++ b/org/out_odt.org @@ -927,48 +927,54 @@ void writeOutputODT(W,I)( 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 @@ -1063,6 +1069,10 @@ void dirtree(I)( 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; } #+END_SRC -- cgit v1.2.3