From f5c32101f14aa21c056b57ddce14394b7f1e7c23 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 2 Feb 2017 12:17:38 -0500 Subject: 0.12.2 ao_summary_and_debugs.org (ao_output_debugs.org moved and reorganised) --- org/ao_output_debugs.org | 936 -------------------------------------- org/ao_read_source_files.org | 8 +- org/ao_summary_and_debugs.org | 991 +++++++++++++++++++++++++++++++++++++++++ org/sdp.org | 27 +- src/sdp.d | 7 +- src/sdp/abstraction.d | 5 +- src/sdp/abstraction_summary.d | 89 ++++ src/sdp/ao_doc_debugs.d | 653 +++++++++++++++++++++++++++ src/sdp/ao_output_debugs.d | 708 ----------------------------- src/sdp/ao_read_source_files.d | 8 +- views/version.txt | 2 +- 11 files changed, 1769 insertions(+), 1665 deletions(-) delete mode 100644 org/ao_output_debugs.org create mode 100644 org/ao_summary_and_debugs.org create mode 100644 src/sdp/abstraction_summary.d create mode 100644 src/sdp/ao_doc_debugs.d delete mode 100644 src/sdp/ao_output_debugs.d diff --git a/org/ao_output_debugs.org b/org/ao_output_debugs.org deleted file mode 100644 index 7a7a8c7..0000000 --- a/org/ao_output_debugs.org +++ /dev/null @@ -1,936 +0,0 @@ -#+TITLE: sdp output debugs -#+AUTHOR: Ralph Amissah -#+EMAIL: ralph.amissah@gmail.com -#+STARTUP: indent -#+LANGUAGE: en -#+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:ao: -#+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) - -[[./sdp.org][sdp]] [[./][org/]] -* 1. output debugs :debug:output: -[[./sdp.org][sdp]] [[./][org/]] -** 0. code structure: :ao_output_debugs: - -#+name: tangle_ao_output_debugs -#+BEGIN_SRC d :tangle ../src/sdp/ao_output_debugs.d -/++ - output debugs -+/ -template SiSUdebugs() { - <> - auto SiSUdebugs(S,T)( - auto ref const S contents, - auto ref T doc_matters, - ) { - mixin SiSUrgxInit; - mixin InternalMarkup; - <> - <> - debug(checkdoc) { - if ((doc_matters.opt_action_bool["debug"])) { - <> - } - <> - } - if ((doc_matters.opt_action_bool["verbose"])) { - <> - } - } - } -} -#+END_SRC - - -** imports - -#+name: debug_imports -#+BEGIN_SRC d -import - ao_defaults, - ao_rgx; -private import - std.algorithm, - std.array, - std.container, - std.exception, - std.getopt, - std.json, - std.process, - std.stdio, - std.file, - std.path, - std.range, - std.regex, - std.string, - std.traits, - std.typecons, - std.uni, - 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: ao_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: ao_output_debugs -#+BEGIN_SRC d -debug(dumpdoc) { - writefln( - "%s\n%s:%s", - "-------------------------------", - __FILE__, - __LINE__, - ); - foreach (obj; contents) { - if (obj.use != "empty") { - writefln( - "[%s][%s]\n%s", - obj.obj_cite_number, - obj.is_a, - obj.text - ); - } - } -} -#+END_SRC - -** (segnames) :objects: - -#+name: ao_output_debugs_checkdoc -#+BEGIN_SRC d -debug(checkdoc) { - void out_segnames(S,T)( - auto ref const S contents, - auto 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: ao_output_debugs_checkdoc -#+BEGIN_SRC d -debug(checkdoc) { - void out_toc(S)( - auto 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: ao_output_debugs_checkdoc -#+BEGIN_SRC d -debug(checkdoc) { - void out_endnotes(S)( - auto 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: ao_output_debugs_checkdoc -#+BEGIN_SRC d -debug(checkdoc) { - void out_bookindex(S)( - auto 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: ao_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: ao_output_debugs -#+BEGIN_SRC d -debug(section_toc) { - key="toc_seg"; - out_toc(contents, key); -} -#+END_SRC - -**** toc seg - -#+name: ao_output_debugs -#+BEGIN_SRC d -debug(section_toc_seg) { - key="toc_seg"; - out_toc(contents, key); -} -#+END_SRC - -**** toc scroll - -#+name: ao_output_debugs -#+BEGIN_SRC d -debug(section_toc_scroll) { - key="toc_scroll"; - out_toc(contents, key); -} -#+END_SRC - -#+name: ao_output_debugs -#+BEGIN_SRC d -debug(segnames) { - writeln(__LINE__); - out_segnames(contents, doc_matters); -} -#+END_SRC - -*** body_section :body: - -#+name: ao_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: ao_output_debugs -#+BEGIN_SRC d -debug(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), ""); - break; - case DomTags.close_and_open : - writeln(markup.indent_by_spaces_provided(k), ""); - writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); - break; - case DomTags.open : - writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); - 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), ""); - break; - case DomTags.close_and_open : - writeln(markup.indent_by_spaces_provided(k), ""); - writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); - break; - case DomTags.open : - writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); - break; - default : - break; - } - } - } - } - } -} -#+END_SRC - -*** endnotes_section (seg & scroll) :endnotes: -**** endnotes - -#+name: ao_output_debugs -#+BEGIN_SRC d -debug(section_endnotes) { - key="endnotes"; - out_endnotes(contents, key); -} -#+END_SRC - -**** endnotes seg - -#+name: ao_output_debugs -#+BEGIN_SRC d -debug(section_endnotes_seg) { - key="endnotes"; - out_endnotes(contents, key); -} -#+END_SRC - -*** glossary_section :glossary: - -#+name: ao_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: ao_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: ao_output_debugs -#+BEGIN_SRC d -debug(section_bookindex) { - key="bookindex_seg"; - out_bookindex(contents, key); -} -#+END_SRC - -**** bookindex seg - -#+name: ao_output_debugs -#+BEGIN_SRC d -debug(section_bookindex_seg) { - key="bookindex_seg"; - out_bookindex(contents, key); -} -#+END_SRC - -**** bookindex scroll - -#+name: ao_output_debugs -#+BEGIN_SRC d -debug(section_bookindex_scroll) { - key="bookindex_scroll"; - out_bookindex(contents, key); -} -#+END_SRC - -*** section_blurb :blurb: - -#+name: ao_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: ao_output_debugs -#+BEGIN_SRC d -debug(objects) { - writefln( - "%s\n%s:%s", - "-------------------------------", - __FILE__, - __LINE__, - ); - foreach (obj; contents) { - if (obj.use != "empty") { - writefln( - "* [%s][%s] %s", - obj.obj_cite_number, - obj.is_a, - obj.text - ); - } - } -} -#+END_SRC - -** (headermakejson) :json:header: - -#+name: ao_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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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: ao_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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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: ao_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 - ); - } - } - } -} -#+END_SRC - -** (headings) :headings: - -#+name: ao_output_debugs -#+BEGIN_SRC d -debug(heading) { // heading - foreach (k; doc_matters.keys_seq_seg) { - foreach (o; contents[k]) { - if (o.is_a == "heading") { - writefln( - "%s* %s\n (markup level: %s; collapsed level: %s)", - replicate(" ", o.heading_lev_markup), - strip(o.text), - o.heading_lev_markup, - o.heading_lev_collapsed, - ); - } - } - } -} -#+END_SRC - -** (summary) [+1] :summary: - -#+name: ao_output_debugs_summary -#+BEGIN_SRC d -debug(headings) { - 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", - obj.marked_up_level, - obj.obj_cite_number, - // "[", obj["is"], "] ", - obj.text - ); - } - } - } -} -#+END_SRC - -#+name: ao_output_debugs -#+BEGIN_SRC d -debug(summary) { - string[string] check = [ - "last_obj_cite_number" : "NA [debug \"checkdoc\" not run]", - ]; -#+END_SRC - -*** (last ocn) :checkdoc: - -#+name: ao_output_debugs_summary_doc -#+BEGIN_SRC d -if ((doc_matters.opt_action_bool["verbose"])) { - foreach (k; doc_matters.keys_seq_seg) { - foreach (obj; contents[k]) { - if (obj.use != "empty") { - if (!empty(obj.obj_cite_number)) { - check["last_obj_cite_number"] = obj.obj_cite_number; - } - } - } - } -} -#+END_SRC - -*** [#A] output summary - -#+name: ao_output_debugs_summary_doc -#+BEGIN_SRC d -auto min_repeat_number = 66; -auto char_repeat_number = (doc_matters.dochead_meta["title"]["full"].length + doc_matters.dochead_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%10d\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n(%s: %s)\n%s", - markup.repeat_character_by_number_provided("-", char_repeat_number), - doc_matters.dochead_meta["title"]["full"], - doc_matters.dochead_meta["creator"]["author"], - doc_matters.source_filename, - markup.repeat_character_by_number_provided("-", char_repeat_number), - "length toc array: ", - to!int(contents["toc_seg"].length), - "length contents array: ", - to!int(contents["body"].length), - "last obj_cite_number: ", - to!int(check["last_obj_cite_number"]), - "length endnotes: ", - (contents["endnotes"].length > 1) - ? (to!int(contents["endnotes"].length)) - : 0, - "length glossary: ", - (contents["glossary"].length > 1) - ? (to!int(contents["glossary"].length)) - : 0, - "length biblio: ", - (contents["bibliography"].length > 1) - ? (to!int(contents["bibliography"].length)) - : 0, - "length bookindex: ", - (contents["bookindex_seg"].length > 1) - ? (to!int(contents["bookindex_seg"].length)) - : 0, - "length blurb: ", - (contents["blurb"].length > 1) - ? (to!int(contents["blurb"].length)) - : 0, - __FILE__, - __LINE__, - markup.repeat_character_by_number_provided("-", min_repeat_number), -); -#+END_SRC - -*** compare number of obj_cite_number for known sisu markup output (checkdoc) - -#+name: ao_output_debugs_summary -#+BEGIN_SRC d -debug(checkdoc) { - if (auto mfn=match(doc_matters.source_filename, rgx.src_fn)) { - if (doc_matters.opt_action_bool["assertions"]) { - switch (mfn.captures[2]) { - // live manual: - case "live-manual.ssm": - assert(check["last_obj_cite_number"] == - "1019","last obj_cite_number should be: 1019 (check test, document is frequently updated)"); // ok - break; - // sisu_markup: - case "sisu_markup.sst": - assert(check["last_obj_cite_number"] == - "297","last obj_cite_number expected to be: 297 rather than " ~ check["last_obj_cite_number"]); // ok - // assert(check["last_obj_cite_number"] == "297","last obj_cite_number expected to be: 297 rather than " ~ check["last_obj_cite_number"]); - // notes for first divergance study sisu headings 247 250 - // sisu has issue with code that contains heading 1~ which results in no obj_cite_number! ?? - // sisu currently has incorrect last body obj_cite_number of 294! - // bug in sisu? attend - break; - // sisu-markup-samples: - case "accelerando.charles_stross.sst": - assert(check["last_obj_cite_number"] == - "2861","last obj_cite_number expected to be: 2861 rather than " ~ check["last_obj_cite_number"]); // ok - break; - case "alices_adventures_in_wonderland.lewis_carroll.sst": - assert(check["last_obj_cite_number"] == - "805","last obj_cite_number expected to be: 805 rather than " ~ check["last_obj_cite_number"]); // 808 - break; - case "autonomy_markup0.sst": - assert(check["last_obj_cite_number"] == - "77","last obj_cite_number expected to be: 77 rather than " ~ check["last_obj_cite_number"]); // ok endnotes - // assert(check["last_obj_cite_number"] == "78","last obj_cite_number expected to be: 78 rather than " ~ check["last_obj_cite_number"]); - break; - case "content.cory_doctorow.sst": - assert(check["last_obj_cite_number"] == - "953","last obj_cite_number expected to be: 953 rather than " ~ check["last_obj_cite_number"]); // 1007 way off, check obj_cite_number off switches - // assert(check["last_obj_cite_number"] == "953","last obj_cite_number expected to be: 953 rather than " ~ check["last_obj_cite_number"]); - break; - case "democratizing_innovation.eric_von_hippel.sst": - // fixed ERROR! range violation, broken check! endnotes, bookindex, biblio - // error in bookindex ... (ch1; ch6; ch8 ) - assert(check["last_obj_cite_number"] == - "905","last obj_cite_number expected to be: 905 rather than " ~ check["last_obj_cite_number"]); // 911 - break; - case "down_and_out_in_the_magic_kingdom.cory_doctorow.sst": - assert(check["last_obj_cite_number"] == - "1417","last obj_cite_number expected to be: 1417 rather than " ~ check["last_obj_cite_number"]); // 1455 check obj_cite_number off switches - break; - case "for_the_win.cory_doctorow.sst": - assert(check["last_obj_cite_number"] == - "3510","last obj_cite_number expected to be: 3510 rather than " ~ check["last_obj_cite_number"]); // 3569 check obj_cite_number off switches - break; - case "free_as_in_freedom_2.richard_stallman_and_the_free_software_revolution.sam_williams.richard_stallman.sst": - assert(check["last_obj_cite_number"] == - "1082","last obj_cite_number expected to be: 1082 rather than " ~ check["last_obj_cite_number"]); // check 1079 too few - break; - case "free_culture.lawrence_lessig.sst": - assert(check["last_obj_cite_number"] == - "1330","last obj_cite_number expected to be: 1330 rather than " ~ check["last_obj_cite_number"]); // 1312 - // fixed ERROR! range violation, broken check! - // error in bookindex ... sections piracy (ch1) & property (ch10 market concentration) fixed - break; - case "free_for_all.peter_wayner.sst": // endnotes, bookindex, biblio - assert(check["last_obj_cite_number"] == - "1559","last obj_cite_number expected to be: 1559 rather than " ~ check["last_obj_cite_number"]); // 1560, check obj_cite_number off switches, has endnotes so 2 too many - // assert(check["last_obj_cite_number"] == "1559","last obj_cite_number expected to be: 1559 rather than " ~ check["last_obj_cite_number"]); - break; - case "gpl2.fsf.sst": - assert(check["last_obj_cite_number"] == - "65","last obj_cite_number expected to be: 65 rather than " ~ check["last_obj_cite_number"]); // ok endnotes? check - // assert(check["last_obj_cite_number"] == "66","last obj_cite_number expected to be: 66 rather than " ~ check["last_obj_cite_number"]); - break; - case "gpl3.fsf.sst": - assert(check["last_obj_cite_number"] == - "123","last obj_cite_number expected to be: 123 rather than " ~ check["last_obj_cite_number"]); // ok - break; - case "gullivers_travels.jonathan_swift.sst": - assert(check["last_obj_cite_number"] == - "668","last obj_cite_number expected to be: 668 rather than " ~ check["last_obj_cite_number"]); // 674 - break; - case "little_brother.cory_doctorow.sst": - assert(check["last_obj_cite_number"] == - "3130","last obj_cite_number expected to be: 3130 rather than " ~ check["last_obj_cite_number"]); // 3204, check obj_cite_number off switches - break; - case "the_cathedral_and_the_bazaar.eric_s_raymond.sst": - assert(check["last_obj_cite_number"] == - "258","last obj_cite_number expected to be: 258 rather than " ~ check["last_obj_cite_number"]); // ok - break; - case "the_public_domain.james_boyle.sst": - assert(check["last_obj_cite_number"] == - "970","last obj_cite_number expected to be: 970 rather than " ~ check["last_obj_cite_number"]); // 978 - break; - case "the_wealth_of_networks.yochai_benkler.sst": // endnotes, bookindex - assert(check["last_obj_cite_number"] == - "829","last obj_cite_number expected to be: 829 rather than " ~ check["last_obj_cite_number"]); // ok - // assert(check["last_obj_cite_number"] == "832","last obj_cite_number expected to be: 832 rather than " ~ check["last_obj_cite_number"]); - // has endnotes and bookindex, issue with sisu.rb - break; - case "through_the_looking_glass.lewis_carroll.sst": - assert(check["last_obj_cite_number"] == - "949","last obj_cite_number expected to be: 949 rather than " ~ check["last_obj_cite_number"]); // 955 - break; - case "two_bits.christopher_kelty.sst": // endnotes, bookindex, biblio - assert(check["last_obj_cite_number"] == - "1190","last obj_cite_number expected to be: 1190 rather than " ~ check["last_obj_cite_number"]); // 1191 - // assert(check["last_obj_cite_number"] == "1193","last obj_cite_number expected to be: 1193 rather than " ~ check["last_obj_cite_number"]); // 1191 ok? - // has endnotes and bookindex, issue with sisu.rb - break; - // fixed ERROR! range violation! - // error in bookindex ... (ch3 the movement) - case "un_contracts_international_sale_of_goods_convention_1980.sst": - assert(check["last_obj_cite_number"] == - "377","last obj_cite_number expected to be: 377 rather than " ~ check["last_obj_cite_number"]); // ok - break; - case "viral_spiral.david_bollier.sst": // endnotes, bookindex - assert(check["last_obj_cite_number"] == - "1078","last obj_cite_number expected to be: 1078 rather than " ~ check["last_obj_cite_number"]); // 1100 - // fixed ERROR! range violation! - // error in bookindex ... (ch7 ... building the cc machine, an extra semi colon) - break; - default: - writeln(doc_matters.source_filename); - break; - } - } - } -} -#+END_SRC diff --git a/org/ao_read_source_files.org b/org/ao_read_source_files.org index 24b95e4..c325517 100644 --- a/org/ao_read_source_files.org +++ b/org/ao_read_source_files.org @@ -168,19 +168,19 @@ final auto ConfigHub(C,E)(C conf_sdl, E env) { - open markup files
- if master file scan for addional files to import/insert +/ -template SiSUmarkupRaw() { +template SiSUrawMarkupContent() { private import ao_rgx; <> mixin SiSUrgxInit; auto rgx = Rgx(); - auto rawsrc = MarkupRaw(); - auto SiSUmarkupRaw(Fn)(Fn fn_src) { + auto rawsrc = RawMarkupContent(); + auto SiSUrawMarkupContent(Fn)(Fn fn_src) { auto _0_header_1_body_content_2_insert_filelist_tuple = rawsrc.sourceContentSplitIntoHeaderAndBody(rawsrc.sourceContent(fn_src), fn_src); return _0_header_1_body_content_2_insert_filelist_tuple; } - struct MarkupRaw { + struct RawMarkupContent { final sourceContent(in string fn_src) { auto raw = MarkupRawUnit(); auto source_txt_str = diff --git a/org/ao_summary_and_debugs.org b/org/ao_summary_and_debugs.org new file mode 100644 index 0000000..c921700 --- /dev/null +++ b/org/ao_summary_and_debugs.org @@ -0,0 +1,991 @@ +#+TITLE: sdp output debugs +#+AUTHOR: Ralph Amissah +#+EMAIL: ralph.amissah@gmail.com +#+STARTUP: indent +#+LANGUAGE: en +#+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:ao: +#+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 summary [#A] +** 0. code structure: :ao_doc_debugs: + +#+BEGIN_SRC d :tangle ../src/sdp/abstraction_summary.d +template SiSUabstractionSummary() { + auto SiSUabstractionSummary(S,T)( + auto ref const S contents, + auto ref T doc_matters, + ) { + <> + mixin InternalMarkup; + <> + if (doc_matters.opt_action_bool["verbose"]) { + <> + } + } +} +#+END_SRC + +** imports + +#+name: abstraction_summary_imports +#+BEGIN_SRC d +import + ao_defaults, + ao_rgx; +import + std.algorithm, + std.array, + std.container, + std.exception, + std.getopt, + std.stdio, + std.file, + std.path, + std.range, + std.regex, + std.string, + std.traits, + std.typecons, + std.uni, + std.utf, + std.conv : to; +#+END_SRC + +** initialize :report: + +#+name: abstraction_summary_initialize +#+BEGIN_SRC d +auto markup = InlineMarkup(); +#+END_SRC + +** (last ocn) + +#+name: ao_abstraction_summary +#+BEGIN_SRC d +string[string] check = [ + "last_obj_cite_number" : "NA [debug \"checkdoc\" not run]", +]; +foreach (k; doc_matters.keys_seq_seg) { + foreach (obj; contents[k]) { + if (obj.use != "empty") { + if (!empty(obj.obj_cite_number)) { + check["last_obj_cite_number"] = obj.obj_cite_number; + } + } + } +} +#+END_SRC + +** summary + +#+name: ao_abstraction_summary +#+BEGIN_SRC d +// auto char_repeat_number = doc_matters.source_filename.length; +// char_repeat_number = (char_repeat_number > 33) +auto min_repeat_number = 66; +auto char_repeat_number = (doc_matters.dochead_meta["title"]["full"].length + + doc_matters.dochead_meta["creator"]["author"].length + 4); +char_repeat_number = (char_repeat_number > min_repeat_number) +? char_repeat_number +: min_repeat_number; +// writeln(char_repeat_number); +writefln( + "%s\n\"%s\", %s\n%s\n%s\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n(%s: %s)\n%s", + markup.repeat_character_by_number_provided("-", char_repeat_number), + doc_matters.dochead_meta["title"]["full"], + doc_matters.dochead_meta["creator"]["author"], + doc_matters.source_filename, + markup.repeat_character_by_number_provided("-", char_repeat_number), + "length toc array: ", + to!int(contents["toc_seg"].length), + "length contents array: ", + to!int(contents["body"].length), + "last obj_cite_number: ", + to!int(check["last_obj_cite_number"]), + "length endnotes: ", + (contents["endnotes"].length > 1) + ? (to!int(contents["endnotes"].length)) + : 0, + "length glossary: ", + (contents["glossary"].length > 1) + ? (to!int(contents["glossary"].length)) + : 0, + "length biblio: ", + (contents["bibliography"].length > 1) + ? (to!int(contents["bibliography"].length)) + : 0, + "length bookindex: ", + (contents["bookindex_seg"].length > 1) + ? (to!int(contents["bookindex_seg"].length)) + : 0, + "length blurb: ", + (contents["blurb"].length > 1) + ? (to!int(contents["blurb"].length)) + : 0, + __FILE__, + __LINE__, + markup.repeat_character_by_number_provided("-", min_repeat_number), +); +#+END_SRC + +markup.repeat_character_by_number_provided("-", 10) +markup.repeat_character_by_number_provided("-", (doc_matters.dochead_meta["title"]["full"].length)) +markup.repeat_character_by_number_provided("-", (doc_matters.source_filename.length)) + +* 2. abstraction debugs :debug:output: +** 0. code structure: :ao_output_debugs: + +#+BEGIN_SRC d :tangle ../src/sdp/ao_doc_debugs.d +/++ + output debugs ++/ +template SiSUdebugs() { + <> + auto SiSUdebugs(S,T)( + auto ref const S contents, + auto ref T doc_matters, + ) { + mixin SiSUrgxInit; + mixin InternalMarkup; + <> + <> + debug(checkdoc) { + if ((doc_matters.opt_action_bool["debug"])) { + <> + <> + } + } + } +} +#+END_SRC + +** imports + +#+name: debug_imports +#+BEGIN_SRC d +import + ao_defaults, + ao_rgx; +private import + std.algorithm, + std.array, + std.container, + std.exception, + std.getopt, + std.json, + std.process, + std.stdio, + std.file, + std.path, + std.range, + std.regex, + std.string, + std.traits, + std.typecons, + std.uni, + 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: ao_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: ao_output_debugs +#+BEGIN_SRC d +debug(dumpdoc) { + writefln( + "%s\n%s:%s", + "-------------------------------", + __FILE__, + __LINE__, + ); + foreach (obj; contents) { + if (obj.use != "empty") { + writefln( + "[%s][%s]\n%s", + obj.obj_cite_number, + obj.is_a, + obj.text + ); + } + } +} +#+END_SRC + +** (segnames) :objects: + +#+name: ao_output_debugs_checkdoc +#+BEGIN_SRC d +debug(checkdoc) { + void out_segnames(S,T)( + auto ref const S contents, + auto 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: ao_output_debugs_checkdoc +#+BEGIN_SRC d +debug(checkdoc) { + void out_toc(S)( + auto 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: ao_output_debugs_checkdoc +#+BEGIN_SRC d +debug(checkdoc) { + void out_endnotes(S)( + auto 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: ao_output_debugs_checkdoc +#+BEGIN_SRC d +debug(checkdoc) { + void out_bookindex(S)( + auto 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: ao_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: ao_output_debugs +#+BEGIN_SRC d +debug(section_toc) { + key="toc_seg"; + out_toc(contents, key); +} +#+END_SRC + +**** toc seg + +#+name: ao_output_debugs +#+BEGIN_SRC d +debug(section_toc_seg) { + key="toc_seg"; + out_toc(contents, key); +} +#+END_SRC + +**** toc scroll + +#+name: ao_output_debugs +#+BEGIN_SRC d +debug(section_toc_scroll) { + key="toc_scroll"; + out_toc(contents, key); +} +#+END_SRC + +#+name: ao_output_debugs +#+BEGIN_SRC d +debug(segnames) { + writeln(__LINE__); + out_segnames(contents, doc_matters); +} +#+END_SRC + +*** body_section :body: + +#+name: ao_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: ao_output_debugs +#+BEGIN_SRC d +debug(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), ""); + break; + case DomTags.close_and_open : + writeln(markup.indent_by_spaces_provided(k), ""); + writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); + break; + case DomTags.open : + writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); + 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), ""); + break; + case DomTags.close_and_open : + writeln(markup.indent_by_spaces_provided(k), ""); + writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); + break; + case DomTags.open : + writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); + break; + default : + break; + } + } + } + } + } +} +#+END_SRC + +*** endnotes_section (seg & scroll) :endnotes: +**** endnotes + +#+name: ao_output_debugs +#+BEGIN_SRC d +debug(section_endnotes) { + key="endnotes"; + out_endnotes(contents, key); +} +#+END_SRC + +**** endnotes seg + +#+name: ao_output_debugs +#+BEGIN_SRC d +debug(section_endnotes_seg) { + key="endnotes"; + out_endnotes(contents, key); +} +#+END_SRC + +*** glossary_section :glossary: + +#+name: ao_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: ao_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: ao_output_debugs +#+BEGIN_SRC d +debug(section_bookindex) { + key="bookindex_seg"; + out_bookindex(contents, key); +} +#+END_SRC + +**** bookindex seg + +#+name: ao_output_debugs +#+BEGIN_SRC d +debug(section_bookindex_seg) { + key="bookindex_seg"; + out_bookindex(contents, key); +} +#+END_SRC + +**** bookindex scroll + +#+name: ao_output_debugs +#+BEGIN_SRC d +debug(section_bookindex_scroll) { + key="bookindex_scroll"; + out_bookindex(contents, key); +} +#+END_SRC + +*** section_blurb :blurb: + +#+name: ao_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: ao_output_debugs +#+BEGIN_SRC d +debug(objects) { + writefln( + "%s\n%s:%s", + "-------------------------------", + __FILE__, + __LINE__, + ); + foreach (obj; contents) { + if (obj.use != "empty") { + writefln( + "* [%s][%s] %s", + obj.obj_cite_number, + obj.is_a, + obj.text + ); + } + } +} +#+END_SRC + +** (headermakejson) :json:header: + +#+name: ao_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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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: ao_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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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: ao_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 + ); + } + } + } +} +#+END_SRC + +** (headings) :headings: + +#+name: ao_output_debugs +#+BEGIN_SRC d +debug(heading) { // heading + foreach (k; doc_matters.keys_seq_seg) { + foreach (o; contents[k]) { + if (o.is_a == "heading") { + writefln( + "%s* %s\n (markup level: %s; collapsed level: %s)", + replicate(" ", o.heading_lev_markup), + strip(o.text), + o.heading_lev_markup, + o.heading_lev_collapsed, + ); + } + } + } +} +#+END_SRC + +** (summary) [+1] :summary: + +#+name: ao_output_debugs_summary +#+BEGIN_SRC d +debug(headings) { + 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", + obj.marked_up_level, + obj.obj_cite_number, + // "[", obj["is"], "] ", + obj.text + ); + } + } + } +} +#+END_SRC + +#+name: ao_output_debugs +#+BEGIN_SRC d +debug(summary) { + string[string] check = [ + "last_obj_cite_number" : "NA [debug \"checkdoc\" not run]", + ]; +} +#+END_SRC + +*** compare number of obj_cite_number for known sisu markup output (checkdoc) + +#+name: ao_output_debugs_summary +#+BEGIN_SRC d +debug(checkdoc) { + if (auto mfn=match(doc_matters.source_filename, rgx.src_fn)) { + if (doc_matters.opt_action_bool["assertions"]) { + switch (mfn.captures[2]) { + // live manual: + case "live-manual.ssm": + assert(check["last_obj_cite_number"] == + "1019","last obj_cite_number should be: 1019 (check test, document is frequently updated)"); // ok + break; + // sisu_markup: + case "sisu_markup.sst": + assert(check["last_obj_cite_number"] == + "297","last obj_cite_number expected to be: 297 rather than " ~ check["last_obj_cite_number"]); // ok + // assert(check["last_obj_cite_number"] == "297","last obj_cite_number expected to be: 297 rather than " ~ check["last_obj_cite_number"]); + // notes for first divergance study sisu headings 247 250 + // sisu has issue with code that contains heading 1~ which results in no obj_cite_number! ?? + // sisu currently has incorrect last body obj_cite_number of 294! + // bug in sisu? attend + break; + // sisu-markup-samples: + case "accelerando.charles_stross.sst": + assert(check["last_obj_cite_number"] == + "2861","last obj_cite_number expected to be: 2861 rather than " ~ check["last_obj_cite_number"]); // ok + break; + case "alices_adventures_in_wonderland.lewis_carroll.sst": + assert(check["last_obj_cite_number"] == + "805","last obj_cite_number expected to be: 805 rather than " ~ check["last_obj_cite_number"]); // 808 + break; + case "autonomy_markup0.sst": + assert(check["last_obj_cite_number"] == + "77","last obj_cite_number expected to be: 77 rather than " ~ check["last_obj_cite_number"]); // ok endnotes + // assert(check["last_obj_cite_number"] == "78","last obj_cite_number expected to be: 78 rather than " ~ check["last_obj_cite_number"]); + break; + case "content.cory_doctorow.sst": + assert(check["last_obj_cite_number"] == + "953","last obj_cite_number expected to be: 953 rather than " ~ check["last_obj_cite_number"]); // 1007 way off, check obj_cite_number off switches + // assert(check["last_obj_cite_number"] == "953","last obj_cite_number expected to be: 953 rather than " ~ check["last_obj_cite_number"]); + break; + case "democratizing_innovation.eric_von_hippel.sst": + // fixed ERROR! range violation, broken check! endnotes, bookindex, biblio + // error in bookindex ... (ch1; ch6; ch8 ) + assert(check["last_obj_cite_number"] == + "905","last obj_cite_number expected to be: 905 rather than " ~ check["last_obj_cite_number"]); // 911 + break; + case "down_and_out_in_the_magic_kingdom.cory_doctorow.sst": + assert(check["last_obj_cite_number"] == + "1417","last obj_cite_number expected to be: 1417 rather than " ~ check["last_obj_cite_number"]); // 1455 check obj_cite_number off switches + break; + case "for_the_win.cory_doctorow.sst": + assert(check["last_obj_cite_number"] == + "3510","last obj_cite_number expected to be: 3510 rather than " ~ check["last_obj_cite_number"]); // 3569 check obj_cite_number off switches + break; + case "free_as_in_freedom_2.richard_stallman_and_the_free_software_revolution.sam_williams.richard_stallman.sst": + assert(check["last_obj_cite_number"] == + "1082","last obj_cite_number expected to be: 1082 rather than " ~ check["last_obj_cite_number"]); // check 1079 too few + break; + case "free_culture.lawrence_lessig.sst": + assert(check["last_obj_cite_number"] == + "1330","last obj_cite_number expected to be: 1330 rather than " ~ check["last_obj_cite_number"]); // 1312 + // fixed ERROR! range violation, broken check! + // error in bookindex ... sections piracy (ch1) & property (ch10 market concentration) fixed + break; + case "free_for_all.peter_wayner.sst": // endnotes, bookindex, biblio + assert(check["last_obj_cite_number"] == + "1559","last obj_cite_number expected to be: 1559 rather than " ~ check["last_obj_cite_number"]); // 1560, check obj_cite_number off switches, has endnotes so 2 too many + // assert(check["last_obj_cite_number"] == "1559","last obj_cite_number expected to be: 1559 rather than " ~ check["last_obj_cite_number"]); + break; + case "gpl2.fsf.sst": + assert(check["last_obj_cite_number"] == + "65","last obj_cite_number expected to be: 65 rather than " ~ check["last_obj_cite_number"]); // ok endnotes? check + // assert(check["last_obj_cite_number"] == "66","last obj_cite_number expected to be: 66 rather than " ~ check["last_obj_cite_number"]); + break; + case "gpl3.fsf.sst": + assert(check["last_obj_cite_number"] == + "123","last obj_cite_number expected to be: 123 rather than " ~ check["last_obj_cite_number"]); // ok + break; + case "gullivers_travels.jonathan_swift.sst": + assert(check["last_obj_cite_number"] == + "668","last obj_cite_number expected to be: 668 rather than " ~ check["last_obj_cite_number"]); // 674 + break; + case "little_brother.cory_doctorow.sst": + assert(check["last_obj_cite_number"] == + "3130","last obj_cite_number expected to be: 3130 rather than " ~ check["last_obj_cite_number"]); // 3204, check obj_cite_number off switches + break; + case "the_cathedral_and_the_bazaar.eric_s_raymond.sst": + assert(check["last_obj_cite_number"] == + "258","last obj_cite_number expected to be: 258 rather than " ~ check["last_obj_cite_number"]); // ok + break; + case "the_public_domain.james_boyle.sst": + assert(check["last_obj_cite_number"] == + "970","last obj_cite_number expected to be: 970 rather than " ~ check["last_obj_cite_number"]); // 978 + break; + case "the_wealth_of_networks.yochai_benkler.sst": // endnotes, bookindex + assert(check["last_obj_cite_number"] == + "829","last obj_cite_number expected to be: 829 rather than " ~ check["last_obj_cite_number"]); // ok + // assert(check["last_obj_cite_number"] == "832","last obj_cite_number expected to be: 832 rather than " ~ check["last_obj_cite_number"]); + // has endnotes and bookindex, issue with sisu.rb + break; + case "through_the_looking_glass.lewis_carroll.sst": + assert(check["last_obj_cite_number"] == + "949","last obj_cite_number expected to be: 949 rather than " ~ check["last_obj_cite_number"]); // 955 + break; + case "two_bits.christopher_kelty.sst": // endnotes, bookindex, biblio + assert(check["last_obj_cite_number"] == + "1190","last obj_cite_number expected to be: 1190 rather than " ~ check["last_obj_cite_number"]); // 1191 + // assert(check["last_obj_cite_number"] == "1193","last obj_cite_number expected to be: 1193 rather than " ~ check["last_obj_cite_number"]); // 1191 ok? + // has endnotes and bookindex, issue with sisu.rb + break; + // fixed ERROR! range violation! + // error in bookindex ... (ch3 the movement) + case "un_contracts_international_sale_of_goods_convention_1980.sst": + assert(check["last_obj_cite_number"] == + "377","last obj_cite_number expected to be: 377 rather than " ~ check["last_obj_cite_number"]); // ok + break; + case "viral_spiral.david_bollier.sst": // endnotes, bookindex + assert(check["last_obj_cite_number"] == + "1078","last obj_cite_number expected to be: 1078 rather than " ~ check["last_obj_cite_number"]); // 1100 + // fixed ERROR! range violation! + // error in bookindex ... (ch7 ... building the cc machine, an extra semi colon) + break; + default: + writeln(doc_matters.source_filename); + break; + } + } + } +} +#+END_SRC diff --git a/org/sdp.org b/org/sdp.org index 9cd8265..cafb5d9 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -23,10 +23,10 @@ struct Version { int minor; int patch; } -enum ver = Version(0, 12, 1); +enum ver = Version(0, 12, 2); #+END_SRC -* 1. sdp.d (sisu document parser) :sdp: +* 1. sdp (sisu document parser) :sdp: - deal with imports - get options @@ -34,10 +34,10 @@ enum ver = Version(0, 12, 1); - read config instructions - process files as instructed by options - read in file - - proess file + - process file - output -** 0. sdp src/sdp.d :sdp: +** 0. sdp src/sdp.d :template: #+BEGIN_SRC d :tangle ../src/sdp.d :shebang #!/usr/bin/env rdmd /+ @@ -88,12 +88,13 @@ unittest { #+BEGIN_SRC d /+ sdp: sisu document parser, see http://sisudoc.org +/ import + abstraction_summary, ao_abstract_doc_source, ao_conf_make_meta, ao_conf_make_meta_native, ao_conf_make_meta_sdlang, ao_defaults, - ao_output_debugs, + ao_doc_debugs, ao_read_config_files, ao_read_source_files, ao_rgx, @@ -377,6 +378,15 @@ auto doc_matters = t[1]; #+END_SRC *** 2. _output processing_ (post abstraction processing) +**** 0. abstraction summary :abstraction:summary: + +#+NAME: sdp_each_file_do_debugs_checkdoc +#+BEGIN_SRC d +/+ ↓ debugs +/ +if (doc_matters.opt_action_bool["verbose"]) { + SiSUabstractionSummary!()(doc_abstraction, doc_matters); +} +#+END_SRC **** 1. _debug_ (document parts, checkdoc) :debug:checkdoc: - [[./ao_output_debugs.org][ao_output_debugs]] @@ -425,7 +435,7 @@ break; // terminate, stop #+END_SRC * 2. _document abstraction_ -** 0. abstraction template +** 0. abstraction template :template: #+BEGIN_SRC d :tangle ../src/sdp/abstraction.d template SiSUabstraction() { @@ -450,14 +460,13 @@ template SiSUabstraction() { ** 1. (a) _read in raw file_ & (b) split content into: _doc header & doc content_ - [[./ao_read_source_files.org][ao_read_source_files]] -- [[./ao_read_source_files.org][ao_read_source_files]] #+NAME: sdp_each_file_do_read_and_split_sisu_markup_file_content_into_header_and_body #+BEGIN_SRC d /+ ↓ read file (filename with path) +/ /+ ↓ file tuple of header and content +/ auto _0_header_1_body_content_2_insert_filelist_tuple = - SiSUmarkupRaw!()(fn_src); + SiSUrawMarkupContent!()(fn_src); static assert(!isTypeTuple!(_0_header_1_body_content_2_insert_filelist_tuple)); static assert(_0_header_1_body_content_2_insert_filelist_tuple.length==3); debug(header_and_body) { @@ -479,7 +488,7 @@ static assert(!isTypeTuple!(_0_make_1_dochead_meta_tuple)); static assert(_0_make_1_dochead_meta_tuple.length==2); #+END_SRC -** 3. pre-processing: _document abstraction, tuple_ :processing: +** 3. _document abstraction, tuple_ (pre-processing) :processing: - [[./ao_abstract_doc_source.org][ao_abstract_doc_source]] #+NAME: sdp_each_file_do_document_abstraction diff --git a/src/sdp.d b/src/sdp.d index 31593e0..9d19d38 100755 --- a/src/sdp.d +++ b/src/sdp.d @@ -7,12 +7,13 @@ import abstraction; /+ sdp: sisu document parser, see http://sisudoc.org +/ import + abstraction_summary, ao_abstract_doc_source, ao_conf_make_meta, ao_conf_make_meta_native, ao_conf_make_meta_sdlang, ao_defaults, - ao_output_debugs, + ao_doc_debugs, ao_read_config_files, ao_read_source_files, ao_rgx, @@ -189,6 +190,10 @@ void main(string[] args) { auto doc_abstraction = t[0]; auto doc_matters = t[1]; /+ ↓ debugs +/ + if (doc_matters.opt_action_bool["verbose"]) { + SiSUabstractionSummary!()(doc_abstraction, doc_matters); + } + /+ ↓ debugs +/ if ((doc_matters.opt_action_bool["debug"]) || (doc_matters.opt_action_bool["verbose"]) ) { diff --git a/src/sdp/abstraction.d b/src/sdp/abstraction.d index de26582..c799fb7 100644 --- a/src/sdp/abstraction.d +++ b/src/sdp/abstraction.d @@ -1,12 +1,13 @@ template SiSUabstraction() { /+ sdp: sisu document parser, see http://sisudoc.org +/ import + abstraction_summary, ao_abstract_doc_source, ao_conf_make_meta, ao_conf_make_meta_native, ao_conf_make_meta_sdlang, ao_defaults, - ao_output_debugs, + ao_doc_debugs, ao_read_config_files, ao_read_source_files, ao_rgx, @@ -48,7 +49,7 @@ template SiSUabstraction() { /+ ↓ read file (filename with path) +/ /+ ↓ file tuple of header and content +/ auto _0_header_1_body_content_2_insert_filelist_tuple = - SiSUmarkupRaw!()(fn_src); + SiSUrawMarkupContent!()(fn_src); static assert(!isTypeTuple!(_0_header_1_body_content_2_insert_filelist_tuple)); static assert(_0_header_1_body_content_2_insert_filelist_tuple.length==3); debug(header_and_body) { diff --git a/src/sdp/abstraction_summary.d b/src/sdp/abstraction_summary.d new file mode 100644 index 0000000..d39e020 --- /dev/null +++ b/src/sdp/abstraction_summary.d @@ -0,0 +1,89 @@ +template SiSUabstractionSummary() { + auto SiSUabstractionSummary(S,T)( + auto ref const S contents, + auto ref T doc_matters, + ) { + import + ao_defaults, + ao_rgx; + import + std.algorithm, + std.array, + std.container, + std.exception, + std.getopt, + std.stdio, + std.file, + std.path, + std.range, + std.regex, + std.string, + std.traits, + std.typecons, + std.uni, + std.utf, + std.conv : to; + mixin InternalMarkup; + auto markup = InlineMarkup(); + if (doc_matters.opt_action_bool["verbose"]) { + string[string] check = [ + "last_obj_cite_number" : "NA [debug \"checkdoc\" not run]", + ]; + foreach (k; doc_matters.keys_seq_seg) { + foreach (obj; contents[k]) { + if (obj.use != "empty") { + if (!empty(obj.obj_cite_number)) { + check["last_obj_cite_number"] = obj.obj_cite_number; + } + } + } + } + // auto char_repeat_number = doc_matters.source_filename.length; + // char_repeat_number = (char_repeat_number > 33) + auto min_repeat_number = 66; + auto char_repeat_number = (doc_matters.dochead_meta["title"]["full"].length + + doc_matters.dochead_meta["creator"]["author"].length + 4); + char_repeat_number = (char_repeat_number > min_repeat_number) + ? char_repeat_number + : min_repeat_number; + // writeln(char_repeat_number); + writefln( + "%s\n\"%s\", %s\n%s\n%s\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n(%s: %s)\n%s", + markup.repeat_character_by_number_provided("-", char_repeat_number), + doc_matters.dochead_meta["title"]["full"], + doc_matters.dochead_meta["creator"]["author"], + doc_matters.source_filename, + markup.repeat_character_by_number_provided("-", char_repeat_number), + "length toc array: ", + to!int(contents["toc_seg"].length), + "length contents array: ", + to!int(contents["body"].length), + "last obj_cite_number: ", + to!int(check["last_obj_cite_number"]), + "length endnotes: ", + (contents["endnotes"].length > 1) + ? (to!int(contents["endnotes"].length)) + : 0, + "length glossary: ", + (contents["glossary"].length > 1) + ? (to!int(contents["glossary"].length)) + : 0, + "length biblio: ", + (contents["bibliography"].length > 1) + ? (to!int(contents["bibliography"].length)) + : 0, + "length bookindex: ", + (contents["bookindex_seg"].length > 1) + ? (to!int(contents["bookindex_seg"].length)) + : 0, + "length blurb: ", + (contents["blurb"].length > 1) + ? (to!int(contents["blurb"].length)) + : 0, + __FILE__, + __LINE__, + markup.repeat_character_by_number_provided("-", min_repeat_number), + ); + } + } +} diff --git a/src/sdp/ao_doc_debugs.d b/src/sdp/ao_doc_debugs.d new file mode 100644 index 0000000..c5f1486 --- /dev/null +++ b/src/sdp/ao_doc_debugs.d @@ -0,0 +1,653 @@ +/++ + output debugs ++/ +template SiSUdebugs() { + import + ao_defaults, + ao_rgx; + private import + std.algorithm, + std.array, + std.container, + std.exception, + std.getopt, + std.json, + std.process, + std.stdio, + std.file, + std.path, + std.range, + std.regex, + std.string, + std.traits, + std.typecons, + std.uni, + std.utf, + std.conv : to; + auto SiSUdebugs(S,T)( + auto ref const S contents, + auto ref T doc_matters, + ) { + mixin SiSUrgxInit; + mixin InternalMarkup; + auto rgx = Rgx(); + auto markup = InlineMarkup(); + string key; + 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, + ); + } + } + } + } + } + debug(dumpdoc) { + writefln( + "%s\n%s:%s", + "-------------------------------", + __FILE__, + __LINE__, + ); + foreach (obj; contents) { + if (obj.use != "empty") { + writefln( + "[%s][%s]\n%s", + obj.obj_cite_number, + obj.is_a, + obj.text + ); + } + } + } + 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 + ); + } + } + } + debug(section_toc) { + key="toc_seg"; + out_toc(contents, key); + } + debug(section_toc_seg) { + key="toc_seg"; + out_toc(contents, key); + } + debug(section_toc_scroll) { + key="toc_scroll"; + out_toc(contents, key); + } + debug(segnames) { + writeln(__LINE__); + out_segnames(contents, doc_matters); + } + 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 + ); + } + } + } + debug(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), ""); + break; + case DomTags.close_and_open : + writeln(markup.indent_by_spaces_provided(k), ""); + writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); + break; + case DomTags.open : + writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); + 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), ""); + break; + case DomTags.close_and_open : + writeln(markup.indent_by_spaces_provided(k), ""); + writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); + break; + case DomTags.open : + writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); + break; + default : + break; + } + } + } + } + } + } + debug(section_endnotes) { + key="endnotes"; + out_endnotes(contents, key); + } + debug(section_endnotes_seg) { + key="endnotes"; + out_endnotes(contents, key); + } + 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 + ); + } + } + } + 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 + ); + } + } + } + debug(section_bookindex) { + key="bookindex_seg"; + out_bookindex(contents, key); + } + debug(section_bookindex_seg) { + key="bookindex_seg"; + out_bookindex(contents, key); + } + debug(section_bookindex_scroll) { + key="bookindex_scroll"; + out_bookindex(contents, key); + } + 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 + ); + } + } + } + debug(objects) { + writefln( + "%s\n%s:%s", + "-------------------------------", + __FILE__, + __LINE__, + ); + foreach (obj; contents) { + if (obj.use != "empty") { + writefln( + "* [%s][%s] %s", + obj.obj_cite_number, + obj.is_a, + obj.text + ); + } + } + } + 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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).length > 2) { + writefln( + "%s:%s: %s", + main_header, + sub_header, + doc_matters.dochead_meta[main_header][sub_header] + ); + } + } + break; + default: + break; + } + } + } + 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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).length > 2) { + writefln( + "%s:%s: %s", + main_header, + sub_header, + doc_matters.dochead_meta[main_header][sub_header] + ); + } + } + break; + default: + break; + } + } + } + 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 + ); + } + } + } + } + debug(heading) { // heading + foreach (k; doc_matters.keys_seq_seg) { + foreach (o; contents[k]) { + if (o.is_a == "heading") { + writefln( + "%s* %s\n (markup level: %s; collapsed level: %s)", + replicate(" ", o.heading_lev_markup), + strip(o.text), + o.heading_lev_markup, + o.heading_lev_collapsed, + ); + } + } + } + } + debug(summary) { + string[string] check = [ + "last_obj_cite_number" : "NA [debug \"checkdoc\" not run]", + ]; + } + debug(checkdoc) { + if ((doc_matters.opt_action_bool["debug"])) { + debug(headings) { + 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", + obj.marked_up_level, + obj.obj_cite_number, + // "[", obj["is"], "] ", + obj.text + ); + } + } + } + } + debug(checkdoc) { + if (auto mfn=match(doc_matters.source_filename, rgx.src_fn)) { + if (doc_matters.opt_action_bool["assertions"]) { + switch (mfn.captures[2]) { + // live manual: + case "live-manual.ssm": + assert(check["last_obj_cite_number"] == + "1019","last obj_cite_number should be: 1019 (check test, document is frequently updated)"); // ok + break; + // sisu_markup: + case "sisu_markup.sst": + assert(check["last_obj_cite_number"] == + "297","last obj_cite_number expected to be: 297 rather than " ~ check["last_obj_cite_number"]); // ok + // assert(check["last_obj_cite_number"] == "297","last obj_cite_number expected to be: 297 rather than " ~ check["last_obj_cite_number"]); + // notes for first divergance study sisu headings 247 250 + // sisu has issue with code that contains heading 1~ which results in no obj_cite_number! ?? + // sisu currently has incorrect last body obj_cite_number of 294! + // bug in sisu? attend + break; + // sisu-markup-samples: + case "accelerando.charles_stross.sst": + assert(check["last_obj_cite_number"] == + "2861","last obj_cite_number expected to be: 2861 rather than " ~ check["last_obj_cite_number"]); // ok + break; + case "alices_adventures_in_wonderland.lewis_carroll.sst": + assert(check["last_obj_cite_number"] == + "805","last obj_cite_number expected to be: 805 rather than " ~ check["last_obj_cite_number"]); // 808 + break; + case "autonomy_markup0.sst": + assert(check["last_obj_cite_number"] == + "77","last obj_cite_number expected to be: 77 rather than " ~ check["last_obj_cite_number"]); // ok endnotes + // assert(check["last_obj_cite_number"] == "78","last obj_cite_number expected to be: 78 rather than " ~ check["last_obj_cite_number"]); + break; + case "content.cory_doctorow.sst": + assert(check["last_obj_cite_number"] == + "953","last obj_cite_number expected to be: 953 rather than " ~ check["last_obj_cite_number"]); // 1007 way off, check obj_cite_number off switches + // assert(check["last_obj_cite_number"] == "953","last obj_cite_number expected to be: 953 rather than " ~ check["last_obj_cite_number"]); + break; + case "democratizing_innovation.eric_von_hippel.sst": + // fixed ERROR! range violation, broken check! endnotes, bookindex, biblio + // error in bookindex ... (ch1; ch6; ch8 ) + assert(check["last_obj_cite_number"] == + "905","last obj_cite_number expected to be: 905 rather than " ~ check["last_obj_cite_number"]); // 911 + break; + case "down_and_out_in_the_magic_kingdom.cory_doctorow.sst": + assert(check["last_obj_cite_number"] == + "1417","last obj_cite_number expected to be: 1417 rather than " ~ check["last_obj_cite_number"]); // 1455 check obj_cite_number off switches + break; + case "for_the_win.cory_doctorow.sst": + assert(check["last_obj_cite_number"] == + "3510","last obj_cite_number expected to be: 3510 rather than " ~ check["last_obj_cite_number"]); // 3569 check obj_cite_number off switches + break; + case "free_as_in_freedom_2.richard_stallman_and_the_free_software_revolution.sam_williams.richard_stallman.sst": + assert(check["last_obj_cite_number"] == + "1082","last obj_cite_number expected to be: 1082 rather than " ~ check["last_obj_cite_number"]); // check 1079 too few + break; + case "free_culture.lawrence_lessig.sst": + assert(check["last_obj_cite_number"] == + "1330","last obj_cite_number expected to be: 1330 rather than " ~ check["last_obj_cite_number"]); // 1312 + // fixed ERROR! range violation, broken check! + // error in bookindex ... sections piracy (ch1) & property (ch10 market concentration) fixed + break; + case "free_for_all.peter_wayner.sst": // endnotes, bookindex, biblio + assert(check["last_obj_cite_number"] == + "1559","last obj_cite_number expected to be: 1559 rather than " ~ check["last_obj_cite_number"]); // 1560, check obj_cite_number off switches, has endnotes so 2 too many + // assert(check["last_obj_cite_number"] == "1559","last obj_cite_number expected to be: 1559 rather than " ~ check["last_obj_cite_number"]); + break; + case "gpl2.fsf.sst": + assert(check["last_obj_cite_number"] == + "65","last obj_cite_number expected to be: 65 rather than " ~ check["last_obj_cite_number"]); // ok endnotes? check + // assert(check["last_obj_cite_number"] == "66","last obj_cite_number expected to be: 66 rather than " ~ check["last_obj_cite_number"]); + break; + case "gpl3.fsf.sst": + assert(check["last_obj_cite_number"] == + "123","last obj_cite_number expected to be: 123 rather than " ~ check["last_obj_cite_number"]); // ok + break; + case "gullivers_travels.jonathan_swift.sst": + assert(check["last_obj_cite_number"] == + "668","last obj_cite_number expected to be: 668 rather than " ~ check["last_obj_cite_number"]); // 674 + break; + case "little_brother.cory_doctorow.sst": + assert(check["last_obj_cite_number"] == + "3130","last obj_cite_number expected to be: 3130 rather than " ~ check["last_obj_cite_number"]); // 3204, check obj_cite_number off switches + break; + case "the_cathedral_and_the_bazaar.eric_s_raymond.sst": + assert(check["last_obj_cite_number"] == + "258","last obj_cite_number expected to be: 258 rather than " ~ check["last_obj_cite_number"]); // ok + break; + case "the_public_domain.james_boyle.sst": + assert(check["last_obj_cite_number"] == + "970","last obj_cite_number expected to be: 970 rather than " ~ check["last_obj_cite_number"]); // 978 + break; + case "the_wealth_of_networks.yochai_benkler.sst": // endnotes, bookindex + assert(check["last_obj_cite_number"] == + "829","last obj_cite_number expected to be: 829 rather than " ~ check["last_obj_cite_number"]); // ok + // assert(check["last_obj_cite_number"] == "832","last obj_cite_number expected to be: 832 rather than " ~ check["last_obj_cite_number"]); + // has endnotes and bookindex, issue with sisu.rb + break; + case "through_the_looking_glass.lewis_carroll.sst": + assert(check["last_obj_cite_number"] == + "949","last obj_cite_number expected to be: 949 rather than " ~ check["last_obj_cite_number"]); // 955 + break; + case "two_bits.christopher_kelty.sst": // endnotes, bookindex, biblio + assert(check["last_obj_cite_number"] == + "1190","last obj_cite_number expected to be: 1190 rather than " ~ check["last_obj_cite_number"]); // 1191 + // assert(check["last_obj_cite_number"] == "1193","last obj_cite_number expected to be: 1193 rather than " ~ check["last_obj_cite_number"]); // 1191 ok? + // has endnotes and bookindex, issue with sisu.rb + break; + // fixed ERROR! range violation! + // error in bookindex ... (ch3 the movement) + case "un_contracts_international_sale_of_goods_convention_1980.sst": + assert(check["last_obj_cite_number"] == + "377","last obj_cite_number expected to be: 377 rather than " ~ check["last_obj_cite_number"]); // ok + break; + case "viral_spiral.david_bollier.sst": // endnotes, bookindex + assert(check["last_obj_cite_number"] == + "1078","last obj_cite_number expected to be: 1078 rather than " ~ check["last_obj_cite_number"]); // 1100 + // fixed ERROR! range violation! + // error in bookindex ... (ch7 ... building the cc machine, an extra semi colon) + break; + default: + writeln(doc_matters.source_filename); + break; + } + } + } + } + debug(checkdoc) { + void out_segnames(S,T)( + auto ref const S contents, + auto 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); + } + } + } + } + } + } + debug(checkdoc) { + void out_toc(S)( + auto 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 + ); + } + } + } + } + debug(checkdoc) { + void out_endnotes(S)( + auto ref const S contents, + string key, + ) { + if (contents[key].length > 1) { + foreach (obj; contents[key]) { + writefln( + "[%s]\n%s", + obj.is_a, + obj.text + ); + } + } + } + } + debug(checkdoc) { + void out_bookindex(S)( + auto 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 + ); + } + } + } + } + } + } + } +} diff --git a/src/sdp/ao_output_debugs.d b/src/sdp/ao_output_debugs.d deleted file mode 100644 index aff30e8..0000000 --- a/src/sdp/ao_output_debugs.d +++ /dev/null @@ -1,708 +0,0 @@ -/++ - output debugs -+/ -template SiSUdebugs() { - import - ao_defaults, - ao_rgx; - private import - std.algorithm, - std.array, - std.container, - std.exception, - std.getopt, - std.json, - std.process, - std.stdio, - std.file, - std.path, - std.range, - std.regex, - std.string, - std.traits, - std.typecons, - std.uni, - std.utf, - std.conv : to; - auto SiSUdebugs(S,T)( - auto ref const S contents, - auto ref T doc_matters, - ) { - mixin SiSUrgxInit; - mixin InternalMarkup; - auto rgx = Rgx(); - auto markup = InlineMarkup(); - string key; - 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, - ); - } - } - } - } - } - debug(dumpdoc) { - writefln( - "%s\n%s:%s", - "-------------------------------", - __FILE__, - __LINE__, - ); - foreach (obj; contents) { - if (obj.use != "empty") { - writefln( - "[%s][%s]\n%s", - obj.obj_cite_number, - obj.is_a, - obj.text - ); - } - } - } - 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 - ); - } - } - } - debug(section_toc) { - key="toc_seg"; - out_toc(contents, key); - } - debug(section_toc_seg) { - key="toc_seg"; - out_toc(contents, key); - } - debug(section_toc_scroll) { - key="toc_scroll"; - out_toc(contents, key); - } - debug(segnames) { - writeln(__LINE__); - out_segnames(contents, doc_matters); - } - 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 - ); - } - } - } - debug(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), ""); - break; - case DomTags.close_and_open : - writeln(markup.indent_by_spaces_provided(k), ""); - writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); - break; - case DomTags.open : - writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); - 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), ""); - break; - case DomTags.close_and_open : - writeln(markup.indent_by_spaces_provided(k), ""); - writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); - break; - case DomTags.open : - writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); - break; - default : - break; - } - } - } - } - } - } - debug(section_endnotes) { - key="endnotes"; - out_endnotes(contents, key); - } - debug(section_endnotes_seg) { - key="endnotes"; - out_endnotes(contents, key); - } - 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 - ); - } - } - } - 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 - ); - } - } - } - debug(section_bookindex) { - key="bookindex_seg"; - out_bookindex(contents, key); - } - debug(section_bookindex_seg) { - key="bookindex_seg"; - out_bookindex(contents, key); - } - debug(section_bookindex_scroll) { - key="bookindex_scroll"; - out_bookindex(contents, key); - } - 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 - ); - } - } - } - debug(objects) { - writefln( - "%s\n%s:%s", - "-------------------------------", - __FILE__, - __LINE__, - ); - foreach (obj; contents) { - if (obj.use != "empty") { - writefln( - "* [%s][%s] %s", - obj.obj_cite_number, - obj.is_a, - obj.text - ); - } - } - } - 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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).length > 2) { - writefln( - "%s:%s: %s", - main_header, - sub_header, - doc_matters.dochead_meta[main_header][sub_header] - ); - } - } - break; - default: - break; - } - } - } - 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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).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 (to!string(doc_matters.dochead_meta[main_header][sub_header]).length > 2) { - writefln( - "%s:%s: %s", - main_header, - sub_header, - doc_matters.dochead_meta[main_header][sub_header] - ); - } - } - break; - default: - break; - } - } - } - 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 - ); - } - } - } - } - debug(heading) { // heading - foreach (k; doc_matters.keys_seq_seg) { - foreach (o; contents[k]) { - if (o.is_a == "heading") { - writefln( - "%s* %s\n (markup level: %s; collapsed level: %s)", - replicate(" ", o.heading_lev_markup), - strip(o.text), - o.heading_lev_markup, - o.heading_lev_collapsed, - ); - } - } - } - } - debug(summary) { - string[string] check = [ - "last_obj_cite_number" : "NA [debug \"checkdoc\" not run]", - ]; - debug(checkdoc) { - if ((doc_matters.opt_action_bool["debug"])) { - debug(headings) { - 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", - obj.marked_up_level, - obj.obj_cite_number, - // "[", obj["is"], "] ", - obj.text - ); - } - } - } - } - debug(checkdoc) { - if (auto mfn=match(doc_matters.source_filename, rgx.src_fn)) { - if (doc_matters.opt_action_bool["assertions"]) { - switch (mfn.captures[2]) { - // live manual: - case "live-manual.ssm": - assert(check["last_obj_cite_number"] == - "1019","last obj_cite_number should be: 1019 (check test, document is frequently updated)"); // ok - break; - // sisu_markup: - case "sisu_markup.sst": - assert(check["last_obj_cite_number"] == - "297","last obj_cite_number expected to be: 297 rather than " ~ check["last_obj_cite_number"]); // ok - // assert(check["last_obj_cite_number"] == "297","last obj_cite_number expected to be: 297 rather than " ~ check["last_obj_cite_number"]); - // notes for first divergance study sisu headings 247 250 - // sisu has issue with code that contains heading 1~ which results in no obj_cite_number! ?? - // sisu currently has incorrect last body obj_cite_number of 294! - // bug in sisu? attend - break; - // sisu-markup-samples: - case "accelerando.charles_stross.sst": - assert(check["last_obj_cite_number"] == - "2861","last obj_cite_number expected to be: 2861 rather than " ~ check["last_obj_cite_number"]); // ok - break; - case "alices_adventures_in_wonderland.lewis_carroll.sst": - assert(check["last_obj_cite_number"] == - "805","last obj_cite_number expected to be: 805 rather than " ~ check["last_obj_cite_number"]); // 808 - break; - case "autonomy_markup0.sst": - assert(check["last_obj_cite_number"] == - "77","last obj_cite_number expected to be: 77 rather than " ~ check["last_obj_cite_number"]); // ok endnotes - // assert(check["last_obj_cite_number"] == "78","last obj_cite_number expected to be: 78 rather than " ~ check["last_obj_cite_number"]); - break; - case "content.cory_doctorow.sst": - assert(check["last_obj_cite_number"] == - "953","last obj_cite_number expected to be: 953 rather than " ~ check["last_obj_cite_number"]); // 1007 way off, check obj_cite_number off switches - // assert(check["last_obj_cite_number"] == "953","last obj_cite_number expected to be: 953 rather than " ~ check["last_obj_cite_number"]); - break; - case "democratizing_innovation.eric_von_hippel.sst": - // fixed ERROR! range violation, broken check! endnotes, bookindex, biblio - // error in bookindex ... (ch1; ch6; ch8 ) - assert(check["last_obj_cite_number"] == - "905","last obj_cite_number expected to be: 905 rather than " ~ check["last_obj_cite_number"]); // 911 - break; - case "down_and_out_in_the_magic_kingdom.cory_doctorow.sst": - assert(check["last_obj_cite_number"] == - "1417","last obj_cite_number expected to be: 1417 rather than " ~ check["last_obj_cite_number"]); // 1455 check obj_cite_number off switches - break; - case "for_the_win.cory_doctorow.sst": - assert(check["last_obj_cite_number"] == - "3510","last obj_cite_number expected to be: 3510 rather than " ~ check["last_obj_cite_number"]); // 3569 check obj_cite_number off switches - break; - case "free_as_in_freedom_2.richard_stallman_and_the_free_software_revolution.sam_williams.richard_stallman.sst": - assert(check["last_obj_cite_number"] == - "1082","last obj_cite_number expected to be: 1082 rather than " ~ check["last_obj_cite_number"]); // check 1079 too few - break; - case "free_culture.lawrence_lessig.sst": - assert(check["last_obj_cite_number"] == - "1330","last obj_cite_number expected to be: 1330 rather than " ~ check["last_obj_cite_number"]); // 1312 - // fixed ERROR! range violation, broken check! - // error in bookindex ... sections piracy (ch1) & property (ch10 market concentration) fixed - break; - case "free_for_all.peter_wayner.sst": // endnotes, bookindex, biblio - assert(check["last_obj_cite_number"] == - "1559","last obj_cite_number expected to be: 1559 rather than " ~ check["last_obj_cite_number"]); // 1560, check obj_cite_number off switches, has endnotes so 2 too many - // assert(check["last_obj_cite_number"] == "1559","last obj_cite_number expected to be: 1559 rather than " ~ check["last_obj_cite_number"]); - break; - case "gpl2.fsf.sst": - assert(check["last_obj_cite_number"] == - "65","last obj_cite_number expected to be: 65 rather than " ~ check["last_obj_cite_number"]); // ok endnotes? check - // assert(check["last_obj_cite_number"] == "66","last obj_cite_number expected to be: 66 rather than " ~ check["last_obj_cite_number"]); - break; - case "gpl3.fsf.sst": - assert(check["last_obj_cite_number"] == - "123","last obj_cite_number expected to be: 123 rather than " ~ check["last_obj_cite_number"]); // ok - break; - case "gullivers_travels.jonathan_swift.sst": - assert(check["last_obj_cite_number"] == - "668","last obj_cite_number expected to be: 668 rather than " ~ check["last_obj_cite_number"]); // 674 - break; - case "little_brother.cory_doctorow.sst": - assert(check["last_obj_cite_number"] == - "3130","last obj_cite_number expected to be: 3130 rather than " ~ check["last_obj_cite_number"]); // 3204, check obj_cite_number off switches - break; - case "the_cathedral_and_the_bazaar.eric_s_raymond.sst": - assert(check["last_obj_cite_number"] == - "258","last obj_cite_number expected to be: 258 rather than " ~ check["last_obj_cite_number"]); // ok - break; - case "the_public_domain.james_boyle.sst": - assert(check["last_obj_cite_number"] == - "970","last obj_cite_number expected to be: 970 rather than " ~ check["last_obj_cite_number"]); // 978 - break; - case "the_wealth_of_networks.yochai_benkler.sst": // endnotes, bookindex - assert(check["last_obj_cite_number"] == - "829","last obj_cite_number expected to be: 829 rather than " ~ check["last_obj_cite_number"]); // ok - // assert(check["last_obj_cite_number"] == "832","last obj_cite_number expected to be: 832 rather than " ~ check["last_obj_cite_number"]); - // has endnotes and bookindex, issue with sisu.rb - break; - case "through_the_looking_glass.lewis_carroll.sst": - assert(check["last_obj_cite_number"] == - "949","last obj_cite_number expected to be: 949 rather than " ~ check["last_obj_cite_number"]); // 955 - break; - case "two_bits.christopher_kelty.sst": // endnotes, bookindex, biblio - assert(check["last_obj_cite_number"] == - "1190","last obj_cite_number expected to be: 1190 rather than " ~ check["last_obj_cite_number"]); // 1191 - // assert(check["last_obj_cite_number"] == "1193","last obj_cite_number expected to be: 1193 rather than " ~ check["last_obj_cite_number"]); // 1191 ok? - // has endnotes and bookindex, issue with sisu.rb - break; - // fixed ERROR! range violation! - // error in bookindex ... (ch3 the movement) - case "un_contracts_international_sale_of_goods_convention_1980.sst": - assert(check["last_obj_cite_number"] == - "377","last obj_cite_number expected to be: 377 rather than " ~ check["last_obj_cite_number"]); // ok - break; - case "viral_spiral.david_bollier.sst": // endnotes, bookindex - assert(check["last_obj_cite_number"] == - "1078","last obj_cite_number expected to be: 1078 rather than " ~ check["last_obj_cite_number"]); // 1100 - // fixed ERROR! range violation! - // error in bookindex ... (ch7 ... building the cc machine, an extra semi colon) - break; - default: - writeln(doc_matters.source_filename); - break; - } - } - } - } - } - debug(checkdoc) { - void out_segnames(S,T)( - auto ref const S contents, - auto 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); - } - } - } - } - } - } - debug(checkdoc) { - void out_toc(S)( - auto 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 - ); - } - } - } - } - debug(checkdoc) { - void out_endnotes(S)( - auto ref const S contents, - string key, - ) { - if (contents[key].length > 1) { - foreach (obj; contents[key]) { - writefln( - "[%s]\n%s", - obj.is_a, - obj.text - ); - } - } - } - } - debug(checkdoc) { - void out_bookindex(S)( - auto 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 - ); - } - } - } - } - } - if ((doc_matters.opt_action_bool["verbose"])) { - if ((doc_matters.opt_action_bool["verbose"])) { - foreach (k; doc_matters.keys_seq_seg) { - foreach (obj; contents[k]) { - if (obj.use != "empty") { - if (!empty(obj.obj_cite_number)) { - check["last_obj_cite_number"] = obj.obj_cite_number; - } - } - } - } - } - auto min_repeat_number = 66; - auto char_repeat_number = (doc_matters.dochead_meta["title"]["full"].length + doc_matters.dochead_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%10d\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n(%s: %s)\n%s", - markup.repeat_character_by_number_provided("-", char_repeat_number), - doc_matters.dochead_meta["title"]["full"], - doc_matters.dochead_meta["creator"]["author"], - doc_matters.source_filename, - markup.repeat_character_by_number_provided("-", char_repeat_number), - "length toc array: ", - to!int(contents["toc_seg"].length), - "length contents array: ", - to!int(contents["body"].length), - "last obj_cite_number: ", - to!int(check["last_obj_cite_number"]), - "length endnotes: ", - (contents["endnotes"].length > 1) - ? (to!int(contents["endnotes"].length)) - : 0, - "length glossary: ", - (contents["glossary"].length > 1) - ? (to!int(contents["glossary"].length)) - : 0, - "length biblio: ", - (contents["bibliography"].length > 1) - ? (to!int(contents["bibliography"].length)) - : 0, - "length bookindex: ", - (contents["bookindex_seg"].length > 1) - ? (to!int(contents["bookindex_seg"].length)) - : 0, - "length blurb: ", - (contents["blurb"].length > 1) - ? (to!int(contents["blurb"].length)) - : 0, - __FILE__, - __LINE__, - markup.repeat_character_by_number_provided("-", min_repeat_number), - ); - } - } - } -} diff --git a/src/sdp/ao_read_source_files.d b/src/sdp/ao_read_source_files.d index 808457d..a6459b2 100644 --- a/src/sdp/ao_read_source_files.d +++ b/src/sdp/ao_read_source_files.d @@ -3,7 +3,7 @@ - open markup files
- if master file scan for addional files to import/insert +/ -template SiSUmarkupRaw() { +template SiSUrawMarkupContent() { private import ao_rgx; private import @@ -24,13 +24,13 @@ template SiSUmarkupRaw() { std.conv : to; mixin SiSUrgxInit; auto rgx = Rgx(); - auto rawsrc = MarkupRaw(); - auto SiSUmarkupRaw(Fn)(Fn fn_src) { + auto rawsrc = RawMarkupContent(); + auto SiSUrawMarkupContent(Fn)(Fn fn_src) { auto _0_header_1_body_content_2_insert_filelist_tuple = rawsrc.sourceContentSplitIntoHeaderAndBody(rawsrc.sourceContent(fn_src), fn_src); return _0_header_1_body_content_2_insert_filelist_tuple; } - struct MarkupRaw { + struct RawMarkupContent { final sourceContent(in string fn_src) { auto raw = MarkupRawUnit(); auto source_txt_str = diff --git a/views/version.txt b/views/version.txt index 5c49588..7ab514d 100644 --- a/views/version.txt +++ b/views/version.txt @@ -4,4 +4,4 @@ struct Version { int minor; int patch; } -enum ver = Version(0, 12, 1); +enum ver = Version(0, 12, 2); -- cgit v1.2.3