From 81a26c19c55a98918cf433da2f867db6b693b6df Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 8 Jun 2019 14:15:46 -0400 Subject: harvest, document reporting --- src/doc_reform/doc_reform.d | 54 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 13 deletions(-) (limited to 'src/doc_reform/doc_reform.d') 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); -- cgit v1.2.3