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 +++--- 8 files changed, 528 insertions(+), 588 deletions(-) (limited to 'org') 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 -- cgit v1.2.3