From 1083951efc4f8ddbf8de65907cc5aee2ac6be2ed Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 5 Oct 2019 20:45:42 -0400 Subject: 0.8.1 conf, make, meta: yaml only (toml removed) - yaml only: config, make & headers (yaml is converted directly to struct) - toml removed: preemptively remove confusion of having multiple config formats (toml was converted to json & json to struct) - json removed (intermediate representation): takes out intermediate conversion to json which could be attractive to have if there are multiple formats --- org/source_files_read.org | 135 +--------------------------------------------- 1 file changed, 1 insertion(+), 134 deletions(-) (limited to 'org/source_files_read.org') diff --git a/org/source_files_read.org b/org/source_files_read.org index 6106930..ecf6cc7 100644 --- a/org/source_files_read.org +++ b/org/source_files_read.org @@ -38,11 +38,10 @@ import +/ module doc_reform.source.read_config_files; <> -<> <> #+END_SRC -*** 0. read config files (config_local_site & dr_document_make) (yaml or toml) +*** 0. read config files (config_local_site & dr_document_make) (yaml) **** 1. site configuration #+name: meta_config_file_hub @@ -88,8 +87,6 @@ static template readConfigSite() { string _ft = ""; if (content.match(rgx.yaml_config)) { _ft = "yaml"; - } else if (content.match(rgx.toml_config)) { - _ft = "toml"; } return _ft; } @@ -150,8 +147,6 @@ static template readConfigDoc() { string _ft = ""; if (content.match(rgx.yaml_config)) { _ft = "yaml"; - } else if (content.match(rgx.toml_config)) { - _ft = "toml"; } return _ft; } @@ -161,82 +156,6 @@ static template readConfigDoc() { } #+END_SRC -** A. TOML :toml: -*** 1. TOML read config files (config_local_site & dr_document_make) :file:config: -**** TOML config_local_site - -#+name: meta_config_file_in -#+BEGIN_SRC d -static template configReadInSiteSTR() { - <> - final string configReadInSiteSTR(M,E)(M manifest, E env) { - auto conf_file_details = ConfigFilePaths!()(manifest, env); - string conf_toml = conf_file_details.config_filename_site; - string[] possible_config_path_locations = conf_file_details.possible_config_path_locations.config_local_site; - string config_file_str; - debug(io) { - writeln("WARNING (io debug) in config filename: ", conf_toml); - writeln("WARNING (io debug) in config possible path locations: ", possible_config_path_locations); - } - foreach(pth; possible_config_path_locations) { - auto conf_file = ((chainPath(pth.to!string, conf_toml)).asNormalizedPath).array; - if (config_file_str.length > 0) { - break; - } - try { - if (exists(conf_file)) { - debug(io) { - writeln("WARNING (io debug) in config file found: ", conf_file); - } - config_file_str = conf_file.readText; - break; - } - } catch (ErrnoException ex) { - } catch (FileException ex) { - } - } - return config_file_str; - } -} -#+END_SRC - -**** TOML dr_document_make - -#+name: meta_config_file_in -#+BEGIN_SRC d -static template configReadInDocSTR() { - <> - final string configReadInDocSTR(M,E)(M manifest, E env) { - auto conf_file_details = ConfigFilePaths!()(manifest, env); - string conf_toml = conf_file_details.config_filename_document; - string[] possible_config_path_locations = conf_file_details.possible_config_path_locations.dr_document_make; - string config_file_str; - debug(io) { - writeln("WARNING (io debug) in config filename: ", conf_toml); - writeln("WARNING (io debug) in config possible path locations: ", possible_config_path_locations); - } - foreach(pth; possible_config_path_locations) { - auto conf_file = ((chainPath(pth.to!string, conf_toml)).asNormalizedPath).array; - if (config_file_str.length > 0) { - break; - } - try { - if (exists(conf_file)) { - debug(io) { - writeln("WARNING (io debug) in config file found: ", conf_file); - } - config_file_str = conf_file.readText; - break; - } - } catch (ErrnoException ex) { - } catch (FileException ex) { - } - } - return config_file_str; - } -} -#+END_SRC - *** 2. YAML config files get #+name: meta_config_file_yaml @@ -285,54 +204,6 @@ static template configReadDocYAML() { } #+END_SRC -*** 2. TOML config files get - -#+name: meta_config_file_toml -#+BEGIN_SRC d -static template configTOML() { - import toml; // - <> - TOMLDocument configTOML(string configuration, string conf_toml_filename) { - TOMLDocument _toml_conf; - try { - _toml_conf = parseTOML(configuration); // parseTOML(cast(string)(configuration)); - } catch(ErrnoException e) { - stderr.writeln("Toml problem with content for ", conf_toml_filename); - stderr.writeln(e.msg); - } - return _toml_conf; - } -} -#+END_SRC - -*** 3. TOML config (config_local_site & dr_document_make) :file:config:hub: - -#+name: meta_config_file_hub -#+BEGIN_SRC d -static template configReadSiteTOML() { - <> - import toml; - final TOMLDocument configReadSiteTOML(M,E)(M _manifest, E _env) { - string _configuration = configReadInSiteSTR!()(_manifest, _env); - auto _conf_file_details = ConfigFilePaths!()(_manifest, _env); - string _conf_toml = _conf_file_details.config_filename_site; - TOMLDocument _toml_conf = configTOML!()(_configuration, _conf_toml); - return _toml_conf; - } -} -static template configReadDocTOML() { - <> - import toml; - final TOMLDocument configReadDocTOML(M,E)(M _manifest, E _env) { - string _configuration = configReadInDocSTR!()(_manifest, _env); - auto _conf_file_details = ConfigFilePaths!()(_manifest, _env); - string _conf_toml = _conf_file_details.config_filename_document; - TOMLDocument _toml_conf = configTOML!()(_configuration, _conf_toml); - return _toml_conf; - } -} -#+END_SRC - * B. get _markup source_, read file :module:source_files: ** 0. module template (includes tuple) @@ -397,8 +268,6 @@ static template DocReformRawMarkupContent() { string header_type = ""; if (header_raw.match(rgx.yaml_config)) { header_type = "yaml"; - } else if (header_raw.match(rgx.toml_config)) { - header_type = "toml"; } t = tuple( header_raw, @@ -552,8 +421,6 @@ auto markupSourceHeaderContentRawLineTupleArray(in string source_txt_str) { string header_type = ""; if (header.match(rgx.yaml_config)) { header_type = "yaml"; - } else if (header.match(rgx.toml_config)) { - header_type = "toml"; } auto t = tuple( header, -- cgit v1.2.3