diff options
author | Ralph Amissah <ralph@amissah.com> | 2017-01-29 16:54:15 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:14 -0400 |
commit | 4f20bd5582bc9ed864f0e43f030a4e76259cf6f0 (patch) | |
tree | bbbc5ba31d4154d154405c8be2de14b24b1b60e2 /src/sdp/ao_abstract_doc_source.d | |
parent | 0.12.1 abstraction template (diff) |
org file reorganise
Diffstat (limited to 'src/sdp/ao_abstract_doc_source.d')
-rw-r--r-- | src/sdp/ao_abstract_doc_source.d | 134 |
1 files changed, 56 insertions, 78 deletions
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); |