diff options
Diffstat (limited to 'src/doc_reform/output/source_pod.d')
-rw-r--r-- | src/doc_reform/output/source_pod.d | 84 |
1 files changed, 60 insertions, 24 deletions
diff --git a/src/doc_reform/output/source_pod.d b/src/doc_reform/output/source_pod.d index 73c8d47..bf07715 100644 --- a/src/doc_reform/output/source_pod.d +++ b/src/doc_reform/output/source_pod.d @@ -91,7 +91,8 @@ template DocReformPod() { zip.addMember(zip_arc_member_file); } } else { - if (doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { writeln("WARNING (io) src out NOT found (image): ", fn_src_in); } } @@ -122,19 +123,19 @@ template DocReformPod() { zip.addMember(zip_arc_member_file); } } else { - if (doc_matters.opt.action.verbose - || doc_matters.opt.action.debug_do) { + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { writeln("WARNING (io) src out NOT found (document make): ", fn_src_in); } } - } { /+ bundle primary file +/ + } { /+ pod manifest +/ auto fn_src_in = doc_matters.src.file_with_absolute_path.to!string; auto fn_src_out_pod_zip_base - = pths_pod.fn_doc(doc_matters.src.filename, doc_matters.src.language).zpod.to!string; + = pths_pod.pod_manifest(doc_matters.src.filename).zpod.to!string; auto fn_src_out_filesystem - = pths_pod.fn_doc(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod.to!string; // without root path: + = pths_pod.pod_manifest(doc_matters.src.filename).filesystem_open_zpod.to!string; // needed without root path auto fn_src_out_inside_pod - = pths_pod.fn_doc(doc_matters.src.filename, doc_matters.src.language).zpod.to!string; // without root path: + = pths_pod.pod_manifest(doc_matters.src.filename).zpod.to!string; // needed without root path string[] filelist_src_out_pod_arr; string[] filelist_src_zpod_arr; if (exists(fn_src_in)) { @@ -143,14 +144,51 @@ template DocReformPod() { } filelist_src_out_pod_arr ~= fn_src_out_pod_zip_base; filelist_src_zpod_arr ~= fn_src_out_inside_pod; - if (doc_matters.opt.action.source) { - auto filelist + { + import dyaml; + auto pod_filelist_yaml_string = File(pths_pod.fn_pod_filelist(doc_matters.src.filename).filesystem_open_zpod, "w"); - foreach (source_pth_and_fn; filelist_src_zpod_arr) { - filelist.writeln(source_pth_and_fn); + Node _pmy; + string _pm = "doc:\n filename: " ~ doc_matters.src.filename ~ "\n language: " ~ doc_matters.pod.manifest_list_of_languages.to!string ~ "\n"; + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + _pmy = Loader.fromString(_pm).load(); + writeln("pod filename: ", _pmy["doc"]["filename"].get!string); + writeln("pod languages: ", doc_matters.pod.manifest_list_of_languages.to!string); + writeln("pod languages: ", doc_matters.src.language); + // foreach(string _l; _pmy["doc"]["language"]) { + // writeln("language: ", _l); + // } } - fn_src_in.copy(fn_src_out_filesystem); + if (doc_matters.opt.action.source) { + pod_filelist_yaml_string.writeln(_pm); + } + if (doc_matters.opt.action.pod) { + auto zip_arc_member_file = new ArchiveMember(); + zip_arc_member_file.name = fn_src_out_pod_zip_base; + auto zip_data = new OutBuffer(); + zip_data.write(_pm); + zip_arc_member_file.expandedData = zip_data.toBytes(); + zip.addMember(zip_arc_member_file); + } + } + } + } { /+ bundle primary file (.ssm/.sst) +/ + auto fn_src_in = doc_matters.src.file_with_absolute_path.to!string; + auto fn_src_out_pod_zip_base + = pths_pod.fn_doc(doc_matters.src.filename, doc_matters.src.language).zpod.to!string; + auto fn_src_out_filesystem + = pths_pod.fn_doc(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod.to!string; // needed without root path: + auto fn_src_out_inside_pod + = pths_pod.fn_doc(doc_matters.src.filename, doc_matters.src.language).zpod.to!string; // needed without root path: + string[] filelist_src_out_pod_arr; + string[] filelist_src_zpod_arr; + if (exists(fn_src_in)) { + debug(io) { + writeln("(io debug) src in found: ", fn_src_in); } + filelist_src_out_pod_arr ~= fn_src_out_pod_zip_base; + filelist_src_zpod_arr ~= fn_src_out_inside_pod; if (doc_matters.opt.action.pod) { auto zip_arc_member_file = new ArchiveMember(); zip_arc_member_file.name = fn_src_out_pod_zip_base; @@ -160,12 +198,12 @@ template DocReformPod() { zip.addMember(zip_arc_member_file); } } else { - if (doc_matters.opt.action.verbose - || doc_matters.opt.action.debug_do) { + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { writeln("WARNING (io) src in NOT found (markup source): ", fn_src_in); } } - } { /+ bundle insert files +/ + } { /+ bundle insert files (.ssi) +/ if (doc_matters.srcs.file_insert_list.length > 0) { foreach (insert_file; doc_matters.srcs.file_insert_list) { debug(pod) { @@ -208,8 +246,8 @@ template DocReformPod() { createZipFile!()(fn_pod, zip.build()); } } else { - if (doc_matters.opt.action.verbose - || doc_matters.opt.action.debug_do) { + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { writeln("WARNING (io) src out NOT found (insert file): ", fn_src_in); } } @@ -230,7 +268,8 @@ template DocReformPod() { } if (exists(fn_pod)) { try { - if (!(doc_matters.opt.action.quiet)) { + if (!(doc_matters.opt.action.quiet) + && doc_matters.opt.action.pod) { auto data = (cast(byte[]) (fn_pod).read); if (doc_matters.opt.action.verbose) { writeln(" ", doc_matters.src.filename, " > "); @@ -244,8 +283,7 @@ template DocReformPod() { auto data = zipped.expand(member); writeln("> ", filename, " length ", data.length); } - } - catch (ZipException ex) { + } catch (ZipException ex) { // Handle errors } if (doc_matters.src.filename == "dr_doc/media/text/en/the_wealth_of_networks.yochai_benkler.sst") { @@ -269,14 +307,12 @@ template DocReformPod() { ); } } - } - catch (ErrnoException ex) { + } catch (ErrnoException ex) { // Handle errors } } - } - catch (ErrnoException ex) { + } catch (ErrnoException ex) { // Handle error } } |