From bdcb9189e4cf221bec1efaf2e6e612b127e51f25 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 6 Jan 2018 20:34:42 -0500 Subject: 0.23.3 work on source & target file paths/locations --- org/sdp.org | 226 +++++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 140 insertions(+), 86 deletions(-) (limited to 'org/sdp.org') diff --git a/org/sdp.org b/org/sdp.org index d874489..799f4ec 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -26,7 +26,7 @@ struct Version { int minor; int patch; } -enum ver = Version(0, 23, 2); +enum ver = Version(0, 23, 3); #+END_SRC ** compilation restrictions (supported compilers) @@ -80,7 +80,7 @@ void main(string[] args) { <> if (_manifests.length > 1) { // _manifests[0] initialized dummy element foreach(manifest; _manifests[1..$]) { - if (!empty(manifest.src_fn)) { + if (!empty(manifest.src.filename)) { <> <> <> @@ -486,7 +486,7 @@ auto _env = [ "home" : environment["HOME"], ]; auto _manifest_start = PodManifest!()(); -auto _manifest_matter = PodMatters!()(_opt_action, _env); +auto _manifest_matter = PathMatters!()(_opt_action, _env); auto _manifests = [ _manifest_matter ]; foreach(arg; args[1..$]) { _manifest_start = PodManifest!()(arg); @@ -523,8 +523,8 @@ foreach(arg; args[1..$]) { } else { // (file name with path \n)+ contents_location_ = contents_location_raw_; } - auto contents_locations_arr = - (cast(char[]) contents_location_).split; + auto contents_locations_arr + = (cast(char[]) contents_location_).split; auto tmp_dir_ = (sisudoc_txt_).dirName.array; foreach (contents_location; contents_locations_arr) { assert(contents_location.match(rgx.src_pth_sst_or_ssm), @@ -537,12 +537,12 @@ foreach(arg; args[1..$]) { || (contents_location_pth_).match(lang_rgx_) ) { auto _fns = (((tmp_dir_).chainPath(contents_location_pth_)).array).to!(string); - _manifest_matter = PodMatters!()(_opt_action, _env, arg, _fns, contents_locations_arr); + _manifest_matter = PathMatters!()(_opt_action, _env, arg, _fns, contents_locations_arr); _manifests ~= _manifest_matter; // TODO how to capture? } } } else if (arg.match(rgx.src_pth_sst_or_ssm)) { - _manifests ~= PodMatters!()(_opt_action, _env, arg, arg); // gather input markup source file names for processing + _manifests ~= PathMatters!()(_opt_action, _env, arg, arg); // gather input markup source file names for processing } else if (arg.match(rgx.src_pth_zip)) { // fns_src ~= arg; // gather input markup source file names for processing } else { // anything remaining, unused @@ -587,14 +587,14 @@ scope(failure) { stderr.writefln( "~ document run failure ~ (%s v%s)\n\t%s", __VENDOR__, __VERSION__, - src_fn + manifest.src.filename ); } } enforce( - manifest.src_fn.match(rgx.src_pth_types), + manifest.src.filename.match(rgx.src_pth_types), "not a sisu markup filename: «" ~ - manifest.src_fn ~ "»" + manifest.src.filename ~ "»" ); #+END_SRC @@ -613,13 +613,13 @@ auto doc_abstraction = t[dAM.abstraction]; auto doc_matters = t[dAM.matters]; #+END_SRC -*** 2. _output processing_ (post abstraction processing) +*** 2. _output processing_ (post abstraction processing) >> **** 0. abstraction _print summary_ :abstraction:summary: #+NAME: sdp_each_file_do_debugs_checkdoc #+BEGIN_SRC d /+ ↓ debugs +/ -if (doc_matters.opt_action.verbose) { +if (doc_matters.opt.action.verbose) { SiSUabstractionSummary!()(doc_abstraction, doc_matters); } #+END_SRC @@ -630,8 +630,8 @@ if (doc_matters.opt_action.verbose) { #+NAME: sdp_each_file_do_debugs_checkdoc #+BEGIN_SRC d /+ ↓ debugs +/ -if ((doc_matters.opt_action.debug_do) -|| (doc_matters.opt_action.verbose) +if ((doc_matters.opt.action.debug_do) +|| (doc_matters.opt.action.verbose) ) { SiSUdebugs!()(doc_abstraction, doc_matters); } @@ -643,7 +643,7 @@ if ((doc_matters.opt_action.debug_do) #+NAME: sdp_each_file_do_selected_output #+BEGIN_SRC d /+ ↓ output hub +/ -if (!(doc_matters.opt_action.skip_output)) { +if (!(doc_matters.opt.action.skip_output)) { outputHub!()(doc_abstraction, doc_matters); } #+END_SRC @@ -656,7 +656,7 @@ scope(exit) { debug(checkdoc) { writefln( "processed file: %s", - manifest.src_fn + manifest.src.filename ); } destroy(manifest); @@ -735,8 +735,8 @@ debug(steps) { ": step1 commence → (get document header & body & insert file list & if needed image list)" ); } -auto _header_body_insertfilelist_imagelist = - SiSUrawMarkupContent!()(_opt_action, _manifest.src_path_and_fn); +auto _header_body_insertfilelist_imagelist + = SiSUrawMarkupContent!()(_opt_action, _manifest.src.path_and_fn); static assert(!isTypeTuple!(_header_body_insertfilelist_imagelist)); static assert(_header_body_insertfilelist_imagelist.length==4); debug(steps) { @@ -770,8 +770,11 @@ debug(steps) { ": step2 commence → (doc header: make & meta as struct)" ); } -auto _make_and_meta_struct = - docHeaderMakeAndMetaTupExtractAndConvertToStruct!()(conf_files_composite_make, _header_body_insertfilelist_imagelist[headBody.header]); // breakage ... +auto _make_and_meta_struct + = docHeaderMakeAndMetaTupExtractAndConvertToStruct!()( + conf_files_composite_make, + _header_body_insertfilelist_imagelist[headBody.header] + ); // breakage ... debug(steps) { writeln(__LINE__, ":", __FILE__, ": step2 complete"); } @@ -825,84 +828,135 @@ debug(steps) { writeln(__LINE__, ":", __FILE__, ": step4 commence → (doc_matters)"); } struct DocumentMatters { - auto opt_action() { - /+ getopt options, commandline instructions, raw - - processing instructions --epub --html etc. - - command line config instructions --output-path - +/ - return _opt_action; - } auto conf_make_meta() { // TODO meld with all make instructions auto _k = _make_and_meta_struct; return _k; } - auto environment() { + auto env() { struct Env_ { auto pwd() { - return _manifest.pwd; + return _manifest.env.pwd; } auto home() { - return _manifest.home; + return _manifest.env.home; } } return Env_(); } - auto is_pod() { - return _manifest.is_pod; - } - auto source_filename() { - return _manifest.src_fn; + auto opt() { + struct Opt_ { + auto action() { + /+ getopt options, commandline instructions, raw + - processing instructions --epub --html etc. + - command line config instructions --output-path + +/ + return _opt_action; + } + } + return Opt_(); } - auto src_path_info() { // consider, reconsider? - auto _k = SiSUpathsSRC!()(_manifest.pwd, _manifest.src_fn); - return _k; + auto src() { + struct SRC_ { + auto is_pod() { + return _manifest.src.is_pod; + } + auto filename() { + return _manifest.src.filename; + } + auto language() { + return _manifest.src.lng; + } + auto path_info() { + auto _k = SiSUpathsSRC!()(_manifest.env.pwd, _manifest.src.file_with_absolute_path); // would like (to have and use) relative path + return _k; + } + auto file_with_absolute_path() { + auto _k = _manifest.src.file_with_absolute_path; + return _k; + } + auto absolute_path_to_src() { + auto _k = _manifest.src.absolute_path_to_src; + return _k; + } + auto base_dir() { + auto _k = _manifest.src.base_dir; + return _k; + } + auto base_parent_dir_path() { + auto _k = _manifest.src.base_parent_dir_path; + return _k; + } + auto base_dir_path() { + auto _k = _manifest.src.base_dir_path; + return _k; + } + auto media_dir_path() { + auto _k = _manifest.src.media_dir_path; + return _k; + } + auto base_parent_dir() { + auto _k = _manifest.src.base_parent_dir; + return _k; + } + auto file_insert_list() { + string[] _k = _header_body_insertfilelist_imagelist[headBody.insert_file_list]; + return _k; + } + auto image_list() { + return _images; + } + } + return SRC_(); } - auto language() { - return _manifest.src_lng; + auto pod() { + struct Pod_ { + auto src_is_pod() { + return _manifest.pod.src_is_pod; + } + auto manifest_list_of_filenames() { + return _manifest.pod.manifest_list_of_filenames; + } + auto manifest_list_of_languages() { + return _manifest.pod.manifest_list_of_languages; + } + auto manifest_filename() { + return _manifest.pod.manifest_filename; + } + auto manifest_path() { + return _manifest.pod.manifest_path; + } + auto manifest_file_with_path() { + return _manifest.pod.manifest_file_with_path; + } + auto config_dirs() { + return _manifest.pod.config_dirs; + } + auto image_dirs() { + return _manifest.pod.image_dirs; + } + } + return Pod_(); + } + auto xml() { + struct XML_ { + 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; + } + } + return XML_(); } 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_insertfilelist_imagelist[headBody.insert_file_list]; - return _k; - } - auto image_list() { - return _images; - } - 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; + return _manifest.output.path; } } auto doc_matters = DocumentMatters(); @@ -919,12 +973,12 @@ module sdp.meta.metadoc_summary; template SiSUabstractionSummary() { auto SiSUabstractionSummary(S,T)( auto return ref const S doc_abstraction, - auto return ref T doc_matters, + auto return ref T doc_matters, ) { <> mixin InternalMarkup; <> - if (doc_matters.opt_action.verbose) { + if (doc_matters.opt.action.verbose) { <> } } @@ -968,7 +1022,7 @@ string[string] check = [ "last_obj_cite_number_body" : "0", "last_obj_cite_number_bkidx" : "0", ]; -foreach (k; doc_matters.keys_seq.seg) { +foreach (k; doc_matters.xml.keys_seq.seg) { foreach (obj; doc_abstraction[k]) { if (obj.of_part != "empty") { if (!empty(obj.obj_cite_number)) { @@ -1004,7 +1058,7 @@ writefln( markup.repeat_character_by_number_provided("-", char_repeat_number), doc_matters.conf_make_meta.meta.title_full, doc_matters.conf_make_meta.meta.creator_author, - doc_matters.source_filename, + doc_matters.src.filename, markup.repeat_character_by_number_provided("-", char_repeat_number), "length toc arr:", to!int(doc_abstraction["toc_seg"].length), -- cgit v1.2.3