aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2019-05-04 14:16:24 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2019-05-21 12:03:47 -0400
commit7181cdf206d2dc9da39e2c3afcebb7c47baace99 (patch)
tree596784d0dde42cfabc79f2ad6b0f0172c99ba265 /src
parenta regex & some clearing (diff)
flow, rename functions with multiple return values
Diffstat (limited to 'src')
-rw-r--r--src/doc_reform/meta/metadoc_from_src.d106
1 files changed, 53 insertions, 53 deletions
diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d
index a057ec7..801ebba 100644
--- a/src/doc_reform/meta/metadoc_from_src.d
+++ b/src/doc_reform/meta/metadoc_from_src.d
@@ -490,7 +490,7 @@ template DocReformDocAbstraction() {
}
if (obj_type_status["code"] == TriState.on) {
/+ block object: code +/
- line.txt_block_code(an_object, obj_type_status);
+ line.flow_txt_block_code(an_object, obj_type_status);
continue;
} else if (!matchFirst(line, rgx.skip_from_regular_parse)) { /+ object other than "code block" object +/
/+ (includes regular text paragraph, headings & blocks other than code) +/
@@ -512,7 +512,7 @@ template DocReformDocAbstraction() {
obj_type_status["biblio_section"] = State.on;
obj_type_status["blurb_section"] = State.off;
if (opt_action.backmatter && opt_action.section_biblio) {
- line.txt_block_biblio(obj_type_status, bib_entry, biblio_entry_str_json, biblio_arr_json);
+ line.flow_txt_block_biblio(obj_type_status, bib_entry, biblio_entry_str_json, biblio_arr_json);
debug(bibliobuild) {
writeln("- ", biblio_entry_str_json);
writeln("-> ", biblio_arr_json.length);
@@ -596,7 +596,7 @@ template DocReformDocAbstraction() {
tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html;
tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub;
} else {
- line._para_match_(an_object, an_object_key, indent, bullet, obj_type_status, line_occur);
+ line.flow_para_match_(an_object, an_object_key, indent, bullet, obj_type_status, line_occur);
comp_obj_para = comp_obj_para.init;
comp_obj_para.metainfo.is_of_part = "backmatter";
comp_obj_para.metainfo.is_of_section = "glossary";
@@ -744,7 +744,7 @@ template DocReformDocAbstraction() {
tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html;
tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub;
} else {
- line._para_match_(an_object, an_object_key, indent, bullet, obj_type_status, line_occur);
+ line.flow_para_match_(an_object, an_object_key, indent, bullet, obj_type_status, line_occur);
comp_obj_para = comp_obj_para.init;
comp_obj_para.metainfo.is_of_part = "backmatter";
comp_obj_para.metainfo.is_of_section = "blurb";
@@ -768,7 +768,7 @@ template DocReformDocAbstraction() {
line = line
._doc_header_and_make_substitutions_(conf_make_meta)
._doc_header_and_make_substitutions_fontface_(conf_make_meta);
- line.txt_block_quote(an_object, obj_type_status);
+ line.flow_txt_block_quote(an_object, obj_type_status);
continue;
/+ within block object: group +/
} else if (obj_type_status["group"] == TriState.on) { /+ within block object: group +/
@@ -776,7 +776,7 @@ template DocReformDocAbstraction() {
._doc_header_and_make_substitutions_(conf_make_meta)
._doc_header_and_make_substitutions_fontface_(conf_make_meta)
.replaceAll(rgx.para_delimiter, mkup.br_paragraph ~ "$1");
- line.txt_block_group(an_object, obj_type_status);
+ line.flow_txt_block_group(an_object, obj_type_status);
continue;
} else if (obj_type_status["block"] == TriState.on) { /+ within block object: block +/
line = line
@@ -786,13 +786,13 @@ template DocReformDocAbstraction() {
line = line
.replaceAll(rgx.spaces_keep, (m.captures[1]).translate([ ' ' : mkup.nbsp ]));
}
- line.txt_block_block(an_object, obj_type_status);
+ line.flow_txt_block_block(an_object, obj_type_status);
continue;
} else if (obj_type_status["poem"] == TriState.on) { /+ within block object: poem +/
- line.txt_block_poem(an_object, obj_type_status, cntr, object_number_poem, conf_make_meta, tag_in_seg);
+ line.flow_txt_block_poem(an_object, obj_type_status, cntr, object_number_poem, conf_make_meta, tag_in_seg);
continue;
} else if (obj_type_status["table"] == TriState.on) { /+ within block object: table +/
- line.txt_block_table(an_object, obj_type_status, conf_make_meta);
+ line.flow_txt_block_table(an_object, obj_type_status, conf_make_meta);
continue;
} else { /+ not within a block group +/
assert(
@@ -807,7 +807,7 @@ template DocReformDocAbstraction() {
processing.remove("verse");
object_number_poem["start"] = obj_cite_digits.object_number.to!string;
}
- line.txt_block_start(obj_type_status, object_number_poem);
+ line.flow_txt_block_start(obj_type_status, object_number_poem);
continue;
} else if (!line.empty) { /+ line not empty +/
/+ non blocks (headings, paragraphs) & closed blocks +/
@@ -836,7 +836,7 @@ template DocReformDocAbstraction() {
if (line.matchFirst(rgx.book_index)
|| line.matchFirst(rgx.book_index_open)
|| obj_type_status["book_index"] == State.on ) { /+ book_index +/
- line._book_index_(book_idx_tmp, an_object, obj_type_status, opt_action);
+ line.flow_book_index_(book_idx_tmp, an_object, obj_type_status, opt_action);
} else { /+ not book_index +/
an_object_key="body_nugget";
if (auto m = line.matchFirst(rgx.comment)) { /+ matched comment +/
@@ -851,7 +851,7 @@ template DocReformDocAbstraction() {
comp_obj_comment.metainfo.is_a = "comment";
comp_obj_comment.text = an_object[an_object_key].strip;
the_document_body_section ~= comp_obj_comment;
- _common_reset_(line_occur, an_object, obj_type_status);
+ flow_common_reset_(line_occur, an_object, obj_type_status);
processing.remove("verse");
++cntr;
} else if (((line_occur["para"] == State.off)
@@ -860,14 +860,14 @@ template DocReformDocAbstraction() {
&& (obj_type_status["heading"] == State.off))) { /+ heading or para but neither flag nor line exists +/
if ((conf_make_meta.make.headings.length > 2)
&& (obj_type_status["make_headings"] == State.off)) { /+ heading found +/
- line._heading_found_(conf_make_meta.make.headings, heading_match_str, heading_match_rgx, obj_type_status);
+ line.flow_heading_found_(conf_make_meta.make.headings, heading_match_str, heading_match_rgx, obj_type_status);
}
if ((obj_type_status["make_headings"] == State.on)
&& ((line_occur["para"] == State.off)
&& (line_occur["heading"] == State.off))
&& ((obj_type_status["para"] == State.off)
&& (obj_type_status["heading"] == State.off))) { /+ heading make set +/
- line = line._heading_make_set_(line_occur, heading_match_rgx, obj_type_status);
+ line = line.flow_heading_make_set_(line_occur, heading_match_rgx, obj_type_status);
}
/+ TODO node info: all headings identified at this point,
- extract node info here??
@@ -877,13 +877,13 @@ template DocReformDocAbstraction() {
+/
if (line.matchFirst(rgx.heading)) { /+ heading match +/
line = line._doc_header_and_make_substitutions_(conf_make_meta);
- line._heading_matched_(line_occur, an_object, an_object_key, lv, collapsed_lev, obj_type_status, conf_make_meta);
+ line.flow_heading_matched_(line_occur, an_object, an_object_key, lv, collapsed_lev, obj_type_status, conf_make_meta);
} else if (line_occur["para"] == State.off) { /+ para match +/
an_object_key="body_nugget";
line = line
._doc_header_and_make_substitutions_(conf_make_meta)
._doc_header_and_make_substitutions_fontface_(conf_make_meta);
- line._para_match_(an_object, an_object_key, indent, bullet, obj_type_status, line_occur);
+ line.flow_para_match_(an_object, an_object_key, indent, bullet, obj_type_status, line_occur);
}
} else if (line_occur["heading"] > State.off) { /+ heading +/
debug(heading) {
@@ -903,7 +903,7 @@ template DocReformDocAbstraction() {
}
}
} else if (obj_type_status["blocks"] == TriState.closing) { /+ line empty, with blocks flag +/
- _block_flag_line_empty_(
+ flow_block_flag_line_empty_(
bookindex_extract_hash,
line,
an_object,
@@ -1004,7 +1004,7 @@ template DocReformDocAbstraction() {
= bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_digits, tag_in_seg);
/+ (incrementally build toc) table of contents here! +/
_anchor_tag = obj_cite_digits.identifier;
- the_table_of_contents_section = obj_im.table_of_contents_gather_headings(
+ the_table_of_contents_section = obj_im.flow_table_of_contents_gather_headings(
an_object,
conf_make_meta,
tag_in_seg,
@@ -1049,7 +1049,7 @@ template DocReformDocAbstraction() {
debug(objectrelated1) { // check
writeln(line);
}
- _common_reset_(line_occur, an_object, obj_type_status);
+ flow_common_reset_(line_occur, an_object, obj_type_status);
an_object.remove("lev");
an_object.remove("lev_markup_number");
processing.remove("verse");
@@ -1105,7 +1105,7 @@ template DocReformDocAbstraction() {
comp_obj_para.has.image_without_dimensions = substantive_obj_misc_tuple[sObj.image_no_dimensions];
the_document_body_section ~= comp_obj_para;
tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc);
- _common_reset_(line_occur, an_object, obj_type_status);
+ flow_common_reset_(line_occur, an_object, obj_type_status);
indent=[
"hang_position" : 0,
"base_position" : 0,
@@ -1207,7 +1207,7 @@ template DocReformDocAbstraction() {
auto biblio_unsorted_incomplete = biblio_arr_json.dup;
auto biblio = Bibliography();
auto biblio_ordered
- = biblio._bibliography_(biblio_unsorted_incomplete, bib_arr_json);
+ = biblio.flow_bibliography_(biblio_unsorted_incomplete, bib_arr_json);
if (biblio_ordered.length > 0) {
comp_obj_heading_ = comp_obj_heading_.init;
comp_obj_heading_.metainfo.is_of_part = "backmatter";
@@ -2358,7 +2358,7 @@ template DocReformDocAbstraction() {
an_object.remove("bookindex_nugget");
return an_object;
}
- auto _common_reset_(L,O,T)(
+ auto flow_common_reset_(L,O,T)(
return ref L line_occur,
return ref O an_object,
return ref T obj_type_status
@@ -2483,7 +2483,7 @@ template DocReformDocAbstraction() {
}
return line;
}
- void txt_block_start(L,T,N)(
+ void flow_txt_block_start(L,T,N)(
L line,
return ref T obj_type_status,
return ref N object_number_poem
@@ -2638,7 +2638,7 @@ template DocReformDocAbstraction() {
obj_type_status["tic_table"] = TriState.on;
}
}
- void txt_block_quote(L,O,T)(
+ void flow_txt_block_quote(L,O,T)(
L line,
return ref O an_object,
return ref T obj_type_status
@@ -2681,7 +2681,7 @@ template DocReformDocAbstraction() {
}
}
}
- void txt_block_group(L,O,T)(
+ void flow_txt_block_group(L,O,T)(
L line,
return ref O an_object,
return ref T obj_type_status
@@ -2724,7 +2724,7 @@ template DocReformDocAbstraction() {
}
}
}
- void txt_block_block(L,O,T)(
+ void flow_txt_block_block(L,O,T)(
L line,
return ref O an_object,
return ref T obj_type_status
@@ -2767,7 +2767,7 @@ template DocReformDocAbstraction() {
}
}
}
- void txt_block_poem(L,O,T,C,N,CMM,Ts)(
+ void flow_txt_block_poem(L,O,T,C,N,CMM,Ts)(
L line,
return ref O an_object,
return ref T obj_type_status,
@@ -3015,7 +3015,7 @@ template DocReformDocAbstraction() {
}
}
}
- void txt_block_code(L,O,T)(
+ void flow_txt_block_code(L,O,T)(
L line,
return ref O an_object,
return ref T obj_type_status
@@ -3062,7 +3062,7 @@ template DocReformDocAbstraction() {
}
}
}
- void txt_block_table(L,O,T,CMM)(
+ void flow_txt_block_table(L,O,T,CMM)(
L line,
return ref O an_object,
return ref T obj_type_status,
@@ -3093,7 +3093,7 @@ template DocReformDocAbstraction() {
obj_type_status["blocks"] = TriState.off;
obj_type_status["table"] = TriState.off;
obj_type_status["curly_table_special_markup"] = TriState.off;
- _table_closed_make_special_notation_table_(
+ flow_table_closed_make_special_notation_table_(
line,
an_object,
the_document_body_section,
@@ -3147,7 +3147,7 @@ template DocReformDocAbstraction() {
];
return btm[abr];
}
- void txt_block_biblio(
+ void flow_txt_block_biblio(
char[] line,
return ref int[string] obj_type_status,
return ref int bib_entry,
@@ -3276,7 +3276,7 @@ template DocReformDocAbstraction() {
header_tag_value="";
}
}
- void _table_closed_make_special_notation_table_(N,CMM)(
+ void flow_table_closed_make_special_notation_table_(N,CMM)(
char[] line,
return ref string[string] an_object,
return ref ObjGenericComposite[] the_document_body_section,
@@ -3310,14 +3310,14 @@ template DocReformDocAbstraction() {
comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"];
comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx;
comp_obj_block.metainfo.object_number_type = obj_cite_digits.type;
- comp_obj_block = comp_obj_block.table_instructions(an_object["table_head"]);
- comp_obj_block = comp_obj_block.table_substantive_munge_special(an_object["substantive"]);
+ comp_obj_block = comp_obj_block.flow_table_instructions(an_object["table_head"]);
+ comp_obj_block = comp_obj_block.flow_table_substantive_munge_special(an_object["substantive"]);
the_document_body_section ~= comp_obj_block;
object_reset(an_object);
processing.remove("verse");
++cntr;
}
- void _block_flag_line_empty_(B,N,CMM,Ts)(
+ void flow_block_flag_line_empty_(B,N,CMM,Ts)(
B bookindex_extract_hash,
char[] line,
return ref string[string] an_object,
@@ -3606,8 +3606,8 @@ template DocReformDocAbstraction() {
comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"];
comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx;
comp_obj_block.metainfo.object_number_type = obj_cite_digits.type;
- comp_obj_block = comp_obj_block.table_instructions(an_object["table_head"]);
- comp_obj_block = comp_obj_block.table_substantive_munge(an_object["substantive"]);
+ comp_obj_block = comp_obj_block.flow_table_instructions(an_object["table_head"]);
+ comp_obj_block = comp_obj_block.flow_table_substantive_munge(an_object["substantive"]);
the_document_body_section ~= comp_obj_block;
obj_type_status["blocks"] = TriState.off;
obj_type_status["table"] = TriState.off;
@@ -3616,7 +3616,7 @@ template DocReformDocAbstraction() {
++cntr;
}
}
- auto _book_index_(L,I,O,T,B)(
+ auto flow_book_index_(L,I,O,T,B)(
L line,
return ref I book_idx_tmp,
return ref O an_object,
@@ -3671,7 +3671,7 @@ template DocReformDocAbstraction() {
}
}
}
- auto _heading_found_(L,X,H,R,T)(
+ auto flow_heading_found_(L,X,H,R,T)(
L line,
X _make_unmarked_headings,
return ref H heading_match_str,
@@ -3758,7 +3758,7 @@ template DocReformDocAbstraction() {
obj_type_status["make_headings"] = State.on;
}
}
- auto _heading_make_set_(L,C,R,T)(
+ auto flow_heading_make_set_(L,C,R,T)(
L line,
C line_occur,
return ref R heading_match_rgx,
@@ -3820,7 +3820,7 @@ template DocReformDocAbstraction() {
}
return line;
}
- auto _heading_matched_(L,C,O,K,Lv,Lc,T,CMM)(
+ auto flow_heading_matched_(L,C,O,K,Lv,Lc,T,CMM)(
L line,
return ref C line_occur,
return ref O an_object,
@@ -3974,7 +3974,7 @@ template DocReformDocAbstraction() {
}
}
}
- void _para_match_(L,O,K,I,B,T,C)(
+ void flow_para_match_(L,O,K,I,B,T,C)(
L line,
return ref O an_object,
return ref K an_object_key,
@@ -4049,7 +4049,7 @@ template DocReformDocAbstraction() {
}
return textline;
}
- auto table_instructions(O,H)(
+ auto flow_table_instructions(O,H)(
return ref O table_object,
return ref H table_head,
) {
@@ -4074,7 +4074,7 @@ template DocReformDocAbstraction() {
}
return table_object;
}
- auto table_array_munge(O,T)(
+ auto flow_table_array_munge(O,T)(
return ref O table_object,
return ref T table_array,
) {
@@ -4198,7 +4198,7 @@ template DocReformDocAbstraction() {
comp_obj_block.text = _table_substantive;
return table_object;
}
- auto table_substantive_munge(O,T)(
+ auto flow_table_substantive_munge(O,T)(
return ref O table_object,
return ref T table_substantive,
) {
@@ -4211,10 +4211,10 @@ template DocReformDocAbstraction() {
_table_cols = col.split(rgx.table_col_delimiter);
_table ~= _table_cols;
}
- table_object = table_object.table_array_munge(_table);
+ table_object = table_object.flow_table_array_munge(_table);
return table_object;
}
- auto table_substantive_munge_special(O,T)(
+ auto flow_table_substantive_munge_special(O,T)(
return ref O table_object,
return ref T table_substantive,
) {
@@ -4227,7 +4227,7 @@ template DocReformDocAbstraction() {
_table_cols = col.split(rgx.table_col_delimiter_special);
_table ~= _table_cols;
}
- table_object = table_object.table_array_munge(_table);
+ table_object = table_object.flow_table_array_munge(_table);
return table_object;
}
/+ abstraction functions ↑ +/
@@ -4706,7 +4706,7 @@ template DocReformDocAbstraction() {
"");
return heading_toc_;
};
- auto table_of_contents_gather_headings(O,CMM,Ts,Ta,X,Toc)(
+ auto flow_table_of_contents_gather_headings(O,CMM,Ts,Ta,X,Toc)(
O obj_,
CMM conf_make_meta,
Ts tag_in_seg,
@@ -5726,7 +5726,7 @@ template DocReformDocAbstraction() {
}
/+ +/
struct Bibliography {
- public JSONValue[] _bibliography_(Bi,BJ)(
+ public JSONValue[] flow_bibliography_(Bi,BJ)(
return ref Bi biblio_unsorted_incomplete,
return ref BJ bib_arr_json
)
@@ -5738,12 +5738,12 @@ template DocReformDocAbstraction() {
}
body {
JSONValue[] biblio_unsorted
- = _biblio_unsorted_complete_(biblio_unsorted_incomplete, bib_arr_json);
+ = flow_biblio_unsorted_complete_(biblio_unsorted_incomplete, bib_arr_json);
biblio_arr_json = [];
biblio_unsorted_incomplete = [];
JSONValue[] biblio_sorted__ = biblio_sort(biblio_unsorted);
- biblio_debug(biblio_sorted__);
debug(biblio0) {
+ biblio_debug(biblio_sorted__);
writeln("---");
writeln("unsorted incomplete: ", biblio_unsorted_incomplete.length);
writeln("json: ", bib_arr_json.length);
@@ -5758,7 +5758,7 @@ template DocReformDocAbstraction() {
}
return biblio_sorted__;
}
- final private JSONValue[] _biblio_unsorted_complete_(Bi,BJ)(
+ final private JSONValue[] flow_biblio_unsorted_complete_(Bi,BJ)(
Bi biblio_unordered,
return ref BJ bib_arr_json
) {