aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc_reform/source
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2019-10-05 20:45:42 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2019-10-17 19:07:20 -0400
commit1083951efc4f8ddbf8de65907cc5aee2ac6be2ed (patch)
tree0b3f2dd576301a0d15d23c8a0ccc1afff1e86717 /src/doc_reform/source
parent--show-{config,make,metadata,summary} (diff)
0.8.1 conf, make, meta: yaml only (toml removed)doc-reform_v0.8.1
- 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
Diffstat (limited to 'src/doc_reform/source')
-rw-r--r--src/doc_reform/source/read_config_files.d123
-rw-r--r--src/doc_reform/source/read_source_files.d4
2 files changed, 1 insertions, 126 deletions
diff --git a/src/doc_reform/source/read_config_files.d b/src/doc_reform/source/read_config_files.d
index 93f8a35..787f6e0 100644
--- a/src/doc_reform/source/read_config_files.d
+++ b/src/doc_reform/source/read_config_files.d
@@ -4,94 +4,7 @@
meta_config_files.d
+/
module doc_reform.source.read_config_files;
-static template configReadInSiteSTR() {
- import
- doc_reform.meta,
- doc_reform.source.paths_source,
- std.file,
- std.path;
- 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;
- }
-}
-static template configReadInDocSTR() {
- import
- doc_reform.meta,
- doc_reform.source.paths_source,
- std.file,
- std.path;
- 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;
- }
-}
-static template configTOML() {
- import toml; //
- import
- doc_reform.meta,
- doc_reform.source.paths_source,
- std.file,
- std.path;
- 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;
- }
-}
+
static template readConfigSite() {
import
doc_reform.meta.rgx;
@@ -137,8 +50,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;
}
@@ -197,8 +108,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;
}
@@ -236,33 +145,3 @@ static template configReadDocYAML() {
return _yaml_conf;
}
}
-static template configReadSiteTOML() {
- import
- doc_reform.meta,
- doc_reform.source.paths_source,
- std.file,
- std.path;
- 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
- doc_reform.meta,
- doc_reform.source.paths_source,
- std.file,
- std.path;
- 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;
- }
-}
diff --git a/src/doc_reform/source/read_source_files.d b/src/doc_reform/source/read_source_files.d
index 753612e..05f6630 100644
--- a/src/doc_reform/source/read_source_files.d
+++ b/src/doc_reform/source/read_source_files.d
@@ -62,8 +62,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,
@@ -139,8 +137,6 @@ static template DocReformRawMarkupContent() {
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,