aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2019-05-22 10:50:33 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2019-10-17 19:07:20 -0400
commite973365c4b74be2b2cff9be970ccba5928dbe368 (patch)
treef5af8c28ba939095b9c1310c5ea7b91816c12ddf
parent0.7.2 latex (for pdf) (initial stub) (diff)
0.7.3 start to look at document harvest (initial stub)
-rw-r--r--.gitignore1
-rw-r--r--org/default_regex.org13
-rw-r--r--org/doc_reform.org227
-rw-r--r--org/dr_build_scaffold.org1
-rw-r--r--org/meta_conf_make_meta.org218
-rwxr-xr-xsrc/doc_reform/doc_reform.d104
-rw-r--r--src/doc_reform/meta/conf_make_meta_json.d215
-rw-r--r--src/doc_reform/meta/conf_make_meta_structs.d3
-rw-r--r--src/doc_reform/meta/metadoc.d1
-rw-r--r--src/doc_reform/meta/metadoc_harvest.d30
-rw-r--r--src/doc_reform/meta/metadoc_summary.d4
-rw-r--r--src/doc_reform/meta/metadochead.d84
-rw-r--r--src/doc_reform/meta/rgx.d7
-rw-r--r--views/version.txt2
14 files changed, 600 insertions, 310 deletions
diff --git a/.gitignore b/.gitignore
index 5fe2136..c87e3ae 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,7 +12,6 @@
!tangle
!*.org
!*.d
-!*.txt
!*.rb
!conf.sdl
!org
diff --git a/org/default_regex.org b/org/default_regex.org
index 2958027..6d17f0c 100644
--- a/org/default_regex.org
+++ b/org/default_regex.org
@@ -51,6 +51,7 @@ static template DocReformRgxInit() {
#+BEGIN_SRC d
/+ misc +/
static true_dollar = ctRegex!(`\$`, "gm");
+static sep = ctRegex!(`␣`, "gm");
static flag_action = ctRegex!(`^(--[a-z][a-z0-9-]+)$`);
static flag_action_str = ctRegex!(` (--[a-z][a-z0-9-]+)`);
static within_quotes = ctRegex!(`"(.+?)"`, "m");
@@ -106,7 +107,7 @@ static make_simple_substitutions_d = ctRegex!(`(?P<substituti
/+ header +/
static variable_doc_title = ctRegex!(`@title`);
static variable_doc_author = ctRegex!(`@author|@creator`);
-static raw_author_munge = ctRegex!(`(\S.+?),\s+(.+)`,"i");
+static raw_author_munge = ctRegex!(`(?P<last>\S.+?),\s+(?P<first>.+)`,"i");
static toml_header_meta_title = ctRegex!(`^\s*(title\s*=\s*"|\[title\])`, "m");
#+END_SRC
@@ -368,6 +369,16 @@ static bi_sub_terms_plus_object_number_offset_split = ctRegex!(`\s*\|\s*`);
static bi_term_and_object_numbers_match = ctRegex!(`^(.+?)\+(\d+)`);
#+END_SRC
+** topic register split (document classify)
+
+#+name: meta_rgx
+#+BEGIN_SRC d
+static topic_register_main_terms_split = ctRegex!(`\s*;\s*`);
+static topic_register_main_term_plus_rest_split = ctRegex!(`\s*:\s*`);
+static topic_register_sub_terms_split = ctRegex!(`\s*\|\s*`);
+static topic_register_multiple_sub_terms_split = ctRegex!(`␣([^|␣]+(?:\|[^|␣]+)+)`);
+#+END_SRC
+
** language codes :language:codes:
#+name: meta_rgx
diff --git a/org/doc_reform.org b/org/doc_reform.org
index 12eb46a..7bb8029 100644
--- a/org/doc_reform.org
+++ b/org/doc_reform.org
@@ -27,7 +27,7 @@ struct Version {
int minor;
int patch;
}
-enum _ver = Version(0, 7, 2);
+enum _ver = Version(0, 7, 3);
#+END_SRC
** compilation restrictions (supported compilers)
@@ -71,8 +71,7 @@ version (Posix) {
module doc_reform.sisu_document_parser;
import
doc_reform.conf.compile_time_info,
- doc_reform.meta.metadoc,
- doc_reform.meta.metadochead;
+ doc_reform.meta.metadoc;
<<imports_doc_reform>>
import std.algorithm;
import std.parallelism;
@@ -86,6 +85,7 @@ homepage "http://sisudoc.org"
+/
void main(string[] args) {
<<doc_reform_mixin>>
+ <<doc_reform_init>>
<<doc_reform_args>>
<<doc_reform_do_selected>>
if (_manifests.length > 1 // _manifests[0] initialized dummy element
@@ -117,6 +117,38 @@ void main(string[] args) {
}
}
}
+ if (_opt_action.verbose
+ && harvests.length > 1
+ ) {
+ auto min_repeat_number = 42;
+ foreach(doc_harvest; harvests) {
+ 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),
+ doc_harvest.title,
+ doc_harvest.author,
+ (doc_harvest.date_published.length > 0) ? " (" ~ doc_harvest.date_published ~ ")" : "",
+ );
+ string[] _topic_arr;
+ foreach(topic; doc_harvest.topic_register_arr.sort) {
+ foreach (i, _top; topic.split(mkup.sep)) {
+ writeln(" ", (" ".repeat(i).join), "- ", _top);
+ }
+ }
+ }
+ string[] _author_date_title;
+ foreach(doc_harvest; harvests) {
+ _author_date_title ~= doc_harvest.author_date_title;
+ }
+ foreach(_adt; _author_date_title.sort) {
+ writeln(_adt);
+ }
+ }
}
#+END_SRC
@@ -193,6 +225,7 @@ import
import
doc_reform.meta,
doc_reform.meta.metadoc_summary,
+ doc_reform.meta.metadoc_harvest,
doc_reform.meta.metadoc_from_src,
doc_reform.meta.conf_make_meta_structs,
doc_reform.meta.conf_make_meta_toml,
@@ -266,7 +299,25 @@ mixin outputHub;
**** init :init:
-#+NAME: doc_reform_args
+#+NAME: doc_reform_init
+#+BEGIN_SRC d
+struct Harvest {
+ string title = "";
+ string author = "";
+ string author_date_title = "";
+ string date_published = "";
+ string[] topic_register_arr = [""];
+ string html_seg_toc = "";
+ string html_scroll = "";
+ string epub = "";
+}
+Harvest harvested;
+Harvest[] harvests;
+#+END_SRC
+
+**** args :args:
+
+#+NAME: doc_reform_init
#+BEGIN_SRC d
string flag_action;
string arg_unrecognized;
@@ -276,7 +327,7 @@ static auto rgx = Rgx();
*** scope (run complete) :scope:
-#+NAME: doc_reform_args
+#+NAME: doc_reform_init
#+BEGIN_SRC d
scope(success) {
writefln(
@@ -311,6 +362,9 @@ bool[string] opts = [
"debug" : false,
"digest" : false,
"epub" : false,
+ "harvest" : false,
+ "harvest-authors" : false,
+ "harvest-topics" : false,
"html" : false,
"html-seg" : false,
"html-scroll" : false,
@@ -366,6 +420,9 @@ auto helpInfo = getopt(args,
"debug", "--debug", &opts["debug"],
"digest", "--digest hash digest for each object", &opts["digest"],
"epub", "--epub process epub output", &opts["epub"],
+ "harvest", "--harvest extract info on authors & topics from document header metadata", &opts["harvest"],
+ "harvest-authors", "--harvest-authors extract info on authors from document header metadata", &opts["harvest-authors"],
+ "harvest-topics", "--harvest-topics extract info on topics from document header metadata", &opts["harvest-topics"],
"html", "--html process html output", &opts["html"],
"html-seg", "--html-seg process html output", &opts["html-seg"],
"html-scroll", "--html-seg process html output", &opts["html-scroll"],
@@ -449,6 +506,22 @@ struct OptActions {
bool epub() {
return opts["epub"];
}
+ bool harvest() {
+ bool _is = (
+ opts["harvest"]
+ || opts["harvest-authors"]
+ || opts["harvest-topics"]
+ )
+ ? true
+ : false;
+ return _is;
+ }
+ bool harvest_authors() {
+ return opts["harvest-authors"];
+ }
+ bool harvest_topics() {
+ return opts["harvest-topics"];
+ }
bool html() {
bool _is;
if ( opts["html"] || opts["html-seg"] || opts["html-scroll"])
@@ -886,7 +959,29 @@ if ((doc_matters.opt.action.debug_do)
#+BEGIN_SRC d
/+ ↓ debugs +/
if (doc_matters.opt.action.verbose) {
- DocReformAbstractionSummary!()(doc_abstraction, doc_matters);
+ DocReformMetaDocSummary!()(doc_abstraction, doc_matters);
+}
+#+END_SRC
+
+**** 0. abstraction harvest :abstraction:harvest:
+- abstraction harvest
+
+#+NAME: doc_reform_each_file_do_debugs_checkdoc
+#+BEGIN_SRC d
+if (doc_matters.opt.action.harvest) {
+ if (doc_matters.opt.action.harvest_authors) {
+ }
+ if (doc_matters.opt.action.harvest_topics) {
+ }
+ Harvest[] DocReformMetaDocHarvests()(
+ Harvest harvested,
+ Harvest[] harvests,
+ ) {
+ harvests ~= harvested;
+ return harvests;
+ }
+ harvested = DocReformMetaDocHarvest!()(doc_matters, harvested);
+ harvests = DocReformMetaDocHarvests!()(harvested, harvests);
}
#+END_SRC
@@ -947,34 +1042,6 @@ break; // terminate, stop
#+END_SRC
* 2. pre-processing
-** Harvest _get document head_ for harvest (separate thread)
-*** 0 module template
-- harvest, get document head
-
-#+BEGIN_SRC d :tangle "../src/doc_reform/meta/metadochead.d"
-module doc_reform.meta.metadochead;
-template DocReformHarvestGetFromHead() { // TODO
- <<imports_doc_reform>>
- <<doc_reform_mixin>>
- enum headBody { header, body_content, insert_file_list, image_list }
- enum makeMeta { make, meta }
- static auto rgx = Rgx();
- auto DocReformHarvestGetFromHead(E,O,M)( // TODO
- E _env,
- O _opt_action,
- M _manifest
- ){
- <<doc_reform_conf_files_in_toml>>
- <<doc_reform_each_file_do_read_and_split_sisu_markup_file_content_into_header_and_body>>
- <<doc_reform_each_file_do_split_sisu_markup_file_header_into_make_and_meta_structs>>
- <<doc_reform_each_file_do_document_matters_abridged>>
- auto t = tuple(doc_matters_shared, doc_matters_abridged_collected);
- static assert(t.length==2);
- return t;
- }
-}
-#+END_SRC
-
** Output _document abstraction functions_ :module:doc_reform:abstraction:
*** 0 module template
- abstraction template
@@ -1294,13 +1361,13 @@ if ((_opt_action.debug_do)
#+END_SRC
* 3. document abstraction _summary_ :module:doc_reform:metadoc_summary:
-** 0. module template
+** 0. module template metadoc summary
- document summary from abstraction
#+BEGIN_SRC d :tangle "../src/doc_reform/meta/metadoc_summary.d"
module doc_reform.meta.metadoc_summary;
-template DocReformAbstractionSummary() {
- void DocReformAbstractionSummary(S,T)(
+template DocReformMetaDocSummary() {
+ void DocReformMetaDocSummary(S,T)(
const S doc_abstraction,
T doc_matters,
) {
@@ -1308,7 +1375,7 @@ template DocReformAbstractionSummary() {
mixin InternalMarkup;
<<metadoc_summary_initialize>>
if (doc_matters.opt.action.verbose) {
- <<meta_metadoc_summary>>
+ <<meta_metadoc_summary_document>>
}
}
}
@@ -1344,7 +1411,7 @@ auto markup = InlineMarkup();
** (last ocn)
-#+name: meta_metadoc_summary
+#+name: meta_metadoc_summary_document
#+BEGIN_SRC d
string[string] check = [
"last_object_number" : "NA [debug \"checkdoc\" not run]",
@@ -1372,9 +1439,9 @@ foreach (k; doc_matters.has.keys_seq.seg) {
}
#+END_SRC
-** summary
+** document summary
-#+name: meta_metadoc_summary
+#+name: meta_metadoc_summary_document
#+BEGIN_SRC d
auto min_repeat_number = 66;
auto char_repeat_number = (doc_matters.conf_make_meta.meta.title_full.length
@@ -1439,6 +1506,84 @@ writefln(
);
#+END_SRC
+** 0. module template metadoc harvest
+
+#+BEGIN_SRC d :tangle "../src/doc_reform/meta/metadoc_harvest.d"
+module doc_reform.meta.metadoc_harvest;
+template DocReformMetaDocHarvest() {
+ auto DocReformMetaDocHarvest(T,H)(
+ T doc_matters,
+ H harvest,
+ ) {
+ <<metadoc_harvest_imports>>
+ mixin InternalMarkup;
+ <<metadoc_harvest_initialize>>
+ <<meta_metadoc_harvest>>
+ }
+}
+#+END_SRC
+
+** init
+*** imports
+
+#+name: metadoc_harvest_imports
+#+BEGIN_SRC d
+import
+ doc_reform.meta.defaults,
+ doc_reform.meta.rgx;
+import
+ std.array,
+ std.exception,
+ std.regex,
+ std.stdio,
+ std.string,
+ std.traits,
+ std.typecons,
+ std.uni,
+ std.utf,
+ std.conv : to;
+#+END_SRC
+
+*** initialize :report:
+
+#+name: metadoc_harvest_initialize
+#+BEGIN_SRC d
+auto markup = InlineMarkup();
+#+END_SRC
+
+** harvest summary
+
+#+name: meta_metadoc_harvest_summary
+#+BEGIN_SRC d
+auto min_repeat_number = 66;
+auto char_repeat_number = (doc_matters.conf_make_meta.meta.title_full.length
+ + doc_matters.conf_make_meta.meta.creator_author.length + 4);
+char_repeat_number = (char_repeat_number > min_repeat_number)
+? char_repeat_number
+: min_repeat_number;
+writefln(
+ "%s\n\"%s\", %s\n%s\n%s\n%s",
+ markup.repeat_character_by_number_provided("-", char_repeat_number),
+ doc_matters.conf_make_meta.meta.title_full,
+ doc_matters.conf_make_meta.meta.creator_author,
+ doc_matters.src.filename,
+ doc_matters.conf_make_meta.meta.classify_topic_register_arr,
+ markup.repeat_character_by_number_provided("-", char_repeat_number),
+);
+#+END_SRC
+
+** return harvest
+
+#+name: meta_metadoc_harvest
+#+BEGIN_SRC d
+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.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;
+#+END_SRC
+
* __END__
dev notes
diff --git a/org/dr_build_scaffold.org b/org/dr_build_scaffold.org
index 3a209a9..1bb8884 100644
--- a/org/dr_build_scaffold.org
+++ b/org/dr_build_scaffold.org
@@ -1132,7 +1132,6 @@ revision = head
!tangle
!*.org
!*.d
-!*.txt
!*.rb
!conf.sdl
!org
diff --git a/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org
index 853134f..79ee9e7 100644
--- a/org/meta_conf_make_meta.org
+++ b/org/meta_conf_make_meta.org
@@ -260,7 +260,9 @@ struct MetaComposite {
string classify_loc;
string classify_subject;
string classify_topic_register;
+ string[] classify_topic_register_arr;
string creator_author;
+ string creator_author_surname_fn;
string creator_author_email;
string creator_illustrator;
string creator_translator;
@@ -302,6 +304,7 @@ struct MetaComposite {
string title_short;
string title_sub;
string title_subtitle;
+ string author_date_title;
}
#+END_SRC
@@ -431,6 +434,8 @@ JSONValue config_jsonstr = `{
module doc_reform.meta.conf_make_meta_json;
static template contentJSONtoDocReformStruct() {
import
+ std.algorithm,
+ std.array,
std.exception,
std.regex,
std.stdio,
@@ -442,6 +447,7 @@ static template contentJSONtoDocReformStruct() {
import
doc_reform.meta.conf_make_meta_structs,
doc_reform.meta.conf_make_meta_json,
+ doc_reform.meta.defaults,
doc_reform.meta.rgx;
ConfCompositePlus _struct_composite;
auto contentJSONtoDocReformStruct(C,J)(C _struct_composite, J _json, string _identifier) {
@@ -809,6 +815,108 @@ if ("search" in _json.object) {
#+name: json_objects
#+BEGIN_SRC d
/+ meta ------------------------------------------------------------------- +/
+if (_struct_composite.meta.creator_author.empty) {
+ if ("creator" in _json.object) {
+ if ("author" in _json.object["creator"]
+ && (_json.object["creator"]["author"].type().to!string == "string")
+ ) {
+ _struct_composite.meta.creator_author = _json.object["creator"]["author"].str;
+ }
+ if ("email" in _json.object["creator"]
+ && (_json.object["creator"]["email"].type().to!string == "string")
+ ) {
+ _struct_composite.meta.creator_author_email = _json.object["creator"]["email"].str;
+ }
+ if ("illustrator" in _json.object["creator"]
+ && (_json.object["creator"]["illustrator"].type().to!string == "string")
+ ) {
+ _struct_composite.meta.creator_illustrator = _json.object["creator"]["illustrator"].str;
+ }
+ if ("translator" in _json.object["creator"]
+ && (_json.object["creator"]["translator"].type().to!string == "string")
+ ) {
+ _struct_composite.meta.creator_translator = _json.object["creator"]["translator"].str;
+ }
+ }
+ string[] authors_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");
+ 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");
+ authors_hash_arr["as_input"] ~= author_raw;
+ if (auto m = author_raw.match(rgx.raw_author_munge)) {
+ (m.captures[1]).map!toUpper.copy(_lastname);
+ authors_hash_arr["last_first"] ~= _lastname.data.to!string ~ ", " ~ m.captures[2];
+ _lastname = appender!(char[])();
+ }
+ }
+ _struct_composite.meta.creator_author = authors_arr.join(", ").chomp.chomp;
+ 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
+ : authors_hash_arr["as_input"].join("; ").chomp.chomp;
+}
+if (_struct_composite.meta.title_main.empty) {
+ if ("title" in _json.object) {
+ if ((_json.object["title"].type().to!string) == "string") {
+ _struct_composite.meta.title_main = _json.object["title"].str;
+ } else {
+ if ("edition" in _json.object["title"]
+ && (_json.object["title"]["edition"].type().to!string == "string")
+ ) {
+ _struct_composite.meta.title_edition = _json.object["title"]["edition"].str;
+ }
+ if ("full" in _json.object["title"]
+ && (_json.object["title"]["full"].type().to!string == "string")
+ ) {}
+ if ("language" in _json.object["title"]
+ && (_json.object["title"]["language"].type().to!string == "string")
+ ) {
+ _struct_composite.meta.title_language = _json.object["title"]["language"].str;
+ }
+ if ("main" in _json.object["title"]
+ && (_json.object["title"]["main"].type().to!string == "string")
+ ) {
+ _struct_composite.meta.title_main = _json.object["title"]["main"].str;
+ } else if ("title" in _json.object["title"]
+ && (_json.object["title"]["title"].type().to!string == "string")
+ ) {
+ _struct_composite.meta.title_main = _json.object["title"]["title"].str;
+ }
+ if ("note" in _json.object["title"]
+ && (_json.object["title"]["note"].type().to!string == "string")
+ ) {
+ _struct_composite.meta.title_note = _json.object["title"]["note"].str;
+ }
+ if ("sub" in _json.object["title"]
+ && (_json.object["title"]["sub"].type().to!string == "string")
+ ) {
+ _struct_composite.meta.title_sub = _json.object["title"]["sub"].str;
+ }
+ if ("subtitle" in _json.object["title"]
+ && (_json.object["title"]["subtitle"].type().to!string == "string")
+ ) {
+ _struct_composite.meta.title_subtitle = _json.object["title"]["subtitle"].str;
+ }
+ }
+ }
+ if ((!(_struct_composite.meta.title_subtitle.empty))
+ && (_struct_composite.meta.title_sub.empty)) {
+ _struct_composite.meta.title_sub = _struct_composite.meta.title_subtitle;
+ }
+ _struct_composite.meta.title_full = (_struct_composite.meta.title_sub.empty)
+ ? _struct_composite.meta.title_main
+ : format(
+ "%s - %s",
+ _struct_composite.meta.title_main,
+ _struct_composite.meta.title_sub,
+ );
+}
if ("classify" in _json.object) {
if ("dewey" in _json.object["classify"]
&& (_json.object["classify"]["dewey"].type().to!string == "string")
@@ -834,6 +942,22 @@ if ("classify" in _json.object) {
&& (_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);
+ string[] topics;
+ string topics_tmp;
+ string[] multiple_sub_terms;
+ foreach (mt; main_topics_) {
+ topics_tmp = mt.replaceAll(rgx.topic_register_main_term_plus_rest_split, mkup.sep);
+ if (auto m = topics_tmp.match(rgx.topic_register_multiple_sub_terms_split)) {
+ multiple_sub_terms = m.captures[1].split(rgx.topic_register_sub_terms_split);
+ foreach (subterm; multiple_sub_terms) {
+ topics ~= m.captures.pre ~ mkup.sep ~ subterm;
+ }
+ } else {
+ topics ~= topics_tmp;
+ }
+ }
+ _struct_composite.meta.classify_topic_register_arr = topics;
}
}
if ("date" in _json.object) {
@@ -872,6 +996,13 @@ if ("date" in _json.object) {
) {
_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,
+ );
}
if ("links" in _json.object) {}
if ("notes" in _json.object) {
@@ -956,93 +1087,6 @@ if ("rights" in _json.object) {
_struct_composite.meta.rights_license = _json.object["rights"]["license"].str;
}
}
-if (_struct_composite.meta.creator_author.empty) {
- if ("creator" in _json.object) {
- if ("author" in _json.object["creator"]
- && (_json.object["creator"]["author"].type().to!string == "string")
- ) {
- _struct_composite.meta.creator_author = _json.object["creator"]["author"].str;
- }
- if ("email" in _json.object["creator"]
- && (_json.object["creator"]["email"].type().to!string == "string")
- ) {
- _struct_composite.meta.creator_author_email = _json.object["creator"]["email"].str;
- }
- if ("illustrator" in _json.object["creator"]
- && (_json.object["creator"]["illustrator"].type().to!string == "string")
- ) {
- _struct_composite.meta.creator_illustrator = _json.object["creator"]["illustrator"].str;
- }
- if ("translator" in _json.object["creator"]
- && (_json.object["creator"]["translator"].type().to!string == "string")
- ) {
- _struct_composite.meta.creator_translator = _json.object["creator"]["translator"].str;
- }
- }
- string[] authors_arr;
- string[] authors_raw_arr
- = _struct_composite.meta.creator_author.split(rgx.arr_delimiter);
- foreach (author_raw; authors_raw_arr) {
- authors_arr ~= author_raw.replace(rgx.raw_author_munge, "$2 $1");
- }
- _struct_composite.meta.creator_author = join(authors_arr, ", ").chomp.chomp;
-}
-if (_struct_composite.meta.title_main.empty) {
- if ("title" in _json.object) {
- if ((_json.object["title"].type().to!string) == "string") {
- _struct_composite.meta.title_main = _json.object["title"].str;
- } else {
- if ("edition" in _json.object["title"]
- && (_json.object["title"]["edition"].type().to!string == "string")
- ) {
- _struct_composite.meta.title_edition = _json.object["title"]["edition"].str;
- }
- if ("full" in _json.object["title"]
- && (_json.object["title"]["full"].type().to!string == "string")
- ) {}
- if ("language" in _json.object["title"]
- && (_json.object["title"]["language"].type().to!string == "string")
- ) {
- _struct_composite.meta.title_language = _json.object["title"]["language"].str;
- }
- if ("main" in _json.object["title"]
- && (_json.object["title"]["main"].type().to!string == "string")
- ) {
- _struct_composite.meta.title_main = _json.object["title"]["main"].str;
- } else if ("title" in _json.object["title"]
- && (_json.object["title"]["title"].type().to!string == "string")
- ) {
- _struct_composite.meta.title_main = _json.object["title"]["title"].str;
- }
- if ("note" in _json.object["title"]
- && (_json.object["title"]["note"].type().to!string == "string")
- ) {
- _struct_composite.meta.title_note = _json.object["title"]["note"].str;
- }
- if ("sub" in _json.object["title"]
- && (_json.object["title"]["sub"].type().to!string == "string")
- ) {
- _struct_composite.meta.title_sub = _json.object["title"]["sub"].str;
- }
- if ("subtitle" in _json.object["title"]
- && (_json.object["title"]["subtitle"].type().to!string == "string")
- ) {
- _struct_composite.meta.title_subtitle = _json.object["title"]["subtitle"].str;
- }
- }
- }
- if ((!(_struct_composite.meta.title_subtitle.empty))
- && (_struct_composite.meta.title_sub.empty)) {
- _struct_composite.meta.title_sub = _struct_composite.meta.title_subtitle;
- }
- _struct_composite.meta.title_full = (_struct_composite.meta.title_sub.empty)
- ? _struct_composite.meta.title_main
- : format(
- "%s - %s",
- _struct_composite.meta.title_main,
- _struct_composite.meta.title_sub,
- );
-}
#+END_SRC
* 2. TOML returns DocReformStruct (via JSON) :module:conf_make_meta:struct:
diff --git a/src/doc_reform/doc_reform.d b/src/doc_reform/doc_reform.d
index 06866c2..908a3a6 100755
--- a/src/doc_reform/doc_reform.d
+++ b/src/doc_reform/doc_reform.d
@@ -53,8 +53,7 @@
module doc_reform.sisu_document_parser;
import
doc_reform.conf.compile_time_info,
- doc_reform.meta.metadoc,
- doc_reform.meta.metadochead;
+ doc_reform.meta.metadoc;
import
std.datetime,
std.getopt,
@@ -64,6 +63,7 @@ import
import
doc_reform.meta,
doc_reform.meta.metadoc_summary,
+ doc_reform.meta.metadoc_harvest,
doc_reform.meta.metadoc_from_src,
doc_reform.meta.conf_make_meta_structs,
doc_reform.meta.conf_make_meta_toml,
@@ -91,6 +91,18 @@ void main(string[] args) {
mixin DocReformBiblio;
mixin DocReformRgxInitFlags;
mixin outputHub;
+ struct Harvest {
+ string title = "";
+ string author = "";
+ string author_date_title = "";
+ string date_published = "";
+ string[] topic_register_arr = [""];
+ string html_seg_toc = "";
+ string html_scroll = "";
+ string epub = "";
+ }
+ Harvest harvested;
+ Harvest[] harvests;
string flag_action;
string arg_unrecognized;
enum dAM { abstraction, matters }
@@ -119,6 +131,9 @@ void main(string[] args) {
"debug" : false,
"digest" : false,
"epub" : false,
+ "harvest" : false,
+ "harvest-authors" : false,
+ "harvest-topics" : false,
"html" : false,
"html-seg" : false,
"html-scroll" : false,
@@ -174,6 +189,9 @@ void main(string[] args) {
"debug", "--debug", &opts["debug"],
"digest", "--digest hash digest for each object", &opts["digest"],
"epub", "--epub process epub output", &opts["epub"],
+ "harvest", "--harvest extract info on authors & topics from document header metadata", &opts["harvest"],
+ "harvest-authors", "--harvest-authors extract info on authors from document header metadata", &opts["harvest-authors"],
+ "harvest-topics", "--harvest-topics extract info on topics from document header metadata", &opts["harvest-topics"],
"html", "--html process html output", &opts["html"],
"html-seg", "--html-seg process html output", &opts["html-seg"],
"html-scroll", "--html-seg process html output", &opts["html-scroll"],
@@ -250,6 +268,22 @@ void main(string[] args) {
bool epub() {
return opts["epub"];
}
+ bool harvest() {
+ bool _is = (
+ opts["harvest"]
+ || opts["harvest-authors"]
+ || opts["harvest-topics"]
+ )
+ ? true
+ : false;
+ return _is;
+ }
+ bool harvest_authors() {
+ return opts["harvest-authors"];
+ }
+ bool harvest_topics() {
+ return opts["harvest-topics"];
+ }
bool html() {
bool _is;
if ( opts["html"] || opts["html-seg"] || opts["html-scroll"])
@@ -637,7 +671,22 @@ void main(string[] args) {
}
/+ ↓ debugs +/
if (doc_matters.opt.action.verbose) {
- DocReformAbstractionSummary!()(doc_abstraction, doc_matters);
+ DocReformMetaDocSummary!()(doc_abstraction, doc_matters);
+ }
+ if (doc_matters.opt.action.harvest) {
+ if (doc_matters.opt.action.harvest_authors) {
+ }
+ if (doc_matters.opt.action.harvest_topics) {
+ }
+ Harvest[] DocReformMetaDocHarvests()(
+ Harvest harvested,
+ Harvest[] harvests,
+ ) {
+ harvests ~= harvested;
+ return harvests;
+ }
+ harvested = DocReformMetaDocHarvest!()(doc_matters, harvested);
+ harvests = DocReformMetaDocHarvests!()(harvested, harvests);
}
/+ ↓ debugs +/
if (doc_matters.opt.action.debug_do) {
@@ -717,7 +766,22 @@ void main(string[] args) {
}
/+ ↓ debugs +/
if (doc_matters.opt.action.verbose) {
- DocReformAbstractionSummary!()(doc_abstraction, doc_matters);
+ DocReformMetaDocSummary!()(doc_abstraction, doc_matters);
+ }
+ if (doc_matters.opt.action.harvest) {
+ if (doc_matters.opt.action.harvest_authors) {
+ }
+ if (doc_matters.opt.action.harvest_topics) {
+ }
+ Harvest[] DocReformMetaDocHarvests()(
+ Harvest harvested,
+ Harvest[] harvests,
+ ) {
+ harvests ~= harvested;
+ return harvests;
+ }
+ harvested = DocReformMetaDocHarvest!()(doc_matters, harvested);
+ harvests = DocReformMetaDocHarvests!()(harvested, harvests);
}
/+ ↓ debugs +/
if (doc_matters.opt.action.debug_do) {
@@ -755,4 +819,36 @@ void main(string[] args) {
}
}
}
+ if (_opt_action.verbose
+ && harvests.length > 1
+ ) {
+ auto min_repeat_number = 42;
+ foreach(doc_harvest; harvests) {
+ 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),
+ doc_harvest.title,
+ doc_harvest.author,
+ (doc_harvest.date_published.length > 0) ? " (" ~ doc_harvest.date_published ~ ")" : "",
+ );
+ string[] _topic_arr;
+ foreach(topic; doc_harvest.topic_register_arr.sort) {
+ foreach (i, _top; topic.split(mkup.sep)) {
+ writeln(" ", (" ".repeat(i).join), "- ", _top);
+ }
+ }
+ }
+ string[] _author_date_title;
+ foreach(doc_harvest; harvests) {
+ _author_date_title ~= doc_harvest.author_date_title;
+ }
+ 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 fcd52c1..5fd4499 100644
--- a/src/doc_reform/meta/conf_make_meta_json.d
+++ b/src/doc_reform/meta/conf_make_meta_json.d
@@ -5,6 +5,8 @@
module doc_reform.meta.conf_make_meta_json;
static template contentJSONtoDocReformStruct() {
import
+ std.algorithm,
+ std.array,
std.exception,
std.regex,
std.stdio,
@@ -16,6 +18,7 @@ static template contentJSONtoDocReformStruct() {
import
doc_reform.meta.conf_make_meta_structs,
doc_reform.meta.conf_make_meta_json,
+ doc_reform.meta.defaults,
doc_reform.meta.rgx;
ConfCompositePlus _struct_composite;
auto contentJSONtoDocReformStruct(C,J)(C _struct_composite, J _json, string _identifier) {
@@ -361,6 +364,108 @@ static template contentJSONtoDocReformStruct() {
}
}
/+ meta ------------------------------------------------------------------- +/
+ if (_struct_composite.meta.creator_author.empty) {
+ if ("creator" in _json.object) {
+ if ("author" in _json.object["creator"]
+ && (_json.object["creator"]["author"].type().to!string == "string")
+ ) {
+ _struct_composite.meta.creator_author = _json.object["creator"]["author"].str;
+ }
+ if ("email" in _json.object["creator"]
+ && (_json.object["creator"]["email"].type().to!string == "string")
+ ) {
+ _struct_composite.meta.creator_author_email = _json.object["creator"]["email"].str;
+ }
+ if ("illustrator" in _json.object["creator"]
+ && (_json.object["creator"]["illustrator"].type().to!string == "string")
+ ) {
+ _struct_composite.meta.creator_illustrator = _json.object["creator"]["illustrator"].str;
+ }
+ if ("translator" in _json.object["creator"]
+ && (_json.object["creator"]["translator"].type().to!string == "string")
+ ) {
+ _struct_composite.meta.creator_translator = _json.object["creator"]["translator"].str;
+ }
+ }
+ string[] authors_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");
+ 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");
+ authors_hash_arr["as_input"] ~= author_raw;
+ if (auto m = author_raw.match(rgx.raw_author_munge)) {
+ (m.captures[1]).map!toUpper.copy(_lastname);
+ authors_hash_arr["last_first"] ~= _lastname.data.to!string ~ ", " ~ m.captures[2];
+ _lastname = appender!(char[])();
+ }
+ }
+ _struct_composite.meta.creator_author = authors_arr.join(", ").chomp.chomp;
+ 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
+ : authors_hash_arr["as_input"].join("; ").chomp.chomp;
+ }
+ if (_struct_composite.meta.title_main.empty) {
+ if ("title" in _json.object) {
+ if ((_json.object["title"].type().to!string) == "string") {
+ _struct_composite.meta.title_main = _json.object["title"].str;
+ } else {
+ if ("edition" in _json.object["title"]
+ && (_json.object["title"]["edition"].type().to!string == "string")
+ ) {
+ _struct_composite.meta.title_edition = _json.object["title"]["edition"].str;
+ }
+ if ("full" in _json.object["title"]
+ && (_json.object["title"]["full"].type().to!string == "string")
+ ) {}
+ if ("language" in _json.object["title"]
+ && (_json.object["title"]["language"].type().to!string == "string")
+ ) {
+ _struct_composite.meta.title_language = _json.object["title"]["language"].str;
+ }
+ if ("main" in _json.object["title"]
+ && (_json.object["title"]["main"].type().to!string == "string")
+ ) {
+ _struct_composite.meta.title_main = _json.object["title"]["main"].str;
+ } else if ("title" in _json.object["title"]
+ && (_json.object["title"]["title"].type().to!string == "string")
+ ) {
+ _struct_composite.meta.title_main = _json.object["title"]["title"].str;
+ }
+ if ("note" in _json.object["title"]
+ && (_json.object["title"]["note"].type().to!string == "string")
+ ) {
+ _struct_composite.meta.title_note = _json.object["title"]["note"].str;
+ }
+ if ("sub" in _json.object["title"]
+ && (_json.object["title"]["sub"].type().to!string == "string")
+ ) {
+ _struct_composite.meta.title_sub = _json.object["title"]["sub"].str;
+ }
+ if ("subtitle" in _json.object["title"]
+ && (_json.object["title"]["subtitle"].type().to!string == "string")
+ ) {
+ _struct_composite.meta.title_subtitle = _json.object["title"]["subtitle"].str;
+ }
+ }
+ }
+ if ((!(_struct_composite.meta.title_subtitle.empty))
+ && (_struct_composite.meta.title_sub.empty)) {
+ _struct_composite.meta.title_sub = _struct_composite.meta.title_subtitle;
+ }
+ _struct_composite.meta.title_full = (_struct_composite.meta.title_sub.empty)
+ ? _struct_composite.meta.title_main
+ : format(
+ "%s - %s",
+ _struct_composite.meta.title_main,
+ _struct_composite.meta.title_sub,
+ );
+ }
if ("classify" in _json.object) {
if ("dewey" in _json.object["classify"]
&& (_json.object["classify"]["dewey"].type().to!string == "string")
@@ -386,6 +491,22 @@ static template contentJSONtoDocReformStruct() {
&& (_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);
+ string[] topics;
+ string topics_tmp;
+ string[] multiple_sub_terms;
+ foreach (mt; main_topics_) {
+ topics_tmp = mt.replaceAll(rgx.topic_register_main_term_plus_rest_split, mkup.sep);
+ if (auto m = topics_tmp.match(rgx.topic_register_multiple_sub_terms_split)) {
+ multiple_sub_terms = m.captures[1].split(rgx.topic_register_sub_terms_split);
+ foreach (subterm; multiple_sub_terms) {
+ topics ~= m.captures.pre ~ mkup.sep ~ subterm;
+ }
+ } else {
+ topics ~= topics_tmp;
+ }
+ }
+ _struct_composite.meta.classify_topic_register_arr = topics;
}
}
if ("date" in _json.object) {
@@ -424,6 +545,13 @@ 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,
+ );
}
if ("links" in _json.object) {}
if ("notes" in _json.object) {
@@ -508,93 +636,6 @@ static template contentJSONtoDocReformStruct() {
_struct_composite.meta.rights_license = _json.object["rights"]["license"].str;
}
}
- if (_struct_composite.meta.creator_author.empty) {
- if ("creator" in _json.object) {
- if ("author" in _json.object["creator"]
- && (_json.object["creator"]["author"].type().to!string == "string")
- ) {
- _struct_composite.meta.creator_author = _json.object["creator"]["author"].str;
- }
- if ("email" in _json.object["creator"]
- && (_json.object["creator"]["email"].type().to!string == "string")
- ) {
- _struct_composite.meta.creator_author_email = _json.object["creator"]["email"].str;
- }
- if ("illustrator" in _json.object["creator"]
- && (_json.object["creator"]["illustrator"].type().to!string == "string")
- ) {
- _struct_composite.meta.creator_illustrator = _json.object["creator"]["illustrator"].str;
- }
- if ("translator" in _json.object["creator"]
- && (_json.object["creator"]["translator"].type().to!string == "string")
- ) {
- _struct_composite.meta.creator_translator = _json.object["creator"]["translator"].str;
- }
- }
- string[] authors_arr;
- string[] authors_raw_arr
- = _struct_composite.meta.creator_author.split(rgx.arr_delimiter);
- foreach (author_raw; authors_raw_arr) {
- authors_arr ~= author_raw.replace(rgx.raw_author_munge, "$2 $1");
- }
- _struct_composite.meta.creator_author = join(authors_arr, ", ").chomp.chomp;
- }
- if (_struct_composite.meta.title_main.empty) {
- if ("title" in _json.object) {
- if ((_json.object["title"].type().to!string) == "string") {
- _struct_composite.meta.title_main = _json.object["title"].str;
- } else {
- if ("edition" in _json.object["title"]
- && (_json.object["title"]["edition"].type().to!string == "string")
- ) {
- _struct_composite.meta.title_edition = _json.object["title"]["edition"].str;
- }
- if ("full" in _json.object["title"]
- && (_json.object["title"]["full"].type().to!string == "string")
- ) {}
- if ("language" in _json.object["title"]
- && (_json.object["title"]["language"].type().to!string == "string")
- ) {
- _struct_composite.meta.title_language = _json.object["title"]["language"].str;
- }
- if ("main" in _json.object["title"]
- && (_json.object["title"]["main"].type().to!string == "string")
- ) {
- _struct_composite.meta.title_main = _json.object["title"]["main"].str;
- } else if ("title" in _json.object["title"]
- && (_json.object["title"]["title"].type().to!string == "string")
- ) {
- _struct_composite.meta.title_main = _json.object["title"]["title"].str;
- }
- if ("note" in _json.object["title"]
- && (_json.object["title"]["note"].type().to!string == "string")
- ) {
- _struct_composite.meta.title_note = _json.object["title"]["note"].str;
- }
- if ("sub" in _json.object["title"]
- && (_json.object["title"]["sub"].type().to!string == "string")
- ) {
- _struct_composite.meta.title_sub = _json.object["title"]["sub"].str;
- }
- if ("subtitle" in _json.object["title"]
- && (_json.object["title"]["subtitle"].type().to!string == "string")
- ) {
- _struct_composite.meta.title_subtitle = _json.object["title"]["subtitle"].str;
- }
- }
- }
- if ((!(_struct_composite.meta.title_subtitle.empty))
- && (_struct_composite.meta.title_sub.empty)) {
- _struct_composite.meta.title_sub = _struct_composite.meta.title_subtitle;
- }
- _struct_composite.meta.title_full = (_struct_composite.meta.title_sub.empty)
- ? _struct_composite.meta.title_main
- : format(
- "%s - %s",
- _struct_composite.meta.title_main,
- _struct_composite.meta.title_sub,
- );
- }
return _struct_composite;
}
}
diff --git a/src/doc_reform/meta/conf_make_meta_structs.d b/src/doc_reform/meta/conf_make_meta_structs.d
index 874e509..ff1ec76 100644
--- a/src/doc_reform/meta/conf_make_meta_structs.d
+++ b/src/doc_reform/meta/conf_make_meta_structs.d
@@ -181,7 +181,9 @@ struct MetaComposite {
string classify_loc;
string classify_subject;
string classify_topic_register;
+ string[] classify_topic_register_arr;
string creator_author;
+ string creator_author_surname_fn;
string creator_author_email;
string creator_illustrator;
string creator_translator;
@@ -223,6 +225,7 @@ 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/metadoc.d b/src/doc_reform/meta/metadoc.d
index d8cc19f..a4b920b 100644
--- a/src/doc_reform/meta/metadoc.d
+++ b/src/doc_reform/meta/metadoc.d
@@ -9,6 +9,7 @@ template DocReformAbstraction() {
import
doc_reform.meta,
doc_reform.meta.metadoc_summary,
+ doc_reform.meta.metadoc_harvest,
doc_reform.meta.metadoc_from_src,
doc_reform.meta.conf_make_meta_structs,
doc_reform.meta.conf_make_meta_toml,
diff --git a/src/doc_reform/meta/metadoc_harvest.d b/src/doc_reform/meta/metadoc_harvest.d
new file mode 100644
index 0000000..c3534f9
--- /dev/null
+++ b/src/doc_reform/meta/metadoc_harvest.d
@@ -0,0 +1,30 @@
+module doc_reform.meta.metadoc_harvest;
+template DocReformMetaDocHarvest() {
+ auto DocReformMetaDocHarvest(T,H)(
+ T doc_matters,
+ H harvest,
+ ) {
+ import
+ doc_reform.meta.defaults,
+ doc_reform.meta.rgx;
+ import
+ std.array,
+ std.exception,
+ std.regex,
+ std.stdio,
+ std.string,
+ std.traits,
+ std.typecons,
+ std.uni,
+ std.utf,
+ std.conv : to;
+ mixin InternalMarkup;
+ 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.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;
+ }
+}
diff --git a/src/doc_reform/meta/metadoc_summary.d b/src/doc_reform/meta/metadoc_summary.d
index 768cebd..4beada8 100644
--- a/src/doc_reform/meta/metadoc_summary.d
+++ b/src/doc_reform/meta/metadoc_summary.d
@@ -1,6 +1,6 @@
module doc_reform.meta.metadoc_summary;
-template DocReformAbstractionSummary() {
- void DocReformAbstractionSummary(S,T)(
+template DocReformMetaDocSummary() {
+ void DocReformMetaDocSummary(S,T)(
const S doc_abstraction,
T doc_matters,
) {
diff --git a/src/doc_reform/meta/metadochead.d b/src/doc_reform/meta/metadochead.d
deleted file mode 100644
index 05be0a8..0000000
--- a/src/doc_reform/meta/metadochead.d
+++ /dev/null
@@ -1,84 +0,0 @@
-module doc_reform.meta.metadochead;
-template DocReformHarvestGetFromHead() { // TODO
- import
- std.datetime,
- std.getopt,
- std.file,
- std.path,
- std.process;
- import
- doc_reform.meta,
- 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,
- doc_reform.meta.rgx,
- doc_reform.source.paths_source,
- doc_reform.source.read_config_files,
- doc_reform.source.read_source_files,
- doc_reform.output.hub;
- mixin DocReformRgxInit;
- mixin contentJSONtoDocReformStruct;
- mixin DocReformBiblio;
- mixin DocReformRgxInitFlags;
- mixin outputHub;
- enum headBody { header, body_content, insert_file_list, image_list }
- enum makeMeta { make, meta }
- static auto rgx = Rgx();
- auto DocReformHarvestGetFromHead(E,O,M)( // TODO
- E _env,
- 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);
- /+ ↓ read file (filename with path) +/
- /+ ↓ file tuple of header and content +/
- if ((_opt_action.debug_do)
- || (_opt_action.very_verbose)
- ) {
- writeln("step1 commence → (get document header & body & insert file list & if needed image list)"
- );
- }
- 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);
- if ((_opt_action.debug_do)
- || (_opt_action.very_verbose)
- ) {
- writeln("- step1 complete");
- }
- debug(header_and_body) {
- writeln(header);
- writeln(_header_body_insertfilelist_imagelist.length);
- writeln(_header_body_insertfilelist_imagelist.length[headBody.body_content][0]);
- }
- /+ ↓ split header into make and meta +/
- if ((_opt_action.debug_do)
- || (_opt_action.very_verbose)
- ) {
- writeln("step2 commence → (read document header - toml, return struct)");
- }
- _make_and_meta_struct =
- docHeaderMakeAndMetaTupTomlExtractAndConvertToStruct!()(
- _make_and_meta_struct,
- _header_body_insertfilelist_imagelist[headBody.header]
- );
- if ((_opt_action.debug_do)
- || (_opt_action.very_verbose)
- ) {
- writeln("- step2 complete");
- }
-
- auto t = tuple(doc_matters_shared, doc_matters_abridged_collected);
- static assert(t.length==2);
- return t;
- }
-}
diff --git a/src/doc_reform/meta/rgx.d b/src/doc_reform/meta/rgx.d
index 373400f..544b432 100644
--- a/src/doc_reform/meta/rgx.d
+++ b/src/doc_reform/meta/rgx.d
@@ -7,6 +7,7 @@ static template DocReformRgxInit() {
static struct Rgx {
/+ misc +/
static true_dollar = ctRegex!(`\$`, "gm");
+ static sep = ctRegex!(`␣`, "gm");
static flag_action = ctRegex!(`^(--[a-z][a-z0-9-]+)$`);
static flag_action_str = ctRegex!(` (--[a-z][a-z0-9-]+)`);
static within_quotes = ctRegex!(`"(.+?)"`, "m");
@@ -43,7 +44,7 @@ static template DocReformRgxInit() {
/+ header +/
static variable_doc_title = ctRegex!(`@title`);
static variable_doc_author = ctRegex!(`@author|@creator`);
- static raw_author_munge = ctRegex!(`(\S.+?),\s+(.+)`,"i");
+ static raw_author_munge = ctRegex!(`(?P<last>\S.+?),\s+(?P<first>.+)`,"i");
static toml_header_meta_title = ctRegex!(`^\s*(title\s*=\s*"|\[title\])`, "m");
/+ heading & paragraph operators +/
static heading_a = ctRegex!(`^:?[A][~] `, "m");
@@ -191,6 +192,10 @@ static template DocReformRgxInit() {
static bi_main_term_plus_rest_split = ctRegex!(`\s*:\s*`);
static bi_sub_terms_plus_object_number_offset_split = ctRegex!(`\s*\|\s*`);
static bi_term_and_object_numbers_match = ctRegex!(`^(.+?)\+(\d+)`);
+ static topic_register_main_terms_split = ctRegex!(`\s*;\s*`);
+ static topic_register_main_term_plus_rest_split = ctRegex!(`\s*:\s*`);
+ static topic_register_sub_terms_split = ctRegex!(`\s*\|\s*`);
+ static topic_register_multiple_sub_terms_split = ctRegex!(`␣([^|␣]+(?:\|[^|␣]+)+)`);
/+ language codes +/
auto language_codes =
ctRegex!("(am|bg|bn|br|ca|cs|cy|da|de|el|en|eo|es|et|eu|fi|fr|ga|gl|he|hi|hr|hy|ia|is|it|ja|ko|la|lo|lt|lv|ml|mr|nl|no|nn|oc|pl|pt|pt_BR|ro|ru|sa|se|sk|sl|sq|sr|sv|ta|te|th|tk|tr|uk|ur|vi|zh)");
diff --git a/views/version.txt b/views/version.txt
index c1a5679..ace7cb6 100644
--- a/views/version.txt
+++ b/views/version.txt
@@ -4,7 +4,7 @@ struct Version {
int minor;
int patch;
}
-enum _ver = Version(0, 7, 2);
+enum _ver = Version(0, 7, 3);
version (Posix) {
version (DigitalMars) {
} else version (LDC) {