diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2019-09-24 11:13:42 -0400 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2019-10-17 19:07:20 -0400 |
commit | d43281245f1732941228d79663c8e8d3280a972c (patch) | |
tree | 0d0c814b11130e87768791a793204cc3588d8941 /src/doc_reform/meta/metadoc.d | |
parent | flag --show-summary (diff) |
document headers & config: yaml introduced
- as toml alternative
- both toml & yaml (meta, conf, make) work
Diffstat (limited to 'src/doc_reform/meta/metadoc.d')
-rw-r--r-- | src/doc_reform/meta/metadoc.d | 49 |
1 files changed, 35 insertions, 14 deletions
diff --git a/src/doc_reform/meta/metadoc.d b/src/doc_reform/meta/metadoc.d index c597963..9adc0c2 100644 --- a/src/doc_reform/meta/metadoc.d +++ b/src/doc_reform/meta/metadoc.d @@ -11,10 +11,8 @@ template DocReformAbstraction() { doc_reform.meta.metadoc_harvest, doc_reform.meta.metadoc_harvests_authors, doc_reform.meta.metadoc_harvests_topics, - doc_reform.meta.metadoc_summary, doc_reform.meta.metadoc_from_src, doc_reform.meta.conf_make_meta_structs, - doc_reform.meta.conf_make_meta_toml, doc_reform.meta.conf_make_meta_json, doc_reform.meta.defaults, doc_reform.meta.doc_debugs, @@ -28,7 +26,7 @@ template DocReformAbstraction() { mixin DocReformBiblio; mixin DocReformRgxInitFlags; mixin outputHub; - enum headBody { header, body_content, insert_file_list, image_list } + enum headBody { header, body_content, header_type, insert_file_list, image_list } enum makeMeta { make, meta } enum docAbst { doc_abstract_obj, doc_has } static auto rgx = Rgx(); @@ -41,11 +39,23 @@ template DocReformAbstraction() { ConfCompositePlus _make_and_meta_struct; { /+ document config file +/ auto _config_document_struct = readConfigDoc!()(_manifest, _env); - _make_and_meta_struct = _config_document_struct.configParseTOMLreturnDocReformStruct!()(_make_and_meta_struct, _manifest); + if (_config_document_struct.filetype == "yaml") { + import doc_reform.meta.conf_make_meta_yaml; + _make_and_meta_struct = _config_document_struct.configParseYAMLreturnDocReformStruct!()(_make_and_meta_struct, _manifest); + } else if (_config_document_struct.filetype == "toml") { + import doc_reform.meta.conf_make_meta_toml; + _make_and_meta_struct = _config_document_struct.configParseTOMLreturnDocReformStruct!()(_make_and_meta_struct, _manifest); + } } { /+ local site config +/ auto _config_local_site_struct = readConfigSite!()(_manifest, _env); - _make_and_meta_struct = _config_local_site_struct.configParseTOMLreturnDocReformStruct!()(_make_and_meta_struct, _manifest); + if (_config_local_site_struct.filetype == "yaml") { + import doc_reform.meta.conf_make_meta_yaml; + _make_and_meta_struct = _config_local_site_struct.configParseYAMLreturnDocReformStruct!()(_make_and_meta_struct, _manifest); + } else if (_config_local_site_struct.filetype == "toml") { + import doc_reform.meta.conf_make_meta_toml; + _make_and_meta_struct = _config_local_site_struct.configParseTOMLreturnDocReformStruct!()(_make_and_meta_struct, _manifest); + } } /+ ↓ read file (filename with path) +/ /+ ↓ file tuple of header and content +/ @@ -58,7 +68,7 @@ template DocReformAbstraction() { auto _header_body_insertfilelist_imagelist = DocReformRawMarkupContent!()(_opt_action, _manifest.src.path_and_fn); static assert(!isTypeTuple!(_header_body_insertfilelist_imagelist)); - static assert(_header_body_insertfilelist_imagelist.length==4); + static assert(_header_body_insertfilelist_imagelist.length==5); if ((_opt_action.debug_do) || (_opt_action.very_verbose) ) { @@ -73,14 +83,25 @@ template DocReformAbstraction() { if ((_opt_action.debug_do) || (_opt_action.very_verbose) ) { - writeln("step2 commence → (read document header - toml, return struct)"); + writeln("step2 commence → (read document header - yaml or toml, return struct)"); + } + if (_header_body_insertfilelist_imagelist[headBody.header_type] == "toml") { + import doc_reform.meta.conf_make_meta_toml; + _make_and_meta_struct = + docHeaderMakeAndMetaTupTomlExtractAndConvertToStruct!()( + _header_body_insertfilelist_imagelist[headBody.header], + _make_and_meta_struct, + _manifest, + ); + } else if (_header_body_insertfilelist_imagelist[headBody.header_type] == "yaml") { + import doc_reform.meta.conf_make_meta_yaml; + _make_and_meta_struct = + docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct!()( + _header_body_insertfilelist_imagelist[headBody.header], + _make_and_meta_struct, + _manifest, + ); } - _make_and_meta_struct = - docHeaderMakeAndMetaTupTomlExtractAndConvertToStruct!()( - _make_and_meta_struct, - _header_body_insertfilelist_imagelist[headBody.header], - _manifest, - ); if ((_opt_action.debug_do) || (_opt_action.very_verbose) ) { @@ -117,7 +138,7 @@ template DocReformAbstraction() { auto generator_program() { struct Prog_ { string project_name() { - return program_info.project; + return "DocReform"; } string name() { return program_info.name; |