diff options
author | Ralph Amissah <ralph@amissah.com> | 2016-10-11 17:31:01 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:13 -0400 |
commit | c22e8bf5e062a4efd9a4d4867582a34ad159d655 (patch) | |
tree | f8116b4c4f6bccb7ded64effbcffd494f2fe83ed /src | |
parent | 0.7.1 re-arranging for unittests; tuple tests; read in files; obt (diff) |
naming convention: _functions_ using ref identified with _underscore_
Diffstat (limited to 'src')
-rw-r--r-- | src/sdp/ao_abstract_doc_source.d | 100 |
1 files changed, 56 insertions, 44 deletions
diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d index d97b1b0..1f0ac7b 100644 --- a/src/sdp/ao_abstract_doc_source.d +++ b/src/sdp/ao_abstract_doc_source.d @@ -209,11 +209,11 @@ template SiSUdocAbstraction() { } } if (!line.empty) { - check_obj_cite_number_status(line, type); + _check_obj_cite_number_status_(line, type); } if (type["code"] == TriState.on) { /+ block object: code +/ - code_block(line, an_object, type); + _code_block_(line, an_object, type); continue; } else if (!matchFirst(line, rgx.skip_from_regular_parse)) { /+ object other than "code block" object @@ -223,7 +223,7 @@ template SiSUdocAbstraction() { && (!matchFirst(line, rgx.heading)) && (!matchFirst(line, rgx.comment))) { /+ within block object: biblio +/ - biblio_block(line, type, bib_entry, biblio_entry_str_json, biblio_arr_json); + _biblio_block_(line, type, bib_entry, biblio_entry_str_json, biblio_arr_json); debug(bibliobuild) { writeln("- ", biblio_entry_str_json); writeln("-> ", biblio_arr_json.length); @@ -231,24 +231,24 @@ template SiSUdocAbstraction() { continue; } else if (type["poem"] == TriState.on) { /+ within block object: poem +/ - poem_block(line, an_object, type, counter, obj_cite_number_poem, dochead_make_aa); + _poem_block_(line, an_object, type, counter, obj_cite_number_poem, dochead_make_aa); continue; /+ within block object: group +/ } else if (type["group"] == TriState.on) { /+ within block object: group +/ - group_block(line, an_object, type); + _group_block_(line, an_object, type); continue; } else if (type["block"] == TriState.on) { /+ within block object: block +/ - block_block(line, an_object, type); + _block_block_(line, an_object, type); continue; } else if (type["quote"] == TriState.on) { /+ within block object: quote +/ - quote_block(line, an_object, type); + _quote_block_(line, an_object, type); continue; } else if (type["table"] == TriState.on) { /+ within block object: table +/ - table_block(line, an_object, type); + _table_block_(line, an_object, type); continue; } else { /+ not within a block group +/ @@ -265,7 +265,7 @@ template SiSUdocAbstraction() { processing.remove("verse"); obj_cite_number_poem["start"] = to!string(obj_cite_number); } - start_block(line, type, obj_cite_number_poem); + _start_block_(line, type, obj_cite_number_poem); continue; } else if (!line.empty) { /+ line not empty +/ @@ -295,7 +295,7 @@ template SiSUdocAbstraction() { || (matchFirst(line, rgx.book_index_open)) || (type["book_index"] == State.on )) { /+ book_index +/ - book_index(line, book_idx_tmp, an_object, type); + _book_index_(line, book_idx_tmp, an_object, type); } else { /+ not book_index +/ if (auto m = matchFirst(line, rgx.comment)) { @@ -306,7 +306,7 @@ template SiSUdocAbstraction() { an_object["obj"] ~= line ~= "\n"; contents_the_objects ~= set_abstract_object.contents_comment(strip(an_object["obj"])); - header_set_common(line_occur, an_object, type); + _header_set_common_(line_occur, an_object, type); processing.remove("verse"); ++counter; } else if (((line_occur["para"] == State.off) @@ -317,9 +317,7 @@ template SiSUdocAbstraction() { if ((dochead_make_aa["make"]["headings"].length > 2) && (type["make_headings"] == State.off)) { /+ heading found +/ - auto dochead_make_headings = - dochead_make_aa["make"]["headings"]; - heading_found(line, dochead_make_headings, heading_match_str, heading_match_rgx, type); + _heading_found_(line, dochead_make_aa["make"]["headings"], heading_match_str, heading_match_rgx, type); } if ((type["make_headings"] == State.on) && ((line_occur["para"] == State.off) @@ -327,14 +325,14 @@ template SiSUdocAbstraction() { && ((type["para"] == State.off) && (type["heading"] == State.off))) { /+ heading make set +/ - heading_make_set(line, line_occur, heading_match_rgx, type); + _heading_make_set_(line, line_occur, heading_match_rgx, type); } if (matchFirst(line, rgx.heading)) { /+ heading match +/ - heading_matched(line, line_occur, an_object, lv, collapsed_lev, type, dochead_meta_aa); + _heading_matched_(line, line_occur, an_object, lv, collapsed_lev, type, dochead_meta_aa); } else if (line_occur["para"] == State.off) { /+ para match +/ - para_match(line, an_object, indent, bullet, type, line_occur); + _para_match_(line, an_object, indent, bullet, type, line_occur); } } else if (line_occur["heading"] > State.off) { /+ heading +/ @@ -354,7 +352,7 @@ template SiSUdocAbstraction() { } } else if (type["blocks"] == TriState.closing) { /+ line empty, with blocks flag +/ - block_flag_line_empty(line, an_object, contents_the_objects, bookindex_unordered_hashes, obj_cite_number, node, counter, type, obj_cite_number_poem, dochead_make_aa); // watch + _block_flag_line_empty_(line, an_object, contents_the_objects, bookindex_unordered_hashes, obj_cite_number, node, counter, type, obj_cite_number_poem, dochead_make_aa); // watch } else { /+ line empty +/ /+ line.empty, post contents, empty variables: +/ @@ -408,7 +406,7 @@ template SiSUdocAbstraction() { // writeln(contents_am[counter]["obj_cite_number"], " ", contents_am[counter]["obj"]); // writeln(m.hit, "\n"); } - header_set_common(line_occur, an_object, type); + _header_set_common_(line_occur, an_object, type); an_object.remove("lev"); an_object.remove("lev_markup_number"); // an_object["lev_markup_number"]="9"; @@ -452,7 +450,7 @@ template SiSUdocAbstraction() { // indent, // bullet // ); - header_set_common(line_occur, an_object, type); + _header_set_common_(line_occur, an_object, type); indent["hang_position"] = "0"; indent["base_position"] = "0"; bullet = false; @@ -525,7 +523,7 @@ template SiSUdocAbstraction() { // destroy(biblio_arr_json); auto biblio = Bibliography(); auto biblio_ordered = - biblio.bibliography(biblio_unsorted_incomplete, bib_arr_json); + biblio._bibliography_(biblio_unsorted_incomplete, bib_arr_json); auto bi = BookIndexReportSection(); auto bi_tuple = bi.bookindex_build_section(bookindex_unordered_hashes, obj_cite_number); @@ -555,7 +553,7 @@ template SiSUdocAbstraction() { an_object.remove("attrib"); an_object.remove("bookindex"); } - auto header_set_common( + auto _header_set_common_( ref int[string] line_occur, ref string[string] an_object, ref int[string] type @@ -567,7 +565,10 @@ template SiSUdocAbstraction() { type["para"] = State.off; object_reset(an_object); } - void check_obj_cite_number_status(char[] line, ref int[string] type) { + void _check_obj_cite_number_status_( + char[] line, + ref int[string] type + ) { if ((!line.empty) && (type["obj_cite_number_status_multi_obj"] == TriState.off)) { /+ not multi-line object, check whether obj_cite_number is on or turned off +/ if (matchFirst(line, rgx.obj_cite_number_block_marks)) { @@ -609,7 +610,7 @@ template SiSUdocAbstraction() { } } } - void start_block( + void _start_block_( char[] line, ref int[string] type, string[string] obj_cite_number_poem @@ -753,7 +754,7 @@ template SiSUdocAbstraction() { type["tic_table"] = TriState.on; } } - void code_block( + void _code_block_( char[] line, ref string[string] an_object, ref int[string] type @@ -807,7 +808,7 @@ template SiSUdocAbstraction() { ]; return btm[abr]; } - void biblio_block( + void _biblio_block_( char[] line, ref int[string] type, ref int bib_entry, @@ -928,7 +929,7 @@ template SiSUdocAbstraction() { header_tag_value=""; } } - void poem_block( + void _poem_block_( char[] line, ref string[string] an_object, ref int[string] type, @@ -1125,7 +1126,7 @@ template SiSUdocAbstraction() { } } } - void group_block( + void _group_block_( char[] line, ref string[string] an_object, ref int[string] type @@ -1160,7 +1161,7 @@ template SiSUdocAbstraction() { } } } - void block_block( + void _block_block_( char[] line, ref string[string] an_object, ref int[string] type @@ -1195,7 +1196,11 @@ template SiSUdocAbstraction() { } } } - void quote_block(char[] line, ref string[string] an_object, ref int[string] type) { + void _quote_block_( + char[] line, + ref string[string] an_object, + ref int[string] type + ) { if (type["curly_quote"] == TriState.on) { if (matchFirst(line, rgx.block_curly_quote_close)) { debug(quote) { // quote (curly) close @@ -1226,7 +1231,11 @@ template SiSUdocAbstraction() { } } } - void table_block(char[] line, ref string[string] an_object, ref int[string] type) { + void _table_block_( + char[] line, + ref string[string] an_object, + ref int[string] type + ) { if (type["curly_table"] == TriState.on) { if (matchFirst(line, rgx.block_curly_table_close)) { debug(table) { // table (curly) close @@ -1257,7 +1266,7 @@ template SiSUdocAbstraction() { } } } - void block_flag_line_empty( + void _block_flag_line_empty_( char[] line, ref string[string] an_object, ref ObjComposite[] contents_the_objects, @@ -1478,7 +1487,7 @@ template SiSUdocAbstraction() { type["quote"] = TriState.off; } } - auto book_index( + auto _book_index_( char[] line, ref string book_idx_tmp, ref string[string] an_object, @@ -1523,22 +1532,22 @@ template SiSUdocAbstraction() { } } } - auto heading_found( + auto _heading_found_( char[] line, - string dochead_make_headings, + string dochead_make_identify_unmarked_headings, ref string[string] heading_match_str, ref Regex!(char)[string] heading_match_rgx, ref int[string] type ) { - if ((dochead_make_headings.length > 2) + if ((dochead_make_identify_unmarked_headings.length > 2) && (type["make_headings"] == State.off)) { /+ headings found +/ debug(headingsfound) { - writeln(dochead_make_headings); + writeln(dochead_make_identify_unmarked_headings); } char[][] make_headings_spl = split( - cast(char[]) dochead_make_headings, + cast(char[]) dochead_make_identify_unmarked_headings, rgx.make_heading_delimiter); debug(headingsfound) { writeln(make_headings_spl.length); @@ -1607,7 +1616,7 @@ template SiSUdocAbstraction() { type["make_headings"] = State.on; } } - auto heading_make_set( + auto _heading_make_set_( ref char[] line, ref int[string] line_occur, ref Regex!(char)[string] heading_match_rgx, @@ -1663,7 +1672,7 @@ template SiSUdocAbstraction() { } } } - auto heading_matched( + auto _heading_matched_( char[] line, ref int[string] line_occur, ref string[string] an_object, @@ -1802,7 +1811,7 @@ template SiSUdocAbstraction() { } } } - auto para_match( + auto _para_match_( char[] line, ref string[string] an_object, ref string[string] indent, @@ -2851,11 +2860,14 @@ template SiSUdocAbstraction() { } } struct Bibliography { - public JSONValue[] bibliography(ref string[] biblio_unsorted_incomplete, ref JSONValue[] bib_arr_json) + public JSONValue[] _bibliography_( + ref string[] biblio_unsorted_incomplete, + ref JSONValue[] bib_arr_json + ) in { } body { JSONValue[] biblio_unsorted = - biblio_unsorted_complete(biblio_unsorted_incomplete, bib_arr_json); + _biblio_unsorted_complete_(biblio_unsorted_incomplete, bib_arr_json); JSONValue[] biblio_sorted__ = biblio_sort(biblio_unsorted); biblio_debug(biblio_sorted__); debug(biblio0) { @@ -2874,7 +2886,7 @@ template SiSUdocAbstraction() { } return biblio_sorted__; } - final private JSONValue[] biblio_unsorted_complete( + final private JSONValue[] _biblio_unsorted_complete_( string[] biblio_unordered, ref JSONValue[] bib_arr_json ) { |