diff options
Diffstat (limited to 'src/doc_reform/meta')
-rw-r--r-- | src/doc_reform/meta/metadoc_from_src.d | 160 |
1 files changed, 84 insertions, 76 deletions
diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index 6a10534..99e834d 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -608,7 +608,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.flow_para_match_(an_object, an_object_key, indent, bullet, obj_type_status, line_occur); + an_object = 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"; @@ -756,7 +756,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.flow_para_match_(an_object, an_object_key, indent, bullet, obj_type_status, line_occur); + an_object = 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"; @@ -780,7 +780,7 @@ template DocReformDocAbstraction() { line = line ._doc_header_and_make_substitutions_(conf_make_meta) ._doc_header_and_make_substitutions_fontface_(conf_make_meta); - line.flow_txt_block_quote(an_object, obj_type_status); + an_object = 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 +/ @@ -788,7 +788,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.flow_txt_block_group(an_object, obj_type_status); + an_object = 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 @@ -798,13 +798,13 @@ template DocReformDocAbstraction() { line = line .replaceAll(rgx.spaces_keep, (m.captures[1]).translate([ ' ' : mkup.nbsp ])); } - line.flow_txt_block_block(an_object, obj_type_status); + an_object = line.flow_txt_block_block(an_object, obj_type_status); continue; } else if (obj_type_status["poem"] == TriState.on) { /+ within block object: poem +/ - line.flow_txt_block_poem(an_object, obj_type_status, cntr, object_number_poem, conf_make_meta, tag_in_seg); + an_object = 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.flow_txt_block_table(an_object, obj_type_status, conf_make_meta); + an_object = line.flow_txt_block_table(an_object, obj_type_status, conf_make_meta); continue; } else { /+ not within a block group +/ assert( @@ -848,7 +848,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.flow_book_index_(book_idx_tmp, an_object, obj_type_status, opt_action); + an_object = line.flow_book_index_(an_object, book_idx_tmp, obj_type_status, opt_action); } else { /+ not book_index +/ an_object_key="body_nugget"; if (auto m = line.matchFirst(rgx.comment)) { /+ matched comment +/ @@ -872,7 +872,7 @@ 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.flow_heading_found_(conf_make_meta.make.headings, heading_match_str, heading_match_rgx, obj_type_status); + heading_match_str = line.flow_heading_found_(heading_match_str, conf_make_meta.make.headings, heading_match_rgx, obj_type_status); } if ((obj_type_status["make_headings"] == State.on) && ((line_occur["para"] == State.off) @@ -889,13 +889,13 @@ template DocReformDocAbstraction() { +/ if (line.matchFirst(rgx.heading)) { /+ heading match +/ line = line._doc_header_and_make_substitutions_(conf_make_meta); - line.flow_heading_matched_(line_occur, an_object, an_object_key, lv, collapsed_lev, obj_type_status, conf_make_meta); + an_object = line.flow_heading_matched_(an_object, line_occur, 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.flow_para_match_(an_object, an_object_key, indent, bullet, obj_type_status, line_occur); + an_object = 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) { @@ -915,10 +915,9 @@ template DocReformDocAbstraction() { } } } else if (obj_type_status["blocks"] == TriState.closing) { /+ line empty, with blocks flag +/ - flow_block_flag_line_empty_( - bookindex_extract_hash, - line, + an_object = line.flow_block_flag_line_empty_( an_object, + bookindex_extract_hash, the_document_body_section, bookindex_unordered_hashes, obj_cite_digits, @@ -2731,9 +2730,9 @@ template DocReformDocAbstraction() { obj_type_status["tic_table"] = TriState.on; } } - void flow_txt_block_quote(L,O,T)( + auto flow_txt_block_quote(L,O,T)( L line, - return ref O an_object, + O an_object, return ref T obj_type_status ) { debug(asserts) { @@ -2773,10 +2772,11 @@ template DocReformDocAbstraction() { an_object[an_object_key] ~= line ~= "\n"; // build quote array (or string) } } + return an_object; } - void flow_txt_block_group(L,O,T)( + auto flow_txt_block_group(L,O,T)( L line, - return ref O an_object, + O an_object, return ref T obj_type_status ) { debug(asserts) { @@ -2816,10 +2816,11 @@ template DocReformDocAbstraction() { an_object[an_object_key] ~= line ~= "\n"; // build group array (or string) } } + return an_object; } - void flow_txt_block_block(L,O,T)( + auto flow_txt_block_block(L,O,T)( L line, - return ref O an_object, + O an_object, return ref T obj_type_status ) { debug(asserts) { @@ -2859,10 +2860,11 @@ template DocReformDocAbstraction() { an_object[an_object_key] ~= line ~= "\n"; // build block array (or string) } } + return an_object; } - void flow_txt_block_poem(L,O,T,C,N,CMM,Ts)( + auto flow_txt_block_poem(L,O,T,C,N,CMM,Ts)( L line, - return ref O an_object, + O an_object, return ref T obj_type_status, return ref C cntr, N object_number_poem, @@ -3107,6 +3109,7 @@ template DocReformDocAbstraction() { } } } + return an_object; } void flow_txt_block_code(L,O,T)( L line, @@ -3155,9 +3158,9 @@ template DocReformDocAbstraction() { } } } - void flow_txt_block_table(L,O,T,CMM)( + auto flow_txt_block_table(L,O,T,CMM)( L line, - return ref O an_object, + O an_object, return ref T obj_type_status, return ref CMM conf_make_meta, ) { @@ -3186,8 +3189,7 @@ template DocReformDocAbstraction() { obj_type_status["blocks"] = TriState.off; obj_type_status["table"] = TriState.off; obj_type_status["curly_table_special_markup"] = TriState.off; - flow_table_closed_make_special_notation_table_( - line, + line.flow_table_closed_make_special_notation_table_( an_object, the_document_body_section, obj_cite_digits, @@ -3217,6 +3219,7 @@ template DocReformDocAbstraction() { an_object[an_object_key] ~= line ~= "\n"; // build table array (or string) } } + return an_object; } final string biblio_tag_map(A)(A abr) { debug(asserts) { @@ -3370,7 +3373,7 @@ template DocReformDocAbstraction() { } } void flow_table_closed_make_special_notation_table_(N,CMM)( - char[] line, + char[] line, return ref string[string] an_object, return ref ObjGenericComposite[] the_document_body_section, return ref N obj_cite_digits, @@ -3379,41 +3382,41 @@ template DocReformDocAbstraction() { return ref int[string] obj_type_status, CMM conf_make_meta ) { - comp_obj_block = comp_obj_block.init; - obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]); - auto comp_obj_location - = node_construct.node_location_emitter( - content_non_header, - tag_in_seg, - lev_anchor_tag, - tag_assoc, - obj_cite_digits, - cntr, - heading_ptr-1, - "table" - ); - an_object["is"] = "table"; - auto substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, "body_nugget", conf_make_meta, No._new_doc); - an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; - comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; - comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; - comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; - comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; - 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.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; + comp_obj_block = comp_obj_block.init; + obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]); + auto comp_obj_location + = node_construct.node_location_emitter( + content_non_header, + tag_in_seg, + lev_anchor_tag, + tag_assoc, + obj_cite_digits, + cntr, + heading_ptr-1, + "table" + ); + an_object["is"] = "table"; + auto substantive_obj_misc_tuple + = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, "body_nugget", conf_make_meta, No._new_doc); + an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; + comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; + comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; + comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; + comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; + 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.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 flow_block_flag_line_empty_(B,N,CMM,Ts)( - B bookindex_extract_hash, - char[] line, - return ref string[string] an_object, + auto flow_block_flag_line_empty_(B,N,CMM,Ts)( + char[] line, + string[string] an_object, + B bookindex_extract_hash, return ref ObjGenericComposite[] the_document_body_section, return ref string[][string][string] bookindex_unordered_hashes, return ref N obj_cite_digits, @@ -3716,13 +3719,14 @@ template DocReformDocAbstraction() { processing.remove("verse"); ++cntr; } + return an_object; } auto flow_book_index_(L,I,O,T,B)( - L line, - return ref I book_idx_tmp, - return ref O an_object, + L line, + O an_object, + I book_idx_tmp, return ref T obj_type_status, - B opt_action, + B opt_action, ) { debug(asserts) { static assert(is(typeof(line) == char[])); @@ -3771,11 +3775,12 @@ template DocReformDocAbstraction() { } } } + return an_object; } - auto flow_heading_found_(L,X,H,R,T)( - L line, - X _make_unmarked_headings, - return ref H heading_match_str, + auto flow_heading_found_(L,H,X,R,T)( + L line, + H heading_match_str, + X _make_unmarked_headings, return ref R heading_match_rgx, return ref T obj_type_status ) { @@ -3858,6 +3863,7 @@ template DocReformDocAbstraction() { } obj_type_status["make_headings"] = State.on; } + return heading_match_str; } auto flow_heading_make_set_(L,C,R,T)( L line, @@ -3923,8 +3929,8 @@ template DocReformDocAbstraction() { } auto flow_heading_matched_(L,C,O,K,Lv,Lc,T,CMM)( L line, + O an_object, return ref C line_occur, - return ref O an_object, return ref K an_object_key, return ref Lv lv, return ref Lc collapsed_lev, @@ -4074,10 +4080,11 @@ template DocReformDocAbstraction() { writeln(line.strip); } } + return an_object; } - void flow_para_match_(L,O,K,I,B,T,C)( + auto flow_para_match_(L,O,K,I,B,T,C)( L line, - return ref O an_object, + O an_object, return ref K an_object_key, return ref I indent, return ref B bullet, @@ -4119,7 +4126,7 @@ template DocReformDocAbstraction() { debug(paraindenthang) { writeln(line); } - indent=[ + indent = [ "hang_position" : (m["hang"]).to!int, "base_position" : (m["indent"]).to!int, ]; @@ -4127,7 +4134,7 @@ template DocReformDocAbstraction() { debug(parabulletindent) { writeln(line); } - indent=[ + indent = [ "hang_position" : (m["indent"]).to!int, "base_position" : (m["indent"]).to!int, ]; @@ -4135,6 +4142,7 @@ template DocReformDocAbstraction() { } ++line_occur["para"]; } + return an_object; } auto font_faces_line(T)( T textline, @@ -5430,7 +5438,7 @@ template DocReformDocAbstraction() { } struct BookIndexReportIndent { int mkn, skn; - auto bookindex_report_indented(BI)( + void bookindex_report_indented(BI)( BI bookindex_unordered_hashes ) { debug(asserts) { @@ -5461,7 +5469,7 @@ template DocReformDocAbstraction() { int mkn, skn; static auto rgx = Rgx(); static auto munge = ObjInlineMarkupMunge(); - auto bookindex_write_section(BI)( + void bookindex_write_section(BI)( BI bookindex_unordered_hashes ) { auto mainkeys = |