aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/doc_reform.org
diff options
context:
space:
mode:
Diffstat (limited to 'org/doc_reform.org')
-rw-r--r--org/doc_reform.org89
1 files changed, 55 insertions, 34 deletions
diff --git a/org/doc_reform.org b/org/doc_reform.org
index 62ab9c7..35fe96d 100644
--- a/org/doc_reform.org
+++ b/org/doc_reform.org
@@ -215,10 +215,8 @@ import
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,
@@ -804,8 +802,8 @@ foreach(arg; args[1..$]) {
&& _manifest_start.pod_manifest_file_with_path
&& _opt_action.abstraction
) {
- string contents_location_raw_;
- string contents_location_;
+ string pod_manifest_root_content_paths_to_markup_location_raw_;
+ string markup_contents_location_;
string sisudoc_txt_ = _manifest_start.pod_manifest_file_with_path;
enforce(
exists(sisudoc_txt_)!=0,
@@ -815,39 +813,39 @@ foreach(arg; args[1..$]) {
if (exists(sisudoc_txt_)) {
try {
if (exists(sisudoc_txt_)) {
- contents_location_raw_ = sisudoc_txt_.readText;
+ pod_manifest_root_content_paths_to_markup_location_raw_ = sisudoc_txt_.readText;
}
} catch (ErrnoException ex) {
} catch (FileException ex) {
// Handle errors
}
- if (contents_location_raw_.match(rgx.pod_content_location)) { // (file name followed by language codes \n)+
- foreach (m; contents_location_raw_.matchAll(rgx.pod_content_location)) {
+ if (pod_manifest_root_content_paths_to_markup_location_raw_.match(rgx.pod_content_location)) { // (file name followed by language codes \n)+
+ foreach (m; pod_manifest_root_content_paths_to_markup_location_raw_.matchAll(rgx.pod_content_location)) {
foreach (n; m.captures[2].matchAll(rgx.language_codes)) {
- contents_location_ ~= "media/text/" ~ n.captures[1].to!string ~ "/" ~ m.captures[1].to!string ~ "\n";
+ markup_contents_location_ ~= "media/text/" ~ n.captures[1].to!string ~ "/" ~ m.captures[1].to!string ~ "\n";
}
}
- } else {
- contents_location_ = contents_location_raw_;
+ } else { // (file name with path \n)+
+ markup_contents_location_ = pod_manifest_root_content_paths_to_markup_location_raw_;
}
} else {
writeln("manifest not found: ", sisudoc_txt_);
}
- auto contents_locations_arr
- = (cast(char[]) contents_location_).split;
+ auto markup_contents_locations_arr
+ = (cast(char[]) markup_contents_location_).split;
auto tmp_dir_ = (sisudoc_txt_).dirName.array;
- foreach (contents_location; contents_locations_arr) {
- assert(contents_location.match(rgx.src_pth_sst_or_ssm),
+ foreach (markup_contents_location; markup_contents_locations_arr) {
+ assert(markup_contents_location.match(rgx.src_pth_sst_or_ssm),
"not a recognised file: «" ~
- contents_location ~ "»"
+ markup_contents_location ~ "»"
);
- auto contents_location_pth_ = (contents_location).to!string;
+ auto markup_contents_location_pth_ = (markup_contents_location).to!string;
Regex!(char) lang_rgx_ = regex(r"/(" ~ _opt_action.languages_set.join("|") ~ ")/");
if (_opt_action.languages_set[0] == "all"
- || (contents_location_pth_).match(lang_rgx_)
+ || (markup_contents_location_pth_).match(lang_rgx_)
) {
- auto _fns = (((tmp_dir_).chainPath(contents_location_pth_)).array).to!string;
- _manifest_matter = PathMatters!()(_opt_action, _env, arg, _fns, contents_locations_arr);
+ auto _fns = (((tmp_dir_).chainPath(markup_contents_location_pth_)).array).to!string;
+ _manifest_matter = PathMatters!()(_opt_action, _env, arg, _fns, markup_contents_locations_arr);
_manifests ~= _manifest_matter;
}
}
@@ -868,16 +866,28 @@ foreach(arg; args[1..$]) {
*** config files load & read
-#+NAME: doc_reform_conf_files_in_toml
+#+NAME: doc_reform_conf_files_in_yaml_or_toml
#+BEGIN_SRC d
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);
+ }
}
#+END_SRC
@@ -1046,7 +1056,7 @@ module doc_reform.meta.metadoc;
template DocReformAbstraction() {
<<imports_doc_reform>>
<<doc_reform_mixin>>
- 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();
@@ -1056,7 +1066,7 @@ template DocReformAbstraction() {
O _opt_action,
M _manifest
){
- <<doc_reform_conf_files_in_toml>>
+ <<doc_reform_conf_files_in_yaml_or_toml>>
<<doc_reform_each_file_do_read_and_split_dr_markup_file_content_into_header_and_body>>
<<doc_reform_each_file_do_split_dr_markup_file_header_into_make_and_meta_structs>>
<<doc_reform_each_file_do_document_abstraction>>
@@ -1108,7 +1118,7 @@ if ((_opt_action.debug_do)
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)
) {
@@ -1140,14 +1150,25 @@ debug(header_and_body) {
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)
) {
@@ -1224,7 +1245,7 @@ struct DocumentMatters {
auto generator_program() {
struct Prog_ {
string project_name() {
- return program_info.project;
+ return "DocReform";
}
string name() {
return program_info.name;
@@ -1723,7 +1744,7 @@ provide the result as a single set of make instructions for each document parsed
|---------------------+--------------------------+----------------------------+---------------------+-----------------------------|
| comment, fixed: | per dir (pod) | per dir | per document (pod) | per command instruction |
|---------------------+--------------------------+----------------------------+---------------------+-----------------------------|
-| | sdl_root_config_document | sdl_root_config_local_site | | |
+| | config_document | config_local_site | | |
|---------------------+--------------------------+----------------------------+---------------------+-----------------------------|
| local site specific | | * | | *? |
|---------------------+--------------------------+----------------------------+---------------------+-----------------------------|