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_curate_metadata.org | 6 ++-- org/out_latex.org | 34 ++++++++++++------ org/out_metadata.org | 27 +++++++++----- org/out_odt.org | 86 +++++++++++++++++++++++++-------------------- org/out_src_pod.org | 16 +++++---- org/out_xmls.org | 41 +++++++++++++++------ org/output_hub.org | 8 ++--- 7 files changed, 138 insertions(+), 80 deletions(-) (limited to 'org') diff --git a/org/out_curate_metadata.org b/org/out_curate_metadata.org index 9022463..e06ea5c 100644 --- a/org/out_curate_metadata.org +++ b/org/out_curate_metadata.org @@ -452,7 +452,7 @@ foreach(k0; import doc_reform.io_out.paths_output; auto out_pth = spinePathsHTML!()(_make_and_meta_struct.conf.output_path, ""); try { - auto f = File(out_pth.curate("topics.html"), "w"); + auto f = File(out_pth.curate("topics.html"), "w"); foreach (o; topics) { f.writeln(o); } @@ -528,7 +528,7 @@ template spineMetaDocCuratesAuthors() {

⌘ Curated metadata - Authors (output organised by language & filetype)

%s @@ -614,7 +614,7 @@ template spineMetaDocCuratesAuthors() { import doc_reform.io_out.paths_output; auto out_pth = spinePathsHTML!()(_make_and_meta_struct.conf.output_path, ""); try { - auto f = File(out_pth.curate("authors.html"), "w"); + auto f = File(out_pth.curate("authors.html"), "w"); foreach (o; authors) { f.writeln(o); } diff --git a/org/out_latex.org b/org/out_latex.org index adab6e2..d1b6aff 100644 --- a/org/out_latex.org +++ b/org/out_latex.org @@ -203,17 +203,23 @@ void writeOutputLaTeX(T,M)( if (doc_matters.opt.action.vox_gt0) { writeln(" ", pth_latex.latex_file_with_path(paper_size_orientation)); } - auto f = File(pth_latex.latex_file_with_path(paper_size_orientation), "w"); - f.writeln(latex_content.head); - f.writeln(latex_content.content); - f.writeln(latex_content.tail); - foreach (image; doc_matters.srcs.image_list) { - string fn_src_in = doc_matters.src.image_dir_path ~ "/" ~ image; - string fn_src_out_file = pth_latex.latex_path_stuff ~ "/" ~ image; - if (exists(fn_src_in)) { - fn_src_in.copy(fn_src_out_file); + { + auto f = File(pth_latex.latex_file_with_path(paper_size_orientation), "w"); + f.writeln(latex_content.head); + f.writeln(latex_content.content); + f.writeln(latex_content.tail); + foreach (image; doc_matters.srcs.image_list) { + string fn_src_in = doc_matters.src.image_dir_path ~ "/" ~ image; + string fn_src_out_file = pth_latex.latex_path_stuff ~ "/" ~ image; + if (exists(fn_src_in)) { + fn_src_in.copy(fn_src_out_file); + } } } + if (!exists(pth_latex.latex_path_stuff ~ "/index.html")) { + auto f = File(pth_latex.latex_path_stuff ~"/index.html", "w"); + f.writeln(""); + } } catch (ErrnoException ex) { // handle error } @@ -272,8 +278,14 @@ void writeOutputLaTeXstyStatic( if (!exists(pth_latex.base_sty)) { (pth_latex.base_sty).mkdirRecurse; } - auto f = File(pth_latex.latex_document_header_sty(filename), "w"); - f.writeln(latex_sty); + { + auto f = File(pth_latex.latex_document_header_sty(filename), "w"); + f.writeln(latex_sty); + } + if (!exists(pth_latex.base_sty ~ "/index.html")) { + auto f = File(pth_latex.base_sty ~"/index.html", "w"); + f.writeln(""); + } } catch (ErrnoException ex) { // handle error } diff --git a/org/out_metadata.org b/org/out_metadata.org index aa57303..84c374c 100644 --- a/org/out_metadata.org +++ b/org/out_metadata.org @@ -88,12 +88,17 @@ metadata_ ~= format(q"┃ ┃"); metadata_ ~= "
"; if (doc_matters.opt.action.html_link_curate) { - metadata_ ~= format(q"┃

[  ≅ HOME ] ⌘ Curated metadata: - [ Authors ] - [ Topics ]

-┃"); + metadata_ ~= format(q"┃

[  HOME  |  ≅ Collection ]  [ +  🖋 Authors  | +  ⌘ Topics ]

+┃", +(doc_matters.opt.action.webserver_url_doc_root.length > 0) + ? doc_matters.opt.action.webserver_url_doc_root + : doc_matters.conf_make_meta.conf.w_srv_data_root_url + , // HOME index.html equivalent _cfg.www_url_doc_root, +); } else { - metadata_ ~= format(q"┃

[ ≅ HOME ] + metadata_ ~= format(q"┃

[ ≅ HOME   ≅ Collection ] ┃"); } metadata_ ~= "

" ~ inline_search_form(doc_matters) ~ "

"; @@ -265,9 +270,15 @@ metadata_write_output(doc_matters, metadata_); if (!exists(pth_html.base)) { pth_html.base.mkdirRecurse; } - auto f = File(pth_html.fn_scroll("metadata." ~ doc_matters.src.filename), "w"); - foreach (o; metadata_) { - f.writeln(o); + { + auto f = File(pth_html.fn_scroll("metadata." ~ doc_matters.src.filename), "w"); + foreach (o; metadata_) { + f.writeln(o); + } + } + if (!exists(pth_html.base ~ "/index.html")) { + auto f = File(pth_html.base ~"/index.html", "w"); + f.writeln(""); } } catch (ErrnoException ex) { // Handle error 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 diff --git a/org/out_src_pod.org b/org/out_src_pod.org index 9f66c3f..b59b217 100644 --- a/org/out_src_pod.org +++ b/org/out_src_pod.org @@ -143,6 +143,10 @@ if (doc_matters.opt.action.source_or_pod) { pths_pod.doc_lng(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod.mkdirRecurse; } } +if (!exists(pths_pod.pod_dir_() ~ "/index.html")) { + auto f = File(pths_pod.pod_dir_() ~"/index.html", "w"); + f.writeln(""); +} #+END_SRC ** copy :copy: @@ -565,13 +569,13 @@ if (exists(fn_pod)) { # skip .dub/** tmp/** -*_.org -*_.d -*_.txt -*_ -*~ +,*_.org +,*_.d +,*_.txt +,*_ +,*~ \#* -*.\#* +,*.\#* #+END_SRC *** document pod structure diff --git a/org/out_xmls.org b/org/out_xmls.org index d9c4800..febee54 100644 --- a/org/out_xmls.org +++ b/org/out_xmls.org @@ -439,7 +439,7 @@ import ) { string o; string metadata_links = ((doc_matters.opt.action.html_link_curate) - ? format(q"┃

[ ≅ | %s | ◆ |%s%s ⌘• | ⌘A | ⌘T ]

┃", + ? format(q"┃

⟰  [ %s  ◆ %s%s ⌘• ]   ≅ | 🖋 | ⌘ |

┃", (doc_matters.opt.action.webserver_url_doc_root.length > 0) ? doc_matters.opt.action.webserver_url_doc_root : doc_matters.conf_make_meta.conf.w_srv_data_root_url @@ -458,7 +458,7 @@ import ~ doc_matters.src.filename_base ~ "." ~ doc_matters.src.lng - ~ ".a4.portrait.pdf\"> □ |") + ~ ".a4.portrait.pdf\"> □ ") : "", (doc_matters.opt.action.html_link_pdf || doc_matters.opt.action.html_link_pdf_letter) ? (" □ |") + ~ ".letter.portrait.pdf\"> □ ") : "", (type == "seg") ? "../" : "", doc_matters.src.filename_base, (type == "seg") ? "../" : "", (type == "seg") ? "../" : "", + (type == "seg") ? "../" : "", ) : ""); o = format(q"┃ @@ -2007,9 +2008,15 @@ default: if (!exists(pth_html.base)) { pth_html.base.mkdirRecurse; } - auto f = File(pth_html.fn_scroll(doc_matters.src.filename), "w"); - foreach (o; doc) { - f.writeln(o); + { + auto f = File(pth_html.fn_scroll(doc_matters.src.filename), "w"); + foreach (o; doc) { + f.writeln(o); + } + } + if (!exists(pth_html.base ~ "/index.html")) { + auto f = File(pth_html.base ~"/index.html", "w"); + f.writeln(""); } } catch (ErrnoException ex) { // Handle error @@ -2373,10 +2380,16 @@ default: if (!exists(pth_html.css)) { (pth_html.css).mkdirRecurse; } - auto f = File(pth_html.fn_seg_css, "w"); - f.writeln(css.html_seg); - f = File(pth_html.fn_scroll_css, "w"); - f.writeln(css.html_scroll); + { + auto f = File(pth_html.fn_seg_css, "w"); + f.writeln(css.html_seg); + f = File(pth_html.fn_scroll_css, "w"); + f.writeln(css.html_scroll); + } + if (!exists(pth_html.css ~ "/index.html")) { + auto f = File(pth_html.css ~"/index.html", "w"); + f.writeln(""); + } } catch (ErrnoException ex) { // Handle error } @@ -2409,6 +2422,10 @@ default: } } } + if (!exists(pth_html.image ~ "/index.html")) { + auto f = File(pth_html.image ~"/index.html", "w"); + f.writeln(""); + } } } #+END_SRC @@ -3140,6 +3157,10 @@ zip -0 file.epub mimetype && zip -r -9 file.epub META-INF OEBPS if (!exists(pth_epub3.base)) { pth_epub3.base.mkdirRecurse; } + if (!exists(pth_epub3.base ~ "/index.html")) { + auto f = File(pth_epub3.base ~"/index.html", "w"); + f.writeln(""); + } { /+ debug +/ if (doc_matters.opt.action.debug_do_epub) { if (!exists(pth_epub3.dbg_doc_meta_inf(doc_matters.src.filename))) { diff --git a/org/output_hub.org b/org/output_hub.org index 179a008..c4de132 100644 --- a/org/output_hub.org +++ b/org/output_hub.org @@ -81,11 +81,11 @@ template outputHubInitialize() { && !(opt_action.output_dir_set ~ "/index.html").exists ) { writeln(_bespoke_homepage); - if (("./spine-bespoke-output/html/homepage.index.html").exists) { - writeln("copy bespoke html homepage\n./spine-bespoke-output/html/homepage.index.html -> ", opt_action.output_dir_set, "/index.html"); - "./spine-bespoke-output/html/homepage.index.html".copy(opt_action.output_dir_set ~ "/index.html"); + if ((_bespoke_homepage).exists) { + writeln("copy bespoke html homepage\n", _bespoke_homepage, " -> ", opt_action.output_dir_set, "/index.html"); + _bespoke_homepage.copy(opt_action.output_dir_set ~ "/index.html"); } else { - writeln("place bespoke homepage in ./spine-bespoke-output/html/homepage.index.html"); + writeln("place bespoke homepage in ", _bespoke_homepage); } } if ( -- cgit v1.2.3