From 2995a5e6c7f445b3f1fcec2b7ccdad56ed82d382 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 10 Jun 2019 11:54:45 -0400 Subject: meta_abstraction, ultimately cosmetic --- src/doc_reform/meta/metadoc_from_src.d | 163 ++++++++------------------------- 1 file changed, 39 insertions(+), 124 deletions(-) (limited to 'src') 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; -- cgit v1.2.3