diff options
author | Ralph Amissah <ralph@amissah.com> | 2018-02-09 22:03:10 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:14 -0400 |
commit | 1c73ddf3894085c646b55d63e61a2483e03a3b4d (patch) | |
tree | 34e3a837d0e0d224008ff380055ea263a03d3c14 /org/sdp.org | |
parent | paths, further adjustments (diff) |
0.24.0 toml or sdlang for configuration
Diffstat (limited to 'org/sdp.org')
-rw-r--r-- | org/sdp.org | 52 |
1 files changed, 39 insertions, 13 deletions
diff --git a/org/sdp.org b/org/sdp.org index d277ec0..dbc5cda 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -26,7 +26,7 @@ struct Version { int minor; int patch; } -enum ver = Version(0, 23, 3); +enum ver = Version(0, 24, 0); #+END_SRC ** compilation restrictions (supported compilers) @@ -116,10 +116,10 @@ import sdp.meta, sdp.meta.metadoc_summary, sdp.meta.metadoc_from_src, - sdp.meta.conf_make_meta, - // sdp.meta.conf_make_meta_native, + sdp.meta.conf_make_meta_structs, sdp.meta.conf_make_meta_sdlang, - sdp.meta.conf_make_meta_composite, + sdp.meta.conf_make_meta_toml, + sdp.meta.conf_make_meta_json, sdp.meta.defaults, sdp.meta.doc_debugs, sdp.meta.read_config_files, @@ -160,6 +160,10 @@ sdlang.exceptions; std.conv, std.variant, +- https://code.dlang.org/packages/toml +- https://github.com/toml-lang/toml +- https://github.com/toml-lang/toml/blob/master/README.md + **** mixins :mixin: ***** version.txt :version: @@ -179,8 +183,9 @@ mixin CompileTimeInfo; #+NAME: sdp_mixin #+BEGIN_SRC d mixin SiSUrgxInit; -mixin SiSUregisters; +mixin SiSUmakeMetaStructsSDLang; mixin SiSUextractSDLang; +mixin contentJSONtoSiSUstruct; mixin SiSUnode; mixin SiSUbiblio; mixin SiSUrgxInitFlags; @@ -270,6 +275,7 @@ bool[string] opts = [ ]; string[string] settings = [ "output-dir" : "", + "site-config-dir" : "", "lang" : "all", ]; auto helpInfo = getopt(args, @@ -313,6 +319,7 @@ auto helpInfo = getopt(args, "backmatter", "--section-backmatter process document backmatter (default)", &opts["backmatter"], "skip-output", "--skip-output", &opts["skip-output"], "output-dir", "--output-dir=[dir path]", &settings["output-dir"], + "site-config-dir", "--site-config-dir=[dir path]", &settings["site-config-dir"], "lang", "--lang=[lang code e.g. =en or =en,es]", &settings["lang"], ); if (helpInfo.helpWanted) { @@ -522,13 +529,26 @@ foreach(arg; args[1..$]) { } #+END_SRC -**** TODO config files (load & read) (so far only SDLang) :config:files: +**** config files load & read (toml or sdlang) #+NAME: sdp_conf_files #+BEGIN_SRC d -auto sdl_root_config_document = configReadDoc!()(_manifest, _env); // document config file -auto sdl_root_config_local_site = configReadSite!()(_manifest, _env); // local site config -auto conf_files_composite_make = confFilesSDLtoStruct!()(sdl_root_config_document, sdl_root_config_local_site); +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; +} #+END_SRC ** 2a. actions independent of processing files @@ -731,7 +751,8 @@ debug(header_and_body) { } #+END_SRC -** 2. _document metadata_ & _make instructions_ :doc:header:metadata:make: +** 2. _document metadata_ & _make instructions_ (struct from toml or sdlang) >> +header: toml or sdlang - [[./meta_conf_make_meta.org][meta_conf_make_meta]] - read _document header_, split into: @@ -750,9 +771,14 @@ debug(header_and_body) { debug(steps) { writeln("step2 commence → (read document header - toml or sdlang, return struct)"); } -auto _make_and_meta_struct - = docHeaderMakeAndMetaTupExtractAndConvertToStruct!()( - conf_files_composite_make, +_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] ); debug(steps) { |