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 +++++++++++++++++++++-------------------- 1 file changed, 103 insertions(+), 100 deletions(-) (limited to 'org/ao_abstract_doc_source.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 -- cgit v1.2.3