diff options
Diffstat (limited to 'src/sdp/meta/metadoc_from_src.d')
-rw-r--r-- | src/sdp/meta/metadoc_from_src.d | 106 |
1 files changed, 54 insertions, 52 deletions
diff --git a/src/sdp/meta/metadoc_from_src.d b/src/sdp/meta/metadoc_from_src.d index 0484cae..ebcfe71 100644 --- a/src/sdp/meta/metadoc_from_src.d +++ b/src/sdp/meta/metadoc_from_src.d @@ -1,7 +1,7 @@ /++ document abstraction: abstraction of sisu markup for downstream processing - meta_metadoc_from_src.d + metadoc_from_src.d +/ module sdp.meta.metadoc_from_src; template SiSUdocAbstraction() { @@ -64,8 +64,8 @@ template SiSUdocAbstraction() { int[string] indent; bool bullet = true; string content_non_header = "8"; - auto obj_im = ObjInlineMarkup(); - auto obj_att = ObjAttributes(); + static auto obj_im = ObjInlineMarkup(); + static auto obj_att = ObjAttributes(); /+ ocn +/ int obj_cite_number, obj_cite_number_; auto object_citation_number = OCNemitter(); @@ -232,7 +232,7 @@ template SiSUdocAbstraction() { Meta dochead_meta_aa, Opt opt_action, ) { - auto rgx = Rgx(); + static auto rgx = Rgx(); debug(asserts) { static assert(is(typeof(markup_sourcefile_content) == char[][])); static assert(is(typeof(dochead_make_aa) == string[string][string])); @@ -341,8 +341,8 @@ template SiSUdocAbstraction() { "seg": [toc_head], "scroll": [toc_head], ]; - auto mkup = InlineMarkup(); - auto munge = ObjInlineMarkupMunge(); + static auto mkup = InlineMarkup(); + static auto munge = ObjInlineMarkupMunge(); auto note_section = NotesSection(); auto bookindex_extract_hash = BookIndexNuggetHash(); string[][string] lev4_subtoc; @@ -380,7 +380,7 @@ template SiSUdocAbstraction() { } } if (!line.empty) { - _check_ocn_status_(line, type); + type = _check_ocn_status_(line, type); } if (type["code"] == TriState.on) { /+ block object: code +/ @@ -1715,7 +1715,7 @@ template SiSUdocAbstraction() { /+ post loop markup document/text ↑ +/ } /+ ← closed: abstract doc source +/ /+ ↓ abstraction functions +/ - auto object_reset(O)(ref O an_object) { + static auto object_reset(O)(O an_object) { debug(asserts) { static assert(is(typeof(an_object) == string[string])); } @@ -1724,6 +1724,7 @@ template SiSUdocAbstraction() { an_object.remove("is"); an_object.remove("attrib"); an_object.remove("bookindex_nugget"); + return an_object; } auto _common_reset_(L,O,T)( return ref L line_occur, @@ -1739,17 +1740,17 @@ template SiSUdocAbstraction() { line_occur["para"] = State.off; type["heading"] = State.off; type["para"] = State.off; - object_reset(an_object); + an_object = object_reset(an_object); } - void _check_ocn_status_(L,T)( + static auto _check_ocn_status_(L,T)( L line, - return ref T type + T type ) { debug(asserts) { static assert(is(typeof(line) == char[])); static assert(is(typeof(type) == int[string])); } - auto rgx = Rgx(); + static auto rgx = Rgx(); if ((!line.empty) && (type["ocn_status_multi_obj"] == TriState.off)) { /+ not multi-line object, check whether obj_cite_number is on or turned off +/ if (line.matchFirst(rgx.obj_cite_number_block_marks)) { @@ -1789,6 +1790,7 @@ template SiSUdocAbstraction() { } } } + return type; } void _start_block_(L,T,N)( L line, @@ -1800,7 +1802,7 @@ template SiSUdocAbstraction() { static assert(is(typeof(type) == int[string])); static assert(is(typeof(obj_cite_number_poem) == string[string])); } - auto rgx = Rgx(); + static auto rgx = Rgx(); string code_block_syntax = ""; bool code_block_numbered = false; if (auto m = line.matchFirst(rgx.block_curly_code_open)) { @@ -1967,7 +1969,7 @@ template SiSUdocAbstraction() { static assert(is(typeof(an_object) == string[string])); static assert(is(typeof(type) == int[string])); } - auto rgx = Rgx(); + static auto rgx = Rgx(); if (type["curly_quote"] == TriState.on) { if (line.matchFirst(rgx.block_curly_quote_close)) { debug(quote) { // quote (curly) close @@ -2010,7 +2012,7 @@ template SiSUdocAbstraction() { static assert(is(typeof(an_object) == string[string])); static assert(is(typeof(type) == int[string])); } - auto rgx = Rgx(); + static auto rgx = Rgx(); if (type["curly_group"] == State.on) { if (line.matchFirst(rgx.block_curly_group_close)) { debug(group) { @@ -2053,7 +2055,7 @@ template SiSUdocAbstraction() { static assert(is(typeof(an_object) == string[string])); static assert(is(typeof(type) == int[string])); } - auto rgx = Rgx(); + static auto rgx = Rgx(); if (type["curly_block"] == TriState.on) { if (line.matchFirst(rgx.block_curly_block_close)) { debug(block) { // block (curly) close @@ -2102,7 +2104,7 @@ template SiSUdocAbstraction() { static assert(is(typeof(obj_cite_number_poem) == string[string])); static assert(is(typeof(dochead_make_aa) == string[string][string])); } - auto rgx = Rgx(); + static auto rgx = Rgx(); if (type["curly_poem"] == TriState.on) { if (line.matchFirst(rgx.block_curly_poem_close)) { if (an_object_key in an_object @@ -2315,7 +2317,7 @@ template SiSUdocAbstraction() { static assert(is(typeof(an_object) == string[string])); static assert(is(typeof(type) == int[string])); } - auto rgx = Rgx(); + static auto rgx = Rgx(); if (type["curly_code"] == TriState.on) { if (line.matchFirst(rgx.block_curly_code_close)) { debug(code) { // code (curly) close @@ -2363,7 +2365,7 @@ template SiSUdocAbstraction() { static assert(is(typeof(an_object) == string[string])); static assert(is(typeof(type) == int[string])); } - auto rgx = Rgx(); + static auto rgx = Rgx(); if (type["curly_table"] == TriState.on) { if (line.matchFirst(rgx.block_curly_table_close)) { debug(table) { // table (curly) close @@ -2446,7 +2448,7 @@ template SiSUdocAbstraction() { ) { mixin SiSUbiblio; auto jsn = BibJsnStr(); - auto rgx = Rgx(); + static auto rgx = Rgx(); if (line.matchFirst(rgx.heading_biblio)) { type["biblio_section"] = TriState.on; type["blurb_section"] = State.off; @@ -2862,7 +2864,7 @@ template SiSUdocAbstraction() { static assert(is(typeof(type) == int[string])); static assert(is(typeof(opt_action) == bool[string])); } - auto rgx = Rgx(); + static auto rgx = Rgx(); if (auto m = line.match(rgx.book_index)) { /+ match book_index +/ debug(bookindexmatch) { // book index @@ -2921,7 +2923,7 @@ template SiSUdocAbstraction() { static assert(is(typeof(heading_match_rgx) == Regex!(char)[string])); static assert(is(typeof(type) == int[string])); } - auto rgx = Rgx(); + static auto rgx = Rgx(); if ((dochead_make_identify_unmarked_headings.length > 2) && (type["make_headings"] == State.off)) { /+ headings found +/ @@ -3081,7 +3083,7 @@ template SiSUdocAbstraction() { static assert(is(typeof(type) == int[string])); static assert(is(typeof(dochead_meta_aa) == string[string][string])); } - auto rgx = Rgx(); + static auto rgx = Rgx(); if (auto m = line.match(rgx.heading)) { /+ heading match +/ type["heading"] = State.on; @@ -3234,7 +3236,7 @@ template SiSUdocAbstraction() { static assert(is(typeof(type) == int[string])); static assert(is(typeof(line_occur) == int[string])); } - auto rgx = Rgx(); + static auto rgx = Rgx(); if (line_occur["para"] == State.off) { line = font_faces_line(line); /+ para matches +/ @@ -3278,9 +3280,9 @@ template SiSUdocAbstraction() { } } auto font_faces_line(T)( - return ref T textline, + T textline, ) { - auto rgx = Rgx(); + static auto rgx = Rgx(); if (textline.match(rgx.inline_faces_line)) { textline = (textline) .replaceFirst(rgx.inline_emphasis_line, ("*{$1}*$2")) @@ -3294,7 +3296,7 @@ template SiSUdocAbstraction() { return ref O table_object, return ref H table_head, ) { - auto rgx = Rgx(); + static auto rgx = Rgx(); table_object.use = "body"; table_object.is_of = "block"; table_object.is_a = "table"; @@ -3316,8 +3318,8 @@ template SiSUdocAbstraction() { return ref O table_object, return ref T table_array, ) { - auto rgx = Rgx(); - auto mng = InlineMarkup(); + static auto rgx = Rgx(); + static auto mng = InlineMarkup(); string _table_substantive; ulong col_num; ulong col_num_; @@ -3440,8 +3442,8 @@ template SiSUdocAbstraction() { return ref O table_object, return ref T table_array, ) { - auto rgx = Rgx(); - auto mng = InlineMarkup(); + static auto rgx = Rgx(); + static auto mng = InlineMarkup(); string _table_substantive; foreach(row; table_array) { foreach(col; row) { @@ -3459,8 +3461,8 @@ template SiSUdocAbstraction() { return ref O table_object, return ref T table_substantive, ) { - auto rgx = Rgx(); - auto munge = ObjInlineMarkupMunge(); + static auto rgx = Rgx(); + static auto munge = ObjInlineMarkupMunge(); string[] _table_rows = (table_substantive).split(rgx.table_row_delimiter); string[] _table_cols; string[][] _table; @@ -3475,8 +3477,8 @@ template SiSUdocAbstraction() { return ref O table_object, return ref T table_substantive, ) { - auto rgx = Rgx(); - auto munge = ObjInlineMarkupMunge(); + static auto rgx = Rgx(); + static auto munge = ObjInlineMarkupMunge(); string[] _table_rows = (table_substantive).split(rgx.table_row_delimiter_special); string[] _table_cols; string[][] _table; @@ -3508,13 +3510,13 @@ template SiSUdocAbstraction() { } } /+ +/ - struct ObjInlineMarkupMunge { + static struct ObjInlineMarkupMunge { string[string] obj_txt; int n_foot, n_foot_reg, n_foot_sp_asterisk, n_foot_sp_plus; string asterisks_; string obj_txt_out, tail, note; - auto rgx = Rgx(); - auto mkup = InlineMarkup(); + static auto rgx = Rgx(); + static auto mkup = InlineMarkup(); int stage_reset_note_numbers = true; private auto initialize_note_numbers() { n_foot = 0; @@ -3522,11 +3524,11 @@ template SiSUdocAbstraction() { n_foot_sp_asterisk = 0; n_foot_sp_plus = 0; } - string url_links(Ot)(Ot obj_txt_in) { + static string url_links(Ot)(Ot obj_txt_in) { debug(asserts) { static assert(is(typeof(obj_txt_in) == string)); } - auto mng = InlineMarkup(); + static auto mng = InlineMarkup(); obj_txt_in = obj_txt_in.replaceAll(rgx.inline_mono, (mng.mono ~ "{$1}" ~ mng.mono)); /+ url matched +/ if (obj_txt_in.match(rgx.inline_url_generic)) { @@ -3815,9 +3817,9 @@ template SiSUdocAbstraction() { invariant() { } } - struct ObjInlineMarkup { - auto rgx = Rgx(); - auto munge = ObjInlineMarkupMunge(); + static struct ObjInlineMarkup { + 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_, @@ -3936,7 +3938,7 @@ template SiSUdocAbstraction() { body { ObjGenericComposite comp_obj_toc; mixin InternalMarkup; - auto mkup = InlineMarkup(); + static auto mkup = InlineMarkup(); char[] heading_toc_ = (obj_["substantive"].dup.strip.to!(char[])).replaceAll(rgx.inline_notes_al, ""); heading_toc_ = _clean_heading_toc_(heading_toc_); auto attrib=""; @@ -4571,7 +4573,7 @@ template SiSUdocAbstraction() { } } body { - auto rgx = Rgx(); + static auto rgx = Rgx(); if (!bookindex_section.empty) { auto bi_main_terms_split_arr = bookindex_section.split(rgx.bi_main_terms_split); @@ -4655,8 +4657,8 @@ template SiSUdocAbstraction() { } struct BookIndexReportSection { int mkn, skn; - auto rgx = Rgx(); - auto munge = ObjInlineMarkupMunge(); + static auto rgx = Rgx(); + static auto munge = ObjInlineMarkupMunge(); auto bookindex_write_section(BI)( BI bookindex_unordered_hashes ) { @@ -4698,7 +4700,7 @@ template SiSUdocAbstraction() { } mixin SiSUnode; mixin InternalMarkup; - auto mkup = InlineMarkup(); + static auto mkup = InlineMarkup(); string type_is; string lev; int heading_lev_markup, heading_lev_collapsed; @@ -4849,7 +4851,7 @@ template SiSUdocAbstraction() { string[string] object_notes; int previous_count; int mkn; - auto rgx = Rgx(); + static auto rgx = Rgx(); private auto gather_notes_for_endnote_section( ObjGenericComposite[] contents_am, string segment_anchor_tag_that_object_belongs_to, @@ -4871,8 +4873,8 @@ template SiSUdocAbstraction() { } body { mixin InternalMarkup; - auto mkup = InlineMarkup(); - auto munge = ObjInlineMarkupMunge(); + static auto mkup = InlineMarkup(); + static auto munge = ObjInlineMarkupMunge(); foreach( m; (contents_am[cntr].text).matchAll( @@ -5115,7 +5117,7 @@ template SiSUdocAbstraction() { int lv, lv0, lv1, lv2, lv3, lv4, lv5, lv6, lv7; int obj_cite_number; int[string] p_; // p_ parent_ - auto rgx = Rgx(); + static auto rgx = Rgx(); ObjGenericComposite node_location_emitter(Lv,Ta,N,C,P,I)( Lv lev_markup_number, Ta segment_anchor_tag, |