aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc_reform/meta/metadoc.d
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2018-09-10 18:15:02 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2019-04-10 15:14:15 -0400
commite95c49b76f4ac7bf72c383ee43a0567dfcbf1603 (patch)
treeb3aec9058f69be0047bb526052f8deefb5d97463 /src/doc_reform/meta/metadoc.d
parentmaker, subprojects arrange, minor (diff)
0.1.0 renamed doc-reform, doc_reform (& rad)
- from sdp
Diffstat (limited to 'src/doc_reform/meta/metadoc.d')
-rw-r--r--src/doc_reform/meta/metadoc.d177
1 files changed, 177 insertions, 0 deletions
diff --git a/src/doc_reform/meta/metadoc.d b/src/doc_reform/meta/metadoc.d
new file mode 100644
index 0000000..7c0e90d
--- /dev/null
+++ b/src/doc_reform/meta/metadoc.d
@@ -0,0 +1,177 @@
+module doc_reform.meta.metadoc;
+template SiSUabstraction() {
+ import
+ 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 SiSUrgxInit;
+ mixin contentJSONtoSiSUstruct;
+ mixin SiSUbiblio;
+ mixin SiSUrgxInitFlags;
+ mixin outputHub;
+ enum headBody { header, body_content, insert_file_list, image_list }
+ enum makeMeta { make, meta }
+ enum docAbst { doc_abstraction, section_keys, segnames, segnames_0_4, images }
+ static auto rgx = Rgx();
+ auto SiSUabstraction(E,O,M)(
+ 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 = configParseTOMLreturnSiSUstruct!()(_make_and_meta_struct, _config_document_struct);
+ _make_and_meta_struct = configParseTOMLreturnSiSUstruct!()(_make_and_meta_struct, _config_local_site_struct);
+ /+ ↓ read file (filename with path) +/
+ /+ ↓ file tuple of header and content +/
+ debug(steps) {
+ writeln("step1 commence → (get document header & body & insert file list & if needed image list)"
+ );
+ }
+ auto _header_body_insertfilelist_imagelist
+ = SiSUrawMarkupContent!()(_opt_action, _manifest.src.path_and_fn);
+ static assert(!isTypeTuple!(_header_body_insertfilelist_imagelist));
+ static assert(_header_body_insertfilelist_imagelist.length==4);
+ debug(steps) {
+ 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 +/
+ debug(steps) {
+ writeln("step2 commence → (read document header - toml, return struct)");
+ }
+ _make_and_meta_struct =
+ docHeaderMakeAndMetaTupTomlExtractAndConvertToStruct!()(
+ _make_and_meta_struct,
+ _header_body_insertfilelist_imagelist[headBody.header]
+ );
+ debug(steps) {
+ writeln("- step2 complete");
+ }
+ /+ ↓ document abstraction: process document, return abstraction as tuple +/
+ debug(steps) {
+ writeln("step3 commence → (document abstraction (da); da keys; segnames; doc_matters)");
+ }
+ auto da = SiSUdocAbstraction!()(
+ _header_body_insertfilelist_imagelist[headBody.body_content],
+ _make_and_meta_struct,
+ _opt_action,
+ _manifest,
+ true,
+ );
+ static assert(!isTypeTuple!(da));
+ static assert(da.length==5);
+ auto doc_abstraction = da[docAbst.doc_abstraction]; /+ head ~ toc ~ body ~ endnotes_seg ~ glossary ~ bibliography ~ bookindex ~ blurb; +/
+ auto _document_section_keys_sequenced = da[docAbst.section_keys];
+ string[] _doc_html_segnames = da[docAbst.segnames];
+ string[] _doc_epub_segnames_0_4 = da[docAbst.segnames_0_4];
+ auto _images = da[docAbst.images];
+ debug(steps) {
+ writeln("- step3 complete");
+ }
+ debug(steps) {
+ writeln("step4 commence → (doc_matters)");
+ }
+ struct DocumentMatters {
+ auto conf_make_meta() { // TODO meld with all make instructions
+ return _make_and_meta_struct;
+ }
+ auto env() {
+ struct Env_ {
+ auto pwd() {
+ return _manifest.env.pwd;
+ }
+ auto home() {
+ return _manifest.env.home;
+ }
+ }
+ return Env_();
+ }
+ auto opt() {
+ struct Opt_ {
+ auto action() {
+ /+ getopt options, commandline instructions, raw
+ - processing instructions --epub --html etc.
+ - command line config instructions --output-path
+ +/
+ return _opt_action;
+ }
+ }
+ return Opt_();
+ }
+ auto src() {
+ return _manifest.src;
+ }
+ auto src_path_info() {
+ return SiSUpathsSRC!()(_manifest.env.pwd, _manifest.src.file_with_absolute_path); // would like (to have and use) relative path
+ }
+ auto srcs() {
+ struct SRC_ {
+ auto file_insert_list() {
+ return _header_body_insertfilelist_imagelist[headBody.insert_file_list];
+ }
+ auto image_list() {
+ return _images;
+ }
+ }
+ return SRC_();
+ }
+ auto pod() {
+ return _manifest.pod;
+ }
+ auto sqlite() {
+ struct SQLite_ {
+ string filename() {
+ return _opt_action.sqlite_filename;
+ }
+ }
+ return SQLite_();
+ }
+ auto xml() {
+ struct XML_ {
+ auto keys_seq() {
+ /+ contains .seg & .scroll sequences +/
+ return _document_section_keys_sequenced;
+ }
+ string[] segnames() {
+ return _doc_html_segnames;
+ }
+ string[] segnames_lv_0_to_4() {
+ return _doc_epub_segnames_0_4;
+ }
+ }
+ return XML_();
+ }
+ auto output_path() {
+ return _manifest.output.path;
+ }
+ }
+ auto doc_matters = DocumentMatters();
+ debug(steps) {
+ writeln("- step4 complete");
+ }
+ auto t = tuple(doc_abstraction, doc_matters);
+ static assert(t.length==2);
+ return t;
+ }
+}