From 02714184258c9be072857ddcc03bc114b2e843d1 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 22 Oct 2019 19:32:45 -0400 Subject: cosmetic --- src/doc_reform/doc_reform.d | 347 +++++++++++++----------------- src/doc_reform/meta/conf_make_meta_json.d | 4 +- src/doc_reform/meta/conf_make_meta_yaml.d | 22 +- src/doc_reform/meta/metadoc.d | 2 +- src/doc_reform/meta/metadoc_from_src.d | 10 +- src/doc_reform/output/latex.d | 2 +- src/doc_reform/output/paths_output.d | 20 +- src/doc_reform/output/source_pod.d | 4 +- src/doc_reform/output/xmls.d | 22 +- src/doc_reform/source/paths_source.d | 42 ++-- src/doc_reform/source/read_config_files.d | 28 +-- 11 files changed, 225 insertions(+), 278 deletions(-) (limited to 'src/doc_reform') diff --git a/src/doc_reform/doc_reform.d b/src/doc_reform/doc_reform.d index e6a9b59..708c96a 100755 --- a/src/doc_reform/doc_reform.d +++ b/src/doc_reform/doc_reform.d @@ -269,65 +269,31 @@ void main(string[] args) { return opts["epub"]; } bool harvest() { - bool _is = ( - opts["harvest"] - || opts["harvest-authors"] - || opts["harvest-topics"] - ) - ? true : false; - return _is; + return (opts["harvest"] || opts["harvest-authors"] || opts["harvest-topics"]) ? true : false; } bool harvest_authors() { - bool _is = ( - opts["harvest"] - || opts["harvest-authors"] - ) - ? true : false; - return _is; + return (opts["harvest"] || opts["harvest-authors"]) ? true : false; } bool harvest_topics() { - bool _is = ( - opts["harvest"] - || opts["harvest-topics"] - ) - ? true : false; - return _is; + return (opts["harvest"] || opts["harvest-topics"]) ? true : false; } bool html() { - bool _is; - if ( opts["html"] || opts["html-seg"] || opts["html-scroll"]) - { _is = true; } else { _is = false; } - return _is; + return (opts["html"] || opts["html-seg"] || opts["html-scroll"]) ? true : false; } bool html_seg() { - bool _is; - if ( opts["html"] || opts["html-seg"]) - { _is = true; } else { _is = false; } - return _is; + return (opts["html"] || opts["html-seg"]) ? true : false; } bool html_scroll() { - bool _is; - if ( opts["html"] || opts["html-scroll"]) - { _is = true; } else { _is = false; } - return _is; + return (opts["html"] || opts["html-scroll"]) ? true : false; } bool html_stuff() { - bool _is; - if (opts["html"] || opts["html-scroll"] || opts["html-seg"]) - { _is = true; } else { _is = false; } - return _is; + return (opts["html"] || opts["html-scroll"] || opts["html-seg"]) ? true : false; } bool latex() { - bool _is; - if ( opts["latex"] || opts["pdf"]) - { _is = true; } else { _is = false; } - return _is; + return (opts["latex"] || opts["pdf"]) ? true : false; } bool odt() { - bool _is; - if ( opts["odf"] || opts["odt"]) - { _is = true; } else { _is = false; } - return _is; + return (opts["odf"] || opts["odt"]) ? true : false; } bool manifest() { return opts["manifest"]; @@ -366,44 +332,31 @@ void main(string[] args) { return opts["sqlite-discrete"]; } bool sqlite_db_drop() { - bool _is; - if ( opts["sqlite-db-recreate"] || opts["sqlite-db-drop"]) - { _is = true; } else { _is = false; } - return _is; + return (opts["sqlite-db-recreate"] || opts["sqlite-db-drop"]) ? true : false; } bool sqlite_db_create() { - bool _is; - if ( opts["sqlite-db-recreate"] || opts["sqlite-db-create"]) - { _is = true; } else { _is = false; } - return _is; + return (opts["sqlite-db-recreate"] || opts["sqlite-db-create"]) ? true : false; } bool sqlite_delete() { return opts["sqlite-delete"]; } bool sqlite_update() { - bool _is; - if (opts["sqlite-update"] || opts["sqlite-insert"]) - { _is = true; } else { _is = false; } - return _is; + return (opts["sqlite-update"] || opts["sqlite-insert"]) ? true : false; } bool sqlite_shared_db_action() { - bool _is; - if (opts["sqlite-db-recreate"] + return ( + opts["sqlite-db-recreate"] || opts["sqlite-db-create"] || opts["sqlite-delete"] || opts["sqlite-insert"] || opts["sqlite-update"] - ) { _is = true; } else { _is = false; } - return _is; + ) ? true : false; } bool text() { return opts["text"]; } bool verbose() { - bool _is; - if (opts["verbose"] || opts["very-verbose"]) - { _is = true; } else { _is = false; } - return _is; + return (opts["verbose"] || opts["very-verbose"]) ? true : false; } bool very_verbose() { return opts["very-verbose"]; @@ -458,7 +411,8 @@ void main(string[] args) { } else if (opts["parallel"] == false && opts["serial"] == true) { _is = false; - } else if (opts["abstraction"] + } else if ( + opts["abstraction"] || concordance || harvest || html @@ -505,8 +459,8 @@ void main(string[] args) { return schedule.sort().uniq; } bool abstraction() { - bool _is; - if (opts["abstraction"] + return ( + opts["abstraction"] || concordance || source_or_pod || harvest @@ -518,31 +472,28 @@ void main(string[] args) { || sqlite_discrete || sqlite_delete || sqlite_update - ) { _is = true; } else { _is = false; } - return _is; + ) ? true : false; } bool meta_processing_general() { - bool _is; - if (opts["abstraction"] + return ( + opts["abstraction"] || html || epub || odt || latex || sqlite_discrete || sqlite_update - ) { _is = true; } else { _is = false; } - return _is; + ) ? true :false; } bool meta_processing_xml_dom() { - bool _is; - if (opts["abstraction"] + return ( + opts["abstraction"] || html || epub || odt || sqlite_discrete || sqlite_update - ) { _is = true; } else { _is = false; } - return _is; + ) ? true : false; } } auto _opt_action = OptActions(); @@ -576,77 +527,110 @@ void main(string[] args) { "pwd" : environment["PWD"], "home" : environment["HOME"], ]; - auto _manifest_matter = PathMatters!()(_opt_action, _env, ""); - auto _manifests = [ _manifest_matter ]; + auto _manifested = PathMatters!()(_opt_action, _env, ""); + auto _manifests = [ _manifested ]; ConfCompositePlus _make_and_meta_struct_tst; foreach(arg; args[1..$]) { - _manifest_matter = PathMatters!()(_opt_action, _env, arg); // gather input markup source file names for processing - auto _config_local_site_struct = readConfigSite!()(_manifest_matter, _env); - { /+ local site config +/ - if (_config_local_site_struct.filetype == "yaml") { - import doc_reform.meta.conf_make_meta_yaml; - _make_and_meta_struct_tst = _config_local_site_struct.configParseYAMLreturnDocReformStruct!()(_make_and_meta_struct_tst, _manifest_matter); - } - } auto _manifest_start = PodManifest!()(arg); - if (arg.match(rgx.flag_action)) { + if (arg.match(rgx.flag_action)) { /+ cli instruction, flag do +/ flag_action ~= " " ~ arg; // flags not taken by getopt - } else if ( - !(arg.match(rgx.src_pth_sst_or_ssm)) - && _manifest_start.pod_manifest_file_with_path - && _opt_action.abstraction - ) { - string pod_manifest_root_content_paths_to_markup_location_raw_; - string markup_contents_location_; - string sisudoc_txt_ = _manifest_start.pod_manifest_file_with_path; - enforce( - exists(sisudoc_txt_)!=0, - "file not found: «" ~ - sisudoc_txt_ ~ "»" - ); - if (exists(sisudoc_txt_)) { - try { - if (exists(sisudoc_txt_)) { - import dyaml; - try { - Node pod_manifest_yaml = Loader.fromFile(sisudoc_txt_).load(); - if ("doc" in pod_manifest_yaml) { - if (pod_manifest_yaml["doc"].type.mapping - && pod_manifest_yaml["doc"].tag.match(rgx.yaml_tag_is_map) - ) { - if ("path" in pod_manifest_yaml["doc"]) { - if (pod_manifest_yaml["doc"]["path"].tag.match(rgx.yaml_tag_is_seq)) { - foreach (string _path; pod_manifest_yaml["doc"]["path"]) { - markup_contents_location_ ~= _path ~ "\n"; - pod_manifest_root_content_paths_to_markup_location_raw_ ~= - _path ~ "\n"; + } else { /+ cli, assumed to be path to source files +/ + _manifested = PathMatters!()(_opt_action, _env, arg); // gather input markup source file names for processing + auto _config_local_site_struct = readConfigSite!()(_manifested, _env); + { /+ local site config +/ + if (_config_local_site_struct.filetype == "yaml") { + import doc_reform.meta.conf_make_meta_yaml; + _make_and_meta_struct_tst = _config_local_site_struct.configParseYAMLreturnDocReformStruct!()(_make_and_meta_struct_tst, _manifested); + } + } + if ( /+ pod files +/ + !(arg.match(rgx.src_pth_sst_or_ssm)) + && _manifest_start.pod_manifest_file_with_path + && _opt_action.abstraction + ) { + string pod_manifest_root_content_paths_to_markup_location_raw_; + string markup_contents_location_; + string sisudoc_txt_ = _manifest_start.pod_manifest_file_with_path; + enforce( + exists(sisudoc_txt_)!=0, + "file not found: «" ~ + sisudoc_txt_ ~ "»" + ); + if (exists(sisudoc_txt_)) { + try { + if (exists(sisudoc_txt_)) { + import dyaml; + try { + Node pod_manifest_yaml = Loader.fromFile(sisudoc_txt_).load(); + if ("doc" in pod_manifest_yaml) { + if (pod_manifest_yaml["doc"].type.mapping + && pod_manifest_yaml["doc"].tag.match(rgx.yaml_tag_is_map) + ) { + if ("path" in pod_manifest_yaml["doc"]) { + if (pod_manifest_yaml["doc"]["path"].tag.match(rgx.yaml_tag_is_seq)) { + foreach (string _path; pod_manifest_yaml["doc"]["path"]) { + markup_contents_location_ ~= _path ~ "\n"; + pod_manifest_root_content_paths_to_markup_location_raw_ ~= + _path ~ "\n"; + } + } else if ( + pod_manifest_yaml["doc"]["path"].type.string + && pod_manifest_yaml["doc"]["path"].tag.match(rgx.yaml_tag_is_str) + ) { + markup_contents_location_ = pod_manifest_yaml["doc"]["path"].get!string; + pod_manifest_root_content_paths_to_markup_location_raw_ = + pod_manifest_yaml["doc"]["path"].get!string; } - } else if ( - pod_manifest_yaml["doc"]["path"].type.string - && pod_manifest_yaml["doc"]["path"].tag.match(rgx.yaml_tag_is_str) - ) { - markup_contents_location_ = pod_manifest_yaml["doc"]["path"].get!string; - pod_manifest_root_content_paths_to_markup_location_raw_ = - pod_manifest_yaml["doc"]["path"].get!string; } - } - if ("filename" in pod_manifest_yaml["doc"]) { - if (pod_manifest_yaml["doc"]["filename"].tag.match(rgx.yaml_tag_is_seq)) { - foreach (string _filename; pod_manifest_yaml["doc"]["filename"]) { + if ("filename" in pod_manifest_yaml["doc"]) { + if (pod_manifest_yaml["doc"]["filename"].tag.match(rgx.yaml_tag_is_seq)) { + foreach (string _filename; pod_manifest_yaml["doc"]["filename"]) { + if ("language" in pod_manifest_yaml["doc"]) { + if (pod_manifest_yaml["doc"]["language"].tag.match(rgx.yaml_tag_is_seq)) { + foreach (string _lang; pod_manifest_yaml["doc"]["language"]) { + markup_contents_location_ ~= + "media/text/" + ~ _lang ~ "/" + ~ _filename ~ "\n"; + } + } else if (pod_manifest_yaml["doc"]["language"].tag.match(rgx.yaml_tag_is_str) + ) { + markup_contents_location_ = + "media/text/" + ~ pod_manifest_yaml["doc"]["language"].get!string + ~ "/" ~ _filename ~ "\n"; + } else { + string _lang_default = "en"; + markup_contents_location_ ~= + "media/text/" + ~ _lang_default ~ "/" + ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; + } + } else { + string _lang_default = "en"; + markup_contents_location_ ~= + "media/text/" + ~ _lang_default ~ "/" + ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; + } + } + } else if ( + pod_manifest_yaml["doc"]["filename"].type.string + && pod_manifest_yaml["doc"]["filename"].tag.match(rgx.yaml_tag_is_str) + ) { if ("language" in pod_manifest_yaml["doc"]) { if (pod_manifest_yaml["doc"]["language"].tag.match(rgx.yaml_tag_is_seq)) { foreach (string _lang; pod_manifest_yaml["doc"]["language"]) { markup_contents_location_ ~= "media/text/" ~ _lang ~ "/" - ~ _filename ~ "\n"; + ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; } - } else if (pod_manifest_yaml["doc"]["language"].tag.match(rgx.yaml_tag_is_str) - ) { + } else if (pod_manifest_yaml["doc"]["language"].tag.match(rgx.yaml_tag_is_str)) { markup_contents_location_ = "media/text/" ~ pod_manifest_yaml["doc"]["language"].get!string - ~ "/" ~ _filename ~ "\n"; + ~ "/" ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; } else { string _lang_default = "en"; markup_contents_location_ ~= @@ -662,81 +646,50 @@ void main(string[] args) { ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; } } - } else if ( - pod_manifest_yaml["doc"]["filename"].type.string - && pod_manifest_yaml["doc"]["filename"].tag.match(rgx.yaml_tag_is_str) - ) { - if ("language" in pod_manifest_yaml["doc"]) { - if (pod_manifest_yaml["doc"]["language"].tag.match(rgx.yaml_tag_is_seq)) { - foreach (string _lang; pod_manifest_yaml["doc"]["language"]) { - markup_contents_location_ ~= - "media/text/" - ~ _lang ~ "/" - ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; - } - } else if (pod_manifest_yaml["doc"]["language"].tag.match(rgx.yaml_tag_is_str)) { - markup_contents_location_ = - "media/text/" - ~ pod_manifest_yaml["doc"]["language"].get!string - ~ "/" ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; - } else { - string _lang_default = "en"; - markup_contents_location_ ~= - "media/text/" - ~ _lang_default ~ "/" - ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; - } - } else { - string _lang_default = "en"; - markup_contents_location_ ~= - "media/text/" - ~ _lang_default ~ "/" - ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; - } } } } - } - } catch (ErrnoException ex) { + } catch (ErrnoException ex) { + } } + } catch (ErrnoException ex) { + } catch (FileException ex) { + // Handle errors } - } catch (ErrnoException ex) { - } catch (FileException ex) { - // Handle errors + } else { + writeln("manifest not found: ", sisudoc_txt_); } - } else { - writeln("manifest not found: ", sisudoc_txt_); - } - auto markup_contents_locations_arr - = (cast(char[]) markup_contents_location_).split; - auto tmp_dir_ = (sisudoc_txt_).dirName.array; - foreach (markup_contents_location; markup_contents_locations_arr) { - assert(markup_contents_location.match(rgx.src_pth_sst_or_ssm), - "not a recognised file: «" ~ - markup_contents_location ~ "»" - ); - auto markup_contents_location_pth_ = (markup_contents_location).to!string; - Regex!(char) lang_rgx_ = regex(r"/(" ~ _opt_action.languages_set.join("|") ~ ")/"); - if (_opt_action.languages_set[0] == "all" - || (markup_contents_location_pth_).match(lang_rgx_) - ) { - auto _fns = (((tmp_dir_).chainPath(markup_contents_location_pth_)).array).to!string; - _manifest_matter = PathMatters!()(_opt_action, _env, arg, _fns, markup_contents_locations_arr); - _manifests ~= _manifest_matter; + auto markup_contents_locations_arr + = (cast(char[]) markup_contents_location_).split; + auto tmp_dir_ = (sisudoc_txt_).dirName.array; + foreach (markup_contents_location; markup_contents_locations_arr) { + assert(markup_contents_location.match(rgx.src_pth_sst_or_ssm), + "not a recognised file: «" ~ + markup_contents_location ~ "»" + ); + auto markup_contents_location_pth_ = (markup_contents_location).to!string; + Regex!(char) lang_rgx_ = regex(r"/(" ~ _opt_action.languages_set.join("|") ~ ")/"); + if (_opt_action.languages_set[0] == "all" + || (markup_contents_location_pth_).match(lang_rgx_) + ) { + auto _fns = (((tmp_dir_).chainPath(markup_contents_location_pth_)).array).to!string; + _manifested = PathMatters!()(_opt_action, _env, arg, _fns, markup_contents_locations_arr); + _manifests ~= _manifested; + } } + } else if (arg.match(rgx.src_pth_sst_or_ssm)) { /+ markup txt files +/ + if (exists(arg)==0) { + writeln("ERROR >> Processing Skipped! File not found: ", arg); + } else { + _manifested = PathMatters!()(_opt_action, _env, arg, arg); + _manifests ~= _manifested; + } + } else if (arg.match(rgx.src_pth_zip)) { + // fns_src ~= arg; // gather input markup source file names for processing + } else { // anything remaining, unused + arg_unrecognized ~= " " ~ arg; } - } else if (arg.match(rgx.src_pth_sst_or_ssm)) { - if (exists(arg)==0) { - writeln("ERROR >> Processing Skipped! File not found: ", arg); - } else { - _manifest_matter = PathMatters!()(_opt_action, _env, arg, arg); - _manifests ~= _manifest_matter; - } - } else if (arg.match(rgx.src_pth_zip)) { - // fns_src ~= arg; // gather input markup source file names for processing - } else { // anything remaining, unused - arg_unrecognized ~= " " ~ arg; } } if (!(_opt_action.skip_output)) { diff --git a/src/doc_reform/meta/conf_make_meta_json.d b/src/doc_reform/meta/conf_make_meta_json.d index 7ad4744..0a3c4c2 100644 --- a/src/doc_reform/meta/conf_make_meta_json.d +++ b/src/doc_reform/meta/conf_make_meta_json.d @@ -21,7 +21,7 @@ static template contentJSONtoDocReformStruct() { doc_reform.meta.defaults, doc_reform.meta.rgx; ConfCompositePlus _struct_composite; - auto contentJSONtoDocReformStruct(C,J,M)(C _struct_composite, J _json, M _manifest, string _identifier) { + auto contentJSONtoDocReformStruct(C,J,M)(C _struct_composite, J _json, M _manifested, string _identifier) { mixin DocReformRgxInit; static auto rgx = Rgx(); debug (json) { @@ -547,7 +547,7 @@ static template contentJSONtoDocReformStruct() { ) { _struct_composite.meta.date_valid = _json.object["date"]["valid"].str; } - _struct_composite.meta.language_document_char = _manifest.src.language; + _struct_composite.meta.language_document_char = _manifested.src.language; } if ("links" in _json.object) {} if ("notes" in _json.object) { diff --git a/src/doc_reform/meta/conf_make_meta_yaml.d b/src/doc_reform/meta/conf_make_meta_yaml.d index f36a7cf..8b76a3e 100644 --- a/src/doc_reform/meta/conf_make_meta_yaml.d +++ b/src/doc_reform/meta/conf_make_meta_yaml.d @@ -24,14 +24,11 @@ static template contentYAMLtoDocReformStruct() { auto contentYAMLtoDocReformStruct(C,Y,M)( C _struct_composite, Y _yaml, - M _manifest, + M _manifested, string _identifier ) { mixin DocReformRgxInit; static auto rgx = Rgx(); - debug (yaml) { - writeln(">> --------------------------- >>"); - } confCompositeMakeBuild _mk; /+ make ------------------------------------------------------------------- +/ if ("make" in _yaml @@ -238,7 +235,7 @@ static template contentYAMLtoDocReformStruct() { } } if (!(_struct_composite.conf.output_path)) { - _struct_composite.conf.output_path = ((_manifest.output.path).asNormalizedPath).array; + _struct_composite.conf.output_path = ((_manifested.output.path).asNormalizedPath).array; } if ("output" in _yaml && _yaml["output"].type.sequence @@ -250,7 +247,7 @@ static template contentYAMLtoDocReformStruct() { && _yaml["output"]["path"].type.string && _yaml["output"]["path"].tag.match(rgx.yaml_tag_is_str) ) { - if (_manifest.output.path == _manifest.env.pwd + if (_manifested.output.path == _manifested.env.pwd && _yaml["output"]["path"].get!string.length > 0 ) { _struct_composite.conf.output_path = (((_yaml["output"]["path"].get!string).expandTilde).asNormalizedPath).array; @@ -645,7 +642,7 @@ static template contentYAMLtoDocReformStruct() { } } } - _struct_composite.meta.language_document_char = _manifest.src.language; // move + _struct_composite.meta.language_document_char = _manifested.src.language; // move if ("links" in _yaml) { // if ("" in _yaml["links"]) { // _struct_composite.meta.links_ = _yaml["links"][""].str; @@ -782,11 +779,11 @@ static template configParseYAMLreturnDocReformStruct() { auto configParseYAMLreturnDocReformStruct(T,CCm,M)( T _document_struct, CCm _make_and_meta_struct, - M _manifest + M _manifested ){ Node yaml_root = Loader.fromString(_document_struct.content).load(); _make_and_meta_struct - = contentYAMLtoDocReformStruct!()(_make_and_meta_struct, yaml_root, _manifest, _document_struct.filename); // struct from yaml + = contentYAMLtoDocReformStruct!()(_make_and_meta_struct, yaml_root, _manifested, _document_struct.filename); // struct from yaml return _make_and_meta_struct; } } @@ -811,18 +808,15 @@ static template docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct() { auto docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct(CCm,Src,M)( Src header_src, CCm _make_and_meta_struct, - M _manifest, + M _manifested, ) { Node _yaml_root; if (header_src.match(rgx.yaml_header_meta_title)) { - debug (yaml) { - writeln(">>> document header is yaml, consider converting to JSON"); - } import dyaml; _yaml_root = Loader.fromString(header_src).load(); } auto _header_and_make_and_meta_struct - = contentYAMLtoDocReformStruct!()(_make_and_meta_struct, _yaml_root, _manifest, "header"); + = contentYAMLtoDocReformStruct!()(_make_and_meta_struct, _yaml_root, _manifested, "header"); return _header_and_make_and_meta_struct; } } diff --git a/src/doc_reform/meta/metadoc.d b/src/doc_reform/meta/metadoc.d index 115ab9f..69f7142 100644 --- a/src/doc_reform/meta/metadoc.d +++ b/src/doc_reform/meta/metadoc.d @@ -37,7 +37,7 @@ template DocReformAbstraction() { M _manifest ){ ConfCompositePlus _make_and_meta_struct; - { /+ document config file +/ + { /+ document config/make file +/ auto _config_document_struct = readConfigDoc!()(_manifest, _env); if (_config_document_struct.filetype == "yaml") { import doc_reform.meta.conf_make_meta_yaml; diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index ec1e01a..f5e0b81 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -313,7 +313,7 @@ template DocReformDocAbstraction() { char[][] markup_sourcefile_content, CMM conf_make_meta, Opt opt_action, - Mf manifest_matter, + Mf manifested, bool _new_doc ) { static auto rgx = Rgx(); @@ -1777,7 +1777,7 @@ template DocReformDocAbstraction() { return images_; } string[] segnames_0_to_4; - auto _image_dimensions(O,M)(O obj, M manifest_matter) { + auto _image_dimensions(O,M)(O obj, M manifested) { if (obj.has.image_without_dimensions) { import std.math; import imageformats; @@ -1786,9 +1786,9 @@ template DocReformDocAbstraction() { int max_width = 640; foreach (m; obj.text.matchAll(rgx.inline_image_without_dimensions)) { debug(images) { - writeln(manifest_matter.src.image_dir_path ~ "/" ~ m["img"]); + writeln(manifested.src.image_dir_path ~ "/" ~ m["img"]); } - read_image_info(manifest_matter.src.image_dir_path ~ "/" ~ m["img"], w, h, chans); + read_image_info(manifested.src.image_dir_path ~ "/" ~ m["img"], w, h, chans); // calculate, decide max width and proportionally reduce to keep w & h within it debug(images) { writeln("width: ", w, ", height: ", h); @@ -1923,7 +1923,7 @@ template DocReformDocAbstraction() { obj = obj.obj_heading_ancestors(lv_ancestors_txt); } else if (obj.metainfo.is_a == "para") { _images ~= extract_images(obj.text); - obj = _image_dimensions(obj, manifest_matter); + obj = _image_dimensions(obj, manifested); } obj = _links(obj); } diff --git a/src/doc_reform/output/latex.d b/src/doc_reform/output/latex.d index 0444d5b..da509ac 100644 --- a/src/doc_reform/output/latex.d +++ b/src/doc_reform/output/latex.d @@ -1169,7 +1169,7 @@ string table(O,M)( (pth_latex.latex_path_stuff).mkdirRecurse; } if (!(doc_matters.opt.action.quiet)) { - writeln(pth_latex.latex_file_with_path); + writeln(" ", pth_latex.latex_file_with_path); } auto f = File(pth_latex.latex_file_with_path, "w"); f.writeln(latex_content.head); diff --git a/src/doc_reform/output/paths_output.d b/src/doc_reform/output/paths_output.d index 048f9e9..26b3509 100644 --- a/src/doc_reform/output/paths_output.d +++ b/src/doc_reform/output/paths_output.d @@ -139,7 +139,7 @@ template DocReformPathsHTML() { mixin DocReformRgxInit; static auto rgx = Rgx(); auto DocReformPathsHTML()( - string root_pth, + string output_path_root, string lng, ) { auto doc_tree = DocReformDocRootTreeHTML!()(lng); @@ -147,34 +147,34 @@ template DocReformPathsHTML() { string suffix = ".html"; struct _PathsStruct { string doc_root() { - return ((root_pth.chainPath(doc_tree.doc_root)).asNormalizedPath).array; + return ((output_path_root.chainPath(doc_tree.doc_root)).asNormalizedPath).array; } string harvest(string fn_harvest) { return doc_root ~ "/" ~ fn_harvest; } string base() { - return ((root_pth.chainPath(doc_tree.base)).asNormalizedPath).array; + return ((output_path_root.chainPath(doc_tree.base)).asNormalizedPath).array; } string image() { - return ((root_pth.chainPath(doc_tree.image)).asNormalizedPath).array; + return ((output_path_root.chainPath(doc_tree.image)).asNormalizedPath).array; } string css() { - return ((root_pth.chainPath(doc_tree.css)).asNormalizedPath).array; + return ((output_path_root.chainPath(doc_tree.css)).asNormalizedPath).array; } string fn_seg_css() { - return ((root_pth.chainPath(doc_tree.fn_seg_css)).asNormalizedPath).array; + return ((output_path_root.chainPath(doc_tree.fn_seg_css)).asNormalizedPath).array; } string fn_scroll_css() { - return ((root_pth.chainPath(doc_tree.fn_scroll_css)).asNormalizedPath).array; + return ((output_path_root.chainPath(doc_tree.fn_scroll_css)).asNormalizedPath).array; } string seg(string fn_src) { - return ((root_pth.chainPath(doc_tree.seg(fn_src))).asNormalizedPath).array; + return ((output_path_root.chainPath(doc_tree.seg(fn_src))).asNormalizedPath).array; } string fn_scroll(string fn_src) { - return ((root_pth.chainPath(doc_tree.fn_scroll(fn_src))).asNormalizedPath).array; + return ((output_path_root.chainPath(doc_tree.fn_scroll(fn_src))).asNormalizedPath).array; } string fn_seg(string fn_src, string seg_filename) { - return ((root_pth.chainPath(doc_tree.fn_seg(fn_src, seg_filename))).asNormalizedPath).array; + return ((output_path_root.chainPath(doc_tree.fn_seg(fn_src, seg_filename))).asNormalizedPath).array; } string tail_seg(string fn_src) { return doc_tree.tail_seg(fn_src); diff --git a/src/doc_reform/output/source_pod.d b/src/doc_reform/output/source_pod.d index 3b1261b..cff5ba8 100644 --- a/src/doc_reform/output/source_pod.d +++ b/src/doc_reform/output/source_pod.d @@ -184,7 +184,7 @@ template DocReformPod() { } } } { /+ bundle primary file (.ssm/.sst) +/ - auto fn_src_in = doc_matters.src.file_with_absolute_path.to!string; // original source file, inlcudes language code + 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 @@ -328,7 +328,7 @@ template DocReformPod() { writeln(" ", doc_matters.src.filename, " > "); } if (doc_matters.opt.action.pod) { - writefln(" %s\n %s %-(%02x%)", fn_pod, "sha256", data.sha256Of); + writefln(" %s\n %s %-(%02x%)", fn_pod, "sha256", data.sha256Of); } } debug(pod) { diff --git a/src/doc_reform/output/xmls.d b/src/doc_reform/output/xmls.d index 57277b5..f0420fe 100644 --- a/src/doc_reform/output/xmls.d +++ b/src/doc_reform/output/xmls.d @@ -707,17 +707,17 @@ template outputXHTMLs() { %s ┃", - _horizontal_rule, - obj.metainfo.identifier, - (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier), - obj.metainfo.heading_lev_markup, - obj.metainfo.is_a, - obj.metainfo.identifier, - obj.metainfo.identifier, - tags, - heading_lev_anchor_tag, - _txt, - obj.metainfo.heading_lev_markup, + _horizontal_rule, + obj.metainfo.identifier, + (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier), + obj.metainfo.heading_lev_markup, + obj.metainfo.is_a, + obj.metainfo.identifier, + obj.metainfo.identifier, + tags, + heading_lev_anchor_tag, + _txt, + obj.metainfo.heading_lev_markup, ); } else { o = format(q"┃%s diff --git a/src/doc_reform/source/paths_source.d b/src/doc_reform/source/paths_source.d index 86338af..838f114 100644 --- a/src/doc_reform/source/paths_source.d +++ b/src/doc_reform/source/paths_source.d @@ -72,7 +72,7 @@ template PathMatters() { string _fns = "", char[][] _manifest_fn_list = [[]], ) { - auto _manifest = PodManifest!()(_pth); + auto _manifested = PodManifest!()(_pth); struct ManifestMatters_ { auto env() { auto _env = _env; @@ -89,35 +89,35 @@ template PathMatters() { auto opt() { auto _opt_actions = _opt_actions; struct Opt_ { - auto action() { // redundant + auto action() { return _opt_actions; } } return Opt_(); } bool src_is_pod() { - return (_manifest.pod_manifest_path.length > 0) ? true : false; + return (_manifested.pod_manifest_path.length > 0) ? true : false; } auto pod() { struct Pod_ { bool src_is_pod() { - return (_manifest.pod_manifest_path.length > 0) ? true : false; + return (_manifested.pod_manifest_path.length > 0) ? true : false; } auto collection_root() { - auto _collection_root = ((chainPath(_manifest.pod_manifest_path, "..")).asNormalizedPath).array; + auto _collection_root = ((chainPath(_manifested.pod_manifest_path, "..")).asNormalizedPath).array; return _collection_root; } string manifest_filename() { - return _manifest.pod_manifest_filename; + return _manifested.pod_manifest_filename; } string manifest_path() { - return _manifest.pod_manifest_path; + return _manifested.pod_manifest_path; } string pod_name_with_path() { - return _manifest.pod_manifest_path.baseName; + return _manifested.pod_manifest_path.baseName; } string manifest_file_with_path() { - return _manifest.pod_manifest_file_with_path; + return _manifested.pod_manifest_file_with_path; } string[] config_dr_document_make_dirs() { string[] _config_dirs; @@ -154,13 +154,13 @@ template PathMatters() { auto _env = _env; struct SRC_ { bool is_pod() { - return (_manifest.pod_manifest_path.length > 0) ? true : false; + return (_manifested.pod_manifest_path.length > 0) ? true : false; } string path_and_fn() { return _fns; } string pod_name_with_path() { - return (is_pod) ? _manifest.pod_manifest_path : ""; + return (is_pod) ? _manifested.pod_manifest_path : ""; } string pod_name() { return pod_name_with_path.baseName; @@ -392,7 +392,7 @@ template ConfigFilePaths() { mixin DocReformRgxInit; static auto rgx = Rgx(); auto ConfigFilePaths(M,E)( - M _manifest, + M _manifested, E _env, ) { struct ConfFilePaths { @@ -409,17 +409,17 @@ template ConfigFilePaths() { /+ config local site (file system only, not in pod) +/ /+ return paths +/ string[] _possible_config_path_locations; - if (_manifest.src.is_pod) { + if (_manifested.src.is_pod) { /+ config document in pod +/ string _dr_doc_conf_pod; string _dr_doc_conf_pod_text; _dr_doc_conf_pod = asNormalizedPath(chainPath( to!string(_env["pwd"]), - _manifest.pod.manifest_path ~ "/conf" + _manifested.pod.manifest_path ~ "/conf" )).array; _dr_doc_conf_pod_text = asNormalizedPath(chainPath( to!string(_env["pwd"]), - _manifest.pod.manifest_path ~ "/media/text/" ~ _manifest.src.lng ~ "/conf" + _manifested.pod.manifest_path ~ "/media/text/" ~ _manifested.src.lng ~ "/conf" )).array; /+ return paths +/ _possible_config_path_locations = [ @@ -455,9 +455,9 @@ template ConfigFilePaths() { string _dot_home = ((chainPath(to!string(_env["home"]), ".dr")).asNormalizedPath).array; /+ return paths +/ string[] _possible_config_path_locations; - if (_manifest.src.is_pod) { - string _collection_root_a = ((chainPath(to!string(_manifest.pod.collection_root.to!string), ".dr")).asNormalizedPath).array; - string _collection_root_b = ((chainPath(to!string(_manifest.pod.collection_root.to!string), "_dr")).asNormalizedPath).array; + if (_manifested.src.is_pod) { + string _collection_root_a = ((chainPath(to!string(_manifested.pod.collection_root.to!string), ".dr")).asNormalizedPath).array; + string _collection_root_b = ((chainPath(to!string(_manifested.pod.collection_root.to!string), "_dr")).asNormalizedPath).array; _possible_config_path_locations = [ _dot_pwd, _underscore_pwd, @@ -762,9 +762,9 @@ template DocReformPathsPods() { } auto fn_pod_filelist(string fn_src) { auto pod_root_ = pod_root(fn_src); - auto _manifest = PodManifest!()(fn_src).pod_manifest_filename; - auto pth_1_ = _manifest; - auto pth_2_ = ((pod_root(fn_src).filesystem_open_zpod.chainPath(_manifest)).asNormalizedPath).array; + auto _manifested = PodManifest!()(fn_src).pod_manifest_filename; + auto pth_1_ = _manifested; + auto pth_2_ = ((pod_root(fn_src).filesystem_open_zpod.chainPath(_manifested)).asNormalizedPath).array; struct _pods { auto zpod() { return pth_1_; diff --git a/src/doc_reform/source/read_config_files.d b/src/doc_reform/source/read_config_files.d index 6c652fb..4827fff 100644 --- a/src/doc_reform/source/read_config_files.d +++ b/src/doc_reform/source/read_config_files.d @@ -14,11 +14,11 @@ static template readConfigSite() { std.file, std.path; mixin DocReformRgxInit; - final auto readConfigSite(M,E)(M _manifest, E _env) { + final auto readConfigSite(M,E)(M _manifested, E _env) { static auto rgx = Rgx(); string config_file_str; string conf_filename = "NONE"; - auto _conf_file_details = ConfigFilePaths!()(_manifest, _env); + auto _conf_file_details = ConfigFilePaths!()(_manifested, _env); string[] possible_config_path_locations = _conf_file_details.possible_config_path_locations.config_local_site; foreach(conf_fn; [_conf_file_details.config_filename_site]) { foreach(pth; possible_config_path_locations) { @@ -69,11 +69,11 @@ static template readConfigDoc() { std.file, std.path; mixin DocReformRgxInit; - final auto readConfigDoc(M,E)(M _manifest, E _env) { + final auto readConfigDoc(M,E)(M _manifested, E _env) { static auto rgx = Rgx(); string config_file_str; string conf_filename = "NONE"; - auto _conf_file_details = ConfigFilePaths!()(_manifest, _env); + auto _conf_file_details = ConfigFilePaths!()(_manifested, _env); string[] possible_config_path_locations = _conf_file_details.possible_config_path_locations.dr_document_make; foreach(conf_fn; [_conf_file_details.config_filename_document]) { foreach(pth; possible_config_path_locations) { @@ -122,11 +122,11 @@ static template configReadSiteYAML() { std.file, std.path; import dyaml; - final YAMLDocument configReadSiteYAML(M,E)(M _manifest, E _env) { - string _configuration = configReadInSiteYAML!()(_manifest, _env); - auto _conf_file_details = ConfigFilePaths!()(_manifest, _env); - string _conf_yaml = _conf_file_details.config_filename_site; - YAMLDocument _yaml_conf = configYAML!()(_configuration, _conf_yaml); + final YAMLDocument configReadSiteYAML(M,E)(M _manifested, E _env) { + string _configuration = configReadInSiteYAML!()(_manifested, _env); + auto _conf_file_details = ConfigFilePaths!()(_manifested, _env); + string _conf_yaml_fn = _conf_file_details.config_filename_site; + YAMLDocument _yaml_conf = configYAML!()(_configuration, _conf_yaml_fn); return _yaml_conf; } } @@ -136,11 +136,11 @@ static template configReadDocYAML() { doc_reform.source.paths_source, std.file, std.path; - final YAMLDocument configReadDocYAML(M,E)(M _manifest, E _env) { - string _configuration = configReadInDocYAML!()(_manifest, _env); - auto _conf_file_details = ConfigFilePaths!()(_manifest, _env); - string _conf_yaml = _conf_file_details.config_filename_document; - YAMLDocument _yaml_conf = configYAML!()(_configuration, _conf_yaml); + final YAMLDocument configReadDocYAML(M,E)(M _manifested, E _env) { + string _configuration = configReadInDocYAML!()(_manifested, _env); + auto _conf_file_details = ConfigFilePaths!()(_manifested, _env); + string _conf_yaml_fn = _conf_file_details.config_filename_document; + YAMLDocument _yaml_conf = configYAML!()(_configuration, _conf_yaml_fn); return _yaml_conf; } } -- cgit v1.2.3