diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/doc_reform/doc_reform.d | 4 | ||||
-rw-r--r-- | src/doc_reform/meta/metadoc_from_src.d | 138 | ||||
-rw-r--r-- | src/doc_reform/output/epub3.d | 38 | ||||
-rw-r--r-- | src/doc_reform/output/html.d | 68 | ||||
-rw-r--r-- | src/doc_reform/output/hub.d | 8 | ||||
-rw-r--r-- | src/doc_reform/output/sqlite.d | 32 | ||||
-rw-r--r-- | src/doc_reform/output/xmls.d | 291 |
7 files changed, 282 insertions, 297 deletions
diff --git a/src/doc_reform/doc_reform.d b/src/doc_reform/doc_reform.d index 2d93c29..b59743c 100755 --- a/src/doc_reform/doc_reform.d +++ b/src/doc_reform/doc_reform.d @@ -557,7 +557,7 @@ void main(string[] args) { ) { writeln("step5 commence → (process outputs)"); } - outputHub!()(doc_abstraction, doc_matters); + doc_abstraction.outputHub!()(doc_matters); if ((_opt_action.debug_do) || (_opt_action.very_verbose) ) { @@ -637,7 +637,7 @@ void main(string[] args) { ) { writeln("step5 commence → (process outputs)"); } - outputHub!()(doc_abstraction, doc_matters); + doc_abstraction.outputHub!()(doc_matters); if ((_opt_action.debug_do) || (_opt_action.very_verbose) ) { diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index de2df2b..5df5e87 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -438,11 +438,11 @@ template DocReformDocAbstraction() { } } if (!line.empty) { - obj_type_status = _check_ocn_status_(line, obj_type_status); + obj_type_status = line._check_ocn_status_(obj_type_status); } if (obj_type_status["code"] == TriState.on) { /+ block object: code +/ - _code_block_(line, an_object, obj_type_status); + line._code_block_(an_object, obj_type_status); continue; } else if (!matchFirst(line, rgx.skip_from_regular_parse)) { /+ object other than "code block" object @@ -458,7 +458,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) { - _biblio_block_(line, obj_type_status, bib_entry, biblio_entry_str_json, biblio_arr_json); + line._biblio_block_(obj_type_status, bib_entry, biblio_entry_str_json, biblio_arr_json); debug(bibliobuild) { writeln("- ", biblio_entry_str_json); writeln("-> ", biblio_arr_json.length); @@ -534,7 +534,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 { - _para_match_(line, an_object, an_object_key, indent, bullet, obj_type_status, line_occur); + line._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"; @@ -673,7 +673,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 { - _para_match_(line, an_object, an_object_key, indent, bullet, obj_type_status, line_occur); + line._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"; @@ -695,23 +695,23 @@ template DocReformDocAbstraction() { continue; } else if (obj_type_status["quote"] == TriState.on) { /+ within block object: quote +/ - line = _doc_header_and_make_substitutions_(line, conf_make_meta); - line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta); - _quote_block_(line, an_object, obj_type_status); + line = line._doc_header_and_make_substitutions_(conf_make_meta); + line = line._doc_header_and_make_substitutions_fontface_(conf_make_meta); + line._quote_block_(an_object, obj_type_status); continue; /+ within block object: group +/ } else if (obj_type_status["group"] == TriState.on) { /+ within block object: group +/ - line = _doc_header_and_make_substitutions_(line, conf_make_meta); - line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta); + line = line._doc_header_and_make_substitutions_(conf_make_meta); + line = line._doc_header_and_make_substitutions_fontface_(conf_make_meta); line = line .replaceAll(rgx.para_delimiter, mkup.br_paragraph ~ "$1"); - _group_block_(line, an_object, obj_type_status); + line._group_block_(an_object, obj_type_status); continue; } else if (obj_type_status["block"] == TriState.on) { /+ within block object: block +/ - line = _doc_header_and_make_substitutions_(line, conf_make_meta); - line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta); + line = line._doc_header_and_make_substitutions_(conf_make_meta); + line = line._doc_header_and_make_substitutions_fontface_(conf_make_meta); if (auto m = line.match(rgx.spaces_line_start)) { line = line .replaceAll(rgx.spaces_line_start, (m.captures[1]).translate([ ' ' : mkup.nbsp ])); @@ -720,15 +720,15 @@ template DocReformDocAbstraction() { line = line .replaceAll(rgx.spaces_multiple, (m.captures[1]).translate([ ' ' : mkup.nbsp ])); } - _block_block_(line, an_object, obj_type_status); + line._block_block_(an_object, obj_type_status); continue; } else if (obj_type_status["poem"] == TriState.on) { /+ within block object: poem +/ - _poem_block_(line, an_object, obj_type_status, cntr, object_number_poem, conf_make_meta, tag_in_seg); + line._poem_block_(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 +/ - _table_block_(line, an_object, obj_type_status, conf_make_meta); + line._table_block_(an_object, obj_type_status, conf_make_meta); continue; } else { /+ not within a block group +/ @@ -745,7 +745,7 @@ template DocReformDocAbstraction() { processing.remove("verse"); object_number_poem["start"] = obj_cite_digits.object_number.to!string; } - _start_block_(line, obj_type_status, object_number_poem); + line._start_block_(obj_type_status, object_number_poem); continue; } else if (!line.empty) { /+ line not empty +/ @@ -776,7 +776,7 @@ template DocReformDocAbstraction() { || line.matchFirst(rgx.book_index_open) || obj_type_status["book_index"] == State.on ) { /+ book_index +/ - _book_index_(line, book_idx_tmp, an_object, obj_type_status, opt_action); + line._book_index_(book_idx_tmp, an_object, obj_type_status, opt_action); } else { /+ not book_index +/ an_object_key="body_nugget"; @@ -804,7 +804,7 @@ template DocReformDocAbstraction() { if ((conf_make_meta.make.headings.length > 2) && (obj_type_status["make_headings"] == State.off)) { /+ heading found +/ - _heading_found_(line, conf_make_meta.make.headings, heading_match_str, heading_match_rgx, obj_type_status); + line._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) @@ -812,7 +812,7 @@ template DocReformDocAbstraction() { && ((obj_type_status["para"] == State.off) && (obj_type_status["heading"] == State.off))) { /+ heading make set +/ - line = _heading_make_set_(line, line_occur, heading_match_rgx, obj_type_status); + line = line._heading_make_set_(line_occur, heading_match_rgx, obj_type_status); } /+ TODO node info: all headings identified at this point, - extract node info here?? @@ -822,14 +822,14 @@ template DocReformDocAbstraction() { +/ if (line.matchFirst(rgx.heading)) { /+ heading match +/ - line = _doc_header_and_make_substitutions_(line, conf_make_meta); - _heading_matched_(line, line_occur, an_object, an_object_key, lv, collapsed_lev, obj_type_status, conf_make_meta); + 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); } else if (line_occur["para"] == State.off) { /+ para match +/ an_object_key="body_nugget"; - line = _doc_header_and_make_substitutions_(line, conf_make_meta); - line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta); - _para_match_(line, an_object, an_object_key, indent, bullet, obj_type_status, line_occur); + line = line._doc_header_and_make_substitutions_(conf_make_meta); + line = line._doc_header_and_make_substitutions_fontface_(conf_make_meta); + line._para_match_(an_object, an_object_key, indent, bullet, obj_type_status, line_occur); } } else if (line_occur["heading"] > State.off) { /+ heading +/ @@ -843,8 +843,8 @@ template DocReformDocAbstraction() { debug(para) { writeln(an_object_key, "-> ", line); } - line = _doc_header_and_make_substitutions_(line, conf_make_meta); - line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta); + line = line._doc_header_and_make_substitutions_(conf_make_meta); + line = line._doc_header_and_make_substitutions_fontface_(conf_make_meta); an_object[an_object_key] ~= " " ~ line; ++line_occur["para"]; } @@ -1049,7 +1049,7 @@ template DocReformDocAbstraction() { comp_obj_para.has.inline_links = substantive_obj_misc_tuple[sObj.links]; comp_obj_para.has.image_without_dimensions = substantive_obj_misc_tuple[sObj.image_no_dimensions]; the_document_body_section ~= comp_obj_para; - tag_assoc = inline_para_link_anchor(an_object, tag_in_seg, tag_assoc); + tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); _common_reset_(line_occur, an_object, obj_type_status); indent=[ "hang_position" : 0, @@ -1697,7 +1697,7 @@ template DocReformDocAbstraction() { return images_; } string[] segnames_lv0_to_4; - auto _image_dimensions(M,O)(M manifest_matter, O obj) { + auto _image_dimensions(O,M)(O obj, M manifest_matter) { if (obj.has.image_without_dimensions) { import std.math; import imageformats; @@ -1774,10 +1774,10 @@ template DocReformDocAbstraction() { || (opt_action.epub) || (opt_action.sqlite_discrete) || (opt_action.sqlite_update)) { - obj = obj_dom_structure_set_markup_tags(obj, dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); - obj = obj_dom_set_collapsed_tags(obj, dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); + obj = obj.obj_dom_structure_set_markup_tags(dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); + obj = obj.obj_dom_set_collapsed_tags(dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); } - obj = obj_heading_ancestors(obj, lv_ancestors_txt); + obj = obj.obj_heading_ancestors(lv_ancestors_txt); } obj = _links(obj); } @@ -1802,10 +1802,10 @@ template DocReformDocAbstraction() { || (opt_action.epub) || (opt_action.sqlite_discrete) || (opt_action.sqlite_update)) { - obj = obj_dom_structure_set_markup_tags(obj, dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); - obj = obj_dom_set_collapsed_tags(obj, dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); + obj = obj.obj_dom_structure_set_markup_tags(dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); + obj = obj.obj_dom_set_collapsed_tags(dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); } - obj = obj_heading_ancestors(obj, lv_ancestors_txt); + obj = obj.obj_heading_ancestors(lv_ancestors_txt); } obj = _links(obj); } @@ -1846,13 +1846,13 @@ template DocReformDocAbstraction() { || (opt_action.epub) || (opt_action.sqlite_discrete) || (opt_action.sqlite_update)) { - obj = obj_dom_structure_set_markup_tags(obj, dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); - obj = obj_dom_set_collapsed_tags(obj, dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); + obj = obj.obj_dom_structure_set_markup_tags(dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); + obj = obj.obj_dom_set_collapsed_tags(dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); } - obj = obj_heading_ancestors(obj, lv_ancestors_txt); + obj = obj.obj_heading_ancestors(lv_ancestors_txt); } else if (obj.metainfo.is_a == "para") { _images ~= extract_images(obj.text); - obj = _image_dimensions(manifest_matter, obj); + obj = _image_dimensions(obj, manifest_matter); } obj = _links(obj); } @@ -1890,10 +1890,10 @@ template DocReformDocAbstraction() { || (opt_action.epub) || (opt_action.sqlite_discrete) || (opt_action.sqlite_update)) { - obj = obj_dom_structure_set_markup_tags(obj, dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); - obj = obj_dom_set_collapsed_tags(obj, dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); + obj = obj.obj_dom_structure_set_markup_tags(dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); + obj = obj.obj_dom_set_collapsed_tags(dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); } - obj = obj_heading_ancestors(obj, lv_ancestors_txt); + obj = obj.obj_heading_ancestors(lv_ancestors_txt); } obj = _links(obj); } @@ -1926,10 +1926,10 @@ template DocReformDocAbstraction() { || (opt_action.epub) || (opt_action.sqlite_discrete) || (opt_action.sqlite_update)) { - obj = obj_dom_structure_set_markup_tags(obj, dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); - obj = obj_dom_set_collapsed_tags(obj, dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); + obj = obj.obj_dom_structure_set_markup_tags(dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); + obj = obj.obj_dom_set_collapsed_tags(dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); } - obj = obj_heading_ancestors(obj, lv_ancestors_txt); + obj = obj.obj_heading_ancestors(lv_ancestors_txt); } else if (obj.metainfo.is_a == "glossary") { obj_cite_digits = ocn_emit(OCNstatus.on); obj.metainfo.ocn = obj_cite_digits.object_number; @@ -1966,10 +1966,10 @@ template DocReformDocAbstraction() { || (opt_action.epub) || (opt_action.sqlite_discrete) || (opt_action.sqlite_update)) { - obj = obj_dom_structure_set_markup_tags(obj, dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); - obj = obj_dom_set_collapsed_tags(obj, dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); + obj = obj.obj_dom_structure_set_markup_tags(dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); + obj = obj.obj_dom_set_collapsed_tags(dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); } - obj = obj_heading_ancestors(obj, lv_ancestors_txt); + obj = obj.obj_heading_ancestors(lv_ancestors_txt); } else if (obj.metainfo.is_a == "bibliography") { obj_cite_digits = ocn_emit(OCNstatus.on); obj.metainfo.ocn = obj_cite_digits.object_number; @@ -2013,10 +2013,10 @@ template DocReformDocAbstraction() { || (opt_action.epub) || (opt_action.sqlite_discrete) || (opt_action.sqlite_update)) { - obj = obj_dom_structure_set_markup_tags(obj, dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); - obj = obj_dom_set_collapsed_tags(obj, dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); + obj = obj.obj_dom_structure_set_markup_tags(dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); + obj = obj.obj_dom_set_collapsed_tags(dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); } - obj = obj_heading_ancestors(obj, lv_ancestors_txt); + obj = obj.obj_heading_ancestors(lv_ancestors_txt); } else if (obj.metainfo.is_a == "bookindex") { obj_cite_digits = ocn_emit(OCNstatus.bkidx); obj.metainfo.ocn = obj_cite_digits.object_number; @@ -2059,10 +2059,10 @@ template DocReformDocAbstraction() { || (opt_action.epub) || (opt_action.sqlite_discrete) || (opt_action.sqlite_update)) { - obj = obj_dom_structure_set_markup_tags(obj, dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); - obj = obj_dom_set_collapsed_tags(obj, dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); + obj = obj.obj_dom_structure_set_markup_tags(dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); + obj = obj.obj_dom_set_collapsed_tags(dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); } - obj = obj_heading_ancestors(obj, lv_ancestors_txt); + obj = obj.obj_heading_ancestors(lv_ancestors_txt); } else if (obj.metainfo.is_a == "blurb") { obj_cite_digits = ocn_emit(OCNstatus.off); obj.metainfo.object_number_off = obj_cite_digits.off; @@ -2189,9 +2189,9 @@ template DocReformDocAbstraction() { comp_obj_heading_.metainfo.parent_lev_markup = 0; comp_obj_heading_.metainfo.dom_structure_markedup_tags_status = dom_structure_markedup_tags_status.dup; comp_obj_heading_.metainfo.dom_structure_collapsed_tags_status = dom_structure_collapsed_tags_status.dup; - comp_obj_heading_ = obj_dom_structure_set_markup_tags(comp_obj_heading_, dom_structure_markedup_tags_status, 0); - comp_obj_heading_ = obj_dom_set_collapsed_tags(comp_obj_heading_, dom_structure_collapsed_tags_status, 0); - comp_obj_heading_ = obj_heading_ancestors(comp_obj_heading_, lv_ancestors_txt); + comp_obj_heading_ = comp_obj_heading_.obj_dom_structure_set_markup_tags(dom_structure_markedup_tags_status, 0); + comp_obj_heading_ = comp_obj_heading_.obj_dom_set_collapsed_tags(dom_structure_collapsed_tags_status, 0); + comp_obj_heading_ = comp_obj_heading_.obj_heading_ancestors(lv_ancestors_txt); // the_dom_tail_section ~= comp_obj_heading_; // remove tail for now, decide on later auto document_the = [ "head": the_document_head_section, @@ -2779,7 +2779,7 @@ template DocReformDocAbstraction() { comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; - tag_assoc = inline_para_link_anchor(an_object, tag_in_seg, tag_assoc); + tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); } object_reset(an_object); processing.remove("verse"); @@ -2842,7 +2842,7 @@ template DocReformDocAbstraction() { comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; - tag_assoc = inline_para_link_anchor(an_object, tag_in_seg, tag_assoc); + tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); object_reset(an_object); processing.remove("verse"); ++cntr; @@ -2888,7 +2888,7 @@ template DocReformDocAbstraction() { comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; - tag_assoc = inline_para_link_anchor(an_object, tag_in_seg, tag_assoc); + tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); object_number_poem["end"] = obj_cite_digits.object_number.to!string; object_reset(an_object); processing.remove("verse"); @@ -2951,7 +2951,7 @@ template DocReformDocAbstraction() { comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; - tag_assoc = inline_para_link_anchor(an_object, tag_in_seg, tag_assoc); + tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); object_reset(an_object); processing.remove("verse"); ++cntr; @@ -3247,8 +3247,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 = table_instructions(comp_obj_block, an_object["table_head"]); - comp_obj_block = table_substantive_munge_special(comp_obj_block, an_object["substantive"]); + 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"]); the_document_body_section ~= comp_obj_block; object_reset(an_object); processing.remove("verse"); @@ -3321,7 +3321,7 @@ template DocReformDocAbstraction() { comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; - tag_assoc = inline_para_link_anchor(an_object, tag_in_seg, tag_assoc); + tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); obj_type_status["blocks"] = TriState.off; obj_type_status["quote"] = TriState.off; object_reset(an_object); @@ -3370,7 +3370,7 @@ template DocReformDocAbstraction() { comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; - tag_assoc = inline_para_link_anchor(an_object, tag_in_seg, tag_assoc); + tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); obj_type_status["blocks"] = TriState.off; obj_type_status["group"] = TriState.off; object_reset(an_object); @@ -3543,8 +3543,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 = table_instructions(comp_obj_block, an_object["table_head"]); - comp_obj_block = table_substantive_munge(comp_obj_block, an_object["substantive"]); + comp_obj_block = comp_obj_block.table_instructions(an_object["table_head"]); + comp_obj_block = comp_obj_block.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; @@ -4171,7 +4171,7 @@ template DocReformDocAbstraction() { _table_cols = col.split(rgx.table_col_delimiter); _table ~= _table_cols; } - table_object = table_array_munge(table_object, _table); + table_object = table_object.table_array_munge(_table); return table_object; } auto table_substantive_munge_special(O,T)( @@ -4187,7 +4187,7 @@ template DocReformDocAbstraction() { _table_cols = col.split(rgx.table_col_delimiter_special); _table ~= _table_cols; } - table_object = table_array_munge(table_object, _table); + table_object = table_object.table_array_munge(_table); return table_object; } /+ abstraction functions ↑ +/ diff --git a/src/doc_reform/output/epub3.d b/src/doc_reform/output/epub3.d index c94c240..f57229b 100644 --- a/src/doc_reform/output/epub3.d +++ b/src/doc_reform/output/epub3.d @@ -349,7 +349,7 @@ template outputEPub3() { default: epubWrite.doc_parts ~= obj.tags.segment_anchor_tag_epub; epubWrite.doc_epub3[obj.tags.segment_anchor_tag_epub] ~= xhtml_format.epub3_seg_head(doc_matters); - auto t = xhtml_format.heading_seg(doc_matters, obj, _txt, suffix, "epub"); + auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[obj.tags.segment_anchor_tag_epub] ~= t[0]; epubWrite.doc_epub3_endnotes[obj.tags.segment_anchor_tag_epub] ~= t[1]; break; @@ -358,12 +358,12 @@ template outputEPub3() { case 4: segment_filename = obj.tags.segment_anchor_tag_epub; epubWrite.doc_epub3[segment_filename] ~= xhtml_format.epub3_seg_head(doc_matters); - auto t = xhtml_format.heading_seg(doc_matters, obj, _txt, suffix, "epub"); + auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; case 5: .. case 7: - auto t = xhtml_format.heading_seg(doc_matters, obj, _txt, suffix, "epub"); + auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; @@ -393,7 +393,7 @@ template outputEPub3() { case "para": switch (obj.metainfo.is_a) { case "toc": - auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "epub"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; @@ -422,7 +422,7 @@ template outputEPub3() { case "para": switch (obj.metainfo.is_a) { case "para": - auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "epub"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; @@ -439,32 +439,32 @@ template outputEPub3() { case "block": switch (obj.metainfo.is_a) { case "quote": - auto t = xhtml_format.quote_seg(doc_matters, obj, _txt, suffix, "epub"); + auto t = xhtml_format.quote_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0].to!string; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "group": - auto t = xhtml_format.group_seg(doc_matters, obj, _txt, suffix, "epub"); + auto t = xhtml_format.group_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0].to!string; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "block": - auto t = xhtml_format.block_seg(doc_matters, obj, _txt, suffix, "epub"); + auto t = xhtml_format.block_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0].to!string; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "poem": break; case "verse": - auto t = xhtml_format.verse_seg(doc_matters, obj, _txt, suffix, "epub"); + auto t = xhtml_format.verse_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0].to!string; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "code": - epubWrite.doc_epub3[segment_filename] ~= xhtml_format.code(obj, _txt); + epubWrite.doc_epub3[segment_filename] ~= xhtml_format.code(_txt, obj); break; case "table": - epubWrite.doc_epub3[segment_filename] ~= xhtml_format.table(obj, _txt); + epubWrite.doc_epub3[segment_filename] ~= xhtml_format.table(_txt, obj); epubWrite.doc_epub3_endnotes[segment_filename] ~= ""; break; default: @@ -493,26 +493,26 @@ template outputEPub3() { case "para": switch (obj.metainfo.is_a) { case "endnote": assert(part == "endnotes"); - auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "epub"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; break; case "glossary": assert(part == "glossary"); - auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "epub"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "bibliography": assert(part == "bibliography"); - auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "epub"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "bookindex": assert(part == "bookindex"); - auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "epub"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "blurb": assert(part == "blurb"); - auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "epub"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; @@ -598,9 +598,9 @@ template outputEPub3() { /+ epub specific documents +/ epubWrite.mimetypes = epub3_mimetypes; epubWrite.meta_inf_container_xml = epub3_container_xml; - epubWrite.oebps_toc_ncx = epub2_oebps_toc_ncx(doc_abstraction, doc_matters); - epubWrite.oebps_toc_nav_xhtml = epub3_oebps_toc_nav_xhtml(doc_abstraction, doc_matters); - epubWrite.oebps_content_opf = epub3_oebps_content(doc_abstraction, doc_matters, oepbs_content_parts); + epubWrite.oebps_toc_ncx = doc_abstraction.epub2_oebps_toc_ncx(doc_matters); + epubWrite.oebps_toc_nav_xhtml = doc_abstraction.epub3_oebps_toc_nav_xhtml(doc_matters); + epubWrite.oebps_content_opf = doc_abstraction.epub3_oebps_content(doc_matters, oepbs_content_parts); epubWrite.epub3_write_output_files(doc_matters); } void epub3_write_output_files(W,I)( diff --git a/src/doc_reform/output/html.d b/src/doc_reform/output/html.d index dee5d53..45b95ce 100644 --- a/src/doc_reform/output/html.d +++ b/src/doc_reform/output/html.d @@ -35,10 +35,10 @@ template outputHTML() { case "para": switch (obj.metainfo.is_a) { case "heading": - doc_html ~= delimit ~ xhtml_format.heading_scroll(doc_matters, obj, _txt, suffix); + doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc_matters, suffix); break; case "toc": - doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); break; default: { /+ debug +/ @@ -65,10 +65,10 @@ template outputHTML() { case "para": switch (obj.metainfo.is_a) { case "heading": - doc_html ~= delimit ~ xhtml_format.heading_scroll(doc_matters, obj, _txt, suffix); + doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc_matters, suffix); break; case "para": - doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); break; default: { /+ debug +/ @@ -83,24 +83,24 @@ template outputHTML() { case "block": switch (obj.metainfo.is_a) { case "quote": - doc_html ~= xhtml_format.quote_scroll(doc_matters, obj, _txt); + doc_html ~= xhtml_format.quote_scroll(_txt, obj, doc_matters); break; case "group": - doc_html ~= xhtml_format.group_scroll(doc_matters, obj, _txt); + doc_html ~= xhtml_format.group_scroll(_txt, obj, doc_matters); break; case "block": - doc_html ~= xhtml_format.block_scroll(doc_matters, obj, _txt); + doc_html ~= xhtml_format.block_scroll(_txt, obj, doc_matters); break; case "poem": break; case "verse": - doc_html ~= xhtml_format.verse_scroll(doc_matters, obj, _txt, suffix); + doc_html ~= xhtml_format.verse_scroll(_txt, obj, doc_matters, suffix); break; case "code": - doc_html ~= xhtml_format.code(obj, _txt); + doc_html ~= xhtml_format.code(_txt, obj); break; case "table": - doc_html ~= xhtml_format.table(obj, _txt); + doc_html ~= xhtml_format.table(_txt, obj); break; default: { /+ debug +/ @@ -128,22 +128,22 @@ template outputHTML() { case "para": switch (obj.metainfo.is_a) { case "heading": - doc_html ~= delimit ~ xhtml_format.heading_scroll(doc_matters, obj, _txt, suffix); + doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc_matters, suffix); break; case "endnote": assert(part == "endnotes"); - doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); break; case "glossary": assert(part == "glossary"); - doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); break; case "bibliography": assert(part == "bibliography"); - doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); break; case "bookindex": assert(part == "bookindex"); - doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); break; case "blurb": assert(part == "blurb"); - doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); break; default: { /+ debug +/ @@ -251,7 +251,7 @@ template outputHTML() { top_level_headings[3] = ""; goto default; default: - auto t = xhtml_format.heading_seg(doc_matters, obj, _txt, suffix, "seg"); + auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "seg"); top_level_headings[obj.metainfo.heading_lev_markup] = t[0]; break; } @@ -259,19 +259,19 @@ template outputHTML() { case 4: segment_filename = obj.tags.segment_anchor_tag_epub; doc_html[segment_filename] ~= xhtml_format.html_head(doc_matters, "seg"); - auto navigation_bar = xhtml_format.nav_pre_next_svg(doc_matters, obj); + auto navigation_bar = xhtml_format.nav_pre_next_svg(obj, doc_matters); doc_html[segment_filename] ~= navigation_bar.toc_pre_next; previous_seg_filename = segment_filename; foreach (top_level_heading; top_level_headings) { doc_html[segment_filename] ~= top_level_heading; } - auto t = xhtml_format.heading_seg(doc_matters, obj, _txt, suffix, "seg"); + auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "seg"); doc_html[segment_filename] ~= t[0].to!string; - doc_html[segment_filename] ~= xhtml_format.lev4_heading_subtoc(doc_matters, obj); + doc_html[segment_filename] ~= xhtml_format.lev4_heading_subtoc(obj, doc_matters); doc_html_endnotes[segment_filename] ~= t[1]; break; case 5: .. case 7: - auto t = xhtml_format.heading_seg(doc_matters, obj, _txt, suffix, "seg"); + auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "seg"); doc_html[segment_filename] ~= t[0].to!string; doc_html_endnotes[segment_filename] ~= t[1]; break; @@ -301,7 +301,7 @@ template outputHTML() { case "para": switch (obj.metainfo.is_a) { case "toc": - auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "seg"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); doc_html[segment_filename] ~= t[0].to!string; break; default: @@ -329,7 +329,7 @@ template outputHTML() { case "para": switch (obj.metainfo.is_a) { case "para": - auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "seg"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); doc_html[segment_filename] ~= t[0].to!string; doc_html_endnotes[segment_filename] ~= t[1]; break; @@ -346,32 +346,32 @@ template outputHTML() { case "block": switch (obj.metainfo.is_a) { case "quote": - auto t = xhtml_format.quote_seg(doc_matters, obj, _txt, suffix, "seg"); + auto t = xhtml_format.quote_seg(_txt, obj, doc_matters, suffix, "seg"); doc_html[segment_filename] ~= t[0].to!string; doc_html_endnotes[segment_filename] ~= t[1]; break; case "group": - auto t = xhtml_format.group_seg(doc_matters, obj, _txt, suffix, "seg"); + auto t = xhtml_format.group_seg(_txt, obj, doc_matters, suffix, "seg"); doc_html[segment_filename] ~= t[0].to!string; doc_html_endnotes[segment_filename] ~= t[1]; break; case "block": - auto t = xhtml_format.block_seg(doc_matters, obj, _txt, suffix, "seg"); + auto t = xhtml_format.block_seg(_txt, obj, doc_matters, suffix, "seg"); doc_html[segment_filename] ~= t[0].to!string; doc_html_endnotes[segment_filename] ~= t[1]; break; case "poem": break; case "verse": - auto t = xhtml_format.verse_seg(doc_matters, obj, _txt, suffix, "seg"); + auto t = xhtml_format.verse_seg(_txt, obj, doc_matters, suffix, "seg"); doc_html[segment_filename] ~= t[0].to!string; doc_html_endnotes[segment_filename] ~= t[1]; break; case "code": - doc_html[segment_filename] ~= xhtml_format.code(obj, _txt); + doc_html[segment_filename] ~= xhtml_format.code(_txt, obj); break; case "table": - doc_html[segment_filename] ~= xhtml_format.table(obj, _txt); + doc_html[segment_filename] ~= xhtml_format.table(_txt, obj); doc_html_endnotes[segment_filename] ~= ""; break; default: @@ -400,26 +400,26 @@ template outputHTML() { case "para": switch (obj.metainfo.is_a) { case "endnote": assert(part == "endnotes"); - auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "seg"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); doc_html[segment_filename] ~= t[0]; break; case "glossary": assert(part == "glossary"); - auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "seg"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); doc_html[segment_filename] ~= t[0]; doc_html_endnotes[segment_filename] ~= t[1]; break; case "bibliography": assert(part == "bibliography"); - auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "seg"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); doc_html[segment_filename] ~= t[0]; doc_html_endnotes[segment_filename] ~= t[1]; break; case "bookindex": assert(part == "bookindex"); - auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "seg"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); doc_html[segment_filename] ~= t[0]; doc_html_endnotes[segment_filename] ~= t[1]; break; case "blurb": assert(part == "blurb"); - auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "seg"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); doc_html[segment_filename] ~= t[0]; doc_html_endnotes[segment_filename] ~= t[1]; break; diff --git a/src/doc_reform/output/hub.d b/src/doc_reform/output/hub.d index 1534bc0..a32bd9e 100644 --- a/src/doc_reform/output/hub.d +++ b/src/doc_reform/output/hub.d @@ -26,7 +26,7 @@ template outputHub() { if (sched == outTask.epub) { msg.v("epub3 processing... "); import doc_reform.output.epub3; - outputEPub3!()(doc_abstraction, doc_matters); + doc_abstraction.outputEPub3!()(doc_matters); msg.vv("epub3 done"); } if (sched == outTask.html_scroll) { @@ -50,7 +50,7 @@ template outputHub() { if (sched == outTask.sqlite) { msg.v("sqlite processing... "); import doc_reform.output.sqlite; - SQLiteHubDiscreteBuildTablesAndPopulate!()(doc_matters, doc_abstraction); + doc_abstraction.SQLiteHubDiscreteBuildTablesAndPopulate!()(doc_matters); msg.vv("sqlite done"); } } @@ -69,12 +69,12 @@ template outputHub() { if (doc_matters.opt.action.sqlite_update) { msg.v("sqlite update processing..."); import doc_reform.output.sqlite; - SQLiteHubBuildTablesAndPopulate!()(doc_matters, doc_abstraction); + doc_abstraction.SQLiteHubBuildTablesAndPopulate!()(doc_matters); msg.vv("sqlite update done"); } else if (doc_matters.opt.action.sqlite_delete) { msg.v("sqlite delete processing..."); import doc_reform.output.sqlite; - SQLiteHubBuildTablesAndPopulate!()(doc_matters, doc_abstraction); + doc_abstraction.SQLiteHubBuildTablesAndPopulate!()(doc_matters); msg.vv("sqlite delete done"); } } diff --git a/src/doc_reform/output/sqlite.d b/src/doc_reform/output/sqlite.d index e0c9390..acfbff3 100644 --- a/src/doc_reform/output/sqlite.d +++ b/src/doc_reform/output/sqlite.d @@ -10,18 +10,18 @@ mixin DocReformOutputRgxInit; static auto rgx = Rgx(); long _metadata_tid_lastrowid; template SQLiteHubBuildTablesAndPopulate() { - void SQLiteHubBuildTablesAndPopulate(M,D)( - M doc_matters, + void SQLiteHubBuildTablesAndPopulate(D,M)( D doc_abstraction, + M doc_matters, ) { auto pth_sqlite = DocReformPathsSQLite!()(doc_matters.sqlite.filename, doc_matters.output_path); pth_sqlite.base.mkdirRecurse; auto db = Database(pth_sqlite.sqlite_file); template SQLiteDbStatementComposite() { - void SQLiteDbStatementComposite(Db,M,D)( + void SQLiteDbStatementComposite(Db,D,M)( Db db, - M doc_matters, D doc_abstraction, + M doc_matters, ) { { string _db_statement; @@ -42,7 +42,7 @@ template SQLiteHubBuildTablesAndPopulate() { _db_statement ~= SQLiteInsertMetadata!()(doc_matters); SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "INSERT MetaData"); /+ get tid (lastrowid or max) for use in doc_objects table +/ - _db_statement ~= SQLiteInsertDocObjectsLoop!()(doc_matters, doc_abstraction); + _db_statement ~= doc_abstraction.SQLiteInsertDocObjectsLoop!()(doc_matters); SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "INSERT DocObjects"); } } @@ -53,29 +53,29 @@ template SQLiteHubBuildTablesAndPopulate() { } } } - SQLiteDbStatementComposite!()(db, doc_matters, doc_abstraction); + SQLiteDbStatementComposite!()(db, doc_abstraction, doc_matters); } } template SQLiteHubDiscreteBuildTablesAndPopulate() { - void SQLiteHubDiscreteBuildTablesAndPopulate(M,D)( - M doc_matters, + void SQLiteHubDiscreteBuildTablesAndPopulate(D,M)( D doc_abstraction, + M doc_matters, ) { auto pth_sqlite = DocReformPathsSQLiteDiscrete!()(doc_matters.output_path, doc_matters.src.language); pth_sqlite.base.mkdirRecurse; auto db = Database(pth_sqlite.sqlite_file(doc_matters.src.filename)); template SQLiteDiscreteDbStatementComposite() { - void SQLiteDiscreteDbStatementComposite(Db,M,D)( + void SQLiteDiscreteDbStatementComposite(Db,D,M)( Db db, - M doc_matters, D doc_abstraction, + M doc_matters, ) { { string _db_statement; { _db_statement ~= SQLiteTablesReCreate!()(); _db_statement ~= SQLiteInsertMetadata!()(doc_matters); - _db_statement ~= SQLiteInsertDocObjectsLoop!()(doc_matters, doc_abstraction); + _db_statement ~= doc_abstraction.SQLiteInsertDocObjectsLoop!()(doc_matters); SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "table CREATE Tables, INSERT DocObjects"); } db.close; @@ -85,7 +85,7 @@ template SQLiteHubDiscreteBuildTablesAndPopulate() { } } } - SQLiteDiscreteDbStatementComposite!()(db, doc_matters, doc_abstraction); + SQLiteDiscreteDbStatementComposite!()(db, doc_abstraction, doc_matters); } } template SQLiteDbRun() { @@ -286,8 +286,8 @@ template SQLiteFormatAndLoadObject() { ) { if (obj.has.inline_links) { if (obj.metainfo.is_a != "code") { - _txt = replaceAll!(hit => - hit[1] ~ "┤" ~ to!string((obj.stow.link[hit[2].to!ulong])).encode ~ "├" + _txt = replaceAll!(m => + m[1] ~ "┤" ~ to!string((obj.stow.link[m[2].to!ulong])).encode ~ "├" )(_txt, rgx.inline_link_number_only); } if ((_txt.match(rgx.mark_internal_site_lnk)) @@ -1133,9 +1133,9 @@ template SQLiteInsertMetadata() { } } template SQLiteInsertDocObjectsLoop() { - string SQLiteInsertDocObjectsLoop(M,D)( - M doc_matters, + string SQLiteInsertDocObjectsLoop(D,M)( D doc_abstraction, + M doc_matters, ) { string _uid = SQLinsertDelimiter!()(doc_matters.src.doc_uid); auto site_url = DocReformPathsUrl!()(doc_matters); diff --git a/src/doc_reform/output/xmls.d b/src/doc_reform/output/xmls.d index fe02338..97262a1 100644 --- a/src/doc_reform/output/xmls.d +++ b/src/doc_reform/output/xmls.d @@ -318,10 +318,10 @@ template outputXHTMLs() { </html>¶"); return o; } - auto inline_images(M,O)( - M doc_matters, - const O obj, + auto inline_images(O,M)( string _txt, + const O obj, + M doc_matters, string _suffix = ".html", string _xml_type = "seg", ) { @@ -342,18 +342,18 @@ template outputXHTMLs() { } return _txt; } - auto inline_links(M,O)( - M doc_matters, - const O obj, - string _txt, + auto inline_links(O,M)( + string _txt, + const O obj, + M doc_matters, string _suffix = ".html", string _xml_type = "seg", ) { string seg_lvs; if (obj.has.inline_links) { if (obj.metainfo.is_a != "code") { - _txt = replaceAll!(hit => - hit[1] ~ "┤" ~ to!string((obj.stow.link[hit[2].to!ulong])).encode ~ "├" + _txt = replaceAll!(m => + m[1] ~ "┤" ~ to!string((obj.stow.link[m[2].to!ulong])).encode ~ "├" )(_txt, rgx.inline_link_number_only); } if ((_txt.match(rgx.mark_internal_site_lnk)) @@ -429,10 +429,10 @@ template outputXHTMLs() { } return _txt; } - auto inline_notes_scroll(M,O)( - M doc_matters, - const O obj, - string _txt, + auto inline_notes_scroll(O,M)( + string _txt, + const O obj, + M doc_matters, ) { if (obj.has.inline_notes_reg) { _txt = font_face(_txt); @@ -453,10 +453,10 @@ template outputXHTMLs() { } return _txt; } - auto inline_notes_seg(M,O)( - M doc_matters, - const O obj, - string _txt, + auto inline_notes_seg(O,M)( + string _txt, + const O obj, + M doc_matters, ) { string[] _endnotes; if (obj.has.inline_notes_reg) { @@ -493,32 +493,32 @@ template outputXHTMLs() { ); return t; } - auto inline_markup_scroll(M,O)( - M doc_matters, - const O obj, + auto inline_markup_scroll(O,M)( string _txt, + const O obj, + M doc_matters, string _suffix = ".html", ) { - _txt = inline_images(doc_matters, obj, _txt, _suffix, "scroll"); - _txt = inline_links(doc_matters, obj, _txt, _suffix, "scroll"); - _txt = inline_notes_scroll(doc_matters, obj, _txt); + _txt = inline_images(_txt, obj, doc_matters, _suffix, "scroll"); + _txt = inline_links(_txt, obj, doc_matters, _suffix, "scroll"); + _txt = inline_notes_scroll(_txt, obj, doc_matters); return _txt; } - auto inline_markup_seg(M,O)( - M doc_matters, - const O obj, + auto inline_markup_seg(O,M)( string _txt, + const O obj, + M doc_matters, string _suffix = ".html", string _xml_type = "seg", ) { - _txt = inline_images(doc_matters, obj, _txt, _suffix, _xml_type); // TODO - _txt = inline_links(doc_matters, obj, _txt, _suffix, _xml_type); // TODO - auto t = inline_notes_seg(doc_matters, obj, _txt); + _txt = inline_images(_txt, obj, doc_matters, _suffix, _xml_type); // TODO + _txt = inline_links(_txt, obj, doc_matters, _suffix, _xml_type); // TODO + auto t = inline_notes_seg(_txt, obj, doc_matters); return t; } - string lev4_heading_subtoc(M,O)( - M doc_matters, - const O obj, + string lev4_heading_subtoc(O,M)( + const O obj, + M doc_matters, ) { char[] lev4_subtoc; lev4_subtoc ~= " <div class=\"nav\">\n"; @@ -543,9 +543,9 @@ template outputXHTMLs() { lev4_subtoc ~= " </div>\n"; return lev4_subtoc.to!string; } - auto nav_pre_next_svg(M,O)( - M doc_matters, - const O obj, + auto nav_pre_next_svg(O,M)( + const O obj, + M doc_matters, ) { string prev, next, toc; if (obj.tags.segment_anchor_tag_epub == "toc") { @@ -622,8 +622,8 @@ template outputXHTMLs() { return bar(); } auto heading(O)( - const O obj, string _txt, + const O obj, string _xml_type = "html", ) { assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter"); @@ -680,28 +680,28 @@ template outputXHTMLs() { } return o; } - auto heading_scroll(M,O)( - M doc_matters, - const O obj, - string _txt, - string _suffix = ".html", + auto heading_scroll(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", ) { auto tags = _xhtml_anchor_tags(obj); - _txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix); - string o = heading(obj, _txt); + _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); + string o = heading(_txt, obj); return o; } - auto heading_seg(M,O)( - M doc_matters, - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html" + auto heading_seg(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", + string _xml_type = "html", ) { - auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type); + auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0]; string[] _endnotes = t[1]; - string o = heading(obj, _txt, _xml_type); + string o = heading(_txt, obj, _xml_type); auto u = tuple( o, _endnotes, @@ -709,8 +709,8 @@ template outputXHTMLs() { return u; } auto para(O)( - const O obj, string _txt, + const O obj, ) { assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter"); assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb"); @@ -753,28 +753,28 @@ template outputXHTMLs() { } return o; } - auto para_scroll(M,O)( - M doc_matters, - const O obj, - string _txt, - string _suffix = ".html", + auto para_scroll(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", ) { auto tags = _xhtml_anchor_tags(obj); - _txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix); - string o = para(obj, _txt); + _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); + string o = para(_txt, obj); return o; } - auto para_seg(M,O)( - M doc_matters, - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto para_seg(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", + string _xml_type = "html", ) { - auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type); + auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; - string o = para(obj, _txt); + string o = para(_txt, obj); auto u = tuple( o, _endnotes, @@ -782,8 +782,8 @@ template outputXHTMLs() { return u; } auto quote(O)( - const O obj, string _txt, + const O obj, ) { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); @@ -816,28 +816,28 @@ template outputXHTMLs() { } return o; } - auto quote_scroll(M,O)( - M doc_matters, - const O obj, - string _txt, - string _suffix = ".html", + auto quote_scroll(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", ) { auto tags = _xhtml_anchor_tags(obj); - _txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix); - string o = quote(obj, _txt); + _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); + string o = quote(_txt, obj); return o; } - auto quote_seg(M,O)( - M doc_matters, - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto quote_seg(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", + string _xml_type = "html", ) { - auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type); + auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; - string o = quote(obj, _txt); + string o = quote(_txt, obj); auto u = tuple( o, _endnotes, @@ -845,8 +845,8 @@ template outputXHTMLs() { return u; } auto group(O)( - const O obj, string _txt, + const O obj, ) { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); @@ -879,29 +879,29 @@ template outputXHTMLs() { } return o; } - auto group_scroll(M,O)( - M doc_matters, - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto group_scroll(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", + string _xml_type = "html", ) { auto tags = _xhtml_anchor_tags(obj); - _txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix); - string o = group(obj, _txt); + _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); + string o = group(_txt, obj); return o; } - auto group_seg(M,O)( - M doc_matters, - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto group_seg(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", + string _xml_type = "html", ) { - auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type); + auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; - string o = group(obj, _txt); + string o = group(_txt, obj); auto u = tuple( o, _endnotes, @@ -909,8 +909,8 @@ template outputXHTMLs() { return u; } auto block(O)( - const O obj, string _txt, + const O obj, ) { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); @@ -939,29 +939,29 @@ template outputXHTMLs() { } return o; } - auto block_scroll(M,O)( - M doc_matters, - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto block_scroll(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", + string _xml_type = "html", ) { auto tags = _xhtml_anchor_tags(obj); - _txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix); - string o = block(obj, _txt); + _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); + string o = block(_txt, obj); return o; } - auto block_seg(M,O)( - M doc_matters, - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto block_seg(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", + string _xml_type = "html", ) { - auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type); + auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; - string o = block(obj, _txt); + string o = block(_txt, obj); auto u = tuple( o, _endnotes, @@ -969,8 +969,8 @@ template outputXHTMLs() { return u; } auto verse(O)( - const O obj, string _txt, + const O obj, ) { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); @@ -999,29 +999,29 @@ template outputXHTMLs() { } return o; } - auto verse_scroll(M,O)( - M doc_matters, - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto verse_scroll(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", + string _xml_type = "html", ) { auto tags = _xhtml_anchor_tags(obj); - _txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix); - string o = verse(obj, _txt); + _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); + string o = verse(_txt, obj); return o; } - auto verse_seg(M,O)( - M doc_matters, - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto verse_seg(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", + string _xml_type = "html", ) { - auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type); + auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; - string o = verse(obj, _txt); + string o = verse(_txt, obj); auto u = tuple( o, _endnotes, @@ -1029,8 +1029,8 @@ template outputXHTMLs() { return u; } auto tablarize(O)( - const O obj, string _txt, + const O obj, ) { string[] _table_rows = (_txt).split(rgx.table_delimiter_row); string[] _table_cols; @@ -1062,8 +1062,8 @@ template outputXHTMLs() { return t; } auto table(O)( - const O obj, string _txt, + const O obj, ) { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body"); @@ -1071,7 +1071,7 @@ template outputXHTMLs() { assert(obj.metainfo.is_a == "table"); auto tags = _xhtml_anchor_tags(obj); _txt = font_face(_txt); - auto t = tablarize(obj, _txt); + auto t = tablarize(_txt, obj); _txt = t[0]; string _note = t[1]; string o; @@ -1094,24 +1094,9 @@ template outputXHTMLs() { ); return o; } - auto endnote(O)( - const O obj, - string _txt, - ) { - string o; - o = format(q"¶ <p class="%s" indent="h%si%s"> - %s - </p>¶", - obj.metainfo.is_a, - obj.attrib.indent_hang, - obj.attrib.indent_base, - _txt - ); - return o; - } auto code(O)( - const O obj, string _txt, + const O obj, ) { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body"); |