diff options
Diffstat (limited to 'src/sdp/meta/metadoc_from_src.d')
-rw-r--r-- | src/sdp/meta/metadoc_from_src.d | 132 |
1 files changed, 62 insertions, 70 deletions
diff --git a/src/sdp/meta/metadoc_from_src.d b/src/sdp/meta/metadoc_from_src.d index 732dbd0..b164a64 100644 --- a/src/sdp/meta/metadoc_from_src.d +++ b/src/sdp/meta/metadoc_from_src.d @@ -236,17 +236,14 @@ template SiSUdocAbstraction() { auto node_construct = NodeStructureMetadata(); enum sObj { content, anchor_tags, notes_reg, notes_star, links } /+ ↓ 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 +/ @@ -629,11 +626,11 @@ template SiSUdocAbstraction() { continue; } 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; } 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; } else { /+ not within a block group +/ @@ -706,10 +703,10 @@ template SiSUdocAbstraction() { && ((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) @@ -727,7 +724,7 @@ template SiSUdocAbstraction() { +/ 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"; @@ -762,7 +759,7 @@ template SiSUdocAbstraction() { cntr, obj_type_status, obj_cite_number_poem, - dochead_make_aa + conf_make_meta, ); } else { /+ line.empty, post contents, empty variables: +/ @@ -784,7 +781,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_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) { @@ -826,7 +823,7 @@ template SiSUdocAbstraction() { _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, @@ -887,7 +884,7 @@ template SiSUdocAbstraction() { 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; @@ -2193,13 +2190,13 @@ template SiSUdocAbstraction() { } } } - 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[])); @@ -2207,7 +2204,6 @@ template SiSUdocAbstraction() { 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) { @@ -2241,7 +2237,7 @@ template SiSUdocAbstraction() { } 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; @@ -2299,7 +2295,7 @@ template SiSUdocAbstraction() { 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; @@ -2342,7 +2338,7 @@ template SiSUdocAbstraction() { 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; @@ -2400,7 +2396,7 @@ template SiSUdocAbstraction() { 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; @@ -2472,11 +2468,11 @@ template SiSUdocAbstraction() { } } } - 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[])); @@ -2511,7 +2507,7 @@ template SiSUdocAbstraction() { comp_obj_heading, cntr, obj_type_status, - dochead_make_aa + conf_make_meta, ); } else { debug(table) { @@ -2679,7 +2675,7 @@ template SiSUdocAbstraction() { header_tag_value=""; } } - 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, @@ -2687,7 +2683,7 @@ template SiSUdocAbstraction() { 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); @@ -2702,7 +2698,7 @@ template SiSUdocAbstraction() { ); 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; @@ -2716,7 +2712,7 @@ template SiSUdocAbstraction() { processing.remove("verse"); ++cntr; } - 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, @@ -2727,7 +2723,7 @@ template SiSUdocAbstraction() { 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, @@ -2760,7 +2756,7 @@ template SiSUdocAbstraction() { 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; @@ -2804,7 +2800,7 @@ template SiSUdocAbstraction() { 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; @@ -2848,7 +2844,7 @@ template SiSUdocAbstraction() { 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"; @@ -2926,7 +2922,7 @@ template SiSUdocAbstraction() { 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; @@ -2971,7 +2967,7 @@ template SiSUdocAbstraction() { 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; @@ -3202,15 +3198,15 @@ template SiSUdocAbstraction() { } return line; } - 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[])); @@ -3220,7 +3216,6 @@ template SiSUdocAbstraction() { 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)) { @@ -3240,9 +3235,9 @@ template SiSUdocAbstraction() { 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; @@ -3979,16 +3974,15 @@ template SiSUdocAbstraction() { static auto rgx = Rgx(); static auto munge = ObjInlineMarkupMunge(); string[string] obj_txt; - 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 { @@ -4005,7 +3999,7 @@ template SiSUdocAbstraction() { 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]; @@ -4075,9 +4069,9 @@ template SiSUdocAbstraction() { ""); 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, @@ -4086,7 +4080,6 @@ template SiSUdocAbstraction() { 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])); @@ -4247,17 +4240,16 @@ template SiSUdocAbstraction() { invariant() { } private: - 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; @@ -4266,10 +4258,10 @@ template SiSUdocAbstraction() { 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": |