diff options
-rw-r--r-- | meson.build | 2 | ||||
-rw-r--r-- | org/doc_reform.org | 69 | ||||
-rw-r--r-- | org/dr_build_scaffold.org | 2 | ||||
-rw-r--r-- | org/meta_conf_make_meta.org | 48 | ||||
-rw-r--r-- | org/output_harvest_metadata.org | 148 | ||||
-rw-r--r-- | org/output_show.org | 464 | ||||
-rwxr-xr-x | src/doc_reform/doc_reform.d | 59 | ||||
-rw-r--r-- | src/doc_reform/meta/conf_make_meta_structs.d | 2 | ||||
-rw-r--r-- | src/doc_reform/meta/conf_make_meta_yaml.d | 46 | ||||
-rw-r--r-- | src/doc_reform/meta/metadoc.d | 2 | ||||
-rw-r--r-- | src/doc_reform/meta/metadoc_show_config.d | 106 | ||||
-rw-r--r-- | src/doc_reform/meta/metadoc_show_make.d | 74 | ||||
-rw-r--r-- | src/doc_reform/meta/metadoc_show_metadata.d | 122 | ||||
-rw-r--r-- | src/doc_reform/meta/metadoc_show_summary.d | 113 |
14 files changed, 1060 insertions, 197 deletions
diff --git a/meson.build b/meson.build index 46ff731..21b34e1 100644 --- a/meson.build +++ b/meson.build @@ -18,7 +18,7 @@ doc_reform_sources = [ 'src/doc_reform/meta/metadoc_harvests_authors.d', 'src/doc_reform/meta/metadoc_harvests_topics.d', 'src/doc_reform/meta/metadochead.d', - 'src/doc_reform/meta/metadoc_summary.d', + 'src/doc_reform/meta/metadoc_show_summary.d', 'src/doc_reform/meta/object_setter.d', 'src/doc_reform/meta/package.d', 'src/doc_reform/meta/rgx.d', diff --git a/org/doc_reform.org b/org/doc_reform.org index a8fd2a6..1d853c1 100644 --- a/org/doc_reform.org +++ b/org/doc_reform.org @@ -348,6 +348,9 @@ bool[string] opts = [ "pod" : false, "serial" : false, "show-summary" : false, + "show-metadata" : false, + "show-make" : false, + "show-config" : false, "source" : false, "sqlite-discrete" : false, "sqlite-db-create" : false, @@ -408,6 +411,9 @@ auto helpInfo = getopt(args, "pod", "--pod doc reform pod source content bundled", &opts["pod"], "serial", "--serial serial processing", &opts["serial"], "show-summary", "--show-summary", &opts["show-summary"], + "show-make", "--show-make", &opts["show-make"], + "show-metadata", "--show-metadata", &opts["show-metadata"], + "show-config", "--show-config", &opts["show-config"], "source", "--source markup source text content", &opts["source"], "sqlite-discrete", "--sqlite process discrete sqlite output", &opts["sqlite-discrete"], "sqlite-db-create", "--sqlite-db-create create db, create tables", &opts["sqlite-db-create"], @@ -555,6 +561,15 @@ struct OptActions { bool show_summary() { return opts["show-summary"]; } + bool show_make() { + return opts["show-make"]; + } + bool show_metadata() { + return opts["show-metadata"]; + } + bool show_config() { + return opts["show-config"]; + } bool source() { return opts["source"]; } @@ -965,8 +980,9 @@ if ((doc_matters.opt.action.debug_do) #+END_SRC *** 2. _output processing_ (post abstraction processing) -**** 0. abstraction _print summary_ :abstraction:summary: -- abstraction summary +**** 0. abstraction +***** show document summary - abstraction _print summary_ (to screen) :abstraction:summary: +--show-summary (abstraction summary) #+NAME: doc_reform_each_file_do_debugs_checkdoc #+BEGIN_SRC d @@ -974,12 +990,51 @@ if ((doc_matters.opt.action.debug_do) if (doc_matters.opt.action.verbose || doc_matters.opt.action.show_summary ) { - import doc_reform.meta.metadoc_summary; + import doc_reform.meta.metadoc_show_summary; DocReformMetaDocSummary!()(doc_abstraction, doc_matters); } #+END_SRC -**** 0. abstraction harvest :abstraction:harvest: +***** show metadata (doc headers metadata) +--show-metadata + +#+NAME: doc_reform_each_file_do_debugs_checkdoc +#+BEGIN_SRC d +/+ ↓ debugs +/ +if (doc_matters.opt.action.show_metadata +) { + import doc_reform.meta.metadoc_show_metadata; + DocReformShowMetaData!()(doc_matters); +} +#+END_SRC + +***** show make (make files & doc headers) +--show-make + +#+NAME: doc_reform_each_file_do_debugs_checkdoc +#+BEGIN_SRC d +/+ ↓ debugs +/ +if (doc_matters.opt.action.show_make +) { + import doc_reform.meta.metadoc_show_make; + DocReformShowMake!()(doc_matters); +} +#+END_SRC + +***** show config (config files & doc headers) +--show-config + +#+NAME: doc_reform_each_file_do_debugs_checkdoc +#+BEGIN_SRC d +/+ ↓ debugs +/ +if (doc_matters.opt.action.show_config +) { + import doc_reform.meta.metadoc_show_config; + DocReformShowConfig!()(doc_matters); +} +#+END_SRC + +***** abstraction harvest :abstraction:harvest: - abstraction harvest #+NAME: doc_reform_each_file_do_debugs_checkdoc @@ -1028,7 +1083,7 @@ if (!(doc_matters.opt.action.skip_output)) { scope(exit) { if (!(_opt_action.quiet)) { writefln( - "processed file: %s (%s)", + "processed file: %s [%s]", manifest.src.filename, manifest.src.language ); @@ -1356,7 +1411,7 @@ struct DocumentMatters { return SQLite_(); } auto output_path() { - return _manifest.output.path; + return _make_and_meta_struct.conf.output_path; } auto srcs() { struct SRC_ { @@ -1451,7 +1506,7 @@ struct DocumentMattersAbridged { return SQLite_(); } auto output_path() { - return _manifest.output.path; + return _make_and_meta_struct.conf.output_path; } } #+END_SRC diff --git a/org/dr_build_scaffold.org b/org/dr_build_scaffold.org index d17ed7b..815be88 100644 --- a/org/dr_build_scaffold.org +++ b/org/dr_build_scaffold.org @@ -1020,7 +1020,7 @@ doc_reform_sources = [ 'src/doc_reform/meta/metadoc_harvests_authors.d', 'src/doc_reform/meta/metadoc_harvests_topics.d', 'src/doc_reform/meta/metadochead.d', - 'src/doc_reform/meta/metadoc_summary.d', + 'src/doc_reform/meta/metadoc_show_summary.d', 'src/doc_reform/meta/object_setter.d', 'src/doc_reform/meta/package.d', 'src/doc_reform/meta/rgx.d', diff --git a/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org index ff1efb9..a8a5876 100644 --- a/org/meta_conf_make_meta.org +++ b/org/meta_conf_make_meta.org @@ -57,6 +57,7 @@ module doc_reform.meta.conf_make_meta_structs; import std.exception, std.json, + std.path, std.regex, std.stdio, std.string, @@ -225,6 +226,7 @@ struct ConfCompositeSiteLocal { string webserv_cgi_port; string webserv_cgi_user; string webserv_cgi_file_links; + string output_path; string processing_path; string processing_dir; string processing_concord_max; @@ -349,6 +351,7 @@ static template contentYAMLtoDocReformStruct() { std.algorithm, std.array, std.exception, + std.path, std.regex, std.stdio, std.string, @@ -593,24 +596,33 @@ if ("webserv" in _yaml } } } +if (!(_struct_composite.conf.output_path)) { + _struct_composite.conf.output_path = ((_manifest.output.path).asNormalizedPath).array; +} +if ("output" in _yaml + && _yaml["output"].type.sequence +) { + if (_yaml["output"].type.mapping + && _yaml["output"].tag.match(rgx.yaml_tag_is_map) + ) { + if ("path" in _yaml["output"] + && _yaml["output"]["path"].type.string + && _yaml["output"]["path"].tag.match(rgx.yaml_tag_is_str) + ) { + if (_manifest.output.path == _manifest.env.pwd + && _yaml["output"]["path"].get!string.length > 0 + ) { + _struct_composite.conf.output_path = (((_yaml["output"]["path"].get!string).expandTilde).asNormalizedPath).array; + } + } + } +} if ("processing" in _yaml && _yaml["processing"].type.sequence ) { if (_yaml["processing"].type.mapping && _yaml["processing"].tag.match(rgx.yaml_tag_is_map) ) { - if ("path" in _yaml["processing"] - && _yaml["processing"]["path"].type.string - && _yaml["processing"]["path"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.processing_path = _yaml["processing"]["path"].get!string; - } - if ("dir" in _yaml["processing"] - && _yaml["processing"]["dir"].type.string - && _yaml["processing"]["dir"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.processing_dir = _yaml["processing"]["dir"].get!string; - } if ("concord_max" in _yaml["processing"] && _yaml["processing"]["concord_max"].type.string && _yaml["processing"]["concord_max"].tag.match(rgx.yaml_tag_is_str) @@ -625,18 +637,18 @@ if ("flag" in _yaml if (_yaml["flag"].type.mapping && _yaml["flag"].tag.match(rgx.yaml_tag_is_map) ) { - if ("act1" in _yaml["flag"] - && _yaml["flag"]["act1"].type.string - && _yaml["flag"]["act1"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.flag_act1 = _yaml["flag"]["act1"].get!string; - } if ("act0" in _yaml["flag"] && _yaml["flag"]["act0"].type.string && _yaml["flag"]["act0"].tag.match(rgx.yaml_tag_is_str) ) { _struct_composite.conf.flag_act0 = _yaml["flag"]["act0"].get!string; } + if ("act1" in _yaml["flag"] + && _yaml["flag"]["act1"].type.string + && _yaml["flag"]["act1"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.flag_act1 = _yaml["flag"]["act1"].get!string; + } if ("act2" in _yaml["flag"] && _yaml["flag"]["act2"].type.string && _yaml["flag"]["act2"].tag.match(rgx.yaml_tag_is_str) diff --git a/org/output_harvest_metadata.org b/org/output_harvest_metadata.org index e6d5ab5..a25ab61 100644 --- a/org/output_harvest_metadata.org +++ b/org/output_harvest_metadata.org @@ -15,153 +15,7 @@ #+EXPORT_EXCLUDE_TAGS: noexport #+TAGS: assert(a) class(c) debug(d) mixin(m) doc_reform(s) tangle(T) template(t) WEB(W) noexport(n) -* document abstraction _summary_ :module:doc_reform:metadoc_summary: -** 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 DocReformMetaDocSummary() { - void DocReformMetaDocSummary(S,T)( - const S doc_abstraction, - T doc_matters, - ) { - <<metadoc_summary_imports>> - mixin InternalMarkup; - <<metadoc_summary_initialize>> - if (doc_matters.opt.action.verbose - || doc_matters.opt.action.show_summary - ) { - <<meta_metadoc_summary_document>> - } - } -} -#+END_SRC - -** init -*** imports - -#+name: metadoc_summary_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_summary_initialize -#+BEGIN_SRC d -auto markup = InlineMarkup(); -#+END_SRC - -** (last ocn) - -#+name: meta_metadoc_summary_document -#+BEGIN_SRC d -string[string] check = [ - "last_object_number" : "NA [debug \"checkdoc\" not run]", - "last_object_number_body" : "0", - "last_object_number_book_index" : "0", -]; -foreach (k; doc_matters.has.keys_seq.seg) { - foreach (obj; doc_abstraction[k]) { - if (obj.metainfo.is_of_part != "empty") { - if (!empty(obj.metainfo.object_number)) { - if (k == "body") { - check["last_object_number_body"] = obj.metainfo.object_number; - } - if (!(obj.metainfo.object_number.empty)) { - check["last_object_number"] = obj.metainfo.object_number; - } - } - if (k == "bookindex") { - if (obj.metainfo.object_number_type == 2) { - check["last_object_number_book_index"] = obj.metainfo.object_number_book_index; - } - } - } - } -} -#+END_SRC - -** document 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 - + 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%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\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, - markup.repeat_character_by_number_provided("-", char_repeat_number), - "- toc arr length:", - to!int(doc_abstraction["toc"].length), - "- doc_abstraction arr length:", - to!int(doc_abstraction["body"].length), - " doc body last obj on.#:", - to!int(check["last_object_number_body"]), - " - number of tables:", - doc_matters.has.tables, - " - number of codeblocks:", - doc_matters.has.codeblocks, - " - number of poems:", - doc_matters.has.poems, - " - number of blocks:", - doc_matters.has.blocks, - " - number of groups:", - doc_matters.has.groups, - " - number of images:", - doc_matters.has.images, - "- endnotes length:", // subtract headings - (doc_abstraction["endnotes"].length > 2) - ? (to!int(doc_abstraction["endnotes"].length - 2)) - : 0, - "- glossary length:", - (doc_abstraction["glossary"].length > 1) - ? (to!int(doc_abstraction["glossary"].length)) - : 0, - "- biblio length:", - (doc_abstraction["bibliography"].length > 1) - ? (to!int(doc_abstraction["bibliography"].length)) - : 0, - "- bookindex length:", - (doc_abstraction["bookindex"].length > 1) - ? (to!int(doc_abstraction["bookindex"].length)) - : 0, - " book idx last obj on.#:", - to!int(check["last_object_number_book_index"]), - "- blurb length:", - (doc_abstraction["blurb"].length > 1) - ? (to!int(doc_abstraction["blurb"].length)) - : 0, - "* last obj on.#:", - to!int(check["last_object_number"]), - "number of segments:", - (doc_matters.has.segnames_lv4.length > 1) - ? (to!int(doc_matters.has.segnames_lv4.length)) - : 0, - markup.repeat_character_by_number_provided("-", min_repeat_number), -); -#+END_SRC +* document harvest _summary_ :module:doc_reform:metadoc_show_summary: ** 0. module template metadoc harvest diff --git a/org/output_show.org b/org/output_show.org new file mode 100644 index 0000000..0c54c5f --- /dev/null +++ b/org/output_show.org @@ -0,0 +1,464 @@ +-*- mode: org -*- +#+TITLE: metadata (multidocument) harvests +#+DESCRIPTION: documents - structuring, various output representations & search +#+FILETAGS: :doc_reform:hub: +#+AUTHOR: Ralph Amissah +#+EMAIL: [[mailto:ralph.amissah@gmail.com][ralph.amissah@gmail.com]] +#+COPYRIGHT: Copyright (C) 2015 - 2019 Ralph Amissah +#+LANGUAGE: en +#+STARTUP: indent content hideblocks hidestars +#+OPTIONS: H:3 num:nil toc:t \n:nil @:t ::t |:t ^:nil _:nil -:t f:t *:t <:t +#+OPTIONS: TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc +#+OPTIONS: author:nil email:nil creator:nil timestamp:nil +#+PROPERTY: header-args :results silent :padline no :exports code :cache no :noweb yes +#+EXPORT_SELECT_TAGS: export +#+EXPORT_EXCLUDE_TAGS: noexport +#+TAGS: assert(a) class(c) debug(d) mixin(m) doc_reform(s) tangle(T) template(t) WEB(W) noexport(n) + +* document abstraction _summary_ :module:doc_reform:metadoc_show_summary: +** 0. module template metadoc summary +- document summary from abstraction + +#+BEGIN_SRC d :tangle "../src/doc_reform/meta/metadoc_show_summary.d" +module doc_reform.meta.metadoc_show_summary; +template DocReformMetaDocSummary() { + void DocReformMetaDocSummary(S,T)( + const S doc_abstraction, + T doc_matters, + ) { + <<metadoc_show_summary_imports>> + <<metadoc_show_imports_shared>> + mixin InternalMarkup; + <<metadoc_show_initialize>> + if (doc_matters.opt.action.verbose + || doc_matters.opt.action.show_summary) { + <<meta_metadoc_show_summary_document>> + } + } +} +#+END_SRC + +** (last ocn) + +#+name: meta_metadoc_show_summary_document +#+BEGIN_SRC d +string[string] check = [ + "last_object_number" : "NA [debug \"checkdoc\" not run]", + "last_object_number_body" : "0", + "last_object_number_book_index" : "0", +]; +foreach (k; doc_matters.has.keys_seq.seg) { + foreach (obj; doc_abstraction[k]) { + if (obj.metainfo.is_of_part != "empty") { + if (!empty(obj.metainfo.object_number)) { + if (k == "body") { + check["last_object_number_body"] = obj.metainfo.object_number; + } + if (!(obj.metainfo.object_number.empty)) { + check["last_object_number"] = obj.metainfo.object_number; + } + } + if (k == "bookindex") { + if (obj.metainfo.object_number_type == 2) { + check["last_object_number_book_index"] = obj.metainfo.object_number_book_index; + } + } + } + } +} +#+END_SRC + +** document summary + +#+name: meta_metadoc_show_summary_document +#+BEGIN_SRC d +writefln( + "%s\n\"%s\", %s\n%s [%s]\n%s\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\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.src.language, + markup.repeat_character_by_number_provided("-", char_repeat_number), + "- toc arr length:", + to!int(doc_abstraction["toc"].length), + "- doc_abstraction arr length:", + to!int(doc_abstraction["body"].length), + " doc body last obj on.#:", + to!int(check["last_object_number_body"]), + " - number of tables:", + doc_matters.has.tables, + " - number of codeblocks:", + doc_matters.has.codeblocks, + " - number of poems:", + doc_matters.has.poems, + " - number of blocks:", + doc_matters.has.blocks, + " - number of groups:", + doc_matters.has.groups, + " - number of images:", + doc_matters.has.images, + "- endnotes length:", // subtract headings + (doc_abstraction["endnotes"].length > 2) + ? (to!int(doc_abstraction["endnotes"].length - 2)) + : 0, + "- glossary length:", + (doc_abstraction["glossary"].length > 1) + ? (to!int(doc_abstraction["glossary"].length)) + : 0, + "- biblio length:", + (doc_abstraction["bibliography"].length > 1) + ? (to!int(doc_abstraction["bibliography"].length)) + : 0, + "- bookindex length:", + (doc_abstraction["bookindex"].length > 1) + ? (to!int(doc_abstraction["bookindex"].length)) + : 0, + " book idx last obj on.#:", + to!int(check["last_object_number_book_index"]), + "- blurb length:", + (doc_abstraction["blurb"].length > 1) + ? (to!int(doc_abstraction["blurb"].length)) + : 0, + "* last obj on.#:", + to!int(check["last_object_number"]), + "number of segments:", + (doc_matters.has.segnames_lv4.length > 1) + ? (to!int(doc_matters.has.segnames_lv4.length)) + : 0, + markup.repeat_character_by_number_provided("-", min_repeat_number), +); +#+END_SRC + +* show config +** 0. module template show config +--show-config (show config) + +#+BEGIN_SRC d :tangle "../src/doc_reform/meta/metadoc_show_config.d" +module doc_reform.meta.metadoc_show_config; +template DocReformShowConfig() { + void DocReformShowConfig(T)( + T doc_matters, + ) { + <<metadoc_show_summary_imports>> + <<metadoc_show_imports_shared>> + mixin InternalMarkup; + <<metadoc_show_initialize>> + if (doc_matters.opt.action.show_config + && doc_matters.opt.action.debug_do + ) { + writeln(doc_matters.conf_make_meta.conf); + } + if (doc_matters.opt.action.show_config) { + <<meta_metadoc_show_config>> + } + } +} +#+END_SRC + +** show config + +#+name: meta_metadoc_show_config +#+BEGIN_SRC d +writefln( + "%s\n\"%s\", %s\n%s\n%s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n", + 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, + markup.repeat_character_by_number_provided("-", char_repeat_number), + "- webserv url domain:", + doc_matters.conf_make_meta.conf.webserv_url_domain, + "- webserv doc root:", + doc_matters.conf_make_meta.conf.webserv_url_doc_root, + "- webserv doc path:", + doc_matters.conf_make_meta.conf.webserv_url_doc_path, + "- webserv images (location):", + doc_matters.conf_make_meta.conf.webserv_images, + "- webserv cgi:", + doc_matters.conf_make_meta.conf.webserv_cgi, + "- webserv cgi host:", + doc_matters.conf_make_meta.conf.webserv_cgi_host, + "- webserv cgi host path:", + doc_matters.conf_make_meta.conf.webserv_cgi_host_path, + "- webserv cgi port:", + doc_matters.conf_make_meta.conf.webserv_cgi_port, + "- webserv cgi user:", + doc_matters.conf_make_meta.conf.webserv_cgi_user, + "- webserv cgi file links:", + doc_matters.conf_make_meta.conf.webserv_cgi_file_links, + "- output path:", + doc_matters.conf_make_meta.conf.output_path, + "- processing concordance max:", + doc_matters.conf_make_meta.conf.processing_concord_max, + "- flag act0:", + doc_matters.conf_make_meta.conf.flag_act0, + "- flag act1:", + doc_matters.conf_make_meta.conf.flag_act1, + "- flag act2:", + doc_matters.conf_make_meta.conf.flag_act2, + "- flag act3:", + doc_matters.conf_make_meta.conf.flag_act3, + "- flag act4:", + doc_matters.conf_make_meta.conf.flag_act4, + "- flag act5:", + doc_matters.conf_make_meta.conf.flag_act5, + "- flag act6:", + doc_matters.conf_make_meta.conf.flag_act6, + "- flag act7:", + doc_matters.conf_make_meta.conf.flag_act7, + "- flag act8:", + doc_matters.conf_make_meta.conf.flag_act8, + "- flag act9:", + doc_matters.conf_make_meta.conf.flag_act9, + "- default papersize:", + doc_matters.conf_make_meta.conf.default_papersize, + "- default text wrap:", + doc_matters.conf_make_meta.conf.default_text_wrap, + "- default emphasis markup symbol:", + doc_matters.conf_make_meta.conf.default_emphasis, + "- default language:", + doc_matters.conf_make_meta.conf.default_language, + "- default hash digest:", + doc_matters.conf_make_meta.conf.default_digest, + "- search flag:", + doc_matters.conf_make_meta.conf.search_flag, + "- search action:", + doc_matters.conf_make_meta.conf.search_action, + "- search db:", + doc_matters.conf_make_meta.conf.search_db, + "- search title:", + doc_matters.conf_make_meta.conf.search_title, +); +#+END_SRC + +* show make +** 0. module template show make +--show-make (show document make) + +#+BEGIN_SRC d :tangle "../src/doc_reform/meta/metadoc_show_make.d" +module doc_reform.meta.metadoc_show_make; +template DocReformShowMake() { + void DocReformShowMake(T)( + T doc_matters, + ) { + <<metadoc_show_summary_imports>> + <<metadoc_show_imports_shared>> + mixin InternalMarkup; + <<metadoc_show_initialize>> + if (doc_matters.opt.action.show_make + && doc_matters.opt.action.debug_do + ) { + writeln(doc_matters.conf_make_meta.make); + } + if (doc_matters.opt.action.show_make) { + <<meta_metadoc_show_make>> + } + } +} +#+END_SRC + +** show make + +#+name: meta_metadoc_show_make +#+BEGIN_SRC d +writefln( + "%s\n\"%s\", %s\n%s\n%s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n", + 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, + markup.repeat_character_by_number_provided("-", char_repeat_number), + "- bold:", + doc_matters.conf_make_meta.make.bold, + "- breaks:", + doc_matters.conf_make_meta.make.breaks, + "- cover image:", + doc_matters.conf_make_meta.make.cover_image, + "- css:", + doc_matters.conf_make_meta.make.css, + "- emphasis:", + doc_matters.conf_make_meta.make.emphasis, + "- css:", + doc_matters.conf_make_meta.make.css, + "- footer:", + doc_matters.conf_make_meta.make.footer, + "- headings:", + doc_matters.conf_make_meta.make.headings, + "- home button image:", + doc_matters.conf_make_meta.make.home_button_image, + "- home button text:", + doc_matters.conf_make_meta.make.home_button_text, + "- italics:", + doc_matters.conf_make_meta.make.italics, + "- auto num top at level:", + doc_matters.conf_make_meta.make.auto_num_top_at_level, + "- auto num top level:", + doc_matters.conf_make_meta.make.auto_num_top_lv, + "- auto num depth:", + doc_matters.conf_make_meta.make.auto_num_depth, + "- texpdf font:", + doc_matters.conf_make_meta.make.texpdf_font, +); +#+END_SRC + + +* show metadata +** 0. module template show metadata +--show-metadata (show document metadata) + +#+BEGIN_SRC d :tangle "../src/doc_reform/meta/metadoc_show_metadata.d" +module doc_reform.meta.metadoc_show_metadata; +template DocReformShowMetaData() { + void DocReformShowMetaData(T)( + T doc_matters, + ) { + <<metadoc_show_summary_imports>> + <<metadoc_show_imports_shared>> + mixin InternalMarkup; + <<metadoc_show_initialize>> + if (doc_matters.opt.action.show_metadata + && doc_matters.opt.action.debug_do + ) { + writeln(doc_matters.conf_make_meta.meta); + } + if (doc_matters.opt.action.show_metadata) { + <<meta_metadoc_show_metadata>> + } + } +} +#+END_SRC + +** show metadata + +#+name: meta_metadoc_show_metadata +#+BEGIN_SRC d +writefln( + "%s\n\"%s\", %s\n%s\n%s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n", + 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, + markup.repeat_character_by_number_provided("-", char_repeat_number), + "- author:", + doc_matters.conf_make_meta.meta.creator_author, + "- author array:", + doc_matters.conf_make_meta.meta.creator_author_arr, + "- author surname:", + doc_matters.conf_make_meta.meta.creator_author_surname, + "- author email:", + doc_matters.conf_make_meta.meta.creator_author_email, + "- illustrator:", + doc_matters.conf_make_meta.meta.creator_illustrator, + "- translator:", + doc_matters.conf_make_meta.meta.creator_translator, + "- title full:", + doc_matters.conf_make_meta.meta.title_full, + "- title main:", + doc_matters.conf_make_meta.meta.title_main, + "- title sub:", + doc_matters.conf_make_meta.meta.title_subtitle, + "- title edition:", + doc_matters.conf_make_meta.meta.title_edition, + "- title language:", + doc_matters.conf_make_meta.meta.title_language, + "- title note:", + doc_matters.conf_make_meta.meta.title_note, + "- classify dewey:", + doc_matters.conf_make_meta.meta.classify_dewey, + "- classify library of congress:", + doc_matters.conf_make_meta.meta.classify_loc, + "- classify keywords:", + doc_matters.conf_make_meta.meta.classify_keywords, + "- classify topic register:", + doc_matters.conf_make_meta.meta.classify_topic_register, + "- date added to site:", + doc_matters.conf_make_meta.meta.date_added_to_site, + "- date available:", + doc_matters.conf_make_meta.meta.date_available, + "- date created:", + doc_matters.conf_make_meta.meta.date_created, + "- date issued:", + doc_matters.conf_make_meta.meta.date_issued, + "- date modified:", + doc_matters.conf_make_meta.meta.date_modified, + "- date published:", + doc_matters.conf_make_meta.meta.date_published, + "- date valid:", + doc_matters.conf_make_meta.meta.date_valid, + // links + "- notes abstract:", + doc_matters.conf_make_meta.meta.notes_abstract, + "- notes description:", + doc_matters.conf_make_meta.meta.notes_description, + "- original language:", + doc_matters.conf_make_meta.meta.original_language, + "- original language character:", + doc_matters.conf_make_meta.meta.original_language_char, + "- original source:", + doc_matters.conf_make_meta.meta.original_source, + "- original title:", + doc_matters.conf_make_meta.meta.original_title, + // publisher + "- rights copyright:", + doc_matters.conf_make_meta.meta.rights_copyright, + "- rights copyright text:", + doc_matters.conf_make_meta.meta.rights_copyright_text, + "- rights copyright audio:", + doc_matters.conf_make_meta.meta.rights_copyright_audio, + "- rights copyright cover:", + doc_matters.conf_make_meta.meta.rights_copyright_cover, + "- rights copyright illustrations:", + doc_matters.conf_make_meta.meta.rights_copyright_illustrations, + "- rights copyright photographs:", + doc_matters.conf_make_meta.meta.rights_copyright_photographs, + "- rights copyright translation:", + doc_matters.conf_make_meta.meta.rights_copyright_translation, + "- rights copyright video:", + doc_matters.conf_make_meta.meta.rights_copyright_video, + "- rights license:", + doc_matters.conf_make_meta.meta.rights_license, +); +#+END_SRC + +* shared init ? +** init + +*** imports + +#+name: metadoc_show_imports_shared +#+BEGIN_SRC d +import + std.array, + std.exception, + std.regex, + std.stdio, + std.string, + std.traits, + std.typecons, + std.uni, + std.utf, + std.conv : to; +#+END_SRC + +*** imports + +#+name: metadoc_show_summary_imports +#+BEGIN_SRC d +import + doc_reform.meta.defaults, + doc_reform.meta.rgx; +#+END_SRC + +*** initialize :report: + +#+name: metadoc_show_initialize +#+BEGIN_SRC d +auto markup = InlineMarkup(); +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; +#+END_SRC diff --git a/src/doc_reform/doc_reform.d b/src/doc_reform/doc_reform.d index 9c41895..2e388d1 100755 --- a/src/doc_reform/doc_reform.d +++ b/src/doc_reform/doc_reform.d @@ -141,6 +141,9 @@ void main(string[] args) { "pod" : false, "serial" : false, "show-summary" : false, + "show-metadata" : false, + "show-make" : false, + "show-config" : false, "source" : false, "sqlite-discrete" : false, "sqlite-db-create" : false, @@ -201,6 +204,9 @@ void main(string[] args) { "pod", "--pod doc reform pod source content bundled", &opts["pod"], "serial", "--serial serial processing", &opts["serial"], "show-summary", "--show-summary", &opts["show-summary"], + "show-make", "--show-make", &opts["show-make"], + "show-metadata", "--show-metadata", &opts["show-metadata"], + "show-config", "--show-config", &opts["show-config"], "source", "--source markup source text content", &opts["source"], "sqlite-discrete", "--sqlite process discrete sqlite output", &opts["sqlite-discrete"], "sqlite-db-create", "--sqlite-db-create create db, create tables", &opts["sqlite-db-create"], @@ -341,6 +347,15 @@ void main(string[] args) { bool show_summary() { return opts["show-summary"]; } + bool show_make() { + return opts["show-make"]; + } + bool show_metadata() { + return opts["show-metadata"]; + } + bool show_config() { + return opts["show-config"]; + } bool source() { return opts["source"]; } @@ -694,9 +709,27 @@ void main(string[] args) { if (doc_matters.opt.action.verbose || doc_matters.opt.action.show_summary ) { - import doc_reform.meta.metadoc_summary; + import doc_reform.meta.metadoc_show_summary; DocReformMetaDocSummary!()(doc_abstraction, doc_matters); } + /+ ↓ debugs +/ + if (doc_matters.opt.action.show_metadata + ) { + import doc_reform.meta.metadoc_show_metadata; + DocReformShowMetaData!()(doc_matters); + } + /+ ↓ debugs +/ + if (doc_matters.opt.action.show_make + ) { + import doc_reform.meta.metadoc_show_make; + DocReformShowMake!()(doc_matters); + } + /+ ↓ debugs +/ + if (doc_matters.opt.action.show_config + ) { + import doc_reform.meta.metadoc_show_config; + DocReformShowConfig!()(doc_matters); + } if (doc_matters.opt.action.harvest) { hvst.harvests ~= DocReformMetaDocHarvest!()(doc_matters, hvst); } @@ -721,7 +754,7 @@ void main(string[] args) { scope(exit) { if (!(_opt_action.quiet)) { writefln( - "processed file: %s (%s)", + "processed file: %s [%s]", manifest.src.filename, manifest.src.language ); @@ -780,9 +813,27 @@ void main(string[] args) { if (doc_matters.opt.action.verbose || doc_matters.opt.action.show_summary ) { - import doc_reform.meta.metadoc_summary; + import doc_reform.meta.metadoc_show_summary; DocReformMetaDocSummary!()(doc_abstraction, doc_matters); } + /+ ↓ debugs +/ + if (doc_matters.opt.action.show_metadata + ) { + import doc_reform.meta.metadoc_show_metadata; + DocReformShowMetaData!()(doc_matters); + } + /+ ↓ debugs +/ + if (doc_matters.opt.action.show_make + ) { + import doc_reform.meta.metadoc_show_make; + DocReformShowMake!()(doc_matters); + } + /+ ↓ debugs +/ + if (doc_matters.opt.action.show_config + ) { + import doc_reform.meta.metadoc_show_config; + DocReformShowConfig!()(doc_matters); + } if (doc_matters.opt.action.harvest) { hvst.harvests ~= DocReformMetaDocHarvest!()(doc_matters, hvst); } @@ -807,7 +858,7 @@ void main(string[] args) { scope(exit) { if (!(_opt_action.quiet)) { writefln( - "processed file: %s (%s)", + "processed file: %s [%s]", manifest.src.filename, manifest.src.language ); diff --git a/src/doc_reform/meta/conf_make_meta_structs.d b/src/doc_reform/meta/conf_make_meta_structs.d index 4dba388..f56141f 100644 --- a/src/doc_reform/meta/conf_make_meta_structs.d +++ b/src/doc_reform/meta/conf_make_meta_structs.d @@ -2,6 +2,7 @@ module doc_reform.meta.conf_make_meta_structs; import std.exception, std.json, + std.path, std.regex, std.stdio, std.string, @@ -151,6 +152,7 @@ struct ConfCompositeSiteLocal { string webserv_cgi_port; string webserv_cgi_user; string webserv_cgi_file_links; + string output_path; string processing_path; string processing_dir; string processing_concord_max; diff --git a/src/doc_reform/meta/conf_make_meta_yaml.d b/src/doc_reform/meta/conf_make_meta_yaml.d index bb072a9..f36a7cf 100644 --- a/src/doc_reform/meta/conf_make_meta_yaml.d +++ b/src/doc_reform/meta/conf_make_meta_yaml.d @@ -8,6 +8,7 @@ static template contentYAMLtoDocReformStruct() { std.algorithm, std.array, std.exception, + std.path, std.regex, std.stdio, std.string, @@ -236,24 +237,33 @@ static template contentYAMLtoDocReformStruct() { } } } + if (!(_struct_composite.conf.output_path)) { + _struct_composite.conf.output_path = ((_manifest.output.path).asNormalizedPath).array; + } + if ("output" in _yaml + && _yaml["output"].type.sequence + ) { + if (_yaml["output"].type.mapping + && _yaml["output"].tag.match(rgx.yaml_tag_is_map) + ) { + if ("path" in _yaml["output"] + && _yaml["output"]["path"].type.string + && _yaml["output"]["path"].tag.match(rgx.yaml_tag_is_str) + ) { + if (_manifest.output.path == _manifest.env.pwd + && _yaml["output"]["path"].get!string.length > 0 + ) { + _struct_composite.conf.output_path = (((_yaml["output"]["path"].get!string).expandTilde).asNormalizedPath).array; + } + } + } + } if ("processing" in _yaml && _yaml["processing"].type.sequence ) { if (_yaml["processing"].type.mapping && _yaml["processing"].tag.match(rgx.yaml_tag_is_map) ) { - if ("path" in _yaml["processing"] - && _yaml["processing"]["path"].type.string - && _yaml["processing"]["path"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.processing_path = _yaml["processing"]["path"].get!string; - } - if ("dir" in _yaml["processing"] - && _yaml["processing"]["dir"].type.string - && _yaml["processing"]["dir"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.processing_dir = _yaml["processing"]["dir"].get!string; - } if ("concord_max" in _yaml["processing"] && _yaml["processing"]["concord_max"].type.string && _yaml["processing"]["concord_max"].tag.match(rgx.yaml_tag_is_str) @@ -268,18 +278,18 @@ static template contentYAMLtoDocReformStruct() { if (_yaml["flag"].type.mapping && _yaml["flag"].tag.match(rgx.yaml_tag_is_map) ) { - if ("act1" in _yaml["flag"] - && _yaml["flag"]["act1"].type.string - && _yaml["flag"]["act1"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.flag_act1 = _yaml["flag"]["act1"].get!string; - } if ("act0" in _yaml["flag"] && _yaml["flag"]["act0"].type.string && _yaml["flag"]["act0"].tag.match(rgx.yaml_tag_is_str) ) { _struct_composite.conf.flag_act0 = _yaml["flag"]["act0"].get!string; } + if ("act1" in _yaml["flag"] + && _yaml["flag"]["act1"].type.string + && _yaml["flag"]["act1"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.flag_act1 = _yaml["flag"]["act1"].get!string; + } if ("act2" in _yaml["flag"] && _yaml["flag"]["act2"].type.string && _yaml["flag"]["act2"].tag.match(rgx.yaml_tag_is_str) diff --git a/src/doc_reform/meta/metadoc.d b/src/doc_reform/meta/metadoc.d index 9adc0c2..a4ff476 100644 --- a/src/doc_reform/meta/metadoc.d +++ b/src/doc_reform/meta/metadoc.d @@ -226,7 +226,7 @@ template DocReformAbstraction() { return SQLite_(); } auto output_path() { - return _manifest.output.path; + return _make_and_meta_struct.conf.output_path; } auto srcs() { struct SRC_ { diff --git a/src/doc_reform/meta/metadoc_show_config.d b/src/doc_reform/meta/metadoc_show_config.d new file mode 100644 index 0000000..25300aa --- /dev/null +++ b/src/doc_reform/meta/metadoc_show_config.d @@ -0,0 +1,106 @@ +module doc_reform.meta.metadoc_show_config; +template DocReformShowConfig() { + void DocReformShowConfig(T)( + T doc_matters, + ) { + 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(); + 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; + if (doc_matters.opt.action.show_config + && doc_matters.opt.action.debug_do + ) { + writeln(doc_matters.conf_make_meta.conf); + } + if (doc_matters.opt.action.show_config) { + writefln( + "%s\n\"%s\", %s\n%s\n%s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n", + 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, + markup.repeat_character_by_number_provided("-", char_repeat_number), + "- webserv url domain:", + doc_matters.conf_make_meta.conf.webserv_url_domain, + "- webserv doc root:", + doc_matters.conf_make_meta.conf.webserv_url_doc_root, + "- webserv doc path:", + doc_matters.conf_make_meta.conf.webserv_url_doc_path, + "- webserv images (location):", + doc_matters.conf_make_meta.conf.webserv_images, + "- webserv cgi:", + doc_matters.conf_make_meta.conf.webserv_cgi, + "- webserv cgi host:", + doc_matters.conf_make_meta.conf.webserv_cgi_host, + "- webserv cgi host path:", + doc_matters.conf_make_meta.conf.webserv_cgi_host_path, + "- webserv cgi port:", + doc_matters.conf_make_meta.conf.webserv_cgi_port, + "- webserv cgi user:", + doc_matters.conf_make_meta.conf.webserv_cgi_user, + "- webserv cgi file links:", + doc_matters.conf_make_meta.conf.webserv_cgi_file_links, + "- output path:", + doc_matters.conf_make_meta.conf.output_path, + "- processing concordance max:", + doc_matters.conf_make_meta.conf.processing_concord_max, + "- flag act0:", + doc_matters.conf_make_meta.conf.flag_act0, + "- flag act1:", + doc_matters.conf_make_meta.conf.flag_act1, + "- flag act2:", + doc_matters.conf_make_meta.conf.flag_act2, + "- flag act3:", + doc_matters.conf_make_meta.conf.flag_act3, + "- flag act4:", + doc_matters.conf_make_meta.conf.flag_act4, + "- flag act5:", + doc_matters.conf_make_meta.conf.flag_act5, + "- flag act6:", + doc_matters.conf_make_meta.conf.flag_act6, + "- flag act7:", + doc_matters.conf_make_meta.conf.flag_act7, + "- flag act8:", + doc_matters.conf_make_meta.conf.flag_act8, + "- flag act9:", + doc_matters.conf_make_meta.conf.flag_act9, + "- default papersize:", + doc_matters.conf_make_meta.conf.default_papersize, + "- default text wrap:", + doc_matters.conf_make_meta.conf.default_text_wrap, + "- default emphasis markup symbol:", + doc_matters.conf_make_meta.conf.default_emphasis, + "- default language:", + doc_matters.conf_make_meta.conf.default_language, + "- default hash digest:", + doc_matters.conf_make_meta.conf.default_digest, + "- search flag:", + doc_matters.conf_make_meta.conf.search_flag, + "- search action:", + doc_matters.conf_make_meta.conf.search_action, + "- search db:", + doc_matters.conf_make_meta.conf.search_db, + "- search title:", + doc_matters.conf_make_meta.conf.search_title, + ); + } + } +} diff --git a/src/doc_reform/meta/metadoc_show_make.d b/src/doc_reform/meta/metadoc_show_make.d new file mode 100644 index 0000000..017480c --- /dev/null +++ b/src/doc_reform/meta/metadoc_show_make.d @@ -0,0 +1,74 @@ +module doc_reform.meta.metadoc_show_make; +template DocReformShowMake() { + void DocReformShowMake(T)( + T doc_matters, + ) { + 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(); + 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; + if (doc_matters.opt.action.show_make + && doc_matters.opt.action.debug_do + ) { + writeln(doc_matters.conf_make_meta.make); + } + if (doc_matters.opt.action.show_make) { + writefln( + "%s\n\"%s\", %s\n%s\n%s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n", + 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, + markup.repeat_character_by_number_provided("-", char_repeat_number), + "- bold:", + doc_matters.conf_make_meta.make.bold, + "- breaks:", + doc_matters.conf_make_meta.make.breaks, + "- cover image:", + doc_matters.conf_make_meta.make.cover_image, + "- css:", + doc_matters.conf_make_meta.make.css, + "- emphasis:", + doc_matters.conf_make_meta.make.emphasis, + "- css:", + doc_matters.conf_make_meta.make.css, + "- footer:", + doc_matters.conf_make_meta.make.footer, + "- headings:", + doc_matters.conf_make_meta.make.headings, + "- home button image:", + doc_matters.conf_make_meta.make.home_button_image, + "- home button text:", + doc_matters.conf_make_meta.make.home_button_text, + "- italics:", + doc_matters.conf_make_meta.make.italics, + "- auto num top at level:", + doc_matters.conf_make_meta.make.auto_num_top_at_level, + "- auto num top level:", + doc_matters.conf_make_meta.make.auto_num_top_lv, + "- auto num depth:", + doc_matters.conf_make_meta.make.auto_num_depth, + "- texpdf font:", + doc_matters.conf_make_meta.make.texpdf_font, + ); + } + } +} diff --git a/src/doc_reform/meta/metadoc_show_metadata.d b/src/doc_reform/meta/metadoc_show_metadata.d new file mode 100644 index 0000000..11769db --- /dev/null +++ b/src/doc_reform/meta/metadoc_show_metadata.d @@ -0,0 +1,122 @@ +module doc_reform.meta.metadoc_show_metadata; +template DocReformShowMetaData() { + void DocReformShowMetaData(T)( + T doc_matters, + ) { + 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(); + 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; + if (doc_matters.opt.action.show_metadata + && doc_matters.opt.action.debug_do + ) { + writeln(doc_matters.conf_make_meta.meta); + } + if (doc_matters.opt.action.show_metadata) { + writefln( + "%s\n\"%s\", %s\n%s\n%s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n%30-s%10-s\n", + 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, + markup.repeat_character_by_number_provided("-", char_repeat_number), + "- author:", + doc_matters.conf_make_meta.meta.creator_author, + "- author array:", + doc_matters.conf_make_meta.meta.creator_author_arr, + "- author surname:", + doc_matters.conf_make_meta.meta.creator_author_surname, + "- author email:", + doc_matters.conf_make_meta.meta.creator_author_email, + "- illustrator:", + doc_matters.conf_make_meta.meta.creator_illustrator, + "- translator:", + doc_matters.conf_make_meta.meta.creator_translator, + "- title full:", + doc_matters.conf_make_meta.meta.title_full, + "- title main:", + doc_matters.conf_make_meta.meta.title_main, + "- title sub:", + doc_matters.conf_make_meta.meta.title_subtitle, + "- title edition:", + doc_matters.conf_make_meta.meta.title_edition, + "- title language:", + doc_matters.conf_make_meta.meta.title_language, + "- title note:", + doc_matters.conf_make_meta.meta.title_note, + "- classify dewey:", + doc_matters.conf_make_meta.meta.classify_dewey, + "- classify library of congress:", + doc_matters.conf_make_meta.meta.classify_loc, + "- classify keywords:", + doc_matters.conf_make_meta.meta.classify_keywords, + "- classify topic register:", + doc_matters.conf_make_meta.meta.classify_topic_register, + "- date added to site:", + doc_matters.conf_make_meta.meta.date_added_to_site, + "- date available:", + doc_matters.conf_make_meta.meta.date_available, + "- date created:", + doc_matters.conf_make_meta.meta.date_created, + "- date issued:", + doc_matters.conf_make_meta.meta.date_issued, + "- date modified:", + doc_matters.conf_make_meta.meta.date_modified, + "- date published:", + doc_matters.conf_make_meta.meta.date_published, + "- date valid:", + doc_matters.conf_make_meta.meta.date_valid, + // links + "- notes abstract:", + doc_matters.conf_make_meta.meta.notes_abstract, + "- notes description:", + doc_matters.conf_make_meta.meta.notes_description, + "- original language:", + doc_matters.conf_make_meta.meta.original_language, + "- original language character:", + doc_matters.conf_make_meta.meta.original_language_char, + "- original source:", + doc_matters.conf_make_meta.meta.original_source, + "- original title:", + doc_matters.conf_make_meta.meta.original_title, + // publisher + "- rights copyright:", + doc_matters.conf_make_meta.meta.rights_copyright, + "- rights copyright text:", + doc_matters.conf_make_meta.meta.rights_copyright_text, + "- rights copyright audio:", + doc_matters.conf_make_meta.meta.rights_copyright_audio, + "- rights copyright cover:", + doc_matters.conf_make_meta.meta.rights_copyright_cover, + "- rights copyright illustrations:", + doc_matters.conf_make_meta.meta.rights_copyright_illustrations, + "- rights copyright photographs:", + doc_matters.conf_make_meta.meta.rights_copyright_photographs, + "- rights copyright translation:", + doc_matters.conf_make_meta.meta.rights_copyright_translation, + "- rights copyright video:", + doc_matters.conf_make_meta.meta.rights_copyright_video, + "- rights license:", + doc_matters.conf_make_meta.meta.rights_license, + ); + } + } +} diff --git a/src/doc_reform/meta/metadoc_show_summary.d b/src/doc_reform/meta/metadoc_show_summary.d new file mode 100644 index 0000000..67db962 --- /dev/null +++ b/src/doc_reform/meta/metadoc_show_summary.d @@ -0,0 +1,113 @@ +module doc_reform.meta.metadoc_show_summary; +template DocReformMetaDocSummary() { + void DocReformMetaDocSummary(S,T)( + const S doc_abstraction, + T doc_matters, + ) { + 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(); + 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; + if (doc_matters.opt.action.verbose + || doc_matters.opt.action.show_summary) { + string[string] check = [ + "last_object_number" : "NA [debug \"checkdoc\" not run]", + "last_object_number_body" : "0", + "last_object_number_book_index" : "0", + ]; + foreach (k; doc_matters.has.keys_seq.seg) { + foreach (obj; doc_abstraction[k]) { + if (obj.metainfo.is_of_part != "empty") { + if (!empty(obj.metainfo.object_number)) { + if (k == "body") { + check["last_object_number_body"] = obj.metainfo.object_number; + } + if (!(obj.metainfo.object_number.empty)) { + check["last_object_number"] = obj.metainfo.object_number; + } + } + if (k == "bookindex") { + if (obj.metainfo.object_number_type == 2) { + check["last_object_number_book_index"] = obj.metainfo.object_number_book_index; + } + } + } + } + } + writefln( + "%s\n\"%s\", %s\n%s [%s]\n%s\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\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.src.language, + markup.repeat_character_by_number_provided("-", char_repeat_number), + "- toc arr length:", + to!int(doc_abstraction["toc"].length), + "- doc_abstraction arr length:", + to!int(doc_abstraction["body"].length), + " doc body last obj on.#:", + to!int(check["last_object_number_body"]), + " - number of tables:", + doc_matters.has.tables, + " - number of codeblocks:", + doc_matters.has.codeblocks, + " - number of poems:", + doc_matters.has.poems, + " - number of blocks:", + doc_matters.has.blocks, + " - number of groups:", + doc_matters.has.groups, + " - number of images:", + doc_matters.has.images, + "- endnotes length:", // subtract headings + (doc_abstraction["endnotes"].length > 2) + ? (to!int(doc_abstraction["endnotes"].length - 2)) + : 0, + "- glossary length:", + (doc_abstraction["glossary"].length > 1) + ? (to!int(doc_abstraction["glossary"].length)) + : 0, + "- biblio length:", + (doc_abstraction["bibliography"].length > 1) + ? (to!int(doc_abstraction["bibliography"].length)) + : 0, + "- bookindex length:", + (doc_abstraction["bookindex"].length > 1) + ? (to!int(doc_abstraction["bookindex"].length)) + : 0, + " book idx last obj on.#:", + to!int(check["last_object_number_book_index"]), + "- blurb length:", + (doc_abstraction["blurb"].length > 1) + ? (to!int(doc_abstraction["blurb"].length)) + : 0, + "* last obj on.#:", + to!int(check["last_object_number"]), + "number of segments:", + (doc_matters.has.segnames_lv4.length > 1) + ? (to!int(doc_matters.has.segnames_lv4.length)) + : 0, + markup.repeat_character_by_number_provided("-", min_repeat_number), + ); + } + } +} |