diff options
author | Ralph Amissah <ralph@amissah.com> | 2017-01-29 16:54:15 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:14 -0400 |
commit | 4f20bd5582bc9ed864f0e43f030a4e76259cf6f0 (patch) | |
tree | bbbc5ba31d4154d154405c8be2de14b24b1b60e2 /src/sdp/ao_output_debugs.d | |
parent | 0.12.1 abstraction template (diff) |
org file reorganise
Diffstat (limited to 'src/sdp/ao_output_debugs.d')
-rw-r--r-- | src/sdp/ao_output_debugs.d | 1167 |
1 files changed, 590 insertions, 577 deletions
diff --git a/src/sdp/ao_output_debugs.d b/src/sdp/ao_output_debugs.d index 73cdfd7..414e851 100644 --- a/src/sdp/ao_output_debugs.d +++ b/src/sdp/ao_output_debugs.d @@ -28,468 +28,367 @@ template SiSUdebugs() { 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, - ); + 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(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 + ); + } } } - } - void out_segnames(S,T)( - auto ref const S contents, - auto ref T doc_matters, - ) { - foreach (key; doc_matters.keys_seq_seg) { + debug(section_head) { + key="head"; 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); - } + writefln( + "[%s][%s]\n%s", + obj.obj_cite_number, + obj.is_a, + obj.text + ); } } } - } - 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(section_toc) { + key="toc_seg"; + out_toc(contents, key); } - } - 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(section_toc_seg) { + key="toc_seg"; + out_toc(contents, key); } - } - 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 - ); - } + debug(section_toc_scroll) { + key="toc_scroll"; + out_toc(contents, key); } - } - 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(segnames) { + writeln(__LINE__); + out_segnames(contents, doc_matters); } - } - 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(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), "</", k, ">"); - break; - case DomTags.close_and_open : - writeln(markup.indent_by_spaces_provided(k), "</", k, ">"); - writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); - break; - case DomTags.open : - writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); - break; - default : - break; + 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), "</", k, ">"); + break; + case DomTags.close_and_open : + writeln(markup.indent_by_spaces_provided(k), "</", k, ">"); + writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); + 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), "</", k, ">"); - break; - case DomTags.close_and_open : - writeln(markup.indent_by_spaces_provided(k), "</", k, ">"); - writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); - 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), "</", k, ">"); + break; + case DomTags.close_and_open : + writeln(markup.indent_by_spaces_provided(k), "</", k, ">"); + writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); + 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_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_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(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(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] - ); + 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; } - 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] - ); + 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 "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 "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 "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 "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 "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 "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 "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; + 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; } - 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(headings) { + debug(anchor) { writefln( "%s\n%s:%s", "-------------------------------", @@ -500,9 +399,10 @@ template SiSUdebugs() { foreach (obj; contents[k]) { if (obj.is_a == "heading") { writefln( - "%s~ [%s] %s", + "%s~ [%s] %s %s", obj.marked_up_level, obj.obj_cite_number, + obj.anchor_tags, // "[", obj["is"], "] ", obj.text ); @@ -510,179 +410,292 @@ template SiSUdebugs() { } } } - debug(checkdoc) { + debug(heading) { // heading 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; - } + 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, + ); } } } } - 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)", - "---------------------------------", - doc_matters.dochead_meta["title"]["full"], - doc_matters.dochead_meta["creator"]["author"], - doc_matters.source_filename, - "---------------------------------", - "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__, - ); + debug(summary) { + string[string] check = [ + "last_obj_cite_number" : "NA [debug \"checkdoc\" not run]", + ]; 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; + 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; + } + } + } + } + } + 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)", + "---------------------------------", + doc_matters.dochead_meta["title"]["full"], + doc_matters.dochead_meta["creator"]["author"], + doc_matters.source_filename, + "---------------------------------", + "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__, + ); } } } |