diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2019-12-05 11:41:09 -0500 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2020-01-13 16:06:43 -0500 |
commit | 9a91485c10e059dee1374e152e4b068cd9d3866c (patch) | |
tree | 4eaa00d4e7e8fb5d576142d364657d5b67d3b766 /src/doc_reform/meta/metadoc_from_src.d | |
parent | yaml config, provide default if not read (diff) |
0.9.2 @safe & @trusted first pass
Diffstat (limited to 'src/doc_reform/meta/metadoc_from_src.d')
-rw-r--r-- | src/doc_reform/meta/metadoc_from_src.d | 118 |
1 files changed, 59 insertions, 59 deletions
diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index ab87eb2..35d70d5 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -309,7 +309,7 @@ template docAbstraction() { return tag_assoc; } /+ ↓ abstract marked up document +/ - auto docAbstraction(CMM,Opt,Mf)( + auto docAbstraction(CMM,Opt,Mf) ( char[][] markup_sourcefile_content, CMM conf_make_meta, Opt opt_action, @@ -2381,7 +2381,7 @@ template docAbstraction() { /+ post loop markup document/text ↑ +/ } /+ ← closed: abstract doc source +/ /+ ↓ abstraction functions +/ - static string[string] object_reset()(string[string] an_object) { + static string[string] object_reset()(string[string] an_object) @safe { an_object.remove("body_nugget"); an_object.remove("substantive"); an_object.remove("is"); @@ -2403,7 +2403,7 @@ template docAbstraction() { static int[string] _check_ocn_status_()( char[] line, int[string] obj_type_status, - ) { + ) @safe { static auto rgx = Rgx(); if (!(line.empty) && (obj_type_status["ocn_status_off_for_multiple_objects"] == OCN_off_block_status.off) @@ -2462,7 +2462,7 @@ template docAbstraction() { char[] _doc_header_and_make_substitutions_(CMM)( char[] line, CMM conf_make_meta, - ) { + ) @safe { enum Substitute { match, markup, } if (conf_make_meta.make.substitute) { foreach(substitution_pair; conf_make_meta.make.substitute) { @@ -2477,7 +2477,7 @@ template docAbstraction() { char[] _doc_header_and_make_substitutions_fontface_(CMM)( char[] line, CMM conf_make_meta, - ) { + ) @safe { enum Substitute { match, markup, } if ( conf_make_meta.make.bold) { line = line.replaceAll( @@ -2504,7 +2504,7 @@ template docAbstraction() { return ref int[string] obj_type_status, return ref uint[string] dochas, return ref string[string] object_number_poem - ) { + ) @safe { static auto rgx = Rgx(); if (auto m = line.matchFirst(rgx.block_curly_code_open)) { dochas["codeblock"]++; @@ -2689,7 +2689,7 @@ template docAbstraction() { char[] line, string[string] an_object, return ref int[string] obj_type_status - ) { + ) @safe { static auto rgx = Rgx(); if (obj_type_status["curly_quote"] == TriState.on) { if (line.matchFirst(rgx.block_curly_quote_close)) { @@ -2728,7 +2728,7 @@ template docAbstraction() { char[] line, string[string] an_object, return ref int[string] obj_type_status - ) { + ) @safe { static auto rgx = Rgx(); if (obj_type_status["curly_group"] == State.on) { if (line.matchFirst(rgx.block_curly_group_close)) { @@ -2767,7 +2767,7 @@ template docAbstraction() { char[] line, string[string] an_object, return ref int[string] obj_type_status - ) { + ) @safe { static auto rgx = Rgx(); if (obj_type_status["curly_block"] == TriState.on) { if (line.matchFirst(rgx.block_curly_block_close)) { @@ -2810,7 +2810,7 @@ template docAbstraction() { string[string] object_number_poem, CMM conf_make_meta, string[string] tag_in_seg, - ) { + ) @safe { static auto rgx = Rgx(); if (obj_type_status["curly_poem"] == TriState.on) { if (line.matchFirst(rgx.block_curly_poem_close)) { @@ -3048,7 +3048,7 @@ template docAbstraction() { char[] line, return ref string[string] an_object, return ref int[string] obj_type_status - ) { + ) @safe { static auto rgx = Rgx(); if (obj_type_status["curly_code"] == TriState.on) { if (line.matchFirst(rgx.block_curly_code_close)) { @@ -3699,7 +3699,7 @@ template docAbstraction() { string[] _make_unmarked_headings, return ref Regex!(char)[string] heading_match_rgx, return ref int[string] obj_type_status - ) { + ) @safe { static auto rgx = Rgx(); if ((_make_unmarked_headings.length > 2) && (obj_type_status["make_headings"] == State.off)) { /+ headings found +/ @@ -3779,7 +3779,7 @@ template docAbstraction() { int[string] line_occur, return ref Regex!(char)[string] heading_match_rgx, return ref int[string] obj_type_status - ) { + ) @safe { if ((obj_type_status["make_headings"] == State.on) && ((line_occur["para"] == State.off) && (line_occur["heading"] == State.off)) @@ -3839,7 +3839,7 @@ template docAbstraction() { return ref int[string] collapsed_lev, return ref int[string] obj_type_status, return ref CMM conf_make_meta, - ) { + ) @safe { static auto rgx = Rgx(); if (auto m = line.match(rgx.heading)) { /+ heading match +/ ++line_occur["heading"]; @@ -3991,7 +3991,7 @@ template docAbstraction() { return ref bool bullet, return ref int[string] obj_type_status, return ref int[string] line_occur, - ) { + ) @safe { static auto rgx = Rgx(); if (line_occur["para"] == State.off) { line = font_faces_line(line); @@ -4038,7 +4038,7 @@ template docAbstraction() { } char[] font_faces_line()( char[] textline, - ) { + ) @safe { static auto rgx = Rgx(); static auto mkup = InlineMarkup(); if (textline.match(rgx.inline_faces_line)) { @@ -4053,7 +4053,7 @@ template docAbstraction() { ObjGenericComposite flow_table_instructions(H)( return ref ObjGenericComposite table_object, H table_head, - ) { + ) @safe { static auto rgx = Rgx(); table_object.metainfo.is_of_part = "body"; table_object.metainfo.is_of_section = "body"; @@ -4078,7 +4078,7 @@ template docAbstraction() { ObjGenericComposite flow_table_array_munge(T)( return ref ObjGenericComposite table_object, return ref T table_array, - ) { + ) @safe { static auto rgx = Rgx(); static auto mng = InlineMarkup(); string _table_substantive; @@ -4237,7 +4237,7 @@ template docAbstraction() { int ocn_digit, ocn_object_number, ocn_on_, ocn_off_, ocn_bkidx, ocn_bkidx_; string object_identifier; bool ocn_is_off; - auto ocn_emitter(int ocn_status_flag) { + auto ocn_emitter(int ocn_status_flag) @safe { OCNset ocn; assert(ocn_status_flag <= OCNstatus.reset); ocn_object_number = ocn_bkidx = 0; @@ -4290,13 +4290,13 @@ template docAbstraction() { static auto rgx = Rgx(); static auto mkup = InlineMarkup(); int stage_reset_note_numbers = true; - private auto initialize_note_numbers() { + private auto initialize_note_numbers() @safe { n_foot = 0; n_foot_reg = 0; n_foot_sp_asterisk = 0; n_foot_sp_plus = 0; } - static auto images()(string obj_txt_in) { + static auto images()(string obj_txt_in) @safe { static auto mng = InlineMarkup(); /+ url matched +/ obj_txt_in = obj_txt_in.replaceAll(rgx.inline_notes_al_special, ""); // TODO reinstate when special footnotes are implemented @@ -4326,7 +4326,7 @@ template docAbstraction() { } return obj_txt_in; } - auto footnotes_endnotes_markup_and_number_or_stars()(string obj_txt_in, bool reset_note_numbers) { + auto footnotes_endnotes_markup_and_number_or_stars()(string obj_txt_in, bool reset_note_numbers) @safe { /+ endnotes (regular) +/ bool flg_notes_reg = false; bool flg_notes_star = false; @@ -4393,7 +4393,7 @@ template docAbstraction() { private auto object_notes_and_links_()( string obj_txt_in, bool reset_note_numbers=false - ) { + ) @safe { obj_txt_out = ""; bool urls = false; bool images_without_dimensions = false; @@ -4456,7 +4456,7 @@ template docAbstraction() { auto munge_heading()( string obj_txt_in, bool reset_note_numbers=false - ) { + ) @safe { obj_txt["munge"] = obj_txt_in .replaceFirst(rgx.heading, "") .replaceFirst(rgx.object_number_off_all, "") @@ -4472,7 +4472,7 @@ template docAbstraction() { } invariant() { } - auto munge_para()(string obj_txt_in) { + auto munge_para()(string obj_txt_in) @safe { obj_txt["munge"]=(obj_txt_in) .replaceFirst(rgx.para_attribs, "") .replaceFirst(rgx.object_number_off_all, ""); @@ -4485,47 +4485,47 @@ template docAbstraction() { } return t; } - string munge_quote()(string obj_txt_in) { + string munge_quote()(string obj_txt_in) @safe { obj_txt["munge"]=obj_txt_in; return obj_txt["munge"]; } invariant() { } - auto munge_group(string obj_txt_in) { + auto munge_group(string obj_txt_in) @safe { 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) { + auto munge_block()(string obj_txt_in) @safe { 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) { + auto munge_verse()(string obj_txt_in) @safe { 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) { + string munge_code()(string obj_txt_in) @safe { 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) { + string munge_table()(string obj_txt_in) @safe { obj_txt["munge"]=obj_txt_in; return obj_txt["munge"]; } invariant() { } - string munge_comment()(string obj_txt_in) { + string munge_comment()(string obj_txt_in) @safe { obj_txt["munge"]=obj_txt_in; return obj_txt["munge"]; } @@ -4542,7 +4542,7 @@ template docAbstraction() { string obj_key_, CMM conf_make_meta, Flag!"_new_doc" _new_doc - ) { + ) @safe { obj_txt["munge"] = obj_[obj_key_].dup; obj_txt["munge"] = (obj_["is"].match(ctRegex!(`verse|code`))) ? obj_txt["munge"] @@ -4632,7 +4632,7 @@ template docAbstraction() { } auto _clean_heading_toc_()( char[] heading_toc_, - ) { + ) @safe { auto m = (cast(char[]) heading_toc_).matchFirst(rgx.heading); heading_toc_ = (m.post).replaceAll( rgx.inline_notes_curly_gen, @@ -4646,7 +4646,7 @@ template docAbstraction() { string _anchor_tag, return ref string[][string] lev4_subtoc, ObjGenericComposite[] the_table_of_contents_section, - ) { + ) @safe { ObjGenericComposite comp_obj_toc; mixin InternalMarkup; static auto mkup = InlineMarkup(); @@ -4729,7 +4729,7 @@ template docAbstraction() { string[string] obj_, CMM conf_make_meta, bool _new_doc, - ) { + ) @safe { if (_new_doc) { heading_num = [ 0, 0, 0, 0 ]; heading_number_auto_composite = ""; @@ -4872,7 +4872,7 @@ template docAbstraction() { string munge_, string lev_, bool _new_doc - ) { + ) @safe { if (!(munge_.match(rgx.heading_anchor_tag))) { if (munge_.match(rgx.heading_identify_anchor_tag)) { if (auto m = munge_.match(rgx.heading_extract_named_anchor_tag)) { @@ -4909,7 +4909,7 @@ template docAbstraction() { string obj_is_, string obj_raw, ObjGenericComposite _comp_obj_heading, - ) { + ) @safe { scope(exit) { destroy(obj_is_); destroy(obj_raw); @@ -4992,7 +4992,7 @@ template docAbstraction() { } return _obj_attributes; } - string txt_heading()(string obj_txt_in) { + string txt_heading()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"para\"," ~ " \"is\": \"heading\""; @@ -5000,7 +5000,7 @@ template docAbstraction() { } invariant() { } - string txt_para()(string obj_txt_in) { + string txt_para()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"para\"," ~ " \"is\": \"para\""; @@ -5008,7 +5008,7 @@ template docAbstraction() { } invariant() { } - string txt_quote()(string obj_txt_in) { + string txt_quote()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"quote\""; @@ -5016,7 +5016,7 @@ template docAbstraction() { } invariant() { } - string txt_group()(string obj_txt_in) { + string txt_group()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"group\""; @@ -5024,7 +5024,7 @@ template docAbstraction() { } invariant() { } - string txt_block()(string obj_txt_in) { + string txt_block()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"block\""; @@ -5032,7 +5032,7 @@ template docAbstraction() { } invariant() { } - string txt_verse()(string obj_txt_in) { + string txt_verse()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"verse\""; @@ -5040,7 +5040,7 @@ template docAbstraction() { } invariant() { } - string txt_code()(string obj_txt_in) { + string txt_code()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"code\""; @@ -5048,7 +5048,7 @@ template docAbstraction() { } invariant() { } - string txt_table()(string obj_txt_in) { + string txt_table()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"table\""; @@ -5056,7 +5056,7 @@ template docAbstraction() { } invariant() { } - string txt_comment()(string obj_txt_in) { + string txt_comment()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"comment\"," ~ " \"of\": \"comment\"," ~ " \"is\": \"comment\""; @@ -5068,7 +5068,7 @@ template docAbstraction() { string _obj_attrib, string obj_is_, ObjGenericComposite _comp_obj_heading, - ) { + ) @safe { JSONValue oa_j = parseJSON(_obj_attrib); assert( (oa_j.type == JSON_TYPE.OBJECT) @@ -5099,7 +5099,7 @@ template docAbstraction() { string bookindex_section, N obj_cite_digits, S tag_in_seg, - ) { + ) @safe { debug(asserts) { static assert(is(typeof(obj_cite_digits.object_number) == int)); } @@ -5167,7 +5167,7 @@ template docAbstraction() { int mkn, skn; void bookindex_report_indented()( string[][string][string] bookindex_unordered_hashes - ) { + ) @safe { auto mainkeys = bookindex_unordered_hashes.byKey.array.sort().release; foreach (mainkey; mainkeys) { @@ -5195,7 +5195,7 @@ template docAbstraction() { static auto munge = ObjInlineMarkupMunge(); void bookindex_write_section()( string[][string][string] bookindex_unordered_hashes - ) { + ) @safe { auto mainkeys = bookindex_unordered_hashes.byKey.array .sort!("toUpper(a) < toUpper(b)", SwapStrategy.stable).release; @@ -5390,7 +5390,7 @@ template docAbstraction() { ObjGenericComposite[] contents_am, string[string] tag_in_seg, int cntr, - ) { + ) @safe { assert((contents_am[cntr].metainfo.is_a == "para") || (contents_am[cntr].metainfo.is_a == "heading") || (contents_am[cntr].metainfo.is_a == "quote") @@ -5466,7 +5466,7 @@ template docAbstraction() { } return object_notes; } - private auto gathered_notes() { + private auto gathered_notes() @safe { string[][string] endnotes_; if (object_notes.length > 1) { endnotes_["notes"] = (object_notes["notes"].split(rgx.break_string))[0..$-1]; @@ -5480,7 +5480,7 @@ template docAbstraction() { private auto endnote_objects(N,O)( N obj_cite_digits, O opt_action, - ) { + ) @safe { mixin spineNode; ObjGenericComposite[] the_endnotes_section; auto endnotes_ = gathered_notes(); @@ -5683,7 +5683,7 @@ template docAbstraction() { int cntr_, int ptr_, string is_ - ) { + ) @safe { debug(asserts) { static assert(is(typeof(obj_cite_digits.object_number) == int)); } @@ -5745,7 +5745,7 @@ template docAbstraction() { fNr flag_notes_reg, fNs flag_notes_star, fL flag_links, - ) { + ) @safe { debug(asserts) { static assert(is(typeof(lev) == string)); static assert(is(typeof(obj_cite_digits.object_number) == int)); @@ -5930,7 +5930,7 @@ template docAbstraction() { pure void assertions_doc_structure()( string[string] an_object, int[string] lv - ) { + ) @safe { if (lv["h3"] > State.off) { assert(lv["h0"] > State.off); assert(lv["h1"] > State.off); @@ -6102,7 +6102,7 @@ template docAbstraction() { break; } } - pure void assertions_flag_types_block_status_none_or_closed()(int[string] obj_type_status) { + pure void assertions_flag_types_block_status_none_or_closed()(int[string] obj_type_status) @safe { assert( (obj_type_status["code"] == TriState.off) || (obj_type_status["code"] == TriState.closing), @@ -6127,7 +6127,7 @@ template docAbstraction() { /+ abstraction functions assertions ↑ +/ } /+ ← closed: template docAbstraction +/ template docSectKeysSeq() { - auto docSectKeysSeq(string[][string] document_section_keys_sequenced) { + auto docSectKeysSeq(string[][string] document_section_keys_sequenced) @safe { struct doc_sect_keys_seq { string[] scroll() { return document_section_keys_sequenced["scroll"]; |