diff options
author | Ralph Amissah <ralph@amissah.com> | 2017-07-13 07:44:03 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:14 -0400 |
commit | 22cea68385b57a1593f5751e49cfdd41d8067997 (patch) | |
tree | 9e61339eb58679977c24962b1cfd2f50aa7f2998 /org/meta_debugs.org | |
parent | sdl extract and composite conf (make) (diff) |
0.18.0 rename meta from ao (considered adr)
Diffstat (limited to 'org/meta_debugs.org')
-rw-r--r-- | org/meta_debugs.org | 873 |
1 files changed, 873 insertions, 0 deletions
diff --git a/org/meta_debugs.org b/org/meta_debugs.org new file mode 100644 index 0000000..fb34b34 --- /dev/null +++ b/org/meta_debugs.org @@ -0,0 +1,873 @@ +#+TITLE: sdp abstraction summary and debugs +#+AUTHOR: Ralph Amissah +#+EMAIL: [[mailto:ralph.amissah@gmail.com][ralph.amissah@gmail.com]] +#+DESCRIPTION for documents - structuring, publishing in multiple formats and search +#+KEYWORDS +#+LANGUAGE: en +#+STARTUP: indent content +#+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 :padline no :exports code :noweb yes +#+EXPORT_SELECT_TAGS: export +#+EXPORT_EXCLUDE_TAGS: noexport +#+FILETAGS: :sdp:rel:meta: +#+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) + +[[./sdp.org][sdp]] [[./][org/]] +* 1. abstraction debugs :module:sdp:meta_doc_debugs: +** 0. module template + +#+BEGIN_SRC d :tangle ../src/sdp/meta/doc_debugs.d +/++ + output debugs ++/ +module sdp.meta.doc_debugs; +template SiSUdebugs() { + <<debug_imports>> + auto SiSUdebugs(S,T)( + auto return ref const S contents, + auto return ref T doc_matters, + ) { + mixin SiSUrgxInit; + mixin InternalMarkup; + <<initialize>> + <<meta_output_debugs>> + debug(checkdoc) { + if ((doc_matters.opt_action["debug"])) { + <<meta_output_debugs_summary>> + <<meta_output_debugs_checkdoc>> + } + } + } +} +#+END_SRC + +** imports + +#+name: debug_imports +#+BEGIN_SRC d +import + sdp.meta.defaults, + sdp.meta.rgx; +import + std.algorithm, + std.array, + std.container, + std.exception, + std.json, + std.stdio, + std.file, + std.path, + std.range, + std.regex, + std.string, + std.traits, + std.typecons, + std.utf, + std.conv : to; +#+END_SRC + +** initialize :report: + +#+name: initialize +#+BEGIN_SRC d +auto rgx = Rgx(); +auto markup = InlineMarkup(); +string key; +#+END_SRC + +** (parent) :parent: + +#+name: meta_output_debugs +#+BEGIN_SRC d +debug(parent) { + writefln( + "%s:%s", + __FILE__, + __LINE__, + ); + foreach (key; doc_matters.keys_seq.seg) { + foreach (obj; contents[key]) { + if (obj.use != "empty") { + if (obj.is_a == "heading") { + writefln( + "%s node: %s heading: %s %s", + obj.obj_cite_number, + obj.node, + obj.heading_lev_markup, + obj.text, + ); + } + } + } + } +} +#+END_SRC + +** (dumpdoc) :objects: + +#+name: meta_output_debugs +#+BEGIN_SRC d +debug(dumpdoc) { + writefln( + "%s\n%s:%s", + "-------------------------------", + __FILE__, + __LINE__, + ); + foreach (obj; contents[key]) { + if (obj.use != "empty") { + writefln( + "[%s][%s]\n%s", + obj.obj_cite_number, + obj.is_a, + obj.text + ); + } + } +} +#+END_SRC + +** (segnames) :objects: + +#+name: meta_output_debugs_checkdoc +#+BEGIN_SRC d +debug(checkdoc) { + void out_segnames(S,T)( + auto return ref const S contents, + auto return ref T doc_matters, + ) { + foreach (key; doc_matters.keys_seq.seg) { + if (contents[key].length > 1) { + foreach (obj; contents[key]) { + if (obj.heading_lev_markup == 4) { + writeln(obj.ptr_html_segnames, ". (", doc_matters.segnames[obj.ptr_html_segnames], ") -> ", obj.text); + } + } + } + } + } +} +#+END_SRC + +** shared output section arrange +*** out toc + +#+name: meta_output_debugs_checkdoc +#+BEGIN_SRC d +debug(checkdoc) { + void out_toc(S)( + auto return ref const S contents, + string key, + ) { + if (contents[key].length > 1) { + string indent_spaces; + foreach (obj; contents[key]) { + indent_spaces=markup.indent_by_spaces_provided(obj.indent_hang); + writefln( + "%s%s", + indent_spaces, + obj.text + ); + } + } + } +} +#+END_SRC + +*** out endnotes :endnotes: + +#+name: meta_output_debugs_checkdoc +#+BEGIN_SRC d +debug(checkdoc) { + void out_endnotes(S)( + auto return ref const S contents, + string key, + ) { + if (contents[key].length > 1) { + foreach (obj; contents[key]) { + writefln( + "[%s]\n%s", + obj.is_a, + obj.text + ); + } + } + } +} +#+END_SRC + +*** out bookindex :bookindex: + +#+name: meta_output_debugs_checkdoc +#+BEGIN_SRC d +debug(checkdoc) { + void out_bookindex(S)( + auto return ref const S contents, + string key, + ) { + if (contents[key].length > 1) { + foreach (obj; contents[key]) { + writefln( + "[%s][%s]\n%s", + obj.obj_cite_number, + obj.is_a, + obj.text + ); + } + } + } +} +#+END_SRC + +** sections +*** heading_section :heading: + +#+name: meta_output_debugs +#+BEGIN_SRC d +debug(section_head) { + key="head"; + if (contents[key].length > 1) { + foreach (obj; contents[key]) { + writefln( + "[%s][%s]\n%s", + obj.obj_cite_number, + obj.is_a, + obj.text + ); + } + } +} +#+END_SRC + +*** toc_section (seg & scroll) +**** toc + +#+name: meta_output_debugs +#+BEGIN_SRC d +debug(section_toc) { + key="toc_seg"; + out_toc(contents, key); +} +#+END_SRC + +**** toc seg + +#+name: meta_output_debugs +#+BEGIN_SRC d +debug(section_toc_seg) { + key="toc_seg"; + out_toc(contents, key); +} +#+END_SRC + +**** toc scroll + +#+name: meta_output_debugs +#+BEGIN_SRC d +debug(section_toc_scroll) { + key="toc_scroll"; + out_toc(contents, key); +} +#+END_SRC + +#+name: meta_output_debugs +#+BEGIN_SRC d +debug(segnames) { + writeln(__LINE__); + out_segnames(contents, doc_matters); +} +#+END_SRC + +*** body_section :body: + +#+name: meta_output_debugs +#+BEGIN_SRC d +debug(section_body) { + key="body"; + if (contents[key].length > 1) { + foreach (obj; contents[key]) { + writefln( + "[%s][%s]\n%s", + obj.obj_cite_number, + obj.is_a, + obj.text + ); + } + } +} +#+END_SRC + +*** dom structure :body: + +#+name: meta_output_debugs +#+BEGIN_SRC d +debug(toc_nav_dom) { + enum DomTags { none, open, close, close_and_open, open_still, } + foreach (sect; doc_matters.keys_seq.seg) { + foreach (obj; contents[sect]) { + if (obj.is_a == "heading") { + foreach_reverse (k; 0 .. 7) { + switch (obj.dom_markedup[k]) { + case DomTags.close : + writeln(markup.indent_by_spaces_provided(k), "</", k, ">"); + break; + case DomTags.close_and_open : + writeln(markup.indent_by_spaces_provided(k), "</", k, ">"); + writeln(markup.indent_by_spaces_provided(k), + "<", k, ">", obj.text, + " file: ", obj.segment_anchor_tag, ".xhtml#", obj.ocn); + break; + case DomTags.open : + writeln(markup.indent_by_spaces_provided(k), + "<", k, ">", obj.text, + " file: ", obj.segment_anchor_tag, ".xhtml#", obj.ocn); + break; + default : + break; + } + } + } + } + } + writeln("--------------------"); + foreach (sect; doc_matters.keys_seq.seg) { + foreach (obj; contents[sect]) { + if (obj.is_a == "heading") { + foreach_reverse (k; 0 .. 7) { + switch (obj.dom_collapsed[k]) { + case DomTags.close : + writeln(markup.indent_by_spaces_provided(k), "</", k, ">"); + break; + case DomTags.close_and_open : + writeln(markup.indent_by_spaces_provided(k), "</", k, ">"); + writeln(markup.indent_by_spaces_provided(k), + "<", k, ">", obj.text, + " file: ", obj.segment_anchor_tag, ".xhtml#", obj.ocn); + break; + case DomTags.open : + writeln(markup.indent_by_spaces_provided(k), + "<", k, ">", obj.text, + " file: ", obj.segment_anchor_tag, ".xhtml#", obj.ocn); + break; + default : + break; + } + } + } + } + } +} +#+END_SRC + +*** endnotes_section (seg & scroll) :endnotes: +**** endnotes + +#+name: meta_output_debugs +#+BEGIN_SRC d +debug(section_endnotes) { + key="endnotes"; + out_endnotes(contents, key); +} +#+END_SRC + +**** endnotes seg + +#+name: meta_output_debugs +#+BEGIN_SRC d +debug(section_endnotes_seg) { + key="endnotes"; + out_endnotes(contents, key); +} +#+END_SRC + +*** glossary_section :glossary: + +#+name: meta_output_debugs +#+BEGIN_SRC d +debug(section_glossary) { + key="glossary"; + if (contents[key].length > 1) { + foreach (obj; contents[key]) { + writefln( + "[%s][%s]\n%s", + obj.obj_cite_number, + obj.is_a, + obj.text + ); + } + } +} +#+END_SRC + +*** bibliography_section (seg & scroll) :bibliography: + +#+name: meta_output_debugs +#+BEGIN_SRC d +debug(section_bibliography) { + key="bibliography"; + if (contents[key].length > 1) { + foreach (obj; contents[key]) { + writefln( + "[%s][%s]\n%s", + obj.obj_cite_number, + obj.is_a, + obj.text + ); + } + } +} +#+END_SRC + +*** bookindex_section (seg & scroll) :bookindex: +**** bookindex + +#+name: meta_output_debugs +#+BEGIN_SRC d +debug(section_bookindex) { + key="bookindex_seg"; + out_bookindex(contents, key); +} +#+END_SRC + +**** bookindex seg + +#+name: meta_output_debugs +#+BEGIN_SRC d +debug(section_bookindex_seg) { + key="bookindex_seg"; + out_bookindex(contents, key); +} +#+END_SRC + +**** bookindex scroll + +#+name: meta_output_debugs +#+BEGIN_SRC d +debug(section_bookindex_scroll) { + key="bookindex_scroll"; + out_bookindex(contents, key); +} +#+END_SRC + +*** section_blurb :blurb: + +#+name: meta_output_debugs +#+BEGIN_SRC d +debug(blurb_section) { + key="blurb"; + if (contents[key].length > 1) { + foreach (obj; contents[key]) { + writefln( + "[%s][%s]\n%s", + obj.obj_cite_number, + obj.is_a, + obj.text + ); + } + } +} +#+END_SRC + +** (objects) :objects: + +#+name: meta_output_debugs +#+BEGIN_SRC d +debug(objects) { + writefln( + "%s\n%s:%s", + "-------------------------------", + __FILE__, + __LINE__, + ); + foreach (obj; contents[key]) { + if (obj.use != "empty") { + writefln( + "* [%s][%s] %s", + obj.obj_cite_number, + obj.is_a, + obj.text + ); + } + } +} +#+END_SRC + +** (headermakejson) :json:header: + +#+name: meta_output_debugs +#+BEGIN_SRC d +debug(headermakejson) { + writefln( + "%s\n%s\n%s", + "document header, metadata & make instructions:", + doc_matters.dochead_meta, + ptr_head_main, + ); + foreach (main_header; ptr_head_main) { + switch (main_header) { + case "make": + foreach (sub_header; ptr_head_sub_make) { + if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { + writefln( + "%s:%s: %s", + main_header, + sub_header, + doc_matters.dochead_meta[main_header][sub_header] + ); + } + } + break; + default: + break; + } + } +} +#+END_SRC + +** (headermetadatajson) :json:header: + +#+name: meta_output_debugs +#+BEGIN_SRC d +debug(headermetadatajson) { + writefln( + "%s\n%s\n%s", + "document header, metadata & make instructions:", + doc_matters.dochead_meta, + ptr_head_main, + ); + foreach (main_header; ptr_head_main) { + switch (main_header) { + case "creator": + foreach (sub_header; ptr_head_sub_creator) { + if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { + writefln( + "%s:%s: %s", + main_header, + sub_header, + doc_matters.dochead_meta[main_header][sub_header] + ); + } + } + break; + case "title": + foreach (sub_header; ptr_head_sub_title) { + if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { + writefln( + "%s:%s: %s", + main_header, + sub_header, + doc_matters.dochead_meta[main_header][sub_header] + ); + } + } + break; + case "rights": + foreach (sub_header; ptr_head_sub_rights) { + if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { + writefln( + "%s:%s: %s", + main_header, + sub_header, + doc_matters.dochead_meta[main_header][sub_header] + ); + } + } + break; + case "date": + foreach (sub_header; ptr_head_sub_date) { + if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { + writefln( + "%s:%s: %s", + main_header, + sub_header, + doc_matters.dochead_meta[main_header][sub_header] + ); + } + } + break; + case "original": + foreach (sub_header; ptr_head_sub_original) { + if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { + writefln( + "%s:%s: %s", + main_header, + sub_header, + doc_matters.dochead_meta[main_header][sub_header] + ); + } + } + break; + case "classify": + foreach (sub_header; ptr_head_sub_classify) { + if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { + writefln( + "%s:%s: %s", + main_header, + sub_header, + doc_matters.dochead_meta[main_header][sub_header] + ); + } + } + break; + case "identifier": + foreach (sub_header; ptr_head_sub_identifier) { + if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { + writefln( + "%s:%s: %s", + main_header, + sub_header, + doc_matters.dochead_meta[main_header][sub_header] + ); + } + } + break; + case "notes": + foreach (sub_header; ptr_head_sub_notes) { + if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { + writefln( + "%s:%s: %s", + main_header, + sub_header, + doc_matters.dochead_meta[main_header][sub_header] + ); + } + } + break; + case "publisher": + foreach (sub_header; ptr_head_sub_publisher) { + if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { + writefln( + "%s:%s: %s", + main_header, + sub_header, + doc_matters.dochead_meta[main_header][sub_header] + ); + } + } + break; + default: + break; + } + } +} +#+END_SRC + +** anchor tags + +#+name: meta_output_debugs +#+BEGIN_SRC d +debug(anchor) { + writefln( + "%s\n%s:%s", + "-------------------------------", + __FILE__, + __LINE__, + ); + foreach (k; doc_matters.keys_seq.seg) { + foreach (obj; contents[k]) { + if (obj.is_a == "heading") { + writefln( + "%s~ [%s] %s %s", + obj.marked_up_level, + obj.obj_cite_number, + obj.anchor_tags, + // "[", obj["is"], "] ", + obj.text + ); + } + } + } +} |