From b7347229818ecc8727242ae7275acbf326805cc1 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 20 Jun 2019 13:40:57 -0400 Subject: harvest html output --- src/doc_reform/meta/conf_make_meta_json.d | 12 +++++++----- src/doc_reform/meta/conf_make_meta_structs.d | 2 ++ src/doc_reform/meta/metadoc_harvest.d | 6 ++++++ 3 files changed, 15 insertions(+), 5 deletions(-) (limited to 'src/doc_reform/meta') diff --git a/src/doc_reform/meta/conf_make_meta_json.d b/src/doc_reform/meta/conf_make_meta_json.d index 45d3a5a..7ad4744 100644 --- a/src/doc_reform/meta/conf_make_meta_json.d +++ b/src/doc_reform/meta/conf_make_meta_json.d @@ -387,13 +387,13 @@ static template contentJSONtoDocReformStruct() { _struct_composite.meta.creator_translator = _json.object["creator"]["translator"].str; } } - string[] authors_arr; + string[] author_arr; string[][string] authors_hash_arr = [ "first" : [], "last" : [], "full" : [], "last_first" : [], "as_input" : [] ]; string[] authors_raw_arr = _struct_composite.meta.creator_author.split(rgx.arr_delimiter); auto _lastname = appender!(char[])(); foreach (author_raw; authors_raw_arr) { - authors_arr ~= author_raw.replace(rgx.raw_author_munge, "$2 $1"); + author_arr ~= author_raw.replace(rgx.raw_author_munge, "$2 $1"); authors_hash_arr["first"] ~= author_raw.replace(rgx.raw_author_munge, "$2"); authors_hash_arr["last"] ~= author_raw.replace(rgx.raw_author_munge, "$1"); authors_hash_arr["full"] ~= author_raw.replace(rgx.raw_author_munge, "$2 $1"); @@ -404,7 +404,9 @@ static template contentJSONtoDocReformStruct() { _lastname = appender!(char[])(); } } - _struct_composite.meta.creator_author = authors_arr.join(", ").chomp.chomp; + _struct_composite.meta.creator_author_arr = author_arr; + _struct_composite.meta.creator_author = author_arr.join(", ").chomp.chomp; + _struct_composite.meta.creator_author_surname = authors_hash_arr["last"][0]; string _author_name_last_first = authors_hash_arr["last_first"].join("; ").chomp.chomp; _struct_composite.meta.creator_author_surname_fn = (_author_name_last_first.length > 0) ? _author_name_last_first @@ -490,8 +492,8 @@ static template contentJSONtoDocReformStruct() { if ("topic_register" in _json.object["classify"] && (_json.object["classify"]["topic_register"].type().to!string == "string") ) { - _struct_composite.meta.classify_topic_register = _json.object["classify"]["topic_register"].str; - string[] main_topics_ = _struct_composite.meta.classify_topic_register.split(rgx.topic_register_main_terms_split); + _struct_composite.meta.classify_topic_register = _json.object["classify"]["topic_register"].str.strip; + string[] main_topics_ = _struct_composite.meta.classify_topic_register.strip.split(rgx.topic_register_main_terms_split); string[] topics; string topics_tmp; string[] multiple_sub_terms; diff --git a/src/doc_reform/meta/conf_make_meta_structs.d b/src/doc_reform/meta/conf_make_meta_structs.d index 3bd29e2..6c230df 100644 --- a/src/doc_reform/meta/conf_make_meta_structs.d +++ b/src/doc_reform/meta/conf_make_meta_structs.d @@ -182,8 +182,10 @@ struct MetaComposite { string classify_subject; string classify_topic_register; string[] classify_topic_register_arr; + string[] creator_author_arr; string creator_author; string creator_author_surname_fn; + string creator_author_surname; string creator_author_email; string creator_illustrator; string creator_translator; diff --git a/src/doc_reform/meta/metadoc_harvest.d b/src/doc_reform/meta/metadoc_harvest.d index da1cae8..26f2b38 100644 --- a/src/doc_reform/meta/metadoc_harvest.d +++ b/src/doc_reform/meta/metadoc_harvest.d @@ -20,14 +20,20 @@ template DocReformMetaDocHarvest() { std.conv : to; mixin InternalMarkup; auto markup = InlineMarkup(); + import doc_reform.output.paths_output; + auto pth_html = DocReformPathsHTML!()(doc_matters.output_path, doc_matters.src.language); harvest.title = doc_matters.conf_make_meta.meta.title_full; harvest.author = doc_matters.conf_make_meta.meta.creator_author; + harvest.author_surname = doc_matters.conf_make_meta.meta.creator_author_surname; harvest.author_surname_fn = doc_matters.conf_make_meta.meta.creator_author_surname_fn; + harvest.author_arr = doc_matters.conf_make_meta.meta.creator_author_arr; 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; + harvest.path_html_scroll = pth_html.fn_scroll(doc_matters.src.filename); + harvest.path_html_seg = pth_html.fn_seg(doc_matters.src.filename, "toc"); return harvest; } } -- cgit v1.2.3