diff options
-rw-r--r-- | org/doc_reform.org | 2 | ||||
-rw-r--r-- | org/meta_abstraction.org | 211 | ||||
-rw-r--r-- | org/output_hub.org | 8 | ||||
-rw-r--r-- | org/output_sqlite.org | 32 | ||||
-rw-r--r-- | org/output_xmls.org | 403 | ||||
-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 |
12 files changed, 636 insertions, 599 deletions
diff --git a/org/doc_reform.org b/org/doc_reform.org index fe66011..80e703b 100644 --- a/org/doc_reform.org +++ b/org/doc_reform.org @@ -812,7 +812,7 @@ if (!(doc_matters.opt.action.skip_output)) { ) { 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/org/meta_abstraction.org b/org/meta_abstraction.org index 5249df1..10eeddd 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -635,7 +635,7 @@ debug(srclines) { #+name: abs_in_loop_body_00 #+BEGIN_SRC d if (!line.empty) { - obj_type_status = _check_ocn_status_(line, obj_type_status); + obj_type_status = line._check_ocn_status_(obj_type_status); } #+END_SRC @@ -645,7 +645,7 @@ if (!line.empty) { #+name: abs_in_loop_body_00_code_block #+BEGIN_SRC d /+ block object: code +/ -_code_block_(line, an_object, obj_type_status); +line._code_block_(an_object, obj_type_status); continue; #+END_SRC @@ -665,7 +665,7 @@ if (line.matchFirst(rgx.heading_biblio) 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); @@ -754,7 +754,7 @@ if there is a glossary section you need to: 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"; @@ -906,7 +906,7 @@ if there is a blurb section you need to: 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"; @@ -935,9 +935,9 @@ if there is a blurb section you need to: #+BEGIN_SRC d } 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; #+END_SRC @@ -948,11 +948,11 @@ if there is a blurb section you need to: /+ 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; #+END_SRC @@ -962,8 +962,8 @@ if there is a blurb section you need to: #+BEGIN_SRC d } 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 ])); @@ -972,7 +972,7 @@ if there is a blurb section you need to: 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; #+END_SRC @@ -982,7 +982,7 @@ if there is a blurb section you need to: #+BEGIN_SRC d } 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; #+END_SRC @@ -992,7 +992,7 @@ if there is a blurb section you need to: #+BEGIN_SRC d } 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; #+END_SRC @@ -1019,7 +1019,7 @@ if (line.matchFirst(rgx.block_poem_open)) { 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; #+END_SRC @@ -1060,7 +1060,7 @@ if (line.matchFirst(rgx.book_index) || 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); #+END_SRC ******* not book index [+1] @@ -1106,7 +1106,7 @@ if (line.matchFirst(rgx.book_index) 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) @@ -1114,7 +1114,7 @@ if (line.matchFirst(rgx.book_index) && ((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?? @@ -1124,14 +1124,14 @@ if (line.matchFirst(rgx.book_index) +/ 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); } #+END_SRC @@ -1157,8 +1157,8 @@ if (line.matchFirst(rgx.book_index) 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"]; } @@ -1384,7 +1384,7 @@ if ((obj_type_status["heading"] == State.on) 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, @@ -2258,7 +2258,7 @@ string[] segnames_lv0_to_4; #+name: abs_post #+BEGIN_SRC d -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; @@ -2353,10 +2353,10 @@ foreach (ref obj; the_document_head_section) { || (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); } @@ -2387,10 +2387,10 @@ if (the_table_of_contents_section.length > 1) { || (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); } @@ -2437,13 +2437,13 @@ if (the_document_body_section.length > 1) { || (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); } @@ -2489,10 +2489,10 @@ if (the_endnotes_section.length > 1) { || (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); } @@ -2533,10 +2533,10 @@ if (the_glossary_section.length > 1) { || (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; @@ -2581,10 +2581,10 @@ if (the_bibliography_section.length > 1) { || (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; @@ -2636,10 +2636,10 @@ if (the_bookindex_section.length > 1) { || (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; @@ -2688,10 +2688,10 @@ if (the_blurb_section.length > 1) { || (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; @@ -2830,9 +2830,9 @@ comp_obj_heading_.metainfo.parent_ocn = 0; 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 #+END_SRC @@ -3145,6 +3145,12 @@ void _start_block_(L,T,N)( static auto rgx = Rgx(); string code_block_syntax = ""; bool code_block_numbered = false; +#+END_SRC + +******* code + +#+name: abs_functions_block +#+BEGIN_SRC d if (auto m = line.matchFirst(rgx.block_curly_code_open)) { /+ curly code open +/ code_block_syntax = (m.captures[1]) ? m.captures[1].to!string : ""; @@ -3159,6 +3165,12 @@ void _start_block_(L,T,N)( obj_type_status["blocks"] = TriState.on; obj_type_status["code"] = TriState.on; obj_type_status["curly_code"] = TriState.on; +#+END_SRC + +******* poem + +#+name: abs_functions_block +#+BEGIN_SRC d } else if (line.matchFirst(rgx.block_curly_poem_open)) { /+ curly poem open +/ debug(poem) { // poem (curly) open @@ -3172,6 +3184,12 @@ void _start_block_(L,T,N)( obj_type_status["verse_new"] = State.on; obj_type_status["poem"] = TriState.on; obj_type_status["curly_poem"] = TriState.on; +#+END_SRC + +******* group + +#+name: abs_functions_block +#+BEGIN_SRC d } else if (line.matchFirst(rgx.block_curly_group_open)) { /+ curly group open +/ debug(group) { // group (curly) open @@ -3183,6 +3201,12 @@ void _start_block_(L,T,N)( obj_type_status["blocks"] = TriState.on; obj_type_status["group"] = TriState.on; obj_type_status["curly_group"] = TriState.on; +#+END_SRC + +******* block + +#+name: abs_functions_block +#+BEGIN_SRC d } else if (line.matchFirst(rgx.block_curly_block_open)) { /+ curly block open +/ debug(block) { // block (curly) open @@ -3194,6 +3218,12 @@ void _start_block_(L,T,N)( obj_type_status["blocks"] = TriState.on; obj_type_status["block"] = TriState.on; obj_type_status["curly_block"] = TriState.on; +#+END_SRC + +******* quote + +#+name: abs_functions_block +#+BEGIN_SRC d } else if (line.matchFirst(rgx.block_curly_quote_open)) { /+ curly quote open +/ debug(quote) { // quote (curly) open @@ -3205,6 +3235,12 @@ void _start_block_(L,T,N)( obj_type_status["blocks"] = TriState.on; obj_type_status["quote"] = TriState.on; obj_type_status["curly_quote"] = TriState.on; +#+END_SRC + +******* table + +#+name: abs_functions_block +#+BEGIN_SRC d } else if (auto m = line.matchFirst(rgx.block_curly_table_open)) { /+ curly table open +/ debug(table) { // table (curly) open @@ -3218,6 +3254,12 @@ void _start_block_(L,T,N)( obj_type_status["blocks"] = TriState.on; obj_type_status["table"] = TriState.on; obj_type_status["curly_table"] = TriState.on; +#+END_SRC + +******* table special + +#+name: abs_functions_block +#+BEGIN_SRC d } else if (auto m = line.matchFirst(rgx.block_curly_table_special_markup)) { /+ table: special table block markup syntax! +/ an_object["table_head"] = m.captures[1].to!string; @@ -3228,6 +3270,7 @@ void _start_block_(L,T,N)( #+END_SRC ****** block (various) tic open :tic: +******* code #+name: abs_functions_block #+BEGIN_SRC d @@ -3245,6 +3288,12 @@ void _start_block_(L,T,N)( obj_type_status["blocks"] = TriState.on; obj_type_status["code"] = TriState.on; obj_type_status["tic_code"] = TriState.on; +#+END_SRC + +******* poem + +#+name: abs_functions_block +#+BEGIN_SRC d } else if (line.matchFirst(rgx.block_tic_poem_open)) { /+ tic poem open +/ debug(poem) { // poem (tic) open @@ -3258,6 +3307,12 @@ void _start_block_(L,T,N)( obj_type_status["verse_new"] = State.on; obj_type_status["poem"] = TriState.on; obj_type_status["tic_poem"] = TriState.on; +#+END_SRC + +******* group + +#+name: abs_functions_block +#+BEGIN_SRC d } else if (line.matchFirst(rgx.block_tic_group_open)) { /+ tic group open +/ debug(group) { // group (tic) open @@ -3269,6 +3324,12 @@ void _start_block_(L,T,N)( obj_type_status["blocks"] = TriState.on; obj_type_status["group"] = TriState.on; obj_type_status["tic_group"] = TriState.on; +#+END_SRC + +******* block + +#+name: abs_functions_block +#+BEGIN_SRC d } else if (line.matchFirst(rgx.block_tic_block_open)) { /+ tic block open +/ debug(block) { // block (tic) open @@ -3280,6 +3341,12 @@ void _start_block_(L,T,N)( obj_type_status["blocks"] = TriState.on; obj_type_status["block"] = TriState.on; obj_type_status["tic_block"] = TriState.on; +#+END_SRC + +******* quote + +#+name: abs_functions_block +#+BEGIN_SRC d } else if (line.matchFirst(rgx.block_tic_quote_open)) { /+ tic quote open +/ debug(quote) { // quote (tic) open @@ -3291,6 +3358,12 @@ void _start_block_(L,T,N)( obj_type_status["blocks"] = TriState.on; obj_type_status["quote"] = TriState.on; obj_type_status["tic_quote"] = TriState.on; +#+END_SRC + +******* table + +#+name: abs_functions_block +#+BEGIN_SRC d } else if (auto m = line.matchFirst(rgx.block_tic_table_open)) { /+ tic table open +/ debug(table) { // table (tic) open @@ -3783,7 +3856,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( 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"); @@ -3846,7 +3919,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( 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; @@ -3892,7 +3965,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( 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"); @@ -3955,7 +4028,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( 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; @@ -4094,8 +4167,8 @@ void _table_closed_make_special_notation_table_(N,CMM)( 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"); @@ -4182,7 +4255,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( 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); @@ -4237,7 +4310,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( 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); @@ -4434,8 +4507,8 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( 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; @@ -5138,7 +5211,7 @@ auto table_substantive_munge(O,T)( _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; } #+END_SRC @@ -5160,7 +5233,7 @@ auto table_substantive_munge_special(O,T)( _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; } #+END_SRC diff --git a/org/output_hub.org b/org/output_hub.org index 9ffa011..649ae34 100644 --- a/org/output_hub.org +++ b/org/output_hub.org @@ -94,7 +94,7 @@ if (sched == outTask.pod) { 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"); } #+END_SRC @@ -143,7 +143,7 @@ if (sched == outTask.html_stuff) { 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"); } #+END_SRC @@ -157,12 +157,12 @@ if (sched == outTask.sqlite) { 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"); } #+END_SRC diff --git a/org/output_sqlite.org b/org/output_sqlite.org index bdb2ca7..06e7f01 100644 --- a/org/output_sqlite.org +++ b/org/output_sqlite.org @@ -31,18 +31,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, ) { <<sqlite_db_statement_composite_collection>> if (!(doc_matters.opt.action.quiet)) { @@ -50,7 +50,7 @@ template SQLiteHubBuildTablesAndPopulate() { } } } - SQLiteDbStatementComposite!()(db, doc_matters, doc_abstraction); + SQLiteDbStatementComposite!()(db, doc_abstraction, doc_matters); } } #+END_SRC @@ -59,18 +59,18 @@ template SQLiteHubBuildTablesAndPopulate() { #+BEGIN_SRC d :tangle "../src/doc_reform/output/sqlite.d" 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, ) { <<sqlite_db_statement_composite_discrete>> if (!(doc_matters.opt.action.quiet)) { @@ -78,7 +78,7 @@ template SQLiteHubDiscreteBuildTablesAndPopulate() { } } } - SQLiteDiscreteDbStatementComposite!()(db, doc_matters, doc_abstraction); + SQLiteDiscreteDbStatementComposite!()(db, doc_abstraction, doc_matters); } } #+END_SRC @@ -200,9 +200,9 @@ template SQLiteInsertMetadata() { #+BEGIN_SRC d :tangle "../src/doc_reform/output/sqlite.d" 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); @@ -291,7 +291,7 @@ template SQLiteDbDrop() { _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"); } } @@ -308,7 +308,7 @@ template SQLiteDbDrop() { { _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; @@ -536,8 +536,8 @@ auto inline_links(M,O)( ) { 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)) diff --git a/org/output_xmls.org b/org/output_xmls.org index 8c9ed75..979534c 100644 --- a/org/output_xmls.org +++ b/org/output_xmls.org @@ -427,10 +427,10 @@ auto tail() { #+name: xhtml_format_objects #+BEGIN_SRC d -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", ) { @@ -458,18 +458,18 @@ auto inline_images(M,O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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)) @@ -552,10 +552,10 @@ auto inline_links(M,O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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); @@ -582,10 +582,10 @@ auto inline_notes_scroll(M,O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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) { @@ -629,15 +629,15 @@ auto inline_notes_seg(M,O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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; } #+END_SRC @@ -646,16 +646,16 @@ auto inline_markup_scroll(M,O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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; } #+END_SRC @@ -665,9 +665,9 @@ auto inline_markup_seg(M,O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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"; @@ -698,9 +698,9 @@ string lev4_heading_subtoc(M,O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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") { @@ -784,8 +784,8 @@ auto nav_pre_next_svg(M,O)( #+name: xhtml_format_objects #+BEGIN_SRC d auto heading(O)( - const O obj, string _txt, + const O obj, string _xml_type = "html", ) { assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter"); @@ -848,15 +848,15 @@ auto heading(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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; } #+END_SRC @@ -865,17 +865,17 @@ auto heading_scroll(M,O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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, @@ -890,8 +890,8 @@ auto heading_seg(M,O)( #+name: xhtml_format_objects #+BEGIN_SRC d 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"); @@ -940,15 +940,15 @@ auto para(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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; } #+END_SRC @@ -957,17 +957,17 @@ auto para_scroll(M,O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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, @@ -982,8 +982,8 @@ auto para_seg(M,O)( #+name: xhtml_format_objects #+BEGIN_SRC d 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"); @@ -1022,15 +1022,15 @@ auto quote(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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; } #+END_SRC @@ -1039,17 +1039,17 @@ auto quote_scroll(M,O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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, @@ -1064,8 +1064,8 @@ auto quote_seg(M,O)( #+name: xhtml_format_objects #+BEGIN_SRC d 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"); @@ -1104,16 +1104,16 @@ auto group(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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; } #+END_SRC @@ -1122,17 +1122,17 @@ auto group_scroll(M,O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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, @@ -1147,8 +1147,8 @@ auto group_seg(M,O)( #+name: xhtml_format_objects #+BEGIN_SRC d 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"); @@ -1183,16 +1183,16 @@ auto block(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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; } #+END_SRC @@ -1201,17 +1201,17 @@ auto block_scroll(M,O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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, @@ -1226,8 +1226,8 @@ auto block_seg(M,O)( #+name: xhtml_format_objects #+BEGIN_SRC d 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"); @@ -1262,16 +1262,16 @@ auto verse(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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; } #+END_SRC @@ -1280,17 +1280,17 @@ auto verse_scroll(M,O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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, @@ -1304,8 +1304,8 @@ auto verse_seg(M,O)( #+name: xhtml_format_objects_code #+BEGIN_SRC d 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"); @@ -1349,8 +1349,8 @@ align="left|right|center" #+name: xhtml_format_objects #+BEGIN_SRC d auto tablarize(O)( - const O obj, string _txt, + const O obj, ) { string[] _table_rows = (_txt).split(rgx.table_delimiter_row); string[] _table_cols; @@ -1388,8 +1388,8 @@ auto tablarize(O)( #+name: xhtml_format_objects #+BEGIN_SRC d 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"); @@ -1397,7 +1397,7 @@ auto table(O)( 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; @@ -1422,27 +1422,6 @@ auto table(O)( } #+END_SRC -*** endnote - -#+name: xhtml_format_objects -#+BEGIN_SRC d -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; -} -#+END_SRC - * _html_ [#A] :html: ** module template :module: @@ -1497,10 +1476,10 @@ void scroll(D,M)( 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 +/ @@ -1533,10 +1512,10 @@ void scroll(D,M)( 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 +/ @@ -1551,24 +1530,24 @@ void scroll(D,M)( 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 +/ @@ -1602,22 +1581,22 @@ void scroll(D,M)( 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 +/ @@ -1756,7 +1735,7 @@ void seg(D,M)( 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; } @@ -1764,19 +1743,19 @@ void seg(D,M)( 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; @@ -1818,7 +1797,7 @@ void seg(D,M)( 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: @@ -1852,7 +1831,7 @@ void seg(D,M)( 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; @@ -1869,32 +1848,32 @@ void seg(D,M)( 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: @@ -1929,26 +1908,26 @@ void seg(D,M)( 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; @@ -2523,7 +2502,7 @@ void outputEPub3(D,I)( 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; @@ -2532,12 +2511,12 @@ void outputEPub3(D,I)( 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; @@ -2579,7 +2558,7 @@ void outputEPub3(D,I)( 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; @@ -2614,7 +2593,7 @@ void outputEPub3(D,I)( 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; @@ -2631,32 +2610,32 @@ void outputEPub3(D,I)( 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: @@ -2691,26 +2670,26 @@ void outputEPub3(D,I)( 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; @@ -2802,9 +2781,9 @@ void outputEPub3(D,I)( /+ 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); } #+END_SRC 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"); |