diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2019-06-10 11:54:45 -0400 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2019-10-17 19:07:20 -0400 |
commit | 2995a5e6c7f445b3f1fcec2b7ccdad56ed82d382 (patch) | |
tree | 82ada0a1a0d00cb947a0bcf504a8e43817770cc4 | |
parent | remove ./data for now, else relatively minor (diff) |
meta_abstraction, ultimately cosmeticdoc-reform_v0.7.0
-rw-r--r-- | org/meta_abstraction.org | 163 | ||||
-rw-r--r-- | src/doc_reform/meta/metadoc_from_src.d | 163 |
2 files changed, 78 insertions, 248 deletions
diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org index 7059b03..7c5fa5b 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -5492,10 +5492,10 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - private auto object_notes_and_links_()(string obj_txt_in, bool reset_note_numbers=false) - in { - } - body { + private auto object_notes_and_links_()( + string obj_txt_in, + bool reset_note_numbers=false + ) { obj_txt_out = ""; bool urls = false; bool images_without_dimensions = false; @@ -5549,9 +5549,7 @@ static struct ObjInlineMarkupMunge { ); return t; } - auto init() - in { } - body { + auto init() { auto t = object_notes_and_links_(""); return t; } @@ -5565,10 +5563,10 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - auto munge_heading()(string obj_txt_in, bool reset_note_numbers=false) - in { - } - body { + auto munge_heading()( + string obj_txt_in, + bool reset_note_numbers=false + ) { obj_txt["munge"] = obj_txt_in .replaceFirst(rgx.heading, "") .replaceFirst(rgx.object_number_off_all, "") @@ -5596,10 +5594,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - auto munge_para()(string obj_txt_in) - in { - } - body { + auto munge_para()(string obj_txt_in) { obj_txt["munge"]=(obj_txt_in) .replaceFirst(rgx.para_attribs, "") .replaceFirst(rgx.object_number_off_all, ""); @@ -5618,10 +5613,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - string munge_quote()(string obj_txt_in) - in { - } - body { + string munge_quote()(string obj_txt_in) { obj_txt["munge"]=obj_txt_in; return obj_txt["munge"]; } @@ -5640,9 +5632,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - auto munge_group(string obj_txt_in) - in { } - body { + auto munge_group(string obj_txt_in) { obj_txt["munge"]=obj_txt_in; auto t = object_notes_and_links_(obj_txt["munge"]); return t; @@ -5662,10 +5652,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - auto munge_block()(string obj_txt_in) - in { - } - body { + auto munge_block()(string obj_txt_in) { obj_txt["munge"]=obj_txt_in; auto t = object_notes_and_links_(obj_txt["munge"]); return t; @@ -5685,10 +5672,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - auto munge_verse()(string obj_txt_in) - in { - } - body { + auto munge_verse()(string obj_txt_in) { obj_txt["munge"]=obj_txt_in; auto t = object_notes_and_links_(obj_txt["munge"]); return t; @@ -5707,10 +5691,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - string munge_code()(string obj_txt_in) - in { - } - body { + string munge_code()(string obj_txt_in) { obj_txt_in = obj_txt_in.replaceAll(rgx.space, mkup.nbsp); obj_txt["munge"] = obj_txt_in; return obj_txt["munge"]; @@ -5725,10 +5706,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - string munge_table()(string obj_txt_in) - in { - } - body { + string munge_table()(string obj_txt_in) { obj_txt["munge"]=obj_txt_in; return obj_txt["munge"]; } @@ -5740,10 +5718,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - string munge_comment()(string obj_txt_in) - in { - } - body { + string munge_comment()(string obj_txt_in) { obj_txt["munge"]=obj_txt_in; return obj_txt["munge"]; } @@ -5779,10 +5754,7 @@ static struct ObjInlineMarkup { string obj_key_, CMM conf_make_meta, Flag!"_new_doc" _new_doc - ) - in { - } - body { + ) { obj_txt["munge"] = obj_[obj_key_].dup; obj_txt["munge"] = (obj_["is"].match(ctRegex!(`verse|code`))) ? obj_txt["munge"] @@ -5892,10 +5864,7 @@ static struct ObjInlineMarkup { string _anchor_tag, return ref string[][string] lev4_subtoc, ObjGenericComposite[] the_table_of_contents_section, - ) - in { - } - body { + ) { ObjGenericComposite comp_obj_toc; mixin InternalMarkup; static auto mkup = InlineMarkup(); @@ -6194,10 +6163,7 @@ struct ObjAttributes { string obj_is_, string obj_raw, ObjGenericComposite _comp_obj_heading, - ) - in { - } - body { + ) { scope(exit) { destroy(obj_is_); destroy(obj_raw); @@ -6268,10 +6234,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_para_and_blocks()(string obj_txt_in) - in { - } - body { + string txt_para_and_blocks()(string obj_txt_in) { if (obj_txt_in.matchFirst(rgx.para_bullet)) { _obj_attributes =" \"bullet\": \"true\"," ~ " \"indent_hang\": 0," @@ -6301,10 +6264,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_heading()(string obj_txt_in) - in { - } - body { + string txt_heading()(string obj_txt_in) { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"para\"," ~ " \"is\": \"heading\""; @@ -6318,10 +6278,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_para()(string obj_txt_in) - in { - } - body { + string txt_para()(string obj_txt_in) { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"para\"," ~ " \"is\": \"para\""; @@ -6335,10 +6292,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_quote()(string obj_txt_in) - in { - } - body { + string txt_quote()(string obj_txt_in) { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"quote\""; @@ -6352,10 +6306,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_group()(string obj_txt_in) - in { - } - body { + string txt_group()(string obj_txt_in) { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"group\""; @@ -6369,10 +6320,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_block()(string obj_txt_in) - in { - } - body { + string txt_block()(string obj_txt_in) { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"block\""; @@ -6386,10 +6334,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_verse()(string obj_txt_in) - in { - } - body { + string txt_verse()(string obj_txt_in) { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"verse\""; @@ -6403,10 +6348,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_code()(string obj_txt_in) - in { - } - body { + string txt_code()(string obj_txt_in) { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"code\""; @@ -6420,10 +6362,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_table()(string obj_txt_in) - in { - } - body { + string txt_table()(string obj_txt_in) { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"table\""; @@ -6437,10 +6376,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_comment()(string obj_txt_in) - in { - } - body { + string txt_comment()(string obj_txt_in) { _obj_attributes = " \"use\": \"comment\"," ~ " \"of\": \"comment\"," ~ " \"is\": \"comment\""; @@ -6501,8 +6437,7 @@ struct BookIndexNuggetHash { string bookindex_section, N obj_cite_digits, S tag_in_seg, - ) - in { + ) { debug(asserts) { static assert(is(typeof(obj_cite_digits.object_number) == int)); } @@ -6516,8 +6451,6 @@ struct BookIndexNuggetHash { ); } } - } - body { static auto rgx = Rgx(); if (!bookindex_section.empty) { auto bi_main_terms_split_arr @@ -6836,8 +6769,7 @@ struct NotesSection { ObjGenericComposite[] contents_am, string[string] tag_in_seg, int cntr, - ) - in { + ) { assert((contents_am[cntr].metainfo.is_a == "para") || (contents_am[cntr].metainfo.is_a == "heading") || (contents_am[cntr].metainfo.is_a == "quote") @@ -6849,8 +6781,6 @@ struct NotesSection { (contents_am[cntr].text).match( rgx.inline_notes_al_regular_number_note) ); - } - body { mixin InternalMarkup; previous_count=cntr; static auto mkup = InlineMarkup(); @@ -6892,10 +6822,7 @@ struct NotesSection { #+name: meta_emitters_endnotes #+BEGIN_SRC d - private auto gathered_notes() - in { - } - body { + private auto gathered_notes() { string[][string] endnotes_; if (object_notes.length > 1) { endnotes_["notes"] = (object_notes["notes"].split(rgx.break_string))[0..$-1]; @@ -6915,10 +6842,7 @@ struct NotesSection { private auto endnote_objects(N,O)( N obj_cite_digits, O opt_action, - ) - in { - } - body { + ) { mixin DocReformNode; ObjGenericComposite[] the_endnotes_section; auto endnotes_ = gathered_notes(); @@ -7048,10 +6972,7 @@ struct Bibliography { public JSONValue[] flow_bibliography_()( return ref string[] biblio_unsorted_incomplete, return ref JSONValue[] bib_arr_json - ) - in { - } - body { + ) { JSONValue[] biblio_unsorted = biblio_make_unsorted_array_of_json_objects(biblio_unsorted_incomplete, bib_arr_json); // TODO lookat returns biblio_arr_json = []; @@ -7177,17 +7098,14 @@ struct NodeStructureMetadata { int cntr_, int ptr_, string is_ - ) - in { + ) { debug(asserts) { static assert(is(typeof(obj_cite_digits.object_number) == int)); } assert(is_ != "heading"); assert(obj_cite_digits.object_number.to!int >= 0); - } - body { - assert(is_ != "heading"); - assert(obj_cite_digits.object_number.to!int >= 0); + assert(is_ != "heading"); // should not be necessary + assert(obj_cite_digits.object_number.to!int >= 0); // should not be necessary if (lv7 > State.off) { p_["lev_markup_number"] = DocStructMarkupHeading.h_text_4; p_["object_number"] = lv7; @@ -7248,8 +7166,7 @@ struct NodeStructureMetadata { fNr flag_notes_reg, fNs flag_notes_star, fL flag_links, - ) - in { + ) { debug(asserts) { static assert(is(typeof(lev) == string)); static assert(is(typeof(obj_cite_digits.object_number) == int)); @@ -7272,8 +7189,6 @@ struct NodeStructureMetadata { +/ } } - } - body { switch (lev_markup_number.to!int) { case 0: lv = DocStructMarkupHeading.h_sect_A; diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index ac2f80a..042a57e 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -4412,10 +4412,10 @@ template DocReformDocAbstraction() { ); return t; } - private auto object_notes_and_links_()(string obj_txt_in, bool reset_note_numbers=false) - in { - } - body { + private auto object_notes_and_links_()( + string obj_txt_in, + bool reset_note_numbers=false + ) { obj_txt_out = ""; bool urls = false; bool images_without_dimensions = false; @@ -4469,18 +4469,16 @@ template DocReformDocAbstraction() { ); return t; } - auto init() - in { } - body { + auto init() { auto t = object_notes_and_links_(""); return t; } invariant() { } - auto munge_heading()(string obj_txt_in, bool reset_note_numbers=false) - in { - } - body { + auto munge_heading()( + string obj_txt_in, + bool reset_note_numbers=false + ) { obj_txt["munge"] = obj_txt_in .replaceFirst(rgx.heading, "") .replaceFirst(rgx.object_number_off_all, "") @@ -4496,10 +4494,7 @@ template DocReformDocAbstraction() { } invariant() { } - auto munge_para()(string obj_txt_in) - in { - } - body { + auto munge_para()(string obj_txt_in) { obj_txt["munge"]=(obj_txt_in) .replaceFirst(rgx.para_attribs, "") .replaceFirst(rgx.object_number_off_all, ""); @@ -4512,67 +4507,47 @@ template DocReformDocAbstraction() { } return t; } - string munge_quote()(string obj_txt_in) - in { - } - body { + string munge_quote()(string obj_txt_in) { obj_txt["munge"]=obj_txt_in; return obj_txt["munge"]; } invariant() { } - auto munge_group(string obj_txt_in) - in { } - body { + auto munge_group(string obj_txt_in) { obj_txt["munge"]=obj_txt_in; auto t = object_notes_and_links_(obj_txt["munge"]); return t; } invariant() { } - auto munge_block()(string obj_txt_in) - in { - } - body { + auto munge_block()(string obj_txt_in) { obj_txt["munge"]=obj_txt_in; auto t = object_notes_and_links_(obj_txt["munge"]); return t; } invariant() { } - auto munge_verse()(string obj_txt_in) - in { - } - body { + auto munge_verse()(string obj_txt_in) { obj_txt["munge"]=obj_txt_in; auto t = object_notes_and_links_(obj_txt["munge"]); return t; } invariant() { } - string munge_code()(string obj_txt_in) - in { - } - body { + string munge_code()(string obj_txt_in) { obj_txt_in = obj_txt_in.replaceAll(rgx.space, mkup.nbsp); obj_txt["munge"] = obj_txt_in; return obj_txt["munge"]; } invariant() { } - string munge_table()(string obj_txt_in) - in { - } - body { + string munge_table()(string obj_txt_in) { obj_txt["munge"]=obj_txt_in; return obj_txt["munge"]; } invariant() { } - string munge_comment()(string obj_txt_in) - in { - } - body { + string munge_comment()(string obj_txt_in) { obj_txt["munge"]=obj_txt_in; return obj_txt["munge"]; } @@ -4589,10 +4564,7 @@ template DocReformDocAbstraction() { string obj_key_, CMM conf_make_meta, Flag!"_new_doc" _new_doc - ) - in { - } - body { + ) { obj_txt["munge"] = obj_[obj_key_].dup; obj_txt["munge"] = (obj_["is"].match(ctRegex!(`verse|code`))) ? obj_txt["munge"] @@ -4696,10 +4668,7 @@ template DocReformDocAbstraction() { string _anchor_tag, return ref string[][string] lev4_subtoc, ObjGenericComposite[] the_table_of_contents_section, - ) - in { - } - body { + ) { ObjGenericComposite comp_obj_toc; mixin InternalMarkup; static auto mkup = InlineMarkup(); @@ -4962,10 +4931,7 @@ template DocReformDocAbstraction() { string obj_is_, string obj_raw, ObjGenericComposite _comp_obj_heading, - ) - in { - } - body { + ) { scope(exit) { destroy(obj_is_); destroy(obj_raw); @@ -5024,10 +4990,7 @@ template DocReformDocAbstraction() { } private: string _obj_attributes; - string txt_para_and_blocks()(string obj_txt_in) - in { - } - body { + string txt_para_and_blocks()(string obj_txt_in) { if (obj_txt_in.matchFirst(rgx.para_bullet)) { _obj_attributes =" \"bullet\": \"true\"," ~ " \"indent_hang\": 0," @@ -5051,10 +5014,7 @@ template DocReformDocAbstraction() { } return _obj_attributes; } - string txt_heading()(string obj_txt_in) - in { - } - body { + string txt_heading()(string obj_txt_in) { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"para\"," ~ " \"is\": \"heading\""; @@ -5062,10 +5022,7 @@ template DocReformDocAbstraction() { } invariant() { } - string txt_para()(string obj_txt_in) - in { - } - body { + string txt_para()(string obj_txt_in) { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"para\"," ~ " \"is\": \"para\""; @@ -5073,10 +5030,7 @@ template DocReformDocAbstraction() { } invariant() { } - string txt_quote()(string obj_txt_in) - in { - } - body { + string txt_quote()(string obj_txt_in) { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"quote\""; @@ -5084,10 +5038,7 @@ template DocReformDocAbstraction() { } invariant() { } - string txt_group()(string obj_txt_in) - in { - } - body { + string txt_group()(string obj_txt_in) { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"group\""; @@ -5095,10 +5046,7 @@ template DocReformDocAbstraction() { } invariant() { } - string txt_block()(string obj_txt_in) - in { - } - body { + string txt_block()(string obj_txt_in) { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"block\""; @@ -5106,10 +5054,7 @@ template DocReformDocAbstraction() { } invariant() { } - string txt_verse()(string obj_txt_in) - in { - } - body { + string txt_verse()(string obj_txt_in) { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"verse\""; @@ -5117,10 +5062,7 @@ template DocReformDocAbstraction() { } invariant() { } - string txt_code()(string obj_txt_in) - in { - } - body { + string txt_code()(string obj_txt_in) { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"code\""; @@ -5128,10 +5070,7 @@ template DocReformDocAbstraction() { } invariant() { } - string txt_table()(string obj_txt_in) - in { - } - body { + string txt_table()(string obj_txt_in) { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"table\""; @@ -5139,10 +5078,7 @@ template DocReformDocAbstraction() { } invariant() { } - string txt_comment()(string obj_txt_in) - in { - } - body { + string txt_comment()(string obj_txt_in) { _obj_attributes = " \"use\": \"comment\"," ~ " \"of\": \"comment\"," ~ " \"is\": \"comment\""; @@ -5185,8 +5121,7 @@ template DocReformDocAbstraction() { string bookindex_section, N obj_cite_digits, S tag_in_seg, - ) - in { + ) { debug(asserts) { static assert(is(typeof(obj_cite_digits.object_number) == int)); } @@ -5200,8 +5135,6 @@ template DocReformDocAbstraction() { ); } } - } - body { static auto rgx = Rgx(); if (!bookindex_section.empty) { auto bi_main_terms_split_arr @@ -5478,8 +5411,7 @@ template DocReformDocAbstraction() { ObjGenericComposite[] contents_am, string[string] tag_in_seg, int cntr, - ) - in { + ) { assert((contents_am[cntr].metainfo.is_a == "para") || (contents_am[cntr].metainfo.is_a == "heading") || (contents_am[cntr].metainfo.is_a == "quote") @@ -5491,8 +5423,6 @@ template DocReformDocAbstraction() { (contents_am[cntr].text).match( rgx.inline_notes_al_regular_number_note) ); - } - body { mixin InternalMarkup; previous_count=cntr; static auto mkup = InlineMarkup(); @@ -5528,10 +5458,7 @@ template DocReformDocAbstraction() { } return object_notes; } - private auto gathered_notes() - in { - } - body { + private auto gathered_notes() { string[][string] endnotes_; if (object_notes.length > 1) { endnotes_["notes"] = (object_notes["notes"].split(rgx.break_string))[0..$-1]; @@ -5545,10 +5472,7 @@ template DocReformDocAbstraction() { private auto endnote_objects(N,O)( N obj_cite_digits, O opt_action, - ) - in { - } - body { + ) { mixin DocReformNode; ObjGenericComposite[] the_endnotes_section; auto endnotes_ = gathered_notes(); @@ -5660,10 +5584,7 @@ template DocReformDocAbstraction() { public JSONValue[] flow_bibliography_()( return ref string[] biblio_unsorted_incomplete, return ref JSONValue[] bib_arr_json - ) - in { - } - body { + ) { JSONValue[] biblio_unsorted = biblio_make_unsorted_array_of_json_objects(biblio_unsorted_incomplete, bib_arr_json); // TODO lookat returns biblio_arr_json = []; @@ -5753,17 +5674,14 @@ template DocReformDocAbstraction() { int cntr_, int ptr_, string is_ - ) - in { + ) { debug(asserts) { static assert(is(typeof(obj_cite_digits.object_number) == int)); } assert(is_ != "heading"); assert(obj_cite_digits.object_number.to!int >= 0); - } - body { - assert(is_ != "heading"); - assert(obj_cite_digits.object_number.to!int >= 0); + assert(is_ != "heading"); // should not be necessary + assert(obj_cite_digits.object_number.to!int >= 0); // should not be necessary if (lv7 > State.off) { p_["lev_markup_number"] = DocStructMarkupHeading.h_text_4; p_["object_number"] = lv7; @@ -5818,8 +5736,7 @@ template DocReformDocAbstraction() { fNr flag_notes_reg, fNs flag_notes_star, fL flag_links, - ) - in { + ) { debug(asserts) { static assert(is(typeof(lev) == string)); static assert(is(typeof(obj_cite_digits.object_number) == int)); @@ -5842,8 +5759,6 @@ template DocReformDocAbstraction() { +/ } } - } - body { switch (lev_markup_number.to!int) { case 0: lv = DocStructMarkupHeading.h_sect_A; |