From 4f20bd5582bc9ed864f0e43f030a4e76259cf6f0 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 29 Jan 2017 16:54:15 -0500 Subject: org file reorganise --- org/ao_abstract_doc_source.org | 203 +++---- org/ao_conf_make_meta.org | 334 ++++++----- org/ao_defaults.org | 42 +- org/ao_output_debugs.org | 179 +++--- org/ao_read_source_files.org | 214 +++---- org/compile_time_info.org | 27 +- org/output.org | 71 +-- org/sdp.org | 46 +- src/sdp.d | 27 +- src/sdp/abstraction.d | 11 +- src/sdp/ao_abstract_doc_source.d | 134 ++--- src/sdp/ao_defaults.d | 2 +- src/sdp/ao_output_debugs.d | 1167 +++++++++++++++++++------------------- src/sdp/ao_read_config_files.d | 1 - src/sdp/ao_read_source_files.d | 2 +- src/sdp/output_epub.d | 15 - src/sdp/output_html.d | 8 +- src/sdp/output_hub.d | 2 - 18 files changed, 1188 insertions(+), 1297 deletions(-) diff --git a/org/ao_abstract_doc_source.org b/org/ao_abstract_doc_source.org index 6fd6718..e441b7d 100644 --- a/org/ao_abstract_doc_source.org +++ b/org/ao_abstract_doc_source.org @@ -13,8 +13,10 @@ #+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) [[./sdp.org][sdp]] [[./][org/]] -* 0. Code Skeleton / Outline / Structure (tangles) :tangle:io:file: -** 1. ao abstract doc source: :ao_abstract_doc_source: +* 1. Document Abstraction :abstract:process: +Process markup document, create document abstraction. + +** 0. ao abstract doc source: :ao_abstract_doc_source: #+BEGIN_SRC d :tangle ../src/sdp/ao_abstract_doc_source.d /++ @@ -88,7 +90,7 @@ template SiSUdocAbstraction() { <> <> <> - // <> + // <> <> <> <> @@ -133,23 +135,6 @@ template SiSUdocAbstraction() { } /+ ← closed: template SiSUdocAbstraction +/ #+END_SRC -** 2. ao object setter: :ao_object_setter: - -#+BEGIN_SRC d :tangle ../src/sdp/ao_object_setter.d -/++ - object setter: - setting of sisu objects for downstream processing - ao_object_setter.d -+/ -template ObjectSetter() { - /+ structs +/ - <> -} -#+END_SRC - -* 1. Document Abstraction :abstract:process: -Process markup document, create document abstraction. - ** _1. pre loop processing_ :pre: *** imports :imports: @@ -193,6 +178,7 @@ mixin SiSUrgxInit; #+END_SRC *** initialize :initialize: +**** initialize general #+name: abs_init_struct #+BEGIN_SRC d @@ -209,7 +195,7 @@ string segment_anchor_tag_that_object_belongs_to_uri; 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, @@ -250,6 +236,12 @@ int[] dom_markedup_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; int[] dom_collapsed = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; int[] dom_collapsed_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; enum DomTags { none, open, close, close_and_open, open_still, } +#+END_SRC + +**** initialize heading ancestors + +#+name: abs_init_struct +#+BEGIN_SRC d void heading_ancestors(O)( auto ref O obj, ref string[] lv_ancestors, @@ -302,6 +294,12 @@ void heading_ancestors(O)( obj.heading_ancestors_text = lv_ancestors.dup; } } +#+END_SRC + +**** initialize dom markup tags + +#+name: abs_init_struct +#+BEGIN_SRC d auto dom_set_markup_tags(int[] dom, int lev) { foreach (i; 0 .. 8) { if (i < lev) { @@ -341,6 +339,12 @@ auto dom_set_markup_tags(int[] dom, int lev) { } return dom; } +#+END_SRC + +**** initialize dom collapsed tags + +#+name: abs_init_struct +#+BEGIN_SRC d auto dom_set_collapsed_tags(int[] dom, int lev) { foreach (i; 0 .. 8) { if (i < lev) { @@ -380,6 +384,12 @@ auto dom_set_collapsed_tags(int[] dom, int lev) { } return dom; } +#+END_SRC + +**** initialize ocn emit + +#+name: abs_init_struct +#+BEGIN_SRC d int ocn_emit(int ocn_status_flag) { return object_citation_number.ocn_emitter(ocn_status_flag); } @@ -649,8 +659,6 @@ if there is a glossary section you need to: 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; @@ -691,7 +699,6 @@ if there is a blurb section you need to: writeln(__LINE__); writeln(line); } - // _blurb_block_(line, type); type["glossary_section"] = State.off; type["biblio_section"] = State.off; type["blurb_section"] = State.on; @@ -961,7 +968,7 @@ if ((matchFirst(line, rgx.book_index)) #+BEGIN_SRC d } else if (line_occur["heading"] > State.off) { /+ heading +/ - debug(heading) { // heading + debug(heading) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; @@ -1002,7 +1009,6 @@ _block_flag_line_empty_( #+END_SRC ****** line empty [+1] - ******* assert line empty :assert: #+name: abs_in_loop_body_not_block_obj_line_empty @@ -1034,7 +1040,7 @@ if ((type["heading"] == State.on) 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) { @@ -1116,7 +1122,7 @@ if ((type["heading"] == State.on) 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; @@ -1148,8 +1154,7 @@ if ((type["heading"] == State.on) } #+END_SRC -*** close non code objects (regular text) - +** close non code objects (regular text) *** regular text objects :text:paragraph: #+name: abs_in_loop_body_01 @@ -1184,13 +1189,6 @@ if (the_document_body_section.length > 0) { #+END_SRC ** _3. post main-loop processing_ :post: -*** misc - -#+name: abs_post -#+BEGIN_SRC d -debug(objectrelated2) { // check - writeln(line); -} /+ Backmatter: - endnotes @@ -1199,9 +1197,6 @@ debug(objectrelated2) { // check - 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); -#+END_SRC *** tie up preparation of document sections **** endnotes section (scroll & seg) :endnotes: @@ -1258,7 +1253,6 @@ debug(glossary) { #+name: abs_post #+BEGIN_SRC d 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); @@ -1404,7 +1398,7 @@ auto bi_tuple = 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); } @@ -1430,8 +1424,6 @@ if (an_object["blurb_nugget"].length == 0) { 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) { @@ -1462,7 +1454,7 @@ if (the_endnotes_section.length > 1) { "{ %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; @@ -1473,7 +1465,7 @@ if (the_glossary_section.length > 1) { "{ %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; @@ -1481,7 +1473,7 @@ if (the_glossary_section.length > 1) { 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; @@ -1492,7 +1484,7 @@ if (the_bibliography_section.length > 1){ "{ %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; @@ -1501,7 +1493,7 @@ if (the_bibliography_section.length > 1){ 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; @@ -1512,7 +1504,7 @@ if (the_bookindex_section["seg"].length > 1) { "{ %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; @@ -1522,7 +1514,7 @@ if (the_bookindex_section["scroll"].length > 1) { 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; @@ -1533,7 +1525,7 @@ if (the_blurb_section.length > 1) { "{ %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; @@ -1541,7 +1533,7 @@ if (the_blurb_section.length > 1) { 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; @@ -1695,9 +1687,6 @@ if (the_table_of_contents_section["scroll"].length > 1) { 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]); @@ -2016,7 +2005,7 @@ destroy(the_bookindex_section); destroy(the_blurb_section); #+END_SRC -*** _return document tuple_ :return:tuple: +*** [#A] _return document tuple_ :return:tuple: #+name: abs_post #+BEGIN_SRC d @@ -2320,31 +2309,31 @@ void _code_block_(L,O,T)( 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 } } } @@ -2592,8 +2581,8 @@ void _poem_block_(L,O,T,C,N,Ma)( 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 @@ -2602,7 +2591,7 @@ void _poem_block_(L,O,T,C,N,Ma)( 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", @@ -2611,7 +2600,7 @@ void _poem_block_(L,O,T,C,N,Ma)( ); } if (an_object.length > 0) { - debug(poem) { // poem (curly) close + debug(poem) { // poem (curly) close writeln( obj_cite_number, an_object[an_object_key] @@ -2688,18 +2677,18 @@ void _poem_block_(L,O,T,C,N,Ma)( } } 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); } @@ -2717,7 +2706,7 @@ void _poem_block_(L,O,T,C,N,Ma)( 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; @@ -2794,31 +2783,31 @@ void _group_block_(L,O,T)( 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) } } } @@ -2841,31 +2830,31 @@ void _block_block_(L,O,T)( 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) } } } @@ -2888,31 +2877,31 @@ void _quote_block_(L,O,T)( 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) } } } @@ -3045,7 +3034,7 @@ void _block_flag_line_empty_( 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); @@ -3353,7 +3342,7 @@ auto _heading_found_(L,X,H,R,T)( } #+END_SRC -**** TODO heading make set :heading: +**** heading make set :heading: #+name: abs_functions_heading #+BEGIN_SRC d @@ -3607,7 +3596,7 @@ auto _para_match_(L,O,K,I,B,T,C)( 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, @@ -3738,7 +3727,7 @@ struct ObjInlineMarkupMunge { } 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)); } @@ -4497,7 +4486,7 @@ struct ObjAttributes { 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"]); @@ -4746,7 +4735,7 @@ struct ObjAttributes { 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)); @@ -5263,7 +5252,7 @@ struct NotesSection { 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_; } @@ -5533,7 +5522,7 @@ struct NodeStructureMetadata { } 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; @@ -5617,7 +5606,7 @@ struct NodeStructureMetadata { _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); @@ -5905,7 +5894,21 @@ auto assertions_flag_types_block_status_none_or_closed(T)(T type) { set abstracted objects for downstream processing -** initialize structs :struct: +** 0. ao object setter: :ao_object_setter: + +#+BEGIN_SRC d :tangle ../src/sdp/ao_object_setter.d +/++ + object setter: + setting of sisu objects for downstream processing + ao_object_setter.d ++/ +template ObjectSetter() { + /+ structs +/ + <> +} +#+END_SRC + +** 1. initialize structs :struct: *** heading attribute #+name: ao_structs_init diff --git a/org/ao_conf_make_meta.org b/org/ao_conf_make_meta.org index 12dfbbe..dc45daf 100644 --- a/org/ao_conf_make_meta.org +++ b/org/ao_conf_make_meta.org @@ -13,8 +13,7 @@ #+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) [[./sdp.org][sdp]] [[./][org/]] -* 0. Code Skeleton / Outline / Structure (tangles) :tangle: -** 1. Header Hub :ao_markup_header_extract: +* 0. Header Hub :ao_markup_header_extract: #+BEGIN_SRC d :tangle ../src/sdp/ao_conf_make_meta.d /++ @@ -65,39 +64,8 @@ template SiSUheaderExtractHub() { } #+END_SRC -** 2a. Header Native :ao_markup_header_extract_native: - -#+BEGIN_SRC d :tangle ../src/sdp/ao_conf_make_meta_native.d -/++ - native headers using
@title:
:subtitle:
type tags
- extract native/orig header return associative array -+/ -template SiSUheaderExtractNative() { - private import - std.exception, - std.regex, - std.stdio, - std.string, - std.traits, - std.typecons, - std.utf, - std.conv : to; - private import - ao_rgx, - ao_defaults; - struct HeaderDocMetadataAndMakeNativeToAA { - mixin SiSUregisters; - mixin SiSUrgxInitFlags; - mixin SiSUrgxInit; - auto rgx = Rgx(); - enum State { off, on } - string hm, hs; - <> - } -} -#+END_SRC - -** 2b. Header SDLang :ao_markup_header_extract_sdlang: +* A. header sdlang +** extract sdlang header #+BEGIN_SRC d :tangle ../src/sdp/ao_conf_make_meta_sdlang.d /++ @@ -126,7 +94,7 @@ template SiSUheaderExtractSDLang() { } #+END_SRC -* A. sdlang to AA +** sdlang to associative array #+name: ao_conf_make_meta_sdl #+BEGIN_SRC d @@ -152,7 +120,7 @@ private auto sdlangToAAmake(C,Tag)(C conf, Tag conf_sdlang) { } #+END_SRC -* B. conf settings sdlang +** conf settings sdlang #+name: ao_conf_make_meta_sdl #+BEGIN_SRC d @@ -162,7 +130,7 @@ private auto configSettingsSDLangToAAmake(Tag)(Tag conf_sdlang) { } #+END_SRC -* C. conf make sdlang +** conf make sdlang #+name: ao_conf_make_meta_sdl #+BEGIN_SRC d @@ -307,10 +275,164 @@ private auto documentMakeSDLangToAAmake(Tag)(Tag document_make_sdlang) { } #+END_SRC -* D. header :header: -** a. header native :header:native: +** header :header:sdl: +*** sdlang header parse and extract root Tag :sdlang:root:tag: -*** native header document metadata in associative array :aa: +#+name: ao_conf_make_meta_sdl +#+BEGIN_SRC d +final private auto headerMakeSDLang(Hs)(Hs src_header) { + debug(asserts){ + static assert(is(typeof(src_header) == string)); + } + scope(failure) { + stderr.writefln( + "%s\n%s\n%s:%s failed here:\n src_header: %s", + __MODULE__, __FUNCTION__, + __FILE__, __LINE__, + src_header, + ); + } + Tag sdl_root_header; + try { + sdl_root_header = parseSource(src_header); + } + catch(ParseException e) { + stderr.writeln("SDLang problem with this document header:"); + stderr.writeln(src_header); + // Error messages of the form: + // myFile.sdl(5:28): Error: Invalid integer suffix. + stderr.writeln(e.msg); + } + debug(sdlang) { + writeln("header SDL:"); + writeln(sdl_root_header.toSDLDocument()); + } + return sdl_root_header; +} +#+END_SRC + +*** sdlang header get :sdlang:get:src: + +#+name: ao_conf_make_meta_sdl +#+BEGIN_SRC d +private auto headerSDLangGet(Hs)(Hs src_header) { + debug(asserts){ + static assert(is(typeof(src_header) == char[])); + } + char[][] source_header_arr = + split(cast(char[]) src_header, rgx.newline_eol_delimiter); + char[] header_clean; + // TODO + foreach(header_line; source_header_arr) { + if (!match(header_line, rgx.comments)) { + header_clean ~= header_line ~ "\n"; + } + } + /+ get sdlang tags +/ + auto header_sdlang=headerMakeSDLang(to!string(header_clean)); + debug(sdlang) { + writeln("--------------"); + stdout.rawWrite( header_sdlang.toSDLDocument() ); + writeln("--------------"); + Value test = header_sdlang.tags["title"][0].values[0]; + assert(test == typeid(string)); + // writeln(header_sdlang.maybe.tags["title"]); + // writeln(header_sdlang.maybe.tags["title"][0].maybe.attributes["subtitle"]); + } + return header_sdlang; // sdlang.ast.Tag +} +#+END_SRC + +*** sdlang header to associative array make sdlTag in :sdlang:aa: + +#+name: ao_conf_make_meta_sdl +#+BEGIN_SRC d +private auto headerSDLangToAAmake(Tag,Ma)(Tag header_sdlang, Ma dochead_make) { + debug(asserts){ + static assert(is(typeof(dochead_make) == string[string][string])); + } + dochead_make = sdlangToAAmake(dochead_make, header_sdlang); + auto dochead_meta = sdlangToAAmake(meta_aa, header_sdlang); + if (dochead_meta["title"]["main"].empty) { + dochead_meta["title"]["main"] = + to!string(header_sdlang.maybe.tags["title"][0].values[0]); // test that this exists + } + if (!(dochead_meta["title"]["subtitle"].empty) + && (dochead_meta["title"]["sub"].empty)) { + dochead_meta["title"]["sub"] ~= dochead_meta["title"]["subtitle"]; + } + dochead_meta["title"].remove("subtitle"); + if (dochead_meta["title"]["sub"].empty) { + dochead_meta["title"]["full"] ~= dochead_meta["title"]["main"]; + } else { + dochead_meta["title"]["full"] ~= format( + "%s - %s", + dochead_meta["title"]["main"], + dochead_meta["title"]["sub"], + ); + } + dochead_meta["creator"]["author_raw"] = dochead_meta["creator"]["author"]; + string[] authors_arr; + auto authors_raw_arr = split(dochead_meta["creator"]["author"], rgx.arr_delimiter); + foreach (author_raw; authors_raw_arr) { + authors_arr ~= replace(author_raw, rgx.raw_author_munge, "$2 $1"); + } + dochead_meta["creator"]["author"] = join(authors_arr, ", ").chomp.chomp; + auto t = tuple(dochead_make, dochead_meta); + static assert(t.length==2); + return t; +} +#+END_SRC + +*** hub: get sdlang header and convert to associative array :hub:sdlang:aa: + +#+name: ao_conf_make_meta_sdl +#+BEGIN_SRC d +private auto headerSDLangToAA(Hs,Ma)(Hs header_sdlang_src, Ma conf_doc_make_aa) { + debug(asserts){ + static assert(is(typeof(header_sdlang_src) == char[])); + static assert(is(typeof(conf_doc_make_aa) == string[string][string])); + } + auto header_sdlang_tag = headerSDLangGet(header_sdlang_src); // sdlang.ast.Tag + auto header_aa_tuple = headerSDLangToAAmake(header_sdlang_tag, conf_doc_make_aa); + return header_aa_tuple; +} +#+END_SRC + +* B. header native :header:native: +** Header Native :ao_markup_header_extract_native: + +#+BEGIN_SRC d :tangle ../src/sdp/ao_conf_make_meta_native.d +/++ + native headers using
@title:
:subtitle:
type tags
+ extract native/orig header return associative array ++/ +template SiSUheaderExtractNative() { + private import + std.exception, + std.regex, + std.stdio, + std.string, + std.traits, + std.typecons, + std.utf, + std.conv : to; + private import + ao_rgx, + ao_defaults; + struct HeaderDocMetadataAndMakeNativeToAA { + mixin SiSUregisters; + mixin SiSUrgxInitFlags; + mixin SiSUrgxInit; + auto rgx = Rgx(); + enum State { off, on } + string hm, hs; + <> + } +} +#+END_SRC + +** native header document metadata in associative array :aa: #+name: ao_markup_header_extract_native #+BEGIN_SRC d @@ -508,7 +630,7 @@ body { } #+END_SRC -*** native header extract to string object :string: +** native header extract to string object :string: #+name: ao_markup_header_extract_native #+BEGIN_SRC d @@ -558,7 +680,7 @@ private auto native_header_extract(L,Lo,O,T)( } #+END_SRC -*** native header reset states :reset: +** native header reset states :reset: #+name: ao_markup_header_extract_native #+BEGIN_SRC d @@ -581,7 +703,7 @@ auto header_reset_states_common(Lo,O,T)( } #+END_SRC -*** hub: native header start :hub: +** hub: native header start :hub: #+name: ao_markup_header_extract_native #+BEGIN_SRC d @@ -638,127 +760,3 @@ private auto headerNativeToAA(Hn)(Hn src_header) { return t; } #+END_SRC - -** b. header sdlang :header:sdl: -*** sdlang header parse and extract root Tag :sdlang:root:tag: - -#+name: ao_conf_make_meta_sdl -#+BEGIN_SRC d -final private auto headerMakeSDLang(Hs)(Hs src_header) { - debug(asserts){ - static assert(is(typeof(src_header) == string)); - } - scope(failure) { - stderr.writefln( - "%s\n%s\n%s:%s failed here:\n src_header: %s", - __MODULE__, __FUNCTION__, - __FILE__, __LINE__, - src_header, - ); - } - Tag sdl_root_header; - try { - sdl_root_header = parseSource(src_header); - } - catch(ParseException e) { - stderr.writeln("SDLang problem with this document header:"); - stderr.writeln(src_header); - // Error messages of the form: - // myFile.sdl(5:28): Error: Invalid integer suffix. - stderr.writeln(e.msg); - } - debug(sdlang) { - writeln("header SDL:"); - writeln(sdl_root_header.toSDLDocument()); - } - return sdl_root_header; -} -#+END_SRC - -*** sdlang header get :sdlang:get:src: - -#+name: ao_conf_make_meta_sdl -#+BEGIN_SRC d -private auto headerSDLangGet(Hs)(Hs src_header) { - debug(asserts){ - static assert(is(typeof(src_header) == char[])); - } - char[][] source_header_arr = - split(cast(char[]) src_header, rgx.newline_eol_delimiter); - char[] header_clean; - // TODO - foreach(header_line; source_header_arr) { - if (!match(header_line, rgx.comments)) { - header_clean ~= header_line ~ "\n"; - } - } - /+ get sdlang tags +/ - auto header_sdlang=headerMakeSDLang(to!string(header_clean)); - debug(sdlang) { - writeln("--------------"); - stdout.rawWrite( header_sdlang.toSDLDocument() ); - writeln("--------------"); - Value test = header_sdlang.tags["title"][0].values[0]; - assert(test == typeid(string)); - // writeln(header_sdlang.maybe.tags["title"]); - // writeln(header_sdlang.maybe.tags["title"][0].maybe.attributes["subtitle"]); - } - return header_sdlang; // sdlang.ast.Tag -} -#+END_SRC - -*** sdlang header to associative array make sdlTag in :sdlang:aa: - -#+name: ao_conf_make_meta_sdl -#+BEGIN_SRC d -private auto headerSDLangToAAmake(Tag,Ma)(Tag header_sdlang, Ma dochead_make) { - debug(asserts){ - static assert(is(typeof(dochead_make) == string[string][string])); - } - dochead_make = sdlangToAAmake(dochead_make, header_sdlang); - auto dochead_meta = sdlangToAAmake(meta_aa, header_sdlang); - if (dochead_meta["title"]["main"].empty) { - dochead_meta["title"]["main"] = - to!string(header_sdlang.maybe.tags["title"][0].values[0]); // test that this exists - } - if (!(dochead_meta["title"]["subtitle"].empty) - && (dochead_meta["title"]["sub"].empty)) { - dochead_meta["title"]["sub"] ~= dochead_meta["title"]["subtitle"]; - } - dochead_meta["title"].remove("subtitle"); - if (dochead_meta["title"]["sub"].empty) { - dochead_meta["title"]["full"] ~= dochead_meta["title"]["main"]; - } else { - dochead_meta["title"]["full"] ~= format( - "%s - %s", - dochead_meta["title"]["main"], - dochead_meta["title"]["sub"], - ); - } - dochead_meta["creator"]["author_raw"] = dochead_meta["creator"]["author"]; - string[] authors_arr; - auto authors_raw_arr = split(dochead_meta["creator"]["author"], rgx.arr_delimiter); - foreach (author_raw; authors_raw_arr) { - authors_arr ~= replace(author_raw, rgx.raw_author_munge, "$2 $1"); - } - dochead_meta["creator"]["author"] = join(authors_arr, ", ").chomp.chomp; - auto t = tuple(dochead_make, dochead_meta); - static assert(t.length==2); - return t; -} -#+END_SRC - -*** hub: get sdlang header and convert to associative array :hub:sdlang:aa: - -#+name: ao_conf_make_meta_sdl -#+BEGIN_SRC d -private auto headerSDLangToAA(Hs,Ma)(Hs header_sdlang_src, Ma conf_doc_make_aa) { - debug(asserts){ - static assert(is(typeof(header_sdlang_src) == char[])); - static assert(is(typeof(conf_doc_make_aa) == string[string][string])); - } - auto header_sdlang_tag = headerSDLangGet(header_sdlang_src); // sdlang.ast.Tag - auto header_aa_tuple = headerSDLangToAAmake(header_sdlang_tag, conf_doc_make_aa); - return header_aa_tuple; -} -#+END_SRC diff --git a/org/ao_defaults.org b/org/ao_defaults.org index 3184077..908a449 100644 --- a/org/ao_defaults.org +++ b/org/ao_defaults.org @@ -13,8 +13,10 @@ #+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) [[./sdp.org][sdp]] [[./][org/]] -* 0. Code Skeleton / Outline / Structure (tangles) :tangle: -** 1. defaults: :ao_defaults: +* 0. default templates :template:defaults: +[[./sdp.org][sdp]] [[./][org/]] + +** 0. defaults: :ao_defaults: #+name: tangle_ao_defaults #+BEGIN_SRC d :tangle ../src/sdp/ao_defaults.d @@ -33,23 +35,6 @@ template SiSUregisters() { <> #+END_SRC -** 2. rgx: :ao_rgx: - -#+name: tangle_ao_rgx -#+BEGIN_SRC d :tangle ../src/sdp/ao_rgx.d -/++ - regex: regular expressions used in sisu document parser -+/ -template SiSUrgxInit() { - private import ao_defaults; - struct Rgx { - <> - } -} -#+END_SRC - -* 1. default templates :template:defaults: -[[./sdp.org][sdp]] [[./][org/]] ** template: imports #+name: ao_defaults_imports @@ -690,7 +675,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 { @@ -763,13 +748,28 @@ template InternalMarkup() { } #+END_SRC -* 2. regex ctRegex :regex: +* 1. regex ctRegex :regex: [[./sdp.org][sdp]] [[./][org/]] http://dlang.org/phobos/std_regex.html - Plain string, in which case it's compiled to bytecode before matching. - Regex!char (wchar/dchar) that contains a pattern in the form of compiled bytecode. - StaticRegex!char (wchar/dchar) that contains a pattern in the form of compiled native machine code. +** 0. rgx code template: :ao_rgx: + +#+name: tangle_ao_rgx +#+BEGIN_SRC d :tangle ../src/sdp/ao_rgx.d +/++ + regex: regular expressions used in sisu document parser ++/ +template SiSUrgxInit() { + private import ao_defaults; + struct Rgx { + <> + } +} +#+END_SRC + ** misc :misc: #+name: ao_rgx diff --git a/org/ao_output_debugs.org b/org/ao_output_debugs.org index fe20f17..07a4dfe 100644 --- a/org/ao_output_debugs.org +++ b/org/ao_output_debugs.org @@ -13,8 +13,9 @@ #+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) [[./sdp.org][sdp]] [[./][org/]] -* 0. Code Skeleton / Outline / Structure (tangles) :tangle: -** code structure: :ao_output_debugs.d: +* 1. output debugs :debug:output: +[[./sdp.org][sdp]] [[./][org/]] +** 0. code structure: :ao_output_debugs: #+name: tangle_ao_output_debugs #+BEGIN_SRC d :tangle ../src/sdp/ao_output_debugs.d @@ -27,19 +28,24 @@ template SiSUdebugs() { auto ref const S contents, auto ref T doc_matters, ) { - mixin SiSUrgxInit; - mixin InternalMarkup; - <> - <> - <> - <> + mixin SiSUrgxInit; + mixin InternalMarkup; + <> + <> + debug(checkdoc) { + if ((doc_matters.opt_action_bool["debug"])) { + <> + } + <> + } + if ((doc_matters.opt_action_bool["verbose"])) { + <> + } } } } #+END_SRC -* 1. output debugs :debug:output: -[[./sdp.org][sdp]] [[./][org/]] ** imports @@ -69,7 +75,7 @@ private import std.conv : to; #+END_SRC -** initialize :report: +** initialize :report: #+name: initialize #+BEGIN_SRC d @@ -78,7 +84,7 @@ auto markup = InlineMarkup(); string key; #+END_SRC -** (parent) :parent: +** (parent) :parent: #+name: ao_output_debugs #+BEGIN_SRC d @@ -106,7 +112,7 @@ debug(parent) { } #+END_SRC -** (dumpdoc) :objects: +** (dumpdoc) :objects: #+name: ao_output_debugs #+BEGIN_SRC d @@ -130,19 +136,21 @@ debug(dumpdoc) { } #+END_SRC -** (segnames) :objects: +** (segnames) :objects: -#+name: ao_output_debugs +#+name: ao_output_debugs_checkdoc #+BEGIN_SRC d -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_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); + } } } } @@ -153,69 +161,75 @@ void out_segnames(S,T)( ** shared output section arrange *** out toc -#+name: ao_output_debugs +#+name: ao_output_debugs_checkdoc #+BEGIN_SRC d -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_toc(S)( + auto ref const S contents, + string key, + ) { + if (contents[key].length > 1) { + string indent_spaces; + foreach (obj; contents[key]) { + indent_spaces=markup.indent_by_spaces_provided(obj.indent_hang); + writefln( + "%s%s", + indent_spaces, + obj.text + ); + } } } } #+END_SRC -*** out endnotes :endnotes: +*** out endnotes :endnotes: -#+name: ao_output_debugs +#+name: ao_output_debugs_checkdoc #+BEGIN_SRC d -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_endnotes(S)( + auto ref const S contents, + string key, + ) { + if (contents[key].length > 1) { + foreach (obj; contents[key]) { + writefln( + "[%s]\n%s", + obj.is_a, + obj.text + ); + } } } } #+END_SRC -*** out bookindex :bookindex: +*** out bookindex :bookindex: -#+name: ao_output_debugs +#+name: ao_output_debugs_checkdoc #+BEGIN_SRC d -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(checkdoc) { + void out_bookindex(S)( + auto ref const S contents, + string key, + ) { + if (contents[key].length > 1) { + foreach (obj; contents[key]) { + writefln( + "[%s][%s]\n%s", + obj.obj_cite_number, + obj.is_a, + obj.text + ); + } } } } #+END_SRC ** sections -*** heading_section :heading: +*** heading_section :heading: #+name: ao_output_debugs #+BEGIN_SRC d @@ -273,7 +287,7 @@ debug(segnames) { } #+END_SRC -*** body_section :body: +*** body_section :body: #+name: ao_output_debugs #+BEGIN_SRC d @@ -346,7 +360,7 @@ debug(dom) { } #+END_SRC -*** endnotes_section (seg & scroll) :endnotes: +*** endnotes_section (seg & scroll) :endnotes: **** endnotes #+name: ao_output_debugs @@ -367,7 +381,7 @@ debug(section_endnotes_seg) { } #+END_SRC -*** glossary_section :glossary: +*** glossary_section :glossary: #+name: ao_output_debugs #+BEGIN_SRC d @@ -386,7 +400,7 @@ debug(section_glossary) { } #+END_SRC -*** bibliography_section (seg & scroll) :bibliography: +*** bibliography_section (seg & scroll) :bibliography: #+name: ao_output_debugs #+BEGIN_SRC d @@ -405,7 +419,7 @@ debug(section_bibliography) { } #+END_SRC -*** bookindex_section (seg & scroll) :bookindex: +*** bookindex_section (seg & scroll) :bookindex: **** bookindex #+name: ao_output_debugs @@ -436,7 +450,7 @@ debug(section_bookindex_scroll) { } #+END_SRC -*** section_blurb :blurb: +*** section_blurb :blurb: #+name: ao_output_debugs #+BEGIN_SRC d @@ -455,8 +469,7 @@ debug(blurb_section) { } #+END_SRC -* end -** (objects) :objects: +** (objects) :objects: #+name: ao_output_debugs #+BEGIN_SRC d @@ -480,7 +493,7 @@ debug(objects) { } #+END_SRC -** (headermakejson) :json:header: +** (headermakejson) :json:header: #+name: ao_output_debugs #+BEGIN_SRC d @@ -512,7 +525,7 @@ debug(headermakejson) { } #+END_SRC -** (headermetadatajson) :json:header: +** (headermetadatajson) :json:header: #+name: ao_output_debugs #+BEGIN_SRC d @@ -668,7 +681,7 @@ debug(anchor) { } #+END_SRC -** (headings) :headings: +** (headings) :headings: #+name: ao_output_debugs #+BEGIN_SRC d @@ -689,7 +702,7 @@ debug(heading) { // heading } #+END_SRC -** (summary) [+1] :summary: +** (summary) [+1] :summary: #+name: ao_output_debugs_summary #+BEGIN_SRC d @@ -724,11 +737,11 @@ debug(summary) { ]; #+END_SRC -*** (checkdoc) :checkdoc: +*** (checkdoc) :checkdoc: -#+name: ao_output_debugs_summary +#+name: ao_output_debugs_summary_doc #+BEGIN_SRC d -debug(checkdoc) { +if ((doc_matters.opt_action_bool["verbose"])) { foreach (k; doc_matters.keys_seq_seg) { foreach (obj; contents[k]) { if (obj.use != "empty") { @@ -741,9 +754,9 @@ debug(checkdoc) { } #+END_SRC -*** output summary +*** [#A] output summary -#+name: ao_output_debugs_summary +#+name: ao_output_debugs_summary_doc #+BEGIN_SRC d 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)", diff --git a/org/ao_read_source_files.org b/org/ao_read_source_files.org index f537e6a..24b95e4 100644 --- a/org/ao_read_source_files.org +++ b/org/ao_read_source_files.org @@ -13,9 +13,8 @@ #+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) [[./sdp.org][sdp]] [[./][org/]] -* 0. Code Skeleton / Outline / Structure (tangles) :tangle: -** 1. config files (conf.sdl & sisu_document_make) :ao_config_files: -*** config files, read in +* 1. get config file :config: +** 0. config files, read in #+BEGIN_SRC d :tangle ../src/sdp/ao_read_config_files.d /++ @@ -30,108 +29,6 @@ template ConfigIn() { } #+END_SRC -*** config files get sdlang root tag - -#+BEGIN_SRC d :tangle ../src/sdp/ao_read_config_files.d -/+ - -+/ -template ConfigSDLang() { - import sdlang; - <> - <> -} -#+END_SRC - -** 2. ao_markup_source_raw.d: :ao_markup_source_raw: - -#+BEGIN_SRC d :tangle ../src/sdp/ao_read_source_files.d -/++ - module ao_read_source_files;
- - open markup files
- - if master file scan for addional files to import/insert -+/ -template SiSUmarkupRaw() { - private import - ao_rgx; - <> - mixin SiSUrgxInit; - auto rgx = Rgx(); - auto rawsrc = MarkupRaw(); - auto SiSUmarkupRaw(Fn)(Fn fn_src) { - auto _0_header_1_body_content_2_insert_filelist_tuple = - rawsrc.sourceContentSplitIntoHeaderAndBody(rawsrc.sourceContent(fn_src), fn_src); - return _0_header_1_body_content_2_insert_filelist_tuple; - } - struct MarkupRaw { - final sourceContent(in string fn_src) { - auto raw = MarkupRawUnit(); - auto source_txt_str = - raw.markupSourceReadIn(fn_src); - return source_txt_str; - } - final auto sourceContentSplitIntoHeaderAndBody(in string source_txt_str, in string fn_src="") { - auto raw = MarkupRawUnit(); - string[] insert_file_list; - auto t = - raw.markupSourceHeaderContentRawLineTupleArray(source_txt_str); - auto header_raw = t[0]; - auto sourcefile_body_content = t[1]; - if (match(fn_src, rgx.src_fn_master)) { // filename with path needed if master file (.ssm) not otherwise - auto ins = Inserts(); - auto tu = - ins.scan_master_src_for_insert_files_and_import_content(sourcefile_body_content, fn_src); - static assert(!isTypeTuple!(tu)); - sourcefile_body_content = tu[0]; - insert_file_list = tu[1].dup; - } - t = tuple( - header_raw, - sourcefile_body_content, - insert_file_list - ); - static assert(t.length==3); - return t; - } - } - struct MarkupRawUnit { - private import std.file; - <> - <> - <> - <> - <> - <> - } - struct Inserts { - private import ao_defaults; // ao_defaults.d - auto scan_subdoc_source( - char[][] markup_sourcefile_insert_content, - string fn_src - ) { - mixin SiSUrgxInitFlags; - <> - foreach (line; markup_sourcefile_insert_content) { - <> - } // end src subdoc (inserts) loop - <> - } - auto scan_master_src_for_insert_files_and_import_content( - char[][] sourcefile_body_content, - string fn_src - ) { - mixin SiSUrgxInitFlags; - <> - foreach (line; sourcefile_body_content) { - <> - } // end src doc loop - <> - } - } -} -#+END_SRC - -* 1. get config file :config: ** read config file, source string (conf.sdl & sisu_document_make) :file:config: #+name: ao_config_file_in @@ -171,6 +68,20 @@ final string ConfigIn(C,E)(C conf_sdl, E env) { } #+END_SRC +** 0. config files get sdlang root tag + +#+BEGIN_SRC d :tangle ../src/sdp/ao_read_config_files.d +/+ + ++/ +template ConfigSDLang() { + import sdlang; + <> + <> +} +#+END_SRC + + ** config file get sdl root tag :file:conf:sdlang: #+name: ao_config_file_sdlang @@ -200,7 +111,6 @@ auto ConfigSDLang(string configuration, string conf_sdl_filename) { #+BEGIN_SRC d :tangle ../src/sdp/ao_read_config_files.d /+ - +/ template ConfigHub() { <> @@ -231,7 +141,6 @@ private import std.conv : to; #+END_SRC - *** config hub import sdlang #+name: ao_config_file_import_mixin #+BEGIN_SRC d @@ -250,6 +159,95 @@ final auto ConfigHub(C,E)(C conf_sdl, E env) { #+END_SRC * 2. get markup source, read file + +** 0. ao_markup_source_raw.d: :ao_markup_source_raw: + +#+BEGIN_SRC d :tangle ../src/sdp/ao_read_source_files.d +/++ + module ao_read_source_files;
+ - open markup files
+ - if master file scan for addional files to import/insert ++/ +template SiSUmarkupRaw() { + private import + ao_rgx; + <> + mixin SiSUrgxInit; + auto rgx = Rgx(); + auto rawsrc = MarkupRaw(); + auto SiSUmarkupRaw(Fn)(Fn fn_src) { + auto _0_header_1_body_content_2_insert_filelist_tuple = + rawsrc.sourceContentSplitIntoHeaderAndBody(rawsrc.sourceContent(fn_src), fn_src); + return _0_header_1_body_content_2_insert_filelist_tuple; + } + struct MarkupRaw { + final sourceContent(in string fn_src) { + auto raw = MarkupRawUnit(); + auto source_txt_str = + raw.markupSourceReadIn(fn_src); + return source_txt_str; + } + final auto sourceContentSplitIntoHeaderAndBody(in string source_txt_str, in string fn_src="") { + auto raw = MarkupRawUnit(); + string[] insert_file_list; + auto t = + raw.markupSourceHeaderContentRawLineTupleArray(source_txt_str); + auto header_raw = t[0]; + auto sourcefile_body_content = t[1]; + if (match(fn_src, rgx.src_fn_master)) { // filename with path needed if master file (.ssm) not otherwise + auto ins = Inserts(); + auto tu = + ins.scan_master_src_for_insert_files_and_import_content(sourcefile_body_content, fn_src); + static assert(!isTypeTuple!(tu)); + sourcefile_body_content = tu[0]; + insert_file_list = tu[1].dup; + } + t = tuple( + header_raw, + sourcefile_body_content, + insert_file_list + ); + static assert(t.length==3); + return t; + } + } + struct MarkupRawUnit { + private import std.file; + <> + <> + <> + <> + <> + <> + } + struct Inserts { + private import ao_defaults; + auto scan_subdoc_source( + char[][] markup_sourcefile_insert_content, + string fn_src + ) { + mixin SiSUrgxInitFlags; + <> + foreach (line; markup_sourcefile_insert_content) { + <> + } // end src subdoc (inserts) loop + <> + } + auto scan_master_src_for_insert_files_and_import_content( + char[][] sourcefile_body_content, + string fn_src + ) { + mixin SiSUrgxInitFlags; + <> + foreach (line; sourcefile_body_content) { + <> + } // end src doc loop + <> + } + } +} +#+END_SRC + ** get markup source, read file :source:markup: *** [#A] read file, source string :string: @@ -558,3 +556,5 @@ auto t = tuple( ); return t; #+END_SRC + +* 3. config files (conf.sdl & sisu_document_make) :ao_config_files: diff --git a/org/compile_time_info.org b/org/compile_time_info.org index 4e7e3da..8aa083d 100644 --- a/org/compile_time_info.org +++ b/org/compile_time_info.org @@ -13,8 +13,14 @@ #+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) [[./sdp.org][sdp]] [[./][org/]] -* Code Skeleton / Outline / Structure (tangles) :tangle: -** compile_time_info: :compile_time_info.d: +* compilation info :compile: +[[../maker.org][maker.org makefile]] +[[./sdp.org][sdp hub]] [[./][org/]] + +e.g. do on linux bsd osx not windows: +version(Windows) {} else { ... } + +** 0. compile_time_info: :compile_time_info.d: #+begin_src d :tangle ../src/sdp/compile_time_info.d /++ @@ -25,17 +31,10 @@ template CompileTimeInfo() { } #+end_src -* compilation info :compile: -[[../maker.org][maker.org makefile]] -[[./sdp.org][sdp hub]] [[./][org/]] - -e.g. do on linux bsd osx not windows: -version(Windows) {} else { ... } - -*** complile time os +** complile time os OS type shows during compilation -**** set os flags +*** set os flags #+name: sdp_compile_time_info #+BEGIN_SRC d @@ -68,10 +67,10 @@ version(Windows) { } #+END_SRC -*** complile time static if os +** complile time static if os OS type compiled in and shows during program run -**** report os flag (set) (not used here) +*** report os flag (set) (not used here) #+BEGIN_SRC d static if(sysWindows) { @@ -93,7 +92,7 @@ static if(sysWindows) { } #+END_SRC -*** 64 bit compilation? +** 64 bit compilation? #+name: sdp_compile_time_info #+BEGIN_SRC d diff --git a/org/output.org b/org/output.org index 9c23caa..c0dfe5b 100644 --- a/org/output.org +++ b/org/output.org @@ -13,8 +13,7 @@ #+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) [[./sdp.org][sdp]] [[./][org/]] -* Code Skeleton / Outline / Structure (tangles) :tangle: -** output hub template file [#A] +* 0. output hub template file [#A] #+BEGIN_SRC d :tangle ../src/sdp/output_hub.d /++ @@ -62,8 +61,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); @@ -98,7 +95,7 @@ template outputHub() { } #+END_SRC -* output functions :output: +* 1. output functions :output: ** output imports #+name: output_imports @@ -188,7 +185,7 @@ void SiSUpod(S)( #+END_SRC ** text [#C] :text: -** xml offspring (xhtml html epub) +** xml offspring (xhtml html epub) :xml: *** format xhtml objects :format: **** xhtml common template :template: @@ -706,9 +703,7 @@ void seg_write_output_files(M,C)( 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); } @@ -716,7 +711,7 @@ void seg_write_output_files(M,C)( } } catch (ErrnoException ex) { - // Handle error + // handle error } } #+END_SRC @@ -770,7 +765,6 @@ void seg(C,M)( 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); @@ -827,7 +821,7 @@ void seg(C,M)( 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); @@ -872,7 +866,6 @@ void seg(C,M)( } } } - writeln(doc_matters.keys_seq_seg); seg_write_output_files(doc_matters, doc_html); } #+END_SRC @@ -2322,12 +2315,9 @@ string epub_oebps_toc(C,M)(C contents, M doc_matters) { foreach_reverse (k; 0 .. 7) { switch (obj.dom_markedup[k]) { case DomTags.close : - writeln(markup.indent_by_spaces_provided(k), ""); toc ~= ""; break; case DomTags.close_and_open : - writeln(markup.indent_by_spaces_provided(k), ""); - writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); ++counter; toc ~= ""; toc ~= format(q"¶ @@ -2341,7 +2331,6 @@ obj.segment_anchor_tag, // lev < 4 [no link]; lev == 4 [filename] markup.xhtml ); break; case DomTags.open : - writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); ++counter; toc ~= format(q"¶ @@ -2390,8 +2379,6 @@ void outputEPub(C,T)( 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) { @@ -2422,7 +2409,6 @@ void outputEPub(C,T)( 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); @@ -2440,7 +2426,6 @@ void outputEPub(C,T)( 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); @@ -2469,23 +2454,18 @@ void outputEPub(C,T)( 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); @@ -2530,7 +2510,6 @@ void outputEPub(C,T)( } } } - writeln(doc_matters.keys_seq_seg); epub_write_output_files( doc_matters, doc_epub, @@ -2563,7 +2542,6 @@ void epub_write_output_files(C,EpD,Mt,Mic,Ot,Oc)( } 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)); @@ -2601,42 +2579,3 @@ void epub_write_output_files(C,EpD,Mt,Mic,Ot,Oc)( ** odt :odt: ** sqlite [#B] :sqlite: ** pgsql :pgsql: -* +other+ -** example head - - - - - - - Democratizing Innovation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org/sdp.org b/org/sdp.org index 5077df9..10511cc 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -13,7 +13,7 @@ #+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) [[../maker.org][maker.org makefile]] [[./][org/]] -* 0. version.txt: set version (sisu document parser) :version: +* 0. version.txt (set version) :version: #+NAME: version_txt #+BEGIN_SRC d :tangle ../views/version.txt @@ -37,7 +37,7 @@ enum ver = Version(0, 12, 1); - proess file - output -** 0. sdp src/sdp.d :sdp: +** 0. sdp src/sdp.d :sdp: #+BEGIN_SRC d :tangle ../src/sdp.d :shebang #!/usr/bin/env rdmd /+ @@ -142,17 +142,11 @@ sdlang.exceptions; #+BEGIN_SRC 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, @@ -196,15 +190,6 @@ mixin outputHub; #+NAME: sdp_args #+BEGIN_SRC d -/+ -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; @@ -246,6 +231,7 @@ look into using getopt bool[string] _opt_action_bool = [ "assertions" : false, "concordance" : false, + "debug" : false, "digest" : false, "docbook" : false, "epub" : false, @@ -280,6 +266,7 @@ auto helpInfo = getopt(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"], @@ -377,7 +364,7 @@ enforce( ); #+END_SRC -*** 0. _document abstraction_ +*** 1. _document abstraction_ #+NAME: sdp_abstraction #+BEGIN_SRC d @@ -389,19 +376,21 @@ auto doc_abstraction = t[0]; auto doc_matters = t[1]; #+END_SRC -*** 1. _output processing_ (post abstraction processing) -**** 0. _debug_ (document parts, checkdoc) :debug:checkdoc: +*** 2. _output processing_ (post abstraction processing) +**** 1. _debug_ (document parts, checkdoc) :debug:checkdoc: - [[./ao_output_debugs.org][ao_output_debugs]] #+NAME: sdp_each_file_do_debugs_checkdoc #+BEGIN_SRC d /+ ↓ debugs +/ -debug(checkdoc) { +if ((doc_matters.opt_action_bool["debug"]) +|| (doc_matters.opt_action_bool["verbose"]) +) { SiSUdebugs!()(doc_abstraction, doc_matters); } #+END_SRC -**** 1. _process outputs_ :outputs: +**** 2. _process outputs_ :outputs: - [[./output.org][output]] #+NAME: sdp_each_file_do_selected_output @@ -423,12 +412,6 @@ scope(exit) { 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); } #+END_SRC @@ -442,7 +425,7 @@ break; // terminate, stop #+END_SRC * 2. _document abstraction_ -** 0. abstraction +** 0. abstraction template #+BEGIN_SRC d :tangle ../src/sdp/abstraction.d template SiSUabstraction() { @@ -552,6 +535,11 @@ struct DocumentMatters { bool[string] _k = opts; return _k; } + auto environment() { + auto _k = env; + return _k; + } + /+ add a list of images +/ } auto doc_matters = DocumentMatters(); #+END_SRC diff --git a/src/sdp.d b/src/sdp.d index fb5728e..2b511e5 100755 --- a/src/sdp.d +++ b/src/sdp.d @@ -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), ""); - break; - case DomTags.close_and_open : - writeln(markup.indent_by_spaces_provided(k), ""); - writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); - break; - case DomTags.open : - writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); - break; - default : - break; + debug(dom) { + enum DomTags { none, open, close, close_and_open, open_still, } + foreach (sect; doc_matters.keys_seq_seg) { + foreach (obj; contents[sect]) { + if (obj.is_a == "heading") { + foreach_reverse (k; 0 .. 7) { + switch (obj.dom_markedup[k]) { + case DomTags.close : + writeln(markup.indent_by_spaces_provided(k), ""); + break; + case DomTags.close_and_open : + writeln(markup.indent_by_spaces_provided(k), ""); + writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); + break; + case DomTags.open : + writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); + break; + default : + break; + } } } } } - } - writeln("--------------------"); - foreach (sect; doc_matters.keys_seq_seg) { - foreach (obj; contents[sect]) { - if (obj.is_a == "heading") { - foreach_reverse (k; 0 .. 7) { - switch (obj.dom_collapsed[k]) { - case DomTags.close : - writeln(markup.indent_by_spaces_provided(k), ""); - break; - case DomTags.close_and_open : - writeln(markup.indent_by_spaces_provided(k), ""); - writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); - break; - case DomTags.open : - writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); - break; - default : - break; + writeln("--------------------"); + foreach (sect; doc_matters.keys_seq_seg) { + foreach (obj; contents[sect]) { + if (obj.is_a == "heading") { + foreach_reverse (k; 0 .. 7) { + switch (obj.dom_collapsed[k]) { + case DomTags.close : + writeln(markup.indent_by_spaces_provided(k), ""); + break; + case DomTags.close_and_open : + writeln(markup.indent_by_spaces_provided(k), ""); + writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); + break; + case DomTags.open : + writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); + break; + default : + break; + } } } } } } - } - debug(section_endnotes) { - key="endnotes"; - out_endnotes(contents, key); - } - debug(section_endnotes_seg) { - key="endnotes"; - out_endnotes(contents, key); - } - debug(section_glossary) { - key="glossary"; - if (contents[key].length > 1) { - foreach (obj; contents[key]) { - writefln( - "[%s][%s]\n%s", - obj.obj_cite_number, - obj.is_a, - obj.text - ); + debug(section_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), ""); toc ~= ""; break; case DomTags.close_and_open : - writeln(markup.indent_by_spaces_provided(k), ""); - writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); ++counter; toc ~= ""; toc ~= format(q"¶ @@ -137,7 +134,6 @@ template outputEPub() { ); break; case DomTags.open : - writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text); ++counter; toc ~= format(q"¶ @@ -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); -- cgit v1.2.3