From 17b1e024c33bac309c36f439fe267a384548a8b8 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 1 Dec 2017 11:36:01 -0500 Subject: 0.22.0 document matters & pod matters structs - better integrated, redundancy removed --- org/default_paths.org | 8 ++-- org/output_sisupod.org | 2 +- org/output_sqlite.org | 2 +- org/output_xmls.org | 6 +-- org/sdp.org | 111 ++++++++++++++++++++++++++++--------------------- 5 files changed, 72 insertions(+), 57 deletions(-) (limited to 'org') diff --git a/org/default_paths.org b/org/default_paths.org index b2c1980..99da708 100644 --- a/org/default_paths.org +++ b/org/default_paths.org @@ -79,10 +79,10 @@ template PodManifest() { #+name: template_paths_src #+BEGIN_SRC d -template PodManifestAndSrcFile() { +template PodMatters() { mixin SiSUrgxInit; static auto rgx = Rgx(); - auto PodManifestAndSrcFile(O,E,P,F)( + auto PodMatters(O,E,P,F)( O _opt_actions, E _env, P _pth = "", @@ -90,7 +90,7 @@ template PodManifestAndSrcFile() { char[][] _manifest_fn_list = [[]], ) { auto _manifest = PodManifest!()(_pth); - struct ManifestFilePlus_ { + struct ManifestMatters_ { auto pwd() { return _env["pwd"]; } @@ -175,7 +175,7 @@ template PodManifestAndSrcFile() { return _image_dirs; } } - return ManifestFilePlus_(); + return ManifestMatters_(); } } #+END_SRC diff --git a/org/output_sisupod.org b/org/output_sisupod.org index a267384..deb1c82 100644 --- a/org/output_sisupod.org +++ b/org/output_sisupod.org @@ -61,7 +61,7 @@ debug(asserts) { // static assert(is(typeof(doc_matters) == tuple)); } mixin SiSUoutputRgxInit; -string pwd = doc_matters.environment["pwd"]; +string pwd = doc_matters.environment.pwd; auto src_path_info = doc_matters.src_path_info; auto pth_sisudoc_src = doc_matters.src_path_info; auto pths_sisupod = SiSUpathsSisupods!()(); diff --git a/org/output_sqlite.org b/org/output_sqlite.org index 328af1a..14b6577 100644 --- a/org/output_sqlite.org +++ b/org/output_sqlite.org @@ -467,7 +467,7 @@ auto html_table(O)( #+name: sqlite_db_initialize #+BEGIN_SRC d auto pth_sqlite = SiSUpathsSQLite!()(doc_matters.src_path_info, doc_matters.language); -auto db = Database(pth_sqlite.sqlite_file(doc_matters.environment["pwd"].baseName)); +auto db = Database(pth_sqlite.sqlite_file(doc_matters.environment.pwd.baseName)); // auto db = Database(":memory:"); // open database in memory if (doc_matters.opt_action.sqlite_create) { if ((doc_matters.opt_action.verbose)) { writeln("sqlite create tables... "); } diff --git a/org/output_xmls.org b/org/output_xmls.org index 3f82899..bcf8d8d 100644 --- a/org/output_xmls.org +++ b/org/output_xmls.org @@ -1490,7 +1490,7 @@ void scroll_write_output(M,C)( catch (ErrnoException ex) { // Handle error } - writeln(" ", doc_matters.environment["pwd"], "/", pth_html.fn_scroll(fn_src)); + writeln(" ", doc_matters.environment.pwd, "/", pth_html.fn_scroll(fn_src)); } #+END_SRC @@ -1762,7 +1762,7 @@ void seg_write_output(M,D,E)( catch (ErrnoException ex) { // handle error } - writeln(" ", doc_matters.environment["pwd"], "/", pth_html.fn_seg(doc_matters.source_filename, "toc")); + writeln(" ", doc_matters.environment.pwd, "/", pth_html.fn_seg(doc_matters.source_filename, "toc")); } #+END_SRC @@ -2632,7 +2632,7 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)( catch (ErrnoException ex) { // Handle error } - writeln(" ", doc_matters.environment["pwd"], "/", fn_epub); + writeln(" ", doc_matters.environment.pwd, "/", fn_epub); #+END_SRC ** zip debug, read zip archive diff --git a/org/sdp.org b/org/sdp.org index 32e9833..650fb21 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -26,7 +26,7 @@ struct Version { int minor; int patch; } -enum ver = Version(0, 21, 0); +enum ver = Version(0, 22, 0); #+END_SRC ** compilation restrictions (supported compilers) @@ -486,14 +486,14 @@ auto _env = [ "home" : environment["HOME"], ]; auto _manifest = PodManifest!()(); -auto _manifest_plus = PodManifestAndSrcFile!()(_opt_action, _env); +auto _manifest_plus = PodMatters!()(_opt_action, _env); auto _manifests = [ _manifest_plus ]; foreach(arg; args[1..$]) { _manifest = PodManifest!()(arg); if (arg.match(rgx.flag_action)) { flag_action ~= " " ~ arg; // flags not taken by getopt } else if (arg.match(rgx.src_pth)) { - _manifests ~= PodManifestAndSrcFile!()(_opt_action, _env, arg, arg); // gather input markup source file names for processing + _manifests ~= PodMatters!()(_opt_action, _env, arg, arg); // gather input markup source file names for processing } else if (_manifest.pod_manifest_file_with_path) { string contents_location_raw_; string contents_location_; @@ -536,7 +536,7 @@ foreach(arg; args[1..$]) { || (contents_location_pth_).match(lang_rgx_) ) { auto _fns = (((tmp_dir_).chainPath(contents_location_pth_)).array).to!(string); - _manifest_plus = PodManifestAndSrcFile!()(_opt_action, _env, arg, _fns, contents_locations_arr); + _manifest_plus = PodMatters!()(_opt_action, _env, arg, _fns, contents_locations_arr); _manifests ~= _manifest_plus; // TODO how to capture? } } @@ -805,68 +805,83 @@ debug(steps) { writeln(__LINE__, ":", __FILE__, ": step4 commence → (doc_matters)"); } struct DocumentMatters { - auto keys_seq() { - /+ contains .seg & .scroll sequences +/ - auto _k = _document_section_keys_sequenced; - return _k; - } - string[] segnames() { - string[] _k = _doc_html_segnames; - return _k; - } - string[] segnames_lv_0_to_4() { - string[] _k = _doc_epub_segnames_0_4; - return _k; - } - auto conf_make_meta() { - auto _k = _make_and_meta_struct; - return _k; - } - auto source_filename() { - string _k = _manifest.src_fn; - return _k; - } - auto src_path_info() { - string _pwd = _env["pwd"]; - auto _k = SiSUpathsSRC!()(_pwd, _manifest.src_fn); - return _k; - } auto opt_action() { /+ getopt options, commandline instructions, raw - processing instructions --epub --html etc. - command line config instructions --output-path +/ - auto _k = _opt_action; + return _opt_action; + } + auto conf_make_meta() { // TODO meld with all make instructions + auto _k = _make_and_meta_struct; return _k; } auto environment() { - auto _k = _env; + struct Env_ { + auto pwd() { + return _manifest.pwd; + } + auto home() { + return _manifest.home; + } + } + return Env_(); + } + auto is_pod() { + return _manifest.is_pod; + } + auto source_filename() { + return _manifest.src_fn; + } + auto src_path_info() { // consider, reconsider? + auto _k = SiSUpathsSRC!()(_manifest.pwd, _manifest.src_fn); return _k; } auto language() { - string _k; - if (auto m = (_manifest.src_fn).match(rgx.language_code_and_filename)) { - _k = m.captures[1]; - } else { - _k = "en"; - } - return _k; + return _manifest.src_lng; + } + auto output_path() { + return _manifest.output_path; + } + auto pod_manifest_list_of_filenames() { + return _manifest.pod_manifest_list_of_filenames; + } + auto pod_manifest_list_of_languages() { + return _manifest.pod_manifest_list_of_languages; + } + auto pod_manifest_filename() { + return _manifest.pod_manifest_filename; + } + auto pod_manifest_path() { + return _manifest.pod_manifest_path; + } + auto pod_manifest_file_with_path() { + return _manifest.pod_manifest_file_with_path; + } + auto pod_config_dirs() { + return _manifest.pod_config_dirs; + } + auto pod_image_dirs() { + return _manifest.pod_image_dirs; } auto file_insert_list() { string[] _k = _header_body_inserts[headBody.insert_filelist]; return _k; } - auto pod_manifest() { - /+ extensive information on - - source processing paths - - repetition of opt_action with additional processing, including - - output path if any - +/ - auto _k = _manifest; + auto image_list() { + return _images; + } + auto keys_seq() { + /+ contains .seg & .scroll sequences +/ + auto _k = _document_section_keys_sequenced; return _k; } - auto image_list() { - auto _k = _images; + string[] segnames() { + string[] _k = _doc_html_segnames; + return _k; + } + string[] segnames_lv_0_to_4() { + string[] _k = _doc_epub_segnames_0_4; return _k; } } -- cgit v1.2.3