diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2019-10-09 15:21:34 -0400 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2019-10-17 19:07:20 -0400 |
commit | 433f0b2ed0f9d5461c0fdf2b49e41eb26802cc2e (patch) | |
tree | 6f8855ab401dc146161ac104608828a3e302f57a /org/output_src_pod.org | |
parent | 0.8.1 conf, make, meta: yaml only (toml removed) (diff) |
0.8.2 yaml pod.manifest, read site config first
- yaml (configuration & metadata)
site config,
pod:
pod.manifest,
doc header:
make,
meta
- pod.manifest in yaml breaks
- older program reading new pod and
- newer program reading old pod
- read config first,
- get site default language in case it is absent
in pod.manifest
- ensure config is not read too many times
(it is at present, revisit)
Diffstat (limited to 'org/output_src_pod.org')
-rw-r--r-- | org/output_src_pod.org | 91 |
1 files changed, 65 insertions, 26 deletions
diff --git a/org/output_src_pod.org b/org/output_src_pod.org index 1fd6f6c..1e61c72 100644 --- a/org/output_src_pod.org +++ b/org/output_src_pod.org @@ -31,15 +31,15 @@ template DocReformPod() { <<source_pod_mkdirs>> <<source_pod_copy>> <<source_pod_zip>> - } - catch (ErrnoException ex) { + } catch (ErrnoException ex) { // Handle error } } } #+END_SRC -** imports +** init +*** imports #+name: output_imports #+BEGIN_SRC d @@ -55,7 +55,7 @@ import doc_reform.output.xmls; #+END_SRC -** mkdir :mkdir: +*** init #+name: source_pod_init #+BEGIN_SRC d @@ -73,6 +73,8 @@ static auto rgx = Rgx(); assert (doc_matters.src.filename.match(rgx.src_fn)); #+END_SRC +** mkdir :mkdir: + #+name: source_pod_mkdirs #+BEGIN_SRC d /+ create directory structure +/ @@ -148,7 +150,8 @@ auto fn_pod = pths_pod.pod_filename(doc_matters.src.filename).zpod; 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); } } @@ -179,19 +182,19 @@ auto fn_pod = pths_pod.pod_filename(doc_matters.src.filename).zpod; 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)) { @@ -200,14 +203,51 @@ auto fn_pod = pths_pod.pod_filename(doc_matters.src.filename).zpod; } 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); + // } + } + 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); } - fn_src_in.copy(fn_src_out_filesystem); } + } +} { /+ 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; @@ -217,12 +257,12 @@ auto fn_pod = pths_pod.pod_filename(doc_matters.src.filename).zpod; 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) { @@ -265,8 +305,8 @@ auto fn_pod = pths_pod.pod_filename(doc_matters.src.filename).zpod; 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); } } @@ -293,7 +333,8 @@ auto fn_pod = pths_pod.pod_filename(doc_matters.src.filename).zpod; #+BEGIN_SRC d 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, " > "); @@ -307,8 +348,7 @@ if (exists(fn_pod)) { 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") { @@ -332,8 +372,7 @@ if (exists(fn_pod)) { ); } } - } - catch (ErrnoException ex) { + } catch (ErrnoException ex) { // Handle errors } } |