aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sdp/meta
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2018-02-27 15:40:05 -0500
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:14 -0400
commitcf2fd4660ed50da2fbccec7912e429f1d5e37377 (patch)
treef573231485287877c84f4dfb1f0af5275c35b353 /src/sdp/meta
parentplaying with header/make substitutions (diff)
0.25.0 remove sdlang (headers, conf, make doc)
Diffstat (limited to 'src/sdp/meta')
-rw-r--r--src/sdp/meta/conf_make_meta_json.d23
-rw-r--r--src/sdp/meta/conf_make_meta_structs.d6
-rw-r--r--src/sdp/meta/conf_make_meta_toml.d4
-rw-r--r--src/sdp/meta/metadoc.d35
-rw-r--r--src/sdp/meta/read_config_files.d127
-rw-r--r--src/sdp/meta/read_source_files.d1
-rw-r--r--src/sdp/meta/rgx.d1
7 files changed, 36 insertions, 161 deletions
diff --git a/src/sdp/meta/conf_make_meta_json.d b/src/sdp/meta/conf_make_meta_json.d
index 0471dbf..c5585ce 100644
--- a/src/sdp/meta/conf_make_meta_json.d
+++ b/src/sdp/meta/conf_make_meta_json.d
@@ -75,7 +75,28 @@ static template contentJSONtoSiSUstruct() {
_struct_composite.make_str.num_depth = _json.object["num_depth"][""].str;
}
if ("substitute" in _json.object["make"]) {
- _struct_composite.make_str.substitute = _json.object["make"]["substitute"].arrayNoRef;
+ string[][] _sub;
+ if (
+ (_json.object["make"]["substitute"].type().to!string == "ARRAY")
+ && (_json.object["make"]["substitute"][0].type().to!string == "ARRAY")
+ ) {
+ foreach (substitute_pair; _json.object["make"]["substitute"].arrayNoRef) {
+ if ((substitute_pair.type().to!string) == "ARRAY") {
+ if (!empty(substitute_pair[0].str) && !empty(substitute_pair[1].str)) {
+ _sub ~= [ substitute_pair[0].str, substitute_pair[1].str];
+ }
+ }
+ }
+ } else if (
+ (_json.object["make"]["substitute"].type().to!string == "ARRAY")
+ && (_json.object["make"]["substitute"][0].type().to!string == "STRING")
+ ) {
+ if (!empty(_json.object["make"]["substitute"][0].str) && !empty(_json.object["make"]["substitute"][1].str)) {
+ _sub = [[_json.object["make"]["substitute"][0].str, _json.object["make"]["substitute"][1].str]];
+ }
+ }
+ // writeln(_sub);
+ _struct_composite.make_str.substitute = _sub;
}
if ("texpdf_font" in _json.object["make"]) {
_struct_composite.make_str.texpdf_font = _json.object["make"]["texpdf_font"].str;
diff --git a/src/sdp/meta/conf_make_meta_structs.d b/src/sdp/meta/conf_make_meta_structs.d
index 3253b45..88ec9ed 100644
--- a/src/sdp/meta/conf_make_meta_structs.d
+++ b/src/sdp/meta/conf_make_meta_structs.d
@@ -22,7 +22,7 @@ struct ConfCompositeMakeStr {
string italics = "";
string num_top = "";
string num_depth = "";
- JSONValue substitute = JSONValue( ["", ""] );
+ string[][] substitute; // = [["", ""]];
string texpdf_font = "";
}
struct confCompositeMakeBuild {
@@ -98,7 +98,7 @@ struct confCompositeMakeBuild {
auto num_depth(string _mk) {
return _mk;
}
- auto substitute(JSONValue _mk) {
+ auto substitute(string[][] _mk) {
return _mk;
}
auto texpdf_font(string _mk) {
@@ -127,7 +127,7 @@ struct ConfCompositeMakeInit {
auto italics_substitute_html = "<i>$1</i>";
string num_top = "";
string num_depth = "";
- auto substitute = JSONValue(["", ""]);
+ string[][] substitute; // = [["", ""]];
string texpdf_font = "";
}
struct ConfCompositeSiteLocal {
diff --git a/src/sdp/meta/conf_make_meta_toml.d b/src/sdp/meta/conf_make_meta_toml.d
index 4390c5c..d434f00 100644
--- a/src/sdp/meta/conf_make_meta_toml.d
+++ b/src/sdp/meta/conf_make_meta_toml.d
@@ -64,9 +64,7 @@ static template docHeaderMakeAndMetaTupTomlExtractAndConvertToStruct() {
Src header_src,
) {
TOMLDocument _doc;
- if (header_src.match(rgx.sdlang_header_meta_title)) {
- writeln("WARNING >>> document header is sdlang (in wrong location JSON)");
- } else if (header_src.match(rgx.toml_header_meta_title)) {
+ if (header_src.match(rgx.toml_header_meta_title)) {
debug (json) {
writeln(">>> document header is toml, convert to JSON");
}
diff --git a/src/sdp/meta/metadoc.d b/src/sdp/meta/metadoc.d
index 8223029..37545f0 100644
--- a/src/sdp/meta/metadoc.d
+++ b/src/sdp/meta/metadoc.d
@@ -10,7 +10,6 @@ template SiSUabstraction() {
sdp.meta.metadoc_summary,
sdp.meta.metadoc_from_src,
sdp.meta.conf_make_meta_structs,
- sdp.meta.conf_make_meta_sdlang,
sdp.meta.conf_make_meta_toml,
sdp.meta.conf_make_meta_json,
sdp.meta.defaults,
@@ -21,8 +20,6 @@ template SiSUabstraction() {
sdp.output.hub,
sdp.output.paths_source;
mixin SiSUrgxInit;
- mixin SiSUmakeMetaStructsSDLang;
- mixin SiSUextractSDLang;
mixin contentJSONtoSiSUstruct;
mixin SiSUnode;
mixin SiSUbiblio;
@@ -37,22 +34,11 @@ template SiSUabstraction() {
O _opt_action,
M _manifest,
){
- auto _config_document_struct = readConfigDoc!()(_manifest, _env); // document config file
+ auto _config_document_struct = readConfigDoc!()(_manifest, _env); // document config file
auto _config_local_site_struct = readConfigSite!()(_manifest, _env); // local site config
ConfCompositePlus _make_and_meta_struct;
- switch (_config_local_site_struct.filetype) {
- case "toml" :
- _make_and_meta_struct = configParseTOMLreturnSiSUstruct!()(_make_and_meta_struct, _config_document_struct);
- _make_and_meta_struct = configParseTOMLreturnSiSUstruct!()(_make_and_meta_struct, _config_local_site_struct);
- break;
- case "sdl" :
- auto sdl_root_config_document = parseSDLangConfig!()(_config_document_struct.content, _config_document_struct.filename);
- auto sdl_root_config_local_site = parseSDLangConfig!()(_config_local_site_struct.content, _config_local_site_struct.filename);
- _make_and_meta_struct = confFilesSDLtoStruct!()(sdl_root_config_document, sdl_root_config_local_site);
- break;
- default :
- break;
- }
+ _make_and_meta_struct = configParseTOMLreturnSiSUstruct!()(_make_and_meta_struct, _config_document_struct);
+ _make_and_meta_struct = configParseTOMLreturnSiSUstruct!()(_make_and_meta_struct, _config_local_site_struct);
/+ ↓ read file (filename with path) +/
/+ ↓ file tuple of header and content +/
debug(steps) {
@@ -73,18 +59,13 @@ template SiSUabstraction() {
}
/+ ↓ split header into make and meta +/
debug(steps) {
- writeln("step2 commence → (read document header - toml or sdlang, return struct)");
+ writeln("step2 commence → (read document header - toml, return struct)");
}
_make_and_meta_struct =
- ((_header_body_insertfilelist_imagelist[headBody.header]).match(rgx.toml_header_meta_title))
- ? docHeaderMakeAndMetaTupTomlExtractAndConvertToStruct!()(
- _make_and_meta_struct,
- _header_body_insertfilelist_imagelist[headBody.header]
- )
- : docHeaderMakeAndMetaTupSDLangExtractAndConvertToStruct!()(
- _make_and_meta_struct,
- _header_body_insertfilelist_imagelist[headBody.header]
- );
+ docHeaderMakeAndMetaTupTomlExtractAndConvertToStruct!()(
+ _make_and_meta_struct,
+ _header_body_insertfilelist_imagelist[headBody.header]
+ );
debug(steps) {
writeln("- step2 complete");
}
diff --git a/src/sdp/meta/read_config_files.d b/src/sdp/meta/read_config_files.d
index 554f740..74c5a12 100644
--- a/src/sdp/meta/read_config_files.d
+++ b/src/sdp/meta/read_config_files.d
@@ -4,80 +4,6 @@
meta_config_files.d
+/
module sdp.meta.read_config_files;
-static template configReadInSiteSDL() {
- import
- sdp.meta,
- sdp.output.paths_source,
- std.file,
- std.path;
- final string configReadInSiteSDL(M,E)(M manifest, E env) {
- auto conf_file_details = ConfigFilePaths!()(manifest, env);
- string conf_sdl = conf_file_details.config_filename_site_sdl;
- auto 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_sdl);
- writeln("WARNING (io debug) in config possible path locations: ", possible_config_path_locations);
- }
- foreach(pth; possible_config_path_locations) {
- auto conf_file = asNormalizedPath(chainPath(to!string(pth), conf_sdl)).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 configReadInDocSDL() {
- import
- sdp.meta,
- sdp.output.paths_source,
- std.file,
- std.path;
- final string configReadInDocSDL(M,E)(M manifest, E env) {
- auto conf_file_details = ConfigFilePaths!()(manifest, env);
- string conf_sdl = conf_file_details.config_filename_document_sdl;
- auto possible_config_path_locations = conf_file_details.possible_config_path_locations.sisu_document_make;
- string config_file_str;
- debug(io) {
- writeln("WARNING (io debug) in config filename: ", conf_sdl);
- writeln("WARNING (io debug) in config possible path locations: ", possible_config_path_locations);
- }
- foreach(pth; possible_config_path_locations) {
- auto conf_file = asNormalizedPath(chainPath(to!string(pth), conf_sdl)).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 configReadInSiteTOML() {
import
sdp.meta,
@@ -152,25 +78,6 @@ static template configReadInDocTOML() {
return config_file_str;
}
}
-static template configSDLang() {
- import sdlang;
- import
- sdp.meta,
- sdp.output.paths_source,
- std.file,
- std.path;
- auto configSDLang(string configuration, string conf_sdl_filename) {
- Tag sdl_root_conf;
- try {
- sdl_root_conf = parseSource(configuration);
- }
- catch(ParseException e) {
- stderr.writeln("SDLang problem with content for ", conf_sdl_filename);
- stderr.writeln(e.msg);
- }
- return sdl_root_conf;
- }
-}
static template configTOML() {
import toml; //
import
@@ -201,7 +108,7 @@ static template readConfigSite() {
string conf_filename = "NONE";
auto _conf_file_details = ConfigFilePaths!()(_manifest, _env);
auto possible_config_path_locations = _conf_file_details.possible_config_path_locations.config_local_site;
- foreach(conf_fn; [_conf_file_details.config_filename_site_toml, _conf_file_details.config_filename_site_sdl]) {
+ foreach(conf_fn; [_conf_file_details.config_filename_site_toml]) {
foreach(pth; possible_config_path_locations) {
auto conf_file = asNormalizedPath(chainPath(to!string(pth), conf_fn)).array;
conf_filename = conf_fn;
@@ -251,7 +158,7 @@ static template readConfigDoc() {
string conf_filename = "NONE";
auto _conf_file_details = ConfigFilePaths!()(_manifest, _env);
auto possible_config_path_locations = _conf_file_details.possible_config_path_locations.sisu_document_make;
- foreach(conf_fn; [_conf_file_details.config_filename_document_toml, _conf_file_details.config_filename_document_sdl]) {
+ foreach(conf_fn; [_conf_file_details.config_filename_document_toml]) {
foreach(pth; possible_config_path_locations) {
auto conf_file = asNormalizedPath(chainPath(to!string(pth), conf_fn)).array;
conf_filename = conf_fn;
@@ -289,36 +196,6 @@ static template readConfigDoc() {
return _ConfContent();
}
}
-static template configReadSiteSDLang() {
- import
- sdp.meta,
- sdp.output.paths_source,
- std.file,
- std.path;
- import sdlang;
- final auto configReadSiteSDLang(M,E)(M manifest, E env) {
- auto configuration = configReadInSiteSDL!()(manifest, env);
- auto conf_file_details = ConfigFilePaths!()(manifest, env);
- string conf_sdl = conf_file_details.config_filename_site_sdl;
- auto sdl_root = configSDLang!()(configuration, conf_sdl);
- return sdl_root;
- }
-}
-static template configReadDocSDLang() {
- import
- sdp.meta,
- sdp.output.paths_source,
- std.file,
- std.path;
- import sdlang;
- final auto configReadDocSDLang(M,E)(M manifest, E env) {
- auto configuration = configReadInDocSDL!()(manifest, env);
- auto conf_file_details = ConfigFilePaths!()(manifest, env);
- string conf_sdl = conf_file_details.config_filename_document_sdl;
- auto sdl_root = configSDLang!()(configuration, conf_sdl);
- return sdl_root;
- }
-}
static template configReadSiteTOML() {
import
sdp.meta,
diff --git a/src/sdp/meta/read_source_files.d b/src/sdp/meta/read_source_files.d
index cd4a253..5c7d83b 100644
--- a/src/sdp/meta/read_source_files.d
+++ b/src/sdp/meta/read_source_files.d
@@ -155,7 +155,6 @@ static template SiSUrawMarkupContent() {
}
}
struct Inserts {
- import sdp.meta.conf_make_meta_sdlang;
auto scan_subdoc_source(O)(
O _opt_action,
char[][] markup_sourcefile_insert_content,
diff --git a/src/sdp/meta/rgx.d b/src/sdp/meta/rgx.d
index 35d6970..4cc1fe1 100644
--- a/src/sdp/meta/rgx.d
+++ b/src/sdp/meta/rgx.d
@@ -53,7 +53,6 @@ static template SiSUrgxInit() {
static variable_doc_title = ctRegex!(`@title`);
static variable_doc_author = ctRegex!(`@author|@creator`);
static raw_author_munge = ctRegex!(`(\S.+?),\s+(.+)`,"i");
- static sdlang_header_meta_title = ctRegex!(`^\s*title\s+["\\]`, "m");
static toml_header_meta_title = ctRegex!(`^\s*(title\s*=\s*"|\[title\])`, "m");
/+ head +/
static native_subhead_creator = ctRegex!(`^(?:author|translator|illustrator)$`, "m");