From 4ff01a81f048c0b496cc03627324b69b7aebd368 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 7 Sep 2017 16:54:23 -0400 Subject: 0.19.0 conf make meta, composite struct, instead of associative array * remove conf make meta associative arrays, including native doc header (which revisit) --- org/meta_abstraction.org | 132 ++++++++++++++++++++++------------------------- 1 file changed, 62 insertions(+), 70 deletions(-) (limited to 'org/meta_abstraction.org') diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org index f7291cf..358feb4 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -35,17 +35,14 @@ template SiSUdocAbstraction() { /+ ↓ abstraction struct init +/ <> /+ ↓ abstract marked up document +/ - auto SiSUdocAbstraction(Src,Make,Meta,Opt)( + auto SiSUdocAbstraction(Src,CMM,Opt)( Src markup_sourcefile_content, - Make dochead_make_aa, - Meta dochead_meta_aa, + CMM conf_make_meta, Opt opt_action, ) { static auto rgx = Rgx(); debug(asserts) { static assert(is(typeof(markup_sourcefile_content) == char[][])); - static assert(is(typeof(dochead_make_aa) == string[string][string])); - static assert(is(typeof(dochead_meta_aa) == string[string][string])); static assert(is(typeof(opt_action) == bool[string])); } /+ ↓ abstraction init +/ @@ -870,7 +867,7 @@ if there is a blurb section you need to: #+BEGIN_SRC d } else if (obj_type_status["poem"] == TriState.on) { /+ within block object: poem +/ - _poem_block_(line, an_object, obj_type_status, cntr, obj_cite_number_poem, dochead_make_aa); + _poem_block_(line, an_object, obj_type_status, cntr, obj_cite_number_poem, conf_make_meta); continue; #+END_SRC @@ -880,7 +877,7 @@ if there is a blurb section you need to: #+BEGIN_SRC d } else if (obj_type_status["table"] == TriState.on) { /+ within block object: table +/ - _table_block_(line, an_object, obj_type_status, dochead_make_aa); + _table_block_(line, an_object, obj_type_status, conf_make_meta); continue; #+END_SRC @@ -991,10 +988,10 @@ if (line.matchFirst(rgx.book_index) && ((obj_type_status["para"] == State.off) && (obj_type_status["heading"] == State.off))) { /+ heading or para but neither flag nor line exists +/ - if ((dochead_make_aa["make"]["headings"].length > 2) + if ((conf_make_meta.make.headings.length > 2) && (obj_type_status["make_headings"] == State.off)) { /+ heading found +/ - _heading_found_(line, dochead_make_aa["make"]["headings"], heading_match_str, heading_match_rgx, obj_type_status); + _heading_found_(line, conf_make_meta.make.headings, heading_match_str, heading_match_rgx, obj_type_status); } if ((obj_type_status["make_headings"] == State.on) && ((line_occur["para"] == State.off) @@ -1012,7 +1009,7 @@ if (line.matchFirst(rgx.book_index) +/ if (line.matchFirst(rgx.heading)) { /+ heading match +/ - _heading_matched_(line, line_occur, an_object, an_object_key, lv, collapsed_lev, obj_type_status, dochead_meta_aa); + _heading_matched_(line, line_occur, an_object, an_object_key, lv, collapsed_lev, obj_type_status, conf_make_meta); } else if (line_occur["para"] == State.off) { /+ para match +/ an_object_key="body_nugget"; @@ -1063,7 +1060,7 @@ _block_flag_line_empty_( cntr, obj_type_status, obj_cite_number_poem, - dochead_make_aa + conf_make_meta, ); #+END_SRC @@ -1096,7 +1093,7 @@ if ((obj_type_status["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_and_misc(an_object, an_object_key, dochead_make_aa); + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); an_object["substantive"] = substantive_object_and_anchor_tags_tuple[sObj.content]; anchor_tags = substantive_object_and_anchor_tags_tuple[sObj.anchor_tags]; if (an_object["lev_markup_number"].to!int == 4) { @@ -1138,7 +1135,7 @@ if ((obj_type_status["heading"] == State.on) _anchor_tag=to!string(obj_cite_digits.on); the_table_of_contents_section = obj_im.table_of_contents_gather_headings( an_object, - dochead_make_aa, + conf_make_meta, segment_anchor_tag_that_object_belongs_to, _anchor_tag, lev4_subtoc, @@ -1205,7 +1202,7 @@ if ((obj_type_status["heading"] == State.on) an_object["is"], ); auto substantive_obj_misc_tuple = - obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_para = comp_obj_para.init; @@ -3127,13 +3124,13 @@ why extra object stuff only in poem/verse? #+name: abs_functions_block_poem #+BEGIN_SRC d -void _poem_block_(L,O,T,C,N,Ma)( - L line, - return ref O an_object, - return ref T obj_type_status, - return ref C cntr, - N obj_cite_number_poem, - Ma dochead_make_aa, +void _poem_block_(L,O,T,C,N,CMM)( + L line, + return ref O an_object, + return ref T obj_type_status, + return ref C cntr, + N obj_cite_number_poem, + CMM conf_make_meta, ) { debug(asserts) { static assert(is(typeof(line) == char[])); @@ -3141,7 +3138,6 @@ void _poem_block_(L,O,T,C,N,Ma)( static assert(is(typeof(obj_type_status) == int[string])); static assert(is(typeof(cntr) == int)); static assert(is(typeof(obj_cite_number_poem) == string[string])); - static assert(is(typeof(dochead_make_aa) == string[string][string])); } static auto rgx = Rgx(); if (obj_type_status["curly_poem"] == TriState.on) { @@ -3175,7 +3171,7 @@ void _poem_block_(L,O,T,C,N,Ma)( } an_object["is"] = "verse"; auto substantive_obj_misc_tuple = - obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_block = comp_obj_block.init; @@ -3233,7 +3229,7 @@ void _poem_block_(L,O,T,C,N,Ma)( an_object["is"] ); auto substantive_obj_misc_tuple = - obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_block = comp_obj_block.init; @@ -3276,7 +3272,7 @@ void _poem_block_(L,O,T,C,N,Ma)( processing.remove("verse"); an_object["is"] = "verse"; auto substantive_obj_misc_tuple = - obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_block = comp_obj_block.init; @@ -3334,7 +3330,7 @@ void _poem_block_(L,O,T,C,N,Ma)( an_object["is"] ); auto substantive_obj_misc_tuple = - obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_block = comp_obj_block.init; @@ -3381,11 +3377,11 @@ you need: #+name: abs_functions_block_table #+BEGIN_SRC d -void _table_block_(L,O,T,Ma)( +void _table_block_(L,O,T,CMM)( L line, return ref O an_object, - return ref T obj_type_status, - return ref Ma dochead_make_aa + return ref T obj_type_status, + return ref CMM conf_make_meta, ) { debug(asserts) { static assert(is(typeof(line) == char[])); @@ -3420,7 +3416,7 @@ void _table_block_(L,O,T,Ma)( comp_obj_heading, cntr, obj_type_status, - dochead_make_aa + conf_make_meta, ); } else { debug(table) { @@ -3456,7 +3452,7 @@ process and use an_object["table_head"] (then empty it) #+name: abs_functions_block_line_status_empty #+BEGIN_SRC d -void _table_closed_make_special_notation_table_(N)( +void _table_closed_make_special_notation_table_(N,CMM)( char[] line, return ref string[string] an_object, return ref ObjGenericComposite[] the_document_body_section, @@ -3464,7 +3460,7 @@ void _table_closed_make_special_notation_table_(N)( return ref ObjGenericComposite _comp_obj_heading, return ref int cntr, return ref int[string] obj_type_status, - string[string][string] dochead_make_aa, + CMM conf_make_meta ) { comp_obj_block = comp_obj_block.init; obj_cite_digits = ocn_emit(OCNstatus.on); @@ -3479,7 +3475,7 @@ void _table_closed_make_special_notation_table_(N)( ); an_object["is"] = "table"; auto substantive_obj_misc_tuple = - obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, "body_nugget", dochead_make_aa); + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, "body_nugget", conf_make_meta); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; comp_obj_block.ocn = obj_cite_digits.on; comp_obj_block.obj_cite_number = (obj_cite_digits.on==0) ? "" : obj_cite_digits.on.to!string; @@ -3501,7 +3497,7 @@ void _table_closed_make_special_notation_table_(N)( #+name: abs_functions_block_line_status_empty #+BEGIN_SRC d -void _block_flag_line_empty_(B,N)( +void _block_flag_line_empty_(B,N,CMM)( B bookindex_extract_hash, char[] line, return ref string[string] an_object, @@ -3512,7 +3508,7 @@ void _block_flag_line_empty_(B,N)( return ref int cntr, return ref int[string] obj_type_status, string[string] obj_cite_number_poem, - string[string][string] dochead_make_aa, + CMM conf_make_meta, ) { assert( line.empty, @@ -3551,7 +3547,7 @@ void _block_flag_line_empty_(B,N)( an_object["is"] ); auto substantive_obj_misc_tuple = - obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_block = comp_obj_block.init; @@ -3601,7 +3597,7 @@ void _block_flag_line_empty_(B,N)( an_object["is"] ); auto substantive_obj_misc_tuple = - obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_block = comp_obj_block.init; @@ -3651,7 +3647,7 @@ void _block_flag_line_empty_(B,N)( an_object["is"] ); auto substantive_obj_misc_tuple = - obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; comp_obj_block = comp_obj_block.init; comp_obj_block.of_part = "body"; @@ -3741,7 +3737,7 @@ void _block_flag_line_empty_(B,N)( an_object["is"] ); auto substantive_obj_misc_tuple = - obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_code = comp_obj_code.init; @@ -3792,7 +3788,7 @@ void _block_flag_line_empty_(B,N)( an_object["is"] ); auto substantive_obj_misc_tuple = - obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; comp_obj_block = comp_obj_block.init; comp_obj_block.ocn = obj_cite_digits.on; @@ -4054,15 +4050,15 @@ auto _heading_make_set_(L,C,R,T)( #+name: abs_functions_heading #+BEGIN_SRC d -auto _heading_matched_(L,C,O,K,Lv,Lc,T,Me)( - L line, - return ref C line_occur, - return ref O an_object, - return ref K an_object_key, - return ref Lv lv, - return ref Lc collapsed_lev, - return ref T obj_type_status, - return ref Me dochead_meta_aa, +auto _heading_matched_(L,C,O,K,Lv,Lc,T,CMM)( + L line, + return ref C line_occur, + return ref O an_object, + return ref K an_object_key, + return ref Lv lv, + return ref Lc collapsed_lev, + return ref T obj_type_status, + return ref CMM conf_make_meta, ) { debug(asserts) { static assert(is(typeof(line) == char[])); @@ -4072,7 +4068,6 @@ auto _heading_matched_(L,C,O,K,Lv,Lc,T,Me)( static assert(is(typeof(lv) == int[string])); static assert(is(typeof(collapsed_lev) == int[string])); static assert(is(typeof(obj_type_status) == int[string])); - static assert(is(typeof(dochead_meta_aa) == string[string][string])); } static auto rgx = Rgx(); if (auto m = line.match(rgx.heading)) { @@ -4092,9 +4087,9 @@ auto _heading_matched_(L,C,O,K,Lv,Lc,T,Me)( case "A": // Title set an_object[an_object_key]=(an_object[an_object_key]) .replaceFirst(rgx.variable_doc_title, - (dochead_meta_aa["title"]["full"] ~ ",")) + (conf_make_meta.meta.title_full ~ ",")) .replaceFirst(rgx.variable_doc_author, - dochead_meta_aa["creator"]["author"]); + conf_make_meta.meta.creator_author); collapsed_lev["h0"] = 0; an_object["lev_collapsed_number"] = collapsed_lev["h0"].to!string; @@ -5023,16 +5018,15 @@ static struct ObjInlineMarkup { #+name: meta_emitters_obj_inline_markup_and_anchor_tags_and_misc #+BEGIN_SRC d - auto obj_inline_markup_and_anchor_tags_and_misc(O,K,Ma)( - O obj_, - K obj_key_, - Ma dochead_make_aa + auto obj_inline_markup_and_anchor_tags_and_misc(O,K,CMM)( + O obj_, + K obj_key_, + CMM conf_make_meta, ) in { debug(asserts) { static assert(is(typeof(obj_) == string[string])); static assert(is(typeof(obj_key_) == string)); - static assert(is(typeof(dochead_make_aa) == string[string][string])); } } body { @@ -5049,7 +5043,7 @@ static struct ObjInlineMarkup { switch (obj_["is"]) { case "heading": static __gshared string anchor_tag = ""; - obj_txt["munge"]=_configured_auto_heading_numbering_and_segment_anchor_tags(obj_txt["munge"], obj_, dochead_make_aa); + obj_txt["munge"]=_configured_auto_heading_numbering_and_segment_anchor_tags(obj_txt["munge"], obj_, conf_make_meta); obj_txt["munge"]=_make_segment_anchor_tags_if_none_provided(obj_txt["munge"], obj_["lev"]); if (auto m = obj_txt["munge"].match(rgx.heading_anchor_tag)) { anchor_tag = m.captures[1]; @@ -5125,9 +5119,9 @@ static struct ObjInlineMarkup { ""); return heading_toc_; }; - auto table_of_contents_gather_headings(O,Ma,Ts,Ta,X,Toc)( + auto table_of_contents_gather_headings(O,CMM,Ts,Ta,X,Toc)( O obj_, - Ma dochead_make_aa, + CMM conf_make_meta, Ts segment_anchor_tag_that_object_belongs_to, Ta _anchor_tag, return ref X lev4_subtoc, @@ -5136,7 +5130,6 @@ static struct ObjInlineMarkup { in { debug(asserts) { static assert(is(typeof(obj_) == string[string])); - static assert(is(typeof(dochead_make_aa) == string[string][string])); static assert(is(typeof(segment_anchor_tag_that_object_belongs_to) == string)); static assert(is(typeof(_anchor_tag) == string)); static assert(is(typeof(lev4_subtoc) == string[][string])); @@ -5309,17 +5302,16 @@ private: #+name: meta_emitters_obj_inline_markup_heading_numbering_segment_anchor_tags #+BEGIN_SRC d - static string _configured_auto_heading_numbering_and_segment_anchor_tags(M,O,Ma)( - M munge_, - O obj_, - Ma dochead_make_aa + static string _configured_auto_heading_numbering_and_segment_anchor_tags(M,O,CMM)( + M munge_, + O obj_, + CMM conf_make_meta, ) { debug(asserts) { static assert(is(typeof(munge_) == string)); static assert(is(typeof(obj_) == string[string])); - static assert(is(typeof(dochead_make_aa) == string[string][string])); } - if (dochead_make_aa["make"]["num_top"].length > 0) { + if (conf_make_meta.make.num_top.length > 0) { static __gshared int heading_num_top_level=9; static __gshared int heading_num_depth=2; static __gshared int heading_num_0 = 0; @@ -5328,10 +5320,10 @@ private: static __gshared int heading_num_3 = 0; static __gshared string heading_number_auto_composite = ""; if (heading_num_top_level==9) { - if (dochead_make_aa["make"]["num_depth"].length > 0) { - heading_num_depth = dochead_make_aa["make"]["num_depth"].to!uint; + if (conf_make_meta.make.num_depth.length > 0) { + heading_num_depth = conf_make_meta.make.num_depth.to!uint; } - switch (dochead_make_aa["make"]["num_top"]) { + switch (conf_make_meta.make.num_top) { case "A": break; case "B": -- cgit v1.2.3