aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2019-06-08 14:15:46 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2019-10-17 19:07:20 -0400
commit81a26c19c55a98918cf433da2f867db6b693b6df (patch)
treec0d998d51aa040b450215be5949b716cc49e560f /src
parent0.7.3 start to look at document harvest (initial stub) (diff)
harvest, document reporting
Diffstat (limited to 'src')
-rwxr-xr-xsrc/doc_reform/doc_reform.d54
-rw-r--r--src/doc_reform/meta/conf_make_meta_json.d10
-rw-r--r--src/doc_reform/meta/conf_make_meta_structs.d1
-rw-r--r--src/doc_reform/meta/conf_make_meta_toml.d12
-rw-r--r--src/doc_reform/meta/metadoc.d15
-rw-r--r--src/doc_reform/meta/metadoc_harvest.d5
6 files changed, 64 insertions, 33 deletions
diff --git a/src/doc_reform/doc_reform.d b/src/doc_reform/doc_reform.d
index 908a3a6..663fb4d 100755
--- a/src/doc_reform/doc_reform.d
+++ b/src/doc_reform/doc_reform.d
@@ -94,7 +94,10 @@ void main(string[] args) {
struct Harvest {
string title = "";
string author = "";
- string author_date_title = "";
+ string author_surname_fn = "";
+ string language = "";
+ string language_original = "";
+ string uid = "";
string date_published = "";
string[] topic_register_arr = [""];
string html_seg_toc = "";
@@ -819,33 +822,58 @@ void main(string[] args) {
}
}
}
- if (_opt_action.verbose
- && harvests.length > 1
+ if (_opt_action.very_verbose
+ && harvests.length > 0
) {
auto min_repeat_number = 42;
- foreach(doc_harvest; harvests) {
+ string[] _document_topic_register;
+ string[] _topic_register;
+ string[] _sub_topic_register;
+ foreach(k, doc_harvest; harvests) {
+ _topic_register = [];
+ foreach(topic; doc_harvest.topic_register_arr.sort) {
+ _sub_topic_register = [];
+ string _spaces;
+ foreach (i, _top; topic.split(mkup.sep)) {
+ _sub_topic_register ~= format(
+ " %s- %s",
+ " ".repeat(i).join,
+ _top,
+ );
+ }
+ _topic_register ~= _sub_topic_register.join("\n");
+ }
auto char_repeat_number = (doc_harvest.title.length
+ doc_harvest.author.length + 16);
char_repeat_number = (char_repeat_number > min_repeat_number)
? char_repeat_number
: min_repeat_number;
- writefln(
- "%s\n\"%s\", %s%s",
- mkup.repeat_character_by_number_provided("-", char_repeat_number),
+ _document_topic_register ~= format(
+ "\"%s\", %s%s\n%s",
doc_harvest.title,
doc_harvest.author,
(doc_harvest.date_published.length > 0) ? " (" ~ doc_harvest.date_published ~ ")" : "",
+ _topic_register.sort!("toUpper(a) < toUpper(b)", SwapStrategy.stable).release.join("\n"),
);
- string[] _topic_arr;
- foreach(topic; doc_harvest.topic_register_arr.sort) {
- foreach (i, _top; topic.split(mkup.sep)) {
- writeln(" ", (" ".repeat(i).join), "- ", _top);
- }
+ foreach(_dtr; _document_topic_register.sort) {
+ writeln(_dtr);
}
}
+ }
+ if ((_opt_action.verbose
+ || _opt_action.very_verbose)
+ && harvests.length > 0
+ ) {
string[] _author_date_title;
foreach(doc_harvest; harvests) {
- _author_date_title ~= doc_harvest.author_date_title;
+ _author_date_title ~= format(
+ "%s %s \"%s\" [%s]",
+ doc_harvest.author_surname_fn,
+ (doc_harvest.date_published.length > 0)
+ ? "(" ~ doc_harvest.date_published ~ ")" : "",
+ doc_harvest.title,
+ doc_harvest.language,
+ );
}
foreach(_adt; _author_date_title.sort) {
writeln(_adt);
diff --git a/src/doc_reform/meta/conf_make_meta_json.d b/src/doc_reform/meta/conf_make_meta_json.d
index 5fd4499..45d3a5a 100644
--- a/src/doc_reform/meta/conf_make_meta_json.d
+++ b/src/doc_reform/meta/conf_make_meta_json.d
@@ -21,7 +21,7 @@ static template contentJSONtoDocReformStruct() {
doc_reform.meta.defaults,
doc_reform.meta.rgx;
ConfCompositePlus _struct_composite;
- auto contentJSONtoDocReformStruct(C,J)(C _struct_composite, J _json, string _identifier) {
+ auto contentJSONtoDocReformStruct(C,J,M)(C _struct_composite, J _json, M _manifest, string _identifier) {
mixin DocReformRgxInit;
static auto rgx = Rgx();
debug (json) {
@@ -545,13 +545,7 @@ static template contentJSONtoDocReformStruct() {
) {
_struct_composite.meta.date_valid = _json.object["date"]["valid"].str;
}
- _struct_composite.meta.author_date_title = format(
- "%s %s \"%s\"",
- _struct_composite.meta.creator_author_surname_fn,
- (_struct_composite.meta.date_published.length > 0)
- ? "(" ~ _struct_composite.meta.date_published ~ ")" : "",
- _struct_composite.meta.title_full,
- );
+ _struct_composite.meta.language_document_char = _manifest.src.language;
}
if ("links" in _json.object) {}
if ("notes" in _json.object) {
diff --git a/src/doc_reform/meta/conf_make_meta_structs.d b/src/doc_reform/meta/conf_make_meta_structs.d
index ff1ec76..3bd29e2 100644
--- a/src/doc_reform/meta/conf_make_meta_structs.d
+++ b/src/doc_reform/meta/conf_make_meta_structs.d
@@ -225,7 +225,6 @@ struct MetaComposite {
string title_short;
string title_sub;
string title_subtitle;
- string author_date_title;
}
struct ConfComposite {
MetaComposite meta;
diff --git a/src/doc_reform/meta/conf_make_meta_toml.d b/src/doc_reform/meta/conf_make_meta_toml.d
index f047c5d..6008996 100644
--- a/src/doc_reform/meta/conf_make_meta_toml.d
+++ b/src/doc_reform/meta/conf_make_meta_toml.d
@@ -30,14 +30,15 @@ static template configParseTOMLreturnDocReformStruct() {
doc_reform.meta.conf_make_meta_structs,
doc_reform.meta.conf_make_meta_json;
mixin contentJSONtoDocReformStruct;
- auto configParseTOMLreturnDocReformStruct(CCm, T)(
+ auto configParseTOMLreturnDocReformStruct(T,CCm,M)(
+ T _document_struct,
CCm _make_and_meta_struct,
- T _document_struct
+ M _manifest
){
TOMLDocument _doc = parseTOML(cast(string)(_document_struct.content));
auto _doc_json = _doc.toJSON;
_make_and_meta_struct
- = contentJSONtoDocReformStruct!()(_make_and_meta_struct, _doc_json, _document_struct.filename); // struct from json
+ = contentJSONtoDocReformStruct!()(_make_and_meta_struct, _doc_json, _manifest, _document_struct.filename); // struct from json
return _make_and_meta_struct;
}
}
@@ -60,9 +61,10 @@ static template docHeaderMakeAndMetaTupTomlExtractAndConvertToStruct() {
mixin DocReformRgxInit;
mixin contentJSONtoDocReformStruct;
static auto rgx = Rgx();
- auto docHeaderMakeAndMetaTupTomlExtractAndConvertToStruct(CCm, Src)(
+ auto docHeaderMakeAndMetaTupTomlExtractAndConvertToStruct(CCm,Src,M)(
CCm _make_and_meta_struct,
Src header_src,
+ M _manifest,
) {
TOMLDocument _doc;
if (header_src.match(rgx.toml_header_meta_title)) {
@@ -73,7 +75,7 @@ static template docHeaderMakeAndMetaTupTomlExtractAndConvertToStruct() {
}
auto _doc_json = _doc.toJSON;
auto _header_and_make_and_meta_struct
- = contentJSONtoDocReformStruct!()(_make_and_meta_struct, _doc_json, "header");
+ = contentJSONtoDocReformStruct!()(_make_and_meta_struct, _doc_json, _manifest, "header");
return _header_and_make_and_meta_struct;
}
}
diff --git a/src/doc_reform/meta/metadoc.d b/src/doc_reform/meta/metadoc.d
index a4b920b..a26756b 100644
--- a/src/doc_reform/meta/metadoc.d
+++ b/src/doc_reform/meta/metadoc.d
@@ -36,11 +36,15 @@ template DocReformAbstraction() {
O _opt_action,
M _manifest
){
- 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;
- _make_and_meta_struct = configParseTOMLreturnDocReformStruct!()(_make_and_meta_struct, _config_document_struct);
- _make_and_meta_struct = configParseTOMLreturnDocReformStruct!()(_make_and_meta_struct, _config_local_site_struct);
+ { /+ document config file +/
+ auto _config_document_struct = readConfigDoc!()(_manifest, _env);
+ _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);
+ }
/+ ↓ read file (filename with path) +/
/+ ↓ file tuple of header and content +/
if ((_opt_action.debug_do)
@@ -72,7 +76,8 @@ template DocReformAbstraction() {
_make_and_meta_struct =
docHeaderMakeAndMetaTupTomlExtractAndConvertToStruct!()(
_make_and_meta_struct,
- _header_body_insertfilelist_imagelist[headBody.header]
+ _header_body_insertfilelist_imagelist[headBody.header],
+ _manifest,
);
if ((_opt_action.debug_do)
|| (_opt_action.very_verbose)
diff --git a/src/doc_reform/meta/metadoc_harvest.d b/src/doc_reform/meta/metadoc_harvest.d
index c3534f9..da1cae8 100644
--- a/src/doc_reform/meta/metadoc_harvest.d
+++ b/src/doc_reform/meta/metadoc_harvest.d
@@ -22,7 +22,10 @@ template DocReformMetaDocHarvest() {
auto markup = InlineMarkup();
harvest.title = doc_matters.conf_make_meta.meta.title_full;
harvest.author = doc_matters.conf_make_meta.meta.creator_author;
- harvest.author_date_title = doc_matters.conf_make_meta.meta.author_date_title;
+ harvest.author_surname_fn = doc_matters.conf_make_meta.meta.creator_author_surname_fn;
+ harvest.language_original = doc_matters.conf_make_meta.meta.original_language;
+ harvest.language = doc_matters.src.language;
+ harvest.uid = doc_matters.src.doc_uid;
harvest.date_published = doc_matters.conf_make_meta.meta.date_published;
harvest.topic_register_arr = doc_matters.conf_make_meta.meta.classify_topic_register_arr;
return harvest;