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 | |
parent | 0.12.1 abstraction template (diff) |
org file reorganise
Diffstat (limited to 'src')
-rwxr-xr-x | src/sdp.d | 27 | ||||
-rw-r--r-- | src/sdp/abstraction.d | 11 | ||||
-rw-r--r-- | src/sdp/ao_abstract_doc_source.d | 134 | ||||
-rw-r--r-- | src/sdp/ao_defaults.d | 2 | ||||
-rw-r--r-- | src/sdp/ao_output_debugs.d | 1167 | ||||
-rw-r--r-- | src/sdp/ao_read_config_files.d | 1 | ||||
-rw-r--r-- | src/sdp/ao_read_source_files.d | 2 | ||||
-rw-r--r-- | src/sdp/output_epub.d | 15 | ||||
-rw-r--r-- | src/sdp/output_html.d | 8 | ||||
-rw-r--r-- | src/sdp/output_hub.d | 2 |
10 files changed, 660 insertions, 709 deletions
@@ -21,17 +21,11 @@ import import sdlang; // sdlang.d /+ std +/ 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, @@ -50,15 +44,6 @@ void main(string[] args) { mixin SiSUbiblio; mixin SiSUrgxInitFlags; mixin outputHub; - /+ - struct DocumentParts { - string[string][] contents; - string[string][string] meta_aa; - string[string][string] make_aa; - string[][string][string] bookindex_unordered_hashes; - JSONValue[] biblio; - } - +/ string[] fns_src; string flag_action; string arg_unrecognized; @@ -83,6 +68,7 @@ void main(string[] args) { bool[string] _opt_action_bool = [ "assertions" : false, "concordance" : false, + "debug" : false, "digest" : false, "docbook" : false, "epub" : false, @@ -117,6 +103,7 @@ void main(string[] args) { std.getopt.config.passThrough, "assert", "--assert set optional assertions on", &_opt_action_bool["assertions"], "concordance", "--concordance file for document", &_opt_action_bool["concordance"], + "debug", "--debug only relevant when debug options compiled in", &_opt_action_bool["debug"], "digest", "--digest hash digest for each object", &_opt_action_bool["digest"], "docbook", "--docbook process docbook output", &_opt_action_bool["docbook"], "epub", "--epub process epub output", &_opt_action_bool["epub"], @@ -202,7 +189,9 @@ void main(string[] args) { auto doc_abstraction = t[0]; auto doc_matters = t[1]; /+ ↓ debugs +/ - debug(checkdoc) { + if ((doc_matters.opt_action_bool["debug"]) + || (doc_matters.opt_action_bool["verbose"]) + ) { SiSUdebugs!()(doc_abstraction, doc_matters); } /+ ↓ output hub +/ @@ -216,12 +205,6 @@ void main(string[] args) { fn_src ); } - // destroy(_0_header_1_body_content_2_insert_filelist_tuple); - // destroy(t); - // destroy(doc_abstraction); - // // destroy(doc_ao_make_aa); - // // destroy(doc_ao_meta_aa); - // destroy(_doc_html_segnames); destroy(fn_src); } } else { diff --git a/src/sdp/abstraction.d b/src/sdp/abstraction.d index d91618e..de26582 100644 --- a/src/sdp/abstraction.d +++ b/src/sdp/abstraction.d @@ -15,17 +15,11 @@ template SiSUabstraction() { import sdlang; // sdlang.d /+ std +/ 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, @@ -112,6 +106,11 @@ template SiSUabstraction() { bool[string] _k = opts; return _k; } + auto environment() { + auto _k = env; + return _k; + } + /+ add a list of images +/ } auto doc_matters = DocumentMatters(); auto t = tuple(doc_abstraction, doc_matters); diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d index 478cbf8..cd1c266 100644 --- a/src/sdp/ao_abstract_doc_source.d +++ b/src/sdp/ao_abstract_doc_source.d @@ -47,7 +47,7 @@ template SiSUdocAbstraction() { auto note_section = NotesSection(); /+ enum +/ enum State { off, on } - enum TriState { off, on, closing } // make aware, possibility of third state + enum TriState { off, on, closing } enum DocStructMarkupHeading { h_sect_A, h_sect_B, @@ -458,8 +458,6 @@ template SiSUdocAbstraction() { comp_obj_heading_.parent_lev_markup = 0; comp_obj_heading_.anchor_tags = ["glossary"]; the_glossary_section ~= comp_obj_heading_; - // } else if (matchFirst(line, rgx.heading)) { - // _heading_matched_(line, line_occur, an_object, an_object_key, lv, collapsed_lev, type, dochead_meta_aa); // levels? } else { _para_match_(line, an_object, an_object_key, indent, bullet, type, line_occur); comp_obj_para = comp_obj_para.init; @@ -487,7 +485,6 @@ template SiSUdocAbstraction() { writeln(__LINE__); writeln(line); } - // _blurb_block_(line, type); type["glossary_section"] = State.off; type["biblio_section"] = State.off; type["blurb_section"] = State.on; @@ -682,7 +679,7 @@ template SiSUdocAbstraction() { } } else if (line_occur["heading"] > State.off) { /+ heading +/ - debug(heading) { // heading + debug(heading) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; @@ -733,7 +730,7 @@ template SiSUdocAbstraction() { an_object["is"] = "heading"; an_object_key="body_nugget"; auto substantive_object_and_anchor_tags_tuple = - obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); // tuple this with anchor tags? + obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; if (to!int(an_object["lev_markup_number"]) == 4) { @@ -809,7 +806,7 @@ template SiSUdocAbstraction() { an_object["is"], ); auto substantive_object_and_anchor_tags_tuple = - obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); // ... + obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; comp_obj_para = comp_obj_para.init; @@ -871,19 +868,6 @@ template SiSUdocAbstraction() { } } /+ ← closed: loop markup document/text line by line +/ /+ ↓ post loop markup document/text +/ - debug(objectrelated2) { // check - writeln(line); - } - /+ - Backmatter: - - endnotes - - glossary - - bibliography / references - - book index - - blurb - +/ - // TODO FIGURE OUT, you need this possibility - // obj_im.obj_inline_markup_and_anchor_tags("doc_end_reset", an_object_key, "", dochead_make_aa); auto en_tuple = note_section.endnote_objects(obj_cite_number, opt_action_bool); static assert(!isTypeTuple!(en_tuple)); @@ -922,7 +906,6 @@ template SiSUdocAbstraction() { } } auto biblio_unsorted_incomplete = biblio_arr_json.dup; - // destroy(biblio_arr_json); auto biblio = Bibliography(); auto biblio_ordered = biblio._bibliography_(biblio_unsorted_incomplete, bib_arr_json); @@ -1016,7 +999,7 @@ template SiSUdocAbstraction() { static assert(!isTypeTuple!(bi_tuple)); auto the_bookindex_section = bi_tuple[0]; obj_cite_number = bi_tuple[1]; - debug(bookindex) { // bookindex + debug(bookindex) { foreach (bi_entry; the_bookindex_section["seg"]) { writeln(bi_entry); } @@ -1036,8 +1019,6 @@ template SiSUdocAbstraction() { comp_obj_heading_.parent_ocn = 1; comp_obj_heading_.parent_lev_markup = 0; the_blurb_section ~= comp_obj_heading_; - } else { - writeln("blurb"); } debug(blurb) { foreach (blurb; the_blurb_section) { @@ -1062,7 +1043,7 @@ template SiSUdocAbstraction() { "{ %s }%s../%s.fnSuffix", "Endnotes", mkup.mark_internal_site_lnk, - "endnotes", // segment_anchor_tag_that_object_belongs_to + "endnotes", // segment_anchor_tag_that_object_belongs_to ); toc_txt_= munge.url_links(toc_txt_); comp_obj_toc.text = to!string(toc_txt_).strip; @@ -1073,7 +1054,7 @@ template SiSUdocAbstraction() { "{ %s }%s../%s.fnSuffixs", "Glossary", mkup.mark_internal_site_lnk, - "glossary", // segment_anchor_tag_that_object_belongs_to + "glossary", // segment_anchor_tag_that_object_belongs_to ); toc_txt_= munge.url_links(toc_txt_); comp_obj_toc.text = to!string(toc_txt_).strip; @@ -1081,7 +1062,7 @@ template SiSUdocAbstraction() { toc_txt_ = format( "{ %s }#%s", "Glossary", - "glossary", // _anchor_tag + "glossary", // _anchor_tag ); toc_txt_= munge.url_links(toc_txt_); comp_obj_toc.text = to!string(toc_txt_).strip; @@ -1092,7 +1073,7 @@ template SiSUdocAbstraction() { "{ %s }%s../%s.fnSuffix", "Bibliography", mkup.mark_internal_site_lnk, - "bibliography", // segment_anchor_tag_that_object_belongs_to + "bibliography", // segment_anchor_tag_that_object_belongs_to ); toc_txt_= munge.url_links(toc_txt_); comp_obj_toc.text = to!string(toc_txt_).strip; @@ -1101,7 +1082,7 @@ template SiSUdocAbstraction() { toc_txt_ = format( "{ %s }#%s", "Bibliography", - "bibliography", // _anchor_tag + "bibliography", // _anchor_tag ); toc_txt_= munge.url_links(toc_txt_); comp_obj_toc.text = to!string(toc_txt_).strip; @@ -1112,7 +1093,7 @@ template SiSUdocAbstraction() { "{ %s }%s../%s.fnSuffix", "Book Index", mkup.mark_internal_site_lnk, - "bookindex", // segment_anchor_tag_that_object_belongs_to + "bookindex", // segment_anchor_tag_that_object_belongs_to ); toc_txt_= munge.url_links(toc_txt_); comp_obj_toc.text = to!string(toc_txt_).strip; @@ -1122,7 +1103,7 @@ template SiSUdocAbstraction() { toc_txt_ = format( "{ %s }#%s", "Book Index", - "bookindex", // _anchor_tag + "bookindex", // _anchor_tag ); toc_txt_= munge.url_links(toc_txt_); comp_obj_toc.text = to!string(toc_txt_).strip; @@ -1133,7 +1114,7 @@ template SiSUdocAbstraction() { "{ %s }%s../%s.fnSuffix", "Blurb", mkup.mark_internal_site_lnk, - "blurb", // segment_anchor_tag_that_object_belongs_to + "blurb", // segment_anchor_tag_that_object_belongs_to ); toc_txt_= munge.url_links(toc_txt_); comp_obj_toc.text = to!string(toc_txt_).strip; @@ -1141,7 +1122,7 @@ template SiSUdocAbstraction() { toc_txt_ = format( "{ %s }#%s", "Blurb", - "blurb", // _anchor_tag + "blurb", // _anchor_tag ); toc_txt_= munge.url_links(toc_txt_); comp_obj_toc.text = to!string(toc_txt_).strip; @@ -1250,9 +1231,6 @@ template SiSUdocAbstraction() { dom_collapsed_buffer = dom_collapsed.dup; foreach (ref obj; the_table_of_contents_section["scroll"]) { if (obj.is_a == "heading") { - debug(dom) { - // writeln(obj.text); - } if (obj.heading_lev_markup == 4) { obj.segname_next = html_segnames[obj.ptr_html_segnames + 1]; assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]); @@ -1790,31 +1768,31 @@ template SiSUdocAbstraction() { auto rgx = Rgx(); if (type["curly_code"] == TriState.on) { if (matchFirst(line, rgx.block_curly_code_close)) { - debug(code) { // code (curly) close + debug(code) { // code (curly) close writeln(line); } type["blocks"] = TriState.closing; type["code"] = TriState.closing; type["curly_code"] = TriState.off; } else { - debug(code) { // code (curly) line + debug(code) { // code (curly) line writeln(line); } - an_object[an_object_key] ~= line ~= "\n"; // code (curly) line + an_object[an_object_key] ~= line ~= "\n"; // code (curly) line } } else if (type["tic_code"] == TriState.on) { if (matchFirst(line, rgx.block_tic_close)) { - debug(code) { // code (tic) close + debug(code) { // code (tic) close writeln(line); } type["blocks"] = TriState.closing; type["code"] = TriState.closing; type["tic_code"] = TriState.off; } else { - debug(code) { // code (tic) line + debug(code) { // code (tic) line writeln(line); } - an_object[an_object_key] ~= line ~= "\n"; // code (tic) line + an_object[an_object_key] ~= line ~= "\n"; // code (tic) line } } } @@ -1962,7 +1940,7 @@ template SiSUdocAbstraction() { header_tag_value=""; } } - // + // void _poem_block_(L,O,T,C,N,Ma)( L line, ref O an_object, @@ -1982,8 +1960,8 @@ template SiSUdocAbstraction() { auto rgx = Rgx(); if (type["curly_poem"] == TriState.on) { if (matchFirst(line, rgx.block_curly_poem_close)) { - an_object[an_object_key]="verse"; // check that this is as you please - debug(poem) { // poem (curly) close + an_object[an_object_key]="verse"; + debug(poem) { // poem (curly) close writefln( "* [poem curly] %s", line @@ -1992,7 +1970,7 @@ template SiSUdocAbstraction() { if (processing.length > 0) { an_object[an_object_key] = processing["verse"]; } - debug(poem) { // poem (curly) close + debug(poem) { // poem (curly) close writeln(__LINE__); writefln( "* %s %s", @@ -2001,7 +1979,7 @@ template SiSUdocAbstraction() { ); } if (an_object.length > 0) { - debug(poem) { // poem (curly) close + debug(poem) { // poem (curly) close writeln( obj_cite_number, an_object[an_object_key] @@ -2078,18 +2056,18 @@ template SiSUdocAbstraction() { } } else if (type["tic_poem"] == TriState.on) { if (auto m = matchFirst(line, rgx.block_tic_close)) { // tic_poem_close - an_object[an_object_key]="verse"; // check that this is as you please - debug(poem) { // poem (curly) close + an_object[an_object_key]="verse"; + debug(poem) { // poem (curly) close writefln( "* [poem tic] %s", line ); } - if (processing.length > 0) { // needs looking at + if (processing.length > 0) { an_object[an_object_key] = processing["verse"]; } if (an_object.length > 0) { - debug(poem) { // poem (tic) close + debug(poem) { // poem (tic) close writeln(__LINE__); writeln(obj_cite_number, line); } @@ -2107,7 +2085,7 @@ template SiSUdocAbstraction() { comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); comp_obj_block.text = an_object["substantive"]; the_document_body_section ~= comp_obj_block; - obj_cite_number_poem["end"] = to!string(obj_cite_number); + obj_cite_number_poem["end"] = to!string(obj_cite_number); object_reset(an_object); processing.remove("verse"); ++cntr; @@ -2178,31 +2156,31 @@ template SiSUdocAbstraction() { auto rgx = Rgx(); if (type["curly_group"] == State.on) { if (matchFirst(line, rgx.block_curly_group_close)) { - debug(group) { // group (curly) close + debug(group) { // group (curly) close writeln(line); } type["blocks"] = TriState.closing; type["group"] = TriState.closing; type["curly_group"] = TriState.off; } else { - debug(group) { // group + debug(group) { // group writeln(line); } - an_object[an_object_key] ~= line ~= "\n"; // build group array (or string) + an_object[an_object_key] ~= line ~= "\n"; // build group array (or string) } } else if (type["tic_group"] == TriState.on) { if (matchFirst(line, rgx.block_tic_close)) { - debug(group) { // group (tic) close + debug(group) { // group (tic) close writeln(line); } type["blocks"] = TriState.closing; type["group"] = TriState.closing; type["tic_group"] = TriState.off; } else { - debug(group) { // group + debug(group) { // group writeln(line); } - an_object[an_object_key] ~= line ~= "\n"; // build group array (or string) + an_object[an_object_key] ~= line ~= "\n"; // build group array (or string) } } } @@ -2219,31 +2197,31 @@ template SiSUdocAbstraction() { auto rgx = Rgx(); if (type["curly_block"] == TriState.on) { if (matchFirst(line, rgx.block_curly_block_close)) { - debug(block) { // block (curly) close + debug(block) { // block (curly) close writeln(line); } type["blocks"] = TriState.closing; type["block"] = TriState.closing; type["curly_block"] = TriState.off; } else { - debug(block) { // block + debug(block) { // block writeln(line); } - an_object[an_object_key] ~= line ~= "\n"; // build block array (or string) + an_object[an_object_key] ~= line ~= "\n"; // build block array (or string) } } else if (type["tic_block"] == TriState.on) { if (matchFirst(line, rgx.block_tic_close)) { - debug(block) { // block (tic) close + debug(block) { // block (tic) close writeln(line); } type["blocks"] = TriState.closing; type["block"] = TriState.closing; type["tic_block"] = TriState.off; } else { - debug(block) { // block + debug(block) { // block writeln(line); } - an_object[an_object_key] ~= line ~= "\n"; // build block array (or string) + an_object[an_object_key] ~= line ~= "\n"; // build block array (or string) } } } @@ -2260,31 +2238,31 @@ template SiSUdocAbstraction() { auto rgx = Rgx(); if (type["curly_quote"] == TriState.on) { if (matchFirst(line, rgx.block_curly_quote_close)) { - debug(quote) { // quote (curly) close + debug(quote) { // quote (curly) close writeln(line); } type["blocks"] = TriState.closing; type["quote"] = TriState.closing; type["curly_quote"] = TriState.off; } else { - debug(quote) { // quote + debug(quote) { writeln(line); } - an_object[an_object_key] ~= line ~= "\n"; // build quote array (or string) + an_object[an_object_key] ~= line ~= "\n"; // build quote array (or string) } } else if (type["tic_quote"] == TriState.on) { if (matchFirst(line, rgx.block_tic_close)) { - debug(quote) { // quote (tic) close + debug(quote) { // quote (tic) close writeln(line); } type["blocks"] = TriState.closing; type["quote"] = TriState.closing; type["tic_quote"] = TriState.off; } else { - debug(quote) { // quote + debug(quote) { writeln(line); } - an_object[an_object_key] ~= line ~= "\n"; // build quote array (or string) + an_object[an_object_key] ~= line ~= "\n"; // build quote array (or string) } } } @@ -2405,7 +2383,7 @@ template SiSUdocAbstraction() { comp_obj_poem_ocn.is_of = "block"; comp_obj_poem_ocn.is_a = "poem"; comp_obj_poem_ocn.ocn = obj_cite_number; - comp_obj_poem_ocn.obj_cite_number = (obj_cite_number_poem["start"], obj_cite_number_poem["end"]); // not sure about this + comp_obj_poem_ocn.obj_cite_number = (obj_cite_number_poem["start"], obj_cite_number_poem["end"]); comp_obj_poem_ocn.text = ""; // an_object["substantive"]; the_document_body_section ~= comp_obj_poem_ocn; object_reset(an_object); @@ -2936,7 +2914,7 @@ template SiSUdocAbstraction() { if (line_occur["para"] == State.off) { /+ para matches +/ type["para"] = State.on; - an_object[an_object_key] ~= line; // body_nugget + an_object[an_object_key] ~= line; // body_nugget indent=[ "hang_position" : 0, "base_position" : 0, @@ -3056,7 +3034,7 @@ template SiSUdocAbstraction() { } return obj_txt_in; } - string footnotes_endnotes_markup_and_number_or_stars(Ot)(Ot obj_txt_in) { // here endnotes are marked up + string footnotes_endnotes_markup_and_number_or_stars(Ot)(Ot obj_txt_in) { // here endnotes are marked up debug(asserts){ static assert(is(typeof(obj_txt_in) == string)); } @@ -3749,7 +3727,7 @@ template SiSUdocAbstraction() { break; } _obj_attrib["json"] ~=" }"; - _obj_attrib["json"]=_set_additional_values_parse_as_json(_obj_attrib["json"], obj_is_, _comp_obj_heading); // check + _obj_attrib["json"]=_set_additional_values_parse_as_json(_obj_attrib["json"], obj_is_, _comp_obj_heading); debug(structattrib) { if (oa_j["is"].str() == "heading") { writeln(_obj_attrib["json"]); @@ -3925,7 +3903,7 @@ template SiSUdocAbstraction() { OA _obj_attrib, Oi obj_is_, OH _comp_obj_heading, - ) { // + ) { debug(asserts){ static assert(is(typeof(_obj_attrib) == string)); static assert(is(typeof(obj_is_) == string)); @@ -4376,7 +4354,7 @@ template SiSUdocAbstraction() { auto m = (matchFirst(endnote, rgx.note_ref)); string notenumber = to!string(m.captures[1]); string anchor_tag = "note_" ~ notenumber; - comp_obj_endnote_.anchor_tags ~= [ endnotes_["anchor"][i] ]; // fix + comp_obj_endnote_.anchor_tags ~= [ endnotes_["anchor"][i] ]; comp_obj_endnote_.text = endnote.strip; the_endnotes_section ~= comp_obj_endnote_; } @@ -4586,7 +4564,7 @@ template SiSUdocAbstraction() { } body { int obj_cite_number = to!int(obj_cite_number_); - switch (to!int(lev_markup_number)) { // switch (to!string(lv)) { + switch (to!int(lev_markup_number)) { case 0: lv = DocStructMarkupHeading.h_sect_A; lv0 = obj_cite_number; @@ -4670,7 +4648,7 @@ template SiSUdocAbstraction() { _comp_obj_heading_ = _comp_obj_heading_.init; _comp_obj_heading_.use = "body"; _comp_obj_heading_.is_of = "para"; - _comp_obj_heading_.is_a = "heading"; // _node_heading_.is_a = is_; // check whether needed, constant??? + _comp_obj_heading_.is_a = "heading"; // = is_; // check whether needed, constant??? _comp_obj_heading_.text = to!string(_text).strip; _comp_obj_heading_.ocn = obj_cite_number_; _comp_obj_heading_.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); diff --git a/src/sdp/ao_defaults.d b/src/sdp/ao_defaults.d index 3c902df..f7a4e7b 100644 --- a/src/sdp/ao_defaults.d +++ b/src/sdp/ao_defaults.d @@ -432,7 +432,7 @@ template SiSUpaths() { return chainPath(seg(fn_src), seg_filename ~ ".html").array; } // string fn_css(string fn_src) { - // // // return chainPath(seg(fn_src), "html.css").array; + // return chainPath(seg(fn_src), "html.css").array; // } } struct EpubPaths { 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__, + ); } } } diff --git a/src/sdp/ao_read_config_files.d b/src/sdp/ao_read_config_files.d index 2e1bca6..51fd81b 100644 --- a/src/sdp/ao_read_config_files.d +++ b/src/sdp/ao_read_config_files.d @@ -96,7 +96,6 @@ template ConfigSDLang() { } } /+ - +/ template ConfigHub() { private import diff --git a/src/sdp/ao_read_source_files.d b/src/sdp/ao_read_source_files.d index a6c0199..808457d 100644 --- a/src/sdp/ao_read_source_files.d +++ b/src/sdp/ao_read_source_files.d @@ -138,7 +138,7 @@ template SiSUmarkupRaw() { } } struct Inserts { - private import ao_defaults; // ao_defaults.d + private import ao_defaults; auto scan_subdoc_source( char[][] markup_sourcefile_insert_content, string fn_src diff --git a/src/sdp/output_epub.d b/src/sdp/output_epub.d index cffa560..07b2cb9 100644 --- a/src/sdp/output_epub.d +++ b/src/sdp/output_epub.d @@ -118,12 +118,9 @@ template outputEPub() { foreach_reverse (k; 0 .. 7) { switch (obj.dom_markedup[k]) { case DomTags.close : - writeln(markup.indent_by_spaces_provided(k), "</", k, ">"); toc ~= "</navPoint>"; break; case DomTags.close_and_open : - writeln(markup.indent_by_spaces_provided(k), "</", k, ">"); - writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); ++counter; toc ~= "</navPoint>"; toc ~= format(q"¶<navPoint class="chapter" id="navpoint" playOrder="%s"> @@ -137,7 +134,6 @@ template outputEPub() { ); break; case DomTags.open : - writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); ++counter; toc ~= format(q"¶<navPoint class="chapter" id="navpoint" playOrder="%s"> <navLabel> @@ -181,8 +177,6 @@ template outputEPub() { foreach (obj; contents[part]) { if (obj.is_a == "heading") { switch (obj.heading_lev_markup) { - // case 0: - // break; case 0: .. case 3: /+ fill buffer, and replace with new levels from 1 to 3 +/ switch (obj.heading_lev_markup) { @@ -213,7 +207,6 @@ template outputEPub() { segment_filename = obj.segment_anchor_tag; doc_epub[segment_filename] ~= xhtml_format.seg_head(doc_matters.dochead_meta); foreach (top_level_heading; top_level_headings) { - // writeln(top_level_heading); doc_epub[segment_filename] ~= top_level_heading; } doc_epub[segment_filename] ~= xhtml_format.heading(obj); @@ -231,7 +224,6 @@ template outputEPub() { switch (obj.is_a) { case "toc": doc_epub[segment_filename] ~= xhtml_format.toc(obj); - // doc_epub ~= xhtml_toc(obj); break; default: // writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); @@ -260,23 +252,18 @@ template outputEPub() { break; case "verse": doc_epub[segment_filename] ~= xhtml_format.nugget(obj); - // doc_epub ~= xhtml_verse(obj); break; case "group": doc_epub[segment_filename] ~= xhtml_format.nugget(obj); - // doc_epub ~= xhtml_group(obj); break; case "block": doc_epub[segment_filename] ~= xhtml_format.nugget(obj); - // doc_epub ~= xhtml_block(obj); break; case "quote": doc_epub[segment_filename] ~= xhtml_format.nugget(obj); - // doc_epub ~= xhtml_quote(obj); break; case "table": doc_epub[segment_filename] ~= xhtml_format.para(obj); // - // doc_epub ~= xhtml_table(obj); break; case "code": doc_epub[segment_filename] ~= xhtml_format.code(obj); @@ -321,7 +308,6 @@ template outputEPub() { } } } - writeln(doc_matters.keys_seq_seg); epub_write_output_files( doc_matters, doc_epub, @@ -348,7 +334,6 @@ template outputEPub() { } mixin SiSUpaths; auto pth_epub = EpubPaths(); - // doc = xhtml_format.scroll_head ~ doc_epub ~ xhtml_format.tail; auto xhtml_format = outputXHTMLs(); try { mkdirRecurse(pth_epub.doc_meta_inf(doc_matters.source_filename)); diff --git a/src/sdp/output_html.d b/src/sdp/output_html.d index 384576b..fca6f1f 100644 --- a/src/sdp/output_html.d +++ b/src/sdp/output_html.d @@ -173,9 +173,7 @@ template outputHTML() { try { mkdirRecurse(pth_html.seg(doc_matters.source_filename)); foreach (seg_filename; doc_matters.segnames) { - // writeln(__LINE__, ": ", fn); auto f = File(pth_html.fn_seg(doc_matters.source_filename, seg_filename), "w"); - /+ // f.writeln(seg_head); // not needed built and inserted earlier +/ foreach (docseg; doc_html[seg_filename]) { f.writeln(docseg); } @@ -183,7 +181,7 @@ template outputHTML() { } } catch (ErrnoException ex) { - // Handle error + // handle error } } void seg(C,M)( @@ -231,7 +229,6 @@ template outputHTML() { segment_filename = obj.segment_anchor_tag; doc_html[segment_filename] ~= xhtml_format.seg_head(doc_matters.dochead_meta); // consider placing seg_head here as can more easily populate it with lev4 info foreach (top_level_heading; top_level_headings) { - // writeln(top_level_heading); doc_html[segment_filename] ~= top_level_heading; } doc_html[segment_filename] ~= xhtml_format.heading(obj); @@ -288,7 +285,7 @@ template outputHTML() { doc_html[segment_filename] ~= xhtml_format.nugget(obj); break; case "table": - doc_html[segment_filename] ~= xhtml_format.para(obj); // + doc_html[segment_filename] ~= xhtml_format.para(obj); break; case "code": doc_html[segment_filename] ~= xhtml_format.code(obj); @@ -333,7 +330,6 @@ template outputHTML() { } } } - writeln(doc_matters.keys_seq_seg); seg_write_output_files(doc_matters, doc_html); } auto html_css() { diff --git a/src/sdp/output_hub.d b/src/sdp/output_hub.d index fe53bdb..2ec11fe 100644 --- a/src/sdp/output_hub.d +++ b/src/sdp/output_hub.d @@ -43,8 +43,6 @@ template outputHub() { if (doc_matters.opt_action_bool["text"]) { /+ mixin outputText; +/ writeln("text processing"); - // auto text=SDPoutput_text(); - // text.scroll(contents, bookindex_unordered_hashes, biblio, dochead_make, dochead_meta, fn_src, opt_action_bool); } if (doc_matters.opt_action_bool["html"]) { outputHTML!().scroll(contents,doc_matters); |