diff options
author | Ralph Amissah <ralph@amissah.com> | 2016-10-17 21:07:55 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:13 -0400 |
commit | f163bae9496feff1ef5bc299ca54ffcc497b12f7 (patch) | |
tree | 3d16bfd247da04ce3c535c3a58470e5a191120d4 /org | |
parent | 0.7.2 removed screen ansi colors (use previously depreciated) (diff) |
0.7.3 provide associated segment name for endnotes section and book index
Diffstat (limited to 'org')
-rw-r--r-- | org/ao_abstract_doc_source.org | 274 | ||||
-rw-r--r-- | org/ao_output_debugs.org | 2 | ||||
-rw-r--r-- | org/sdp.org | 2 |
3 files changed, 155 insertions, 123 deletions
diff --git a/org/ao_abstract_doc_source.org b/org/ao_abstract_doc_source.org index 8b564d3..7255cc7 100644 --- a/org/ao_abstract_doc_source.org +++ b/org/ao_abstract_doc_source.org @@ -19,6 +19,7 @@ Process markup document, create document abstraction. ** _1. pre loop processing_ :pre: *** imports :imports: + [[./ao_defaults.org][ao_defaults]] #+name: abs_imports @@ -46,6 +47,7 @@ auto rgx = Rgx(); ObjComposite[] contents_the_objects; string[string] an_object, processing; string[] anchor_tags; +string segment_object_belongs_to; auto set_abstract_object = ObjectAbstractSet(); auto note_section = NotesSection(); /+ enum +/ @@ -94,40 +96,8 @@ string[][string][string] bkidx_hash(string bookindex_section, int obj_cite_numbe return bookindex_extract_hash.bookindex_nugget_hash(bookindex_section, obj_cite_number); } /+ node +/ -string node; +string _node; auto node_construct = NodeStructureMetadata(); -string node_jstr( - string lev_markup_number, - int obj_cite_number_, - long counter, - int heading_pointer, - string is_ -) { - return node_construct.node_emitter( - lev_markup_number, - obj_cite_number_, - counter, - heading_pointer, - is_ - ); -} -string node_jstr_heading( - string lev_markup_number, - string lev_collapsed_number, - int obj_cite_number_, - long counter, - int heading_pointer, - string is_ -) { - return node_construct.node_emitter_heading( - lev_markup_number, - lev_collapsed_number, - obj_cite_number_, - counter, - heading_pointer, - is_ - ); -} #+END_SRC *** scope @@ -512,7 +482,7 @@ if (matchFirst(line, rgx.block_open)) { #+BEGIN_SRC d } else if (type["blocks"] == TriState.closing) { /+ line empty, with blocks flag +/ - _block_flag_line_empty_(line, an_object, contents_the_objects, bookindex_unordered_hashes, obj_cite_number, node, counter, type, obj_cite_number_poem, dochead_make_aa); // watch + _block_flag_line_empty_(line, an_object, contents_the_objects, bookindex_unordered_hashes, obj_cite_number, _node, counter, type, obj_cite_number_poem, dochead_make_aa); // watch #+END_SRC ****** line empty [+1] @@ -551,22 +521,32 @@ if ((type["heading"] == State.on) bookindex_unordered_hashes = bkidx_hash(an_object["bookindex"], obj_cite_number); an_object["is"] = "heading"; - node = - node_jstr_heading( + auto substantive_object_and_anchor_tags_tuple = + obj_im.obj_inline_markup_and_anchor_tags(an_object, dochead_make_aa); // tuple this with anchor tags? + 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) { + segment_object_belongs_to = anchor_tags[0]; + } else if (to!int(an_object["lev_markup_number"]) < 4) { + segment_object_belongs_to = ""; + } + _node = + node_construct.node_emitter_heading( an_object["lev_markup_number"], an_object["lev_collapsed_number"], + segment_object_belongs_to, obj_cite_number, counter, heading_pointer, an_object["is"] ); // heading - auto substantive_object_and_anchor_tags_tuple = - obj_im.obj_inline_markup_and_anchor_tags(an_object, dochead_make_aa); // tuple this with anchor tags? - an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; - anchor_tags = substantive_object_and_anchor_tags_tuple[1]; an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object["obj"], node); + obj_att.obj_attributes(an_object["is"], an_object["obj"], _node); ++heading_pointer; + debug(segments) { + writeln(an_object["lev_markup_number"]); + writeln(segment_object_belongs_to); + } contents_the_objects ~= set_abstract_object.contents_heading( an_object["substantive"], @@ -604,9 +584,10 @@ if ((type["heading"] == State.on) bookindex_unordered_hashes = bkidx_hash(an_object["bookindex"], obj_cite_number); an_object["is"] = "para"; - node = - node_jstr( + _node = + node_construct.node_emitter( content_non_header, + segment_object_belongs_to, obj_cite_number, counter, heading_pointer-1, @@ -617,7 +598,7 @@ if ((type["heading"] == State.on) an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object["obj"], node); + obj_att.obj_attributes(an_object["is"], an_object["obj"], _node); contents_the_objects ~= set_abstract_object.contents_para( an_object["is"], @@ -669,16 +650,12 @@ if (contents_the_objects.length > 0) { && (counter-1 > previous_count)) { if (match(contents_the_objects[$-1].object, rgx.inline_notes_delimiter_al_regular_number_note)) { - // endnotes/ footnotes for - // doc objects other than paragraphs & headings - // various forms of grouped text previous_count=contents_the_objects.length -1; note_section.gather_notes_for_endnote_section( contents_the_objects, + segment_object_belongs_to, contents_the_objects.length -1 ); - // notes[notepoint]=note_section.notes_section(contents_the_objects, counter-1); - // notepoint +=1; } } } @@ -691,10 +668,6 @@ if (contents_the_objects.length > 0) { #+BEGIN_SRC d debug(objectrelated2) { // check writeln(line); - // writeln(__FILE__, ":", __LINE__); - // writeln(counter); - // // contents_am[0..counter] - // writeln(contents_am.length); } /+ Backmatter: @@ -745,7 +718,7 @@ auto biblio_ordered = #+BEGIN_SRC d auto bi = BookIndexReportSection(); auto bi_tuple = - bi.bookindex_build_section(bookindex_unordered_hashes, obj_cite_number); + bi.bookindex_build_section(bookindex_unordered_hashes, obj_cite_number, segment_object_belongs_to); static assert(!isTypeTuple!(bi_tuple)); auto bookindex_section = bi_tuple[0]; obj_cite_number = bi_tuple[1]; @@ -799,6 +772,7 @@ return t; #+END_SRC * Functions :abstract:function: + functions used in document abstraction ** set & resets :reset: @@ -1308,6 +1282,7 @@ void _biblio_block_( #+END_SRC **** TODO poem block, verse objects :poem:verse: + why extra object stuff only in poem/verse? #+name: abs_functions_block_poem @@ -1355,7 +1330,7 @@ void _poem_block_( an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object["obj"], node); + obj_att.obj_attributes(an_object["is"], an_object["obj"], _node); contents_the_objects ~= set_abstract_object.contents_block( an_object["is"], @@ -1394,8 +1369,9 @@ void _poem_block_( } processing.remove("verse"); an_object["is"] = "verse"; - node = node_jstr( + _node = node_construct.node_emitter( content_non_header, + segment_object_belongs_to, obj_cite_number, counter, heading_pointer-1, @@ -1406,7 +1382,7 @@ void _poem_block_( an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object["obj"], node); + obj_att.obj_attributes(an_object["is"], an_object["obj"], _node); contents_the_objects ~= set_abstract_object.contents_block( an_object["is"], @@ -1443,7 +1419,7 @@ void _poem_block_( an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object["obj"], node); + obj_att.obj_attributes(an_object["is"], an_object["obj"], _node); contents_the_objects ~= set_abstract_object.contents_block( an_object["is"], @@ -1481,9 +1457,10 @@ void _poem_block_( } processing.remove("verse"); an_object["is"] = "verse"; - node = - node_jstr( + _node = + node_construct.node_emitter( content_non_header, + segment_object_belongs_to, obj_cite_number, counter, heading_pointer-1, @@ -1494,7 +1471,7 @@ void _poem_block_( an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object["obj"], node); + obj_att.obj_attributes(an_object["is"], an_object["obj"], _node); contents_the_objects ~= set_abstract_object.contents_block( an_object["is"], @@ -1685,7 +1662,7 @@ void _block_flag_line_empty_( ref ObjComposite[] contents_the_objects, ref string[][string][string] bookindex_unordered_hashes, ref int obj_cite_number, - ref string node, + ref string _node, ref long counter, ref int[string] type, string[string] obj_cite_number_poem, @@ -1709,9 +1686,10 @@ void _block_flag_line_empty_( bookindex_unordered_hashes = bkidx_hash(an_object["bookindex"], obj_cite_number); an_object["is"] = "code"; - node = - node_jstr( + _node = + node_construct.node_emitter( content_non_header, + segment_object_belongs_to, obj_cite_number, counter, heading_pointer-1, @@ -1722,7 +1700,7 @@ void _block_flag_line_empty_( an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object["obj"], node); + obj_att.obj_attributes(an_object["is"], an_object["obj"], _node); contents_the_objects ~= set_abstract_object.contents_block_code( an_object["is"], @@ -1742,9 +1720,10 @@ void _block_flag_line_empty_( bkidx_hash(an_object["bookindex"], obj_cite_number); // obj_cite_number = obj_cite_number_emit(type["obj_cite_number_status"]); an_object["is"] = "verse"; // check also - node = - node_jstr( + _node = + node_construct.node_emitter( content_non_header, + segment_object_belongs_to, obj_cite_number, counter, heading_pointer-1, @@ -1756,7 +1735,7 @@ void _block_flag_line_empty_( "poem", "", (obj_cite_number_poem["start"], obj_cite_number_poem["end"]), - node + _node ); // bookindex object_reset(an_object); processing.remove("verse"); @@ -1771,9 +1750,10 @@ void _block_flag_line_empty_( bookindex_unordered_hashes = bkidx_hash(an_object["bookindex"], obj_cite_number); an_object["is"] = "table"; - node = - node_jstr( + _node = + node_construct.node_emitter( content_non_header, + segment_object_belongs_to, obj_cite_number, counter, heading_pointer-1, @@ -1784,7 +1764,7 @@ void _block_flag_line_empty_( an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object["obj"], node); + obj_att.obj_attributes(an_object["is"], an_object["obj"], _node); contents_the_objects ~= set_abstract_object.contents_block( an_object["is"], @@ -1805,9 +1785,10 @@ void _block_flag_line_empty_( bookindex_unordered_hashes = bkidx_hash(an_object["bookindex"], obj_cite_number); an_object["is"] = "group"; - node = - node_jstr( + _node = + node_construct.node_emitter( content_non_header, + segment_object_belongs_to, obj_cite_number, counter, heading_pointer-1, @@ -1818,7 +1799,7 @@ void _block_flag_line_empty_( an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object["obj"], node); + obj_att.obj_attributes(an_object["is"], an_object["obj"], _node); contents_the_objects ~= set_abstract_object.contents_block( an_object["is"], @@ -1838,9 +1819,10 @@ void _block_flag_line_empty_( bookindex_unordered_hashes = bkidx_hash(an_object["bookindex"], obj_cite_number); an_object["is"] = "block"; - node = - node_jstr( + _node = + node_construct.node_emitter( content_non_header, + segment_object_belongs_to, obj_cite_number, counter, heading_pointer-1, @@ -1851,7 +1833,7 @@ void _block_flag_line_empty_( an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object["obj"], node); + obj_att.obj_attributes(an_object["is"], an_object["obj"], _node); contents_the_objects ~= set_abstract_object.contents_block( an_object["is"], @@ -1872,9 +1854,10 @@ void _block_flag_line_empty_( bookindex_unordered_hashes = bkidx_hash(an_object["bookindex"], obj_cite_number); an_object["is"] = "quote"; - node = - node_jstr( + _node = + node_construct.node_emitter( content_non_header, + segment_object_belongs_to, obj_cite_number, counter, heading_pointer-1, @@ -1885,7 +1868,7 @@ void _block_flag_line_empty_( an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object["obj"], node); + obj_att.obj_attributes(an_object["is"], an_object["obj"], _node); contents_the_objects ~= set_abstract_object.contents_block( an_object["is"], @@ -2608,6 +2591,7 @@ struct ObjInlineMarkup { #+END_SRC ***** private: + #+name: ao_emitters_obj_inline_markup_private #+BEGIN_SRC d private: @@ -2824,6 +2808,7 @@ private: **** object attrib :attributes: ***** attributes structure open, public + #+name: ao_emitters_obj_attributes #+BEGIN_SRC d struct ObjAttributes { @@ -2831,15 +2816,16 @@ struct ObjAttributes { #+END_SRC ***** attributes structure open, public + #+name: ao_emitters_obj_attributes_public #+BEGIN_SRC d - string obj_attributes(string obj_is_, string obj_raw, string node) + string obj_attributes(string obj_is_, string obj_raw, string _node) in { } body { scope(exit) { - // destroy(obj_is_); + destroy(obj_is_); destroy(obj_raw); - destroy(node); + destroy(_node); } _obj_attrib.remove("json"); _obj_attrib["json"] ="{"; @@ -2879,12 +2865,12 @@ struct ObjAttributes { break; } _obj_attrib["json"] ~=" }"; - _obj_attrib["json"]=_set_additional_values_parse_as_json(_obj_attrib["json"], obj_is_, node); + _obj_attrib["json"]=_set_additional_values_parse_as_json(_obj_attrib["json"], obj_is_, _node); debug(structattrib) { if (oa_j["is"].str() == "heading") { // writeln(__LINE__); writeln(_obj_attrib["json"]); - // writeln(node); + // writeln(_node); writeln( "is: ", oa_j["is"].str(), "; obj_cite_number: ", oa_j["obj_cite_number"].integer() @@ -2898,6 +2884,7 @@ struct ObjAttributes { #+END_SRC ***** private + #+name: ao_emitters_obj_attributes_private #+BEGIN_SRC d private: @@ -2906,6 +2893,7 @@ struct ObjAttributes { ****** attrubutes ******* para and block + #+name: ao_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d string _para_and_blocks(string obj_txt_in) @@ -2938,6 +2926,7 @@ struct ObjAttributes { #+END_SRC ******* para + #+name: ao_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d string _para(string obj_txt_in) @@ -2953,6 +2942,7 @@ struct ObjAttributes { #+END_SRC ******* heading + #+name: ao_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d string _heading(string obj_txt_in) @@ -2968,6 +2958,7 @@ struct ObjAttributes { #+END_SRC ******* code + #+name: ao_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d string _code(string obj_txt_in) @@ -2983,6 +2974,7 @@ struct ObjAttributes { #+END_SRC ******* group + #+name: ao_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d string _group(string obj_txt_in) @@ -2998,6 +2990,7 @@ struct ObjAttributes { #+END_SRC ******* block + #+name: ao_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d string _block(string obj_txt_in) @@ -3013,6 +3006,7 @@ struct ObjAttributes { #+END_SRC ******* verse + #+name: ao_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d string _verse(string obj_txt_in) @@ -3028,6 +3022,7 @@ struct ObjAttributes { #+END_SRC ******* quote + #+name: ao_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d string _quote(string obj_txt_in) @@ -3043,6 +3038,7 @@ struct ObjAttributes { #+END_SRC ******* table + #+name: ao_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d string _table(string obj_txt_in) @@ -3058,6 +3054,7 @@ struct ObjAttributes { #+END_SRC ******* comment + #+name: ao_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d string _comment(string obj_txt_in) @@ -3076,9 +3073,9 @@ struct ObjAttributes { #+name: ao_emitters_obj_attributes_private_json #+BEGIN_SRC d - string _set_additional_values_parse_as_json(string _obj_attrib, string obj_is_, string node) { + string _set_additional_values_parse_as_json(string _obj_attrib, string obj_is_, string _node) { JSONValue oa_j = parseJSON(_obj_attrib); - JSONValue node_j = parseJSON(node); + JSONValue node_j = parseJSON(_node); assert( (oa_j.type == JSON_TYPE.OBJECT) && (node_j.type == JSON_TYPE.OBJECT) @@ -3100,6 +3097,7 @@ struct ObjAttributes { #+END_SRC ***** close + #+name: ao_emitters_obj_attributes_private_close #+BEGIN_SRC d } @@ -3216,8 +3214,8 @@ struct BookIndexReportIndent { #+END_SRC **** book index (sort &) report section :report:section: - ***** book index struct open + #+name: ao_emitters_book_index_report_section #+BEGIN_SRC d struct BookIndexReportSection { @@ -3226,6 +3224,7 @@ struct BookIndexReportSection { #+END_SRC ***** bookindex write section + #+name: ao_emitters_book_index_report_section #+BEGIN_SRC d auto bookindex_write_section( @@ -3257,11 +3256,13 @@ struct BookIndexReportSection { #+END_SRC ***** book index (sort &) build section :report:section: + #+name: ao_emitters_book_index_report_section #+BEGIN_SRC d auto bookindex_build_section( string[][string][string] bookindex_unordered_hashes, - int obj_cite_number + int obj_cite_number, + string segment_object_belongs_to, ) { string type; string lev, lev_markup_number, lev_collapsed_number; @@ -3312,7 +3313,9 @@ struct BookIndexReportSection { // bi_tmp = "_0_1 !{" ~ mainkey ~ "}! "; foreach (ref_; bookindex_unordered_hashes[mainkey]["_a"]) { auto go = replaceAll(ref_, rgx.book_index_go, "$1"); - bi_tmp ~= " {" ~ ref_ ~ "}#" ~ go ~ ", "; + bi_tmp ~= (segment_object_belongs_to.empty) + ? (" {" ~ ref_ ~ "}#" ~ go ~ ", ") + : (" {" ~ ref_ ~ "}[../" ~ segment_object_belongs_to ~ ".fn_suffix]#" ~ go ~ ", "); } bi_tmp ~= " \\\\\n "; bookindex_unordered_hashes[mainkey].remove("_a"); @@ -3322,7 +3325,9 @@ struct BookIndexReportSection { bi_tmp ~= subkey ~ ", "; foreach (ref_; bookindex_unordered_hashes[mainkey][subkey]) { auto go = replaceAll(ref_, rgx.book_index_go, "$1"); - bi_tmp ~= " {" ~ ref_ ~ "}#" ~ go ~ ", "; + bi_tmp ~= (segment_object_belongs_to.empty) + ? (" {" ~ ref_ ~ "}#" ~ go ~ ", ") + : (" {" ~ ref_ ~ "}[../" ~ segment_object_belongs_to ~ ".fn_suffix]#" ~ go ~ ", "); } bi_tmp ~= " \\\\\n "; ++skn; @@ -3358,6 +3363,7 @@ struct BookIndexReportSection { #+END_SRC ***** book index struct close + #+name: ao_emitters_book_index_report_section #+BEGIN_SRC d } @@ -3375,10 +3381,12 @@ struct NotesSection { #+END_SRC **** gather notes for endnote section struct open + #+name: ao_emitters_endnotes #+BEGIN_SRC d private auto gather_notes_for_endnote_section( ObjComposite[] contents_am, + string segment_object_belongs_to, ulong counter ) in { @@ -3400,19 +3408,22 @@ struct NotesSection { rgx.inline_notes_delimiter_al_regular_number_note)) { debug(endnotes_build) { writeln( - "{^{", m.captures[1], ".}^}#noteref_", m.captures[1], " ", + "{^{", m.captures[1], ".}^}[../", segment_object_belongs_to, ".fn_suffix]#noteref_\n ", m.captures[1], " ", m.captures[2]); // sometimes need segment name (segmented html & epub) // writeln("{^{", m.captures[1], ".}^}#", contents_am[counter]["obj_cite_number"], " ", m.captures[2]); } - object_notes ~= - "{^{" ~ m.captures[1] ~ ".}^}#noteref_" ~ - m.captures[1] ~ " " ~ m.captures[2] ~ "』"; + object_notes ~= (segment_object_belongs_to.empty) + ? ("{^{" ~ m.captures[1] ~ ".}^}#noteref_" ~ + m.captures[1] ~ " " ~ m.captures[2] ~ "』") + : ("{^{" ~ m.captures[1] ~ ".}^}[../" ~ segment_object_belongs_to ~ ".fn_suffix]#noteref_" ~ + m.captures[1] ~ " " ~ m.captures[2] ~ "』"); } return object_notes; } #+END_SRC **** gathered notes + #+name: ao_emitters_endnotes #+BEGIN_SRC d private auto gathered_notes() @@ -3428,6 +3439,7 @@ struct NotesSection { #+END_SRC **** endnote objects + #+name: ao_emitters_endnotes #+BEGIN_SRC d private auto endnote_objects(int obj_cite_number) @@ -3497,20 +3509,22 @@ struct NotesSection { #+END_SRC **** gather notes for endnote section struct close + #+name: ao_emitters_endnotes #+BEGIN_SRC d } #+END_SRC *** bibliography :bibliography: - **** biblio struct open + #+name: ao_emitters_bibliography #+BEGIN_SRC d struct Bibliography { #+END_SRC **** biblio + #+name: ao_emitters_bibliography #+BEGIN_SRC d public JSONValue[] _bibliography_( @@ -3542,6 +3556,7 @@ struct Bibliography { #+END_SRC **** biblio unsorted complete + #+name: ao_emitters_bibliography #+BEGIN_SRC d final private JSONValue[] _biblio_unsorted_complete_( @@ -3576,6 +3591,7 @@ struct Bibliography { #+END_SRC **** biblio sort + #+name: ao_emitters_bibliography #+BEGIN_SRC d final private JSONValue[] biblio_sort(JSONValue[] biblio_unordered) { @@ -3597,6 +3613,7 @@ struct Bibliography { #+END_SRC **** biblio debug + #+name: ao_emitters_bibliography #+BEGIN_SRC d void biblio_debug(JSONValue[] biblio_sorted) { @@ -3611,6 +3628,7 @@ struct Bibliography { #+END_SRC **** biblio struct close + #+name: ao_emitters_bibliography #+BEGIN_SRC d } @@ -3625,14 +3643,16 @@ struct NodeStructureMetadata { int lv, lv0, lv1, lv2, lv3, lv4, lv5, lv6, lv7; int obj_cite_number; int[string] p_; // p_ parent_ - string node; + string _node; #+END_SRC -**** metadata node emitter +**** TODO metadata node emitter + #+name: ao_emitters_metadata #+BEGIN_SRC d string node_emitter( string lev_markup_number, + string segment_anchor_tag, int obj_cite_number_, long counter_, int pointer_, @@ -3647,7 +3667,7 @@ struct NodeStructureMetadata { // scope(failure) { // writeln(__FILE__, ":", __LINE__, " failed here:"); // writeln(" is : ", is_); - // writeln(" node: ", node); + // writeln(" node: ", _node); // } assert(is_ != "heading"); // should not be necessary assert(to!int(obj_cite_number_) >= 0); // should not be necessary @@ -3665,39 +3685,41 @@ struct NodeStructureMetadata { p_["lev_markup_number"] = DocStructMarkupHeading.h_text_1; p_["obj_cite_number"] = lv4; } - node=("{ " ~ + _node=("{ " ~ "\"is\": \"" ~ is_ ~ "\"" ~ ", \"heading_pointer\": " ~ to!string(pointer_) ~ ", \"doc_object_pointer\": " ~ to!string(counter_) ~ ", \"obj_cite_number\": " ~ to!string(obj_cite_number_) ~ + ", \"segment_anchor_tag\": \"" ~ segment_anchor_tag ~ "\"" ~ ", \"parent_obj_cite_number\": " ~ to!string(p_["obj_cite_number"]) ~ ", \"parent_lev_markup_number\": " ~ to!string(p_["lev_markup_number"]) ~ " }" ); debug(node) { if (match(lev_markup_number, rgx.levels_numbered_headings)) { - writeln("* ", to!string(node)); + writeln("* ", to!string(_node)); } else { - writeln("* ", to!string(node)); + writeln("* ", to!string(_node)); } } - JSONValue j = parseJSON(node); + JSONValue j = parseJSON(_node); assert(j["parent_lev_markup_number"].integer >= 4); assert(j["parent_lev_markup_number"].integer <= 7); assert(j["parent_obj_cite_number"].integer >= 0); - return node; + return _node; } invariant() { } #+END_SRC -**** metadata emitter heading +**** TODO metadata emitter heading #+name: ao_emitters_metadata #+BEGIN_SRC d string node_emitter_heading( string lev_markup_number, string lev_collapsed_number, + string segment_anchor_tag, int obj_cite_number_, long counter_, int pointer_, @@ -3723,7 +3745,7 @@ struct NodeStructureMetadata { // scope(failure) { // writeln(__FILE__, ":", __LINE__, " failed here:"); // writeln(" is : ", is_); - // writeln(" node: ", node); + // writeln(" node: ", _node); // } auto rgx = Rgx(); int obj_cite_number = to!int(obj_cite_number_); @@ -3816,30 +3838,31 @@ struct NodeStructureMetadata { // } break; } - node=("{ " ~ + _node=("{ " ~ "\"is\": \"" ~ is_ ~ "\"" ~ ", \"heading_pointer\": " ~ to!string(pointer_) ~ ", \"doc_object_pointer\": " ~ to!string(counter_) ~ ", \"obj_cite_number\": " ~ to!string(obj_cite_number_) ~ ", \"lev_markup_number\": " ~ to!string(lev_markup_number) ~ ", \"lev_collapsed_number\": " ~ to!string(lev_collapsed_number) ~ + ", \"segment_anchor_tag\": \"" ~ segment_anchor_tag ~ "\"" ~ ", \"parent_obj_cite_number\": " ~ to!string(p_["obj_cite_number"]) ~ ", \"parent_lev_markup_number\": " ~ to!string(p_["lev_markup_number"]) ~ " }" ); debug(heading) { if (match(lev_markup_number, rgx.levels_numbered_headings)) { - writeln("* ", to!string(node)); + writeln("* ", to!string(_node)); } } debug(node) { if (match(lev_markup_number, rgx.levels_numbered_headings)) { - writeln("* ", to!string(node)); + writeln("* ", to!string(_node)); } else { - writeln("* ", to!string(node)); + writeln("* ", to!string(_node)); } } - JSONValue j = parseJSON(node); + JSONValue j = parseJSON(_node); assert(j["parent_lev_markup_number"].integer <= 7); assert(j["parent_obj_cite_number"].integer >= 0); if (match(lev_markup_number, rgx.levels_numbered_headings)) { @@ -3873,13 +3896,14 @@ struct NodeStructureMetadata { // assert(j["parent_lev_markup_number"].integer <= 7); } } - return node; + return _node; } invariant() { } #+END_SRC **** metadata node struct close + #+name: ao_emitters_metadata #+BEGIN_SRC d } @@ -4093,11 +4117,12 @@ auto assertions_flag_types_block_status_none_or_closed(int[string] type) { #+END_SRC * Object Setter :abstract:object: + set abstracted objects for downstream processing ** initialize structs :struct: - *** heading attribute + #+name: ao_structs_init #+BEGIN_SRC d struct HeadingAttrib { @@ -4108,6 +4133,7 @@ struct HeadingAttrib { #+END_SRC *** paragraph attribute + #+name: ao_structs_init #+BEGIN_SRC d struct ParaAttrib { @@ -4118,6 +4144,7 @@ struct ParaAttrib { #+END_SRC *** block attribute + #+name: ao_structs_init #+BEGIN_SRC d struct BlockAttrib { @@ -4126,6 +4153,7 @@ struct BlockAttrib { #+END_SRC *** comment attribute + #+name: ao_structs_init #+BEGIN_SRC d struct Comment { @@ -4133,7 +4161,8 @@ struct Comment { } #+END_SRC -*** node +*** TODO node + #+name: ao_structs_init #+BEGIN_SRC d struct Node { @@ -4144,7 +4173,8 @@ struct Node { } #+END_SRC -*** composite object +*** TODO composite object + #+name: ao_structs_init #+BEGIN_SRC d struct ObjComposite { @@ -4163,6 +4193,7 @@ struct ObjComposite { #+END_SRC *** object composite array + #+name: ao_structs_init #+BEGIN_SRC d struct ObjCompositeArr { @@ -4208,7 +4239,7 @@ auto contents_heading( object_set.heading_attrib.lev = lev; object_set.heading_attrib.lev_markup_number = lev_markup_number; object_set.heading_attrib.lev_collapsed_number = lev_collapsed_number; - // object_set.node_structure.node = node; + // object_set.node_structure.node = _node; return object_set; } #+END_SRC @@ -4234,7 +4265,7 @@ auto contents_para( object_set.para_attrib.indent_start = 0; // indent["hang_position"]; object_set.para_attrib.indent_rest = 0; // indent["base_position"]; object_set.para_attrib.bullet = false; - // object_set.node_structure.node = node; + // object_set.node_structure.node = _node; return object_set; } #+END_SRC @@ -4278,7 +4309,7 @@ auto contents_block( object_set.is_a = type; object_set.object = object; object_set.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); - // object_set.node_structure.node = node; + // object_set.node_structure.node = _node; return object_set; } #+END_SRC @@ -4300,7 +4331,7 @@ auto contents_block_code( object_set.block_attrib.syntax = attrib_language_syntax; object_set.object = object; object_set.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); - // object_set.node_structure.node = node; + // object_set.node_structure.node = _node; return object_set; } #+END_SRC @@ -4313,7 +4344,7 @@ auto contents_block_obj_cite_number_string( in string type, in string object, in string obj_cite_number, - in string node + in string _node ) { ObjComposite object_set; object_set.use = "content"; @@ -4321,7 +4352,7 @@ auto contents_block_obj_cite_number_string( object_set.is_a = type; object_set.object = object; object_set.obj_cite_number = obj_cite_number; - object_set.node_structure.node = node; + object_set.node_structure.node = _node; return object_set; } #+END_SRC @@ -4442,6 +4473,7 @@ template ObjectSetter() { #+END_SRC * TODO work on + - bespoke struct for sisu objects to replace JSON strings - book index *sort* fix (Aa-Zz instead of A-Za-z) - determine what goes in node info diff --git a/org/ao_output_debugs.org b/org/ao_output_debugs.org index 85e349c..3322373 100644 --- a/org/ao_output_debugs.org +++ b/org/ao_output_debugs.org @@ -618,7 +618,6 @@ debug(checkdoc) { output debugs +/ template SiSUoutputDebugs() { - <<book_index_sorted_report>> struct SDPoutputDebugs { auto abstract_doc_source_debugs(S)( auto ref const S contents, @@ -631,6 +630,7 @@ template SiSUoutputDebugs() { ) { mixin RgxInit; auto rgx = Rgx(); + <<book_index_sorted_report>> <<ao_output_debugs>> <<ao_output_debugs_summary>> } diff --git a/org/sdp.org b/org/sdp.org index 75cffea..97d1498 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -24,7 +24,7 @@ struct Version { int minor; int patch; } -enum ver = Version(0, 7, 2); +enum ver = Version(0, 7, 3); #+END_SRC * sdp.d sisu document parser :sdp.d: |