diff options
Diffstat (limited to 'org')
-rw-r--r-- | org/config_env.org | 18 | ||||
-rw-r--r-- | org/config_nix.org | 2 | ||||
-rw-r--r-- | org/ocda.org | 46 | ||||
-rw-r--r-- | org/ocda_functions.org | 4 | ||||
-rw-r--r-- | org/out_sqlite.org | 161 | ||||
-rw-r--r-- | org/out_xmls.org | 273 | ||||
-rw-r--r-- | org/output_hub.org | 69 | ||||
-rw-r--r-- | org/output_show.org | 46 | ||||
-rw-r--r-- | org/spine.org | 74 |
9 files changed, 326 insertions, 367 deletions
diff --git a/org/config_env.org b/org/config_env.org index 0ef23c2..9913dce 100644 --- a/org/config_env.org +++ b/org/config_env.org @@ -175,8 +175,8 @@ export SpineDBpath=/var/www/sqlite #export SpineDBpath=/srv/www/spine/sqlite #+END_SRC -** versions -*** direnv +* SHARED versions +** direnv #+NAME: direnv_version #+HEADER: :noweb yes @@ -190,7 +190,7 @@ export SpineDBpath=/var/www/sqlite <<./nix-develop-dlang-shared.org:direnv-hash()>> #+END_SRC -*** spine project VERSION :version:set:project: +** spine project VERSION :version:set:project: #+NAME: spine_version #+HEADER: :noweb yes @@ -198,8 +198,8 @@ export SpineDBpath=/var/www/sqlite <<./sisudoc_spine_version_info_and_doc_header_including_copyright_and_license.org:spine_project_version()>> #+END_SRC -*** dlang overlays -**** ldc +** dlang overlays +*** ldc #+NAME: ldc_version #+HEADER: :noweb yes @@ -207,7 +207,7 @@ export SpineDBpath=/var/www/sqlite <<./nix-develop-dlang-shared.org:ldc-version()>> #+END_SRC -**** dmd +*** dmd #+NAME: dmd_version #+HEADER: :noweb yes @@ -215,7 +215,7 @@ export SpineDBpath=/var/www/sqlite <<./nix-develop-dlang-shared.org:dmd-version()>> #+END_SRC -**** dub +*** dub #+NAME: dub_version #+HEADER: :noweb yes @@ -223,7 +223,7 @@ export SpineDBpath=/var/www/sqlite <<./nix-develop-dlang-shared.org:dub-version()>> #+END_SRC -**** dtools +*** dtools #+NAME: dtools_version #+HEADER: :noweb yes @@ -231,6 +231,4 @@ export SpineDBpath=/var/www/sqlite <<./nix-develop-dlang-shared.org:dtools-version()>> #+END_SRC - - * __END__ diff --git a/org/config_nix.org b/org/config_nix.org index 633846f..54ec0ec 100644 --- a/org/config_nix.org +++ b/org/config_nix.org @@ -886,7 +886,6 @@ $SpineBIN/spine -v --show-config --config=$SpinePOD/.dr $SpineBIN/spine --html $SpinePOD/* - $SpineBIN/spine -v --cgi-search-form-codegen --config=$SpinePOD/.dr/config_local_site ,#+END_SRC @@ -1021,6 +1020,7 @@ postInstall: echo `ls -la $${out}/bin/spine` #+END_SRC +* SHARED ** versions *** spine project VERSION :version:set:project: diff --git a/org/ocda.org b/org/ocda.org index 2e4bbb0..148edf8 100644 --- a/org/ocda.org +++ b/org/ocda.org @@ -75,7 +75,7 @@ mixin docAbstractionFunctions; #+HEADER: :noweb yes #+BEGIN_SRC d <<docAbstractionInit>> -<<docAbstractionInitSubstitutions>> +<<docAbstractionInitSubstitutionsDebug>> <<docAbstractionMainLoopSrcByLine>> <<docAbstractionPostMainLoop>> <<docAbstractionReturnsStruct>> @@ -109,8 +109,8 @@ scope(exit) { anchor_tag = ""; } mixin spineNode; -auto node_para_int_ = node_metadata_para_int; -auto node_para_str_ = node_metadata_para_str; +int[string] node_para_int_ = node_metadata_para_int; +string[string] node_para_str_ = node_metadata_para_str; ObjGenericComposite comp_obj_; line_occur = [ "heading" : 0, @@ -221,7 +221,7 @@ int cnt1 = 1; int cnt2 = 1; int cnt3 = 1; *** abstraction init substitutions -#+NAME: docAbstractionInitSubstitutions +#+NAME: docAbstractionInitSubstitutionsDebug #+HEADER: :noweb yes #+BEGIN_SRC d debug (substitutions) { @@ -255,7 +255,7 @@ debug (substitutions) { #+NAME: docAbstractionMainLoopSrcByLine #+HEADER: :noweb yes #+BEGIN_SRC d -auto loopMarkupSrcByLine( +_loopMarkupSrcByLineStruct loopMarkupSrcByLine( char[][] markup_sourcefile_content, string[string] an_object, uint[string] pith, @@ -364,7 +364,7 @@ auto loopMarkupSrcByLine( ._doc_header_and_make_substitutions_(conf_make_meta) ._doc_header_and_make_substitutions_fontface_(conf_make_meta); { - auto _get = line.txt_by_line_block_quote(an_object, pith); + ST_txt_by_line_block_generic _get = line.txt_by_line_block_quote(an_object, pith); { an_object = _get.this_object; pith = _get.pith; @@ -377,7 +377,7 @@ auto loopMarkupSrcByLine( ._doc_header_and_make_substitutions_fontface_(conf_make_meta) .replaceAll(rgx.para_delimiter, mkup.br_line_spaced ~ "$1"); { - auto _get = line.txt_by_line_block_group(an_object, pith); + ST_txt_by_line_block_generic _get = line.txt_by_line_block_group(an_object, pith); { an_object = _get.this_object; pith = _get.pith; @@ -393,7 +393,7 @@ auto loopMarkupSrcByLine( .replaceAll(rgx.spaces_keep, (m.captures[1]).translate([ ' ' : mkup.nbsp ])); } { - auto _get = line.txt_by_line_block_block(an_object, pith); + ST_txt_by_line_block_generic _get = line.txt_by_line_block_block(an_object, pith); { an_object = _get.this_object; pith = _get.pith; @@ -402,7 +402,7 @@ auto loopMarkupSrcByLine( continue; } else if (pith["block_is"] == eN.blk_is.poem) { { - auto _get = line.txt_by_line_block_poem(an_object, pith, cntr, object_number_poem, conf_make_meta, tag_in_seg); + ST_txt_by_line_block_poem _get = line.txt_by_line_block_poem(an_object, pith, cntr, object_number_poem, conf_make_meta, tag_in_seg); { an_object = _get.this_object; pith = _get.pith; @@ -436,7 +436,7 @@ auto loopMarkupSrcByLine( object_number_poem["start"] = obj_cite_digits.object_number.to!string; } { - auto _get = line.txt_by_line_block_start(pith, dochas, object_number_poem); + ST_txt_by_line_block_start _get = line.txt_by_line_block_start(pith, dochas, object_number_poem); { pith = _get.pith; dochas = _get.dochas; @@ -466,7 +466,7 @@ auto loopMarkupSrcByLine( || line.matchFirst(rgx.book_index_item_open) || pith["section"] == eN.sect.book_index) { { // book_index - auto _get = line.flow_book_index_(an_object, book_idx_tmp, pith, opt_action); + ST_flow_book_index _get = line.flow_book_index_(an_object, book_idx_tmp, pith, opt_action); { an_object = _get.this_object; pith = _get.pith; @@ -488,7 +488,7 @@ auto loopMarkupSrcByLine( comp_obj_comment.text = an_object[an_object_key].strip; the_document_body_section ~= comp_obj_comment; { - auto _get = txt_by_line_common_reset_(line_occur, an_object, pith); + ST_txt_by_line_common_reset _get = txt_by_line_common_reset_(line_occur, an_object, pith); { line_occur = _get.line_occur; an_object = _get.this_object; @@ -505,7 +505,7 @@ auto loopMarkupSrcByLine( && (pith["make_headings"] == eN.bi.off)) { // heading found { - auto _get = line.flow_heading_found_(heading_match_str, conf_make_meta.make.headings, heading_match_rgx, pith); + ST_flow_heading_found _get = line.flow_heading_found_(heading_match_str, conf_make_meta.make.headings, heading_match_rgx, pith); { heading_match_str = _get.heading_match_str; heading_match_rgx = _get.heading_match_rgx; @@ -520,7 +520,7 @@ auto loopMarkupSrcByLine( ) { // heading make set { - auto _get = line.flow_heading_make_set_(line_occur, heading_match_rgx, pith); + ST_flow_heading_make_set _get = line.flow_heading_make_set_(line_occur, heading_match_rgx, pith); { line = _get.line; an_object = _get.this_object; @@ -558,7 +558,7 @@ auto loopMarkupSrcByLine( ._doc_header_and_make_substitutions_(conf_make_meta) ._doc_header_and_make_substitutions_fontface_(conf_make_meta); { - auto _get = line.flow_para_match_(an_object, an_object_key, indent, bullet, pith, line_occur); + ST_flow_para_match _get = line.flow_para_match_(an_object, an_object_key, indent, bullet, pith, line_occur); { an_object = _get.this_object; an_object_key = _get.this_object_key; @@ -587,7 +587,7 @@ auto loopMarkupSrcByLine( } else if (pith["block_state"] == eN.blk_state.closing) { // line empty, with blocks flag { - auto _get = line.flow_block_flag_line_empty_( + ST_flow_block_flag_line_empty _get = line.flow_block_flag_line_empty_( an_object, bookindex_extract_hash, the_document_body_section, @@ -703,7 +703,7 @@ auto loopMarkupSrcByLine( _anchor_tag = obj_cite_digits.identifier; // (incrementally build toc) table of contents here! { - auto _get = obj_im.flow_table_of_contents_gather_headings( + ST_flow_table_of_contents_gather_headings _get = obj_im.flow_table_of_contents_gather_headings( an_object, conf_make_meta, tag_in_seg, @@ -724,7 +724,7 @@ auto loopMarkupSrcByLine( if (an_object["lev_markup_number"].to!int <= 4) { segnames["epub"] ~= tag_in_seg["seg_lv1to4"]; } - auto comp_obj_ = node_construct.node_emitter_heading( + ObjGenericComposite comp_obj_ = node_construct.node_emitter_heading( an_object, tag_in_seg, lev_anchor_tag, @@ -745,7 +745,7 @@ auto loopMarkupSrcByLine( the_document_body_section ~= comp_obj_; debug(objectrelated1) { writeln(line); } // check { - auto _get = txt_by_line_common_reset_(line_occur, an_object, pith); + ST_txt_by_line_common_reset _get = txt_by_line_common_reset_(line_occur, an_object, pith); { line_occur = _get.line_occur; an_object = _get.this_object; @@ -766,7 +766,7 @@ auto loopMarkupSrcByLine( an_object["bookindex_nugget"] = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; bookindex_unordered_hashes = bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_digits, tag_in_seg); an_object["is"] = "para"; - auto comp_obj_ = node_construct.node_location_emitter( + ObjGenericComposite comp_obj_ = node_construct.node_location_emitter( content_non_header, tag_in_seg, lev_anchor_tag, @@ -798,7 +798,7 @@ auto loopMarkupSrcByLine( the_document_body_section ~= comp_obj_; tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); { - auto _get = txt_by_line_common_reset_(line_occur, an_object, pith); + ST_txt_by_line_common_reset _get = txt_by_line_common_reset_(line_occur, an_object, pith); { line_occur = _get.line_occur; an_object = _get.this_object; @@ -872,7 +872,7 @@ auto loopMarkupSrcByLine( return ret; } { // loopMarkupSrcByLine - auto _doc_by_line = loopMarkupSrcByLine(markup_sourcefile_content, an_object, pith); + _loopMarkupSrcByLineStruct _doc_by_line = loopMarkupSrcByLine(markup_sourcefile_content, an_object, pith); the_document_toc_section = _doc_by_line.toc; the_document_body_section = _doc_by_line.body; the_document_glossary_section = _doc_by_line.glossary; @@ -1534,7 +1534,7 @@ struct DocHas_ { return tag_assoc; } } -auto doc_has() { +DocHas_ doc_has() { return DocHas_(); } // the doc to be returned diff --git a/org/ocda_functions.org b/org/ocda_functions.org index 120c3e3..ffbecb6 100644 --- a/org/ocda_functions.org +++ b/org/ocda_functions.org @@ -3899,7 +3899,7 @@ ST_the_section build_the_glossary_section( } } else { // para { - auto _get = line.flow_para_match_(an_object, an_object_key, indent, bullet, pith, line_occur); + ST_flow_para_match _get = line.flow_para_match_(an_object, an_object_key, indent, bullet, pith, line_occur); { an_object = _get.this_object; an_object_key = _get.this_object_key; @@ -4206,7 +4206,7 @@ ST_the_section build_the_blurb_section(Opt) ( tag_assoc[comp_obj_.tags.segment_anchor_tag_epub]["seg_lv1to4"] = comp_obj_.tags.segment_anchor_tag_epub; } else if (!(line.empty)) { { - auto _get = line.flow_para_match_(an_object, an_object_key, indent, bullet, pith, line_occur); + ST_flow_para_match _get = line.flow_para_match_(an_object, an_object_key, indent, bullet, pith, line_occur); { an_object = _get.this_object; an_object_key = _get.this_object_key; diff --git a/org/out_sqlite.org b/org/out_sqlite.org index 9610cfc..b9ab903 100644 --- a/org/out_sqlite.org +++ b/org/out_sqlite.org @@ -81,11 +81,8 @@ long _metadata_tid_lastrowid; #+HEADER: :noweb yes #+BEGIN_SRC d template SQLiteHubBuildTablesAndPopulate() { - void SQLiteHubBuildTablesAndPopulate(D,M)( - const D doc_abstraction, - M doc_matters, - ) { - auto pth_sqlite = spinePathsSQLite!()(doc_matters.sqlite.filename, doc_matters.sqlite.path); + void SQLiteHubBuildTablesAndPopulate(D)(D doc) { + auto pth_sqlite = spinePathsSQLite!()(doc.matters.sqlite.filename, doc.matters.sqlite.path); if ((isValidPath(pth_sqlite.base) && exists(pth_sqlite.base) != 0 && pth_sqlite.base.isDir)) { } else { try { @@ -93,20 +90,19 @@ template SQLiteHubBuildTablesAndPopulate() { } catch (FileException ex) { } } template SQLiteDbStatementComposite() { - void SQLiteDbStatementComposite(Db,D,M)( - Db db, - const D doc_abstraction, - M doc_matters, + void SQLiteDbStatementComposite(Db,D)( + Db db, + D doc ) { <<sqlite_db_statement_composite_collection>> - if (doc_matters.opt.action.vox_gt0) { + if (doc.matters.opt.action.vox_gt0) { writeln(" ", pth_sqlite.sqlite_file); } } } try { auto db = Database(pth_sqlite.sqlite_file); - SQLiteDbStatementComposite!()(db, doc_abstraction, doc_matters); + SQLiteDbStatementComposite!()(db, doc); } catch (FileException e) { writeln("Failed (FileException): ", e.msg, " ", pth_sqlite.sqlite_file); @@ -141,24 +137,20 @@ template SQLiteHubBuildTablesAndPopulate() { #+HEADER: :noweb yes #+BEGIN_SRC d template SQLiteHubDiscreteBuildTablesAndPopulate() { - void SQLiteHubDiscreteBuildTablesAndPopulate(D,M)( - const D doc_abstraction, - M doc_matters, - ) { - auto url_html = spineUrlsHTML!()(doc_matters.conf_make_meta.conf.w_srv_data_root_url_html, doc_matters.src.language); - auto pth_sqlite = spinePathsSQLiteDiscrete!()(doc_matters.output_path, doc_matters.src.language); // doc_matters.db_path + void SQLiteHubDiscreteBuildTablesAndPopulate(D)(D doc) { + auto url_html = spineUrlsHTML!()(doc.matters.conf_make_meta.conf.w_srv_data_root_url_html, doc.matters.src.language); + auto pth_sqlite = spinePathsSQLiteDiscrete!()(doc.matters.output_path, doc.matters.src.language); // doc.matters.db_path if ((isValidPath(pth_sqlite.base) && exists(pth_sqlite.base) != 0 && pth_sqlite.base.isDir)) { } else { try { pth_sqlite.base.mkdirRecurse; } catch (FileException ex) { } } - auto db = Database(pth_sqlite.sqlite_file(doc_matters.src.filename)); + auto db = Database(pth_sqlite.sqlite_file(doc.matters.src.filename)); template SQLiteDiscreteDbStatementComposite() { - void SQLiteDiscreteDbStatementComposite(Db,D,M)( - Db db, - const D doc_abstraction, - M doc_matters, + void SQLiteDiscreteDbStatementComposite(Db,D)( + Db db, + D doc ) { try { <<sqlite_db_statement_composite_discrete>> @@ -185,12 +177,12 @@ template SQLiteHubDiscreteBuildTablesAndPopulate() { import core.runtime; core.runtime.Runtime.terminate(); } - if (doc_matters.opt.action.vox_gt0) { - writeln(" ", pth_sqlite.sqlite_file(doc_matters.src.filename)); + if (doc.matters.opt.action.vox_gt0) { + writeln(" ", pth_sqlite.sqlite_file(doc.matters.src.filename)); } } } - SQLiteDiscreteDbStatementComposite!()(db, doc_abstraction, doc_matters); + SQLiteDiscreteDbStatementComposite!()(db, doc); } } #+END_SRC @@ -245,9 +237,7 @@ template SQLinsertDelimiter() { } } template SQLiteFormatAndLoadObject() { - auto SQLiteFormatAndLoadObject(M)( - M doc_matters, - ) { + auto SQLiteFormatAndLoadObject(M)(M doc_matters) { mixin spineRgxOut; mixin spineRgxXHTML; struct sqlite_format_and_load_objects { @@ -313,9 +303,7 @@ template SQLiteTablesReCreate() { #+HEADER: :noweb yes #+BEGIN_SRC d template SQLiteDeleteDocument() { - string SQLiteDeleteDocument(M)( - M doc_matters, - ) { + string SQLiteDeleteDocument(M)(M doc_matters) { <<sqlite_formatted_delete_format>> <<sqlite_formatted_delete_sql>> <<sqlite_formatted_delete_values>> @@ -330,9 +318,7 @@ template SQLiteDeleteDocument() { #+HEADER: :noweb yes #+BEGIN_SRC d template SQLiteInsertMetadata() { - string SQLiteInsertMetadata(M)( - M doc_matters, - ) { + string SQLiteInsertMetadata(M)(M doc_matters) { <<sqlite_formatted_insertions_doc_matters_metadata_format>> <<sqlite_formatted_insertions_doc_matters_metadata_sql>> <<sqlite_formatted_insertions_doc_matters_metadata_sql_values>> @@ -348,9 +334,7 @@ template SQLiteInsertMetadata() { #+HEADER: :noweb yes #+BEGIN_SRC d template SQLiteInsertMetadataTopics() { - string SQLiteInsertMetadataTopics(M)( - M doc_matters, - ) { + string SQLiteInsertMetadataTopics(M)(M doc_matters) { <<sqlite_formatted_insertions_topic_register_loop>> <<sqlite_formatted_insertions_topic_register_format>> <<sqlite_formatted_insertions_topic_register_sql>> @@ -368,12 +352,9 @@ template SQLiteInsertMetadataTopics() { #+HEADER: :noweb yes #+BEGIN_SRC d template SQLiteInsertDocObjectsLoop() { - string SQLiteInsertDocObjectsLoop(D,M)( - const D doc_abstraction, - M doc_matters, - ) { - string _uid = SQLinsertDelimiter!()(doc_matters.src.doc_uid); - auto url_html = spineUrlsHTML!()(doc_matters.conf_make_meta.conf.w_srv_data_root_url_html, doc_matters.src.language); + string SQLiteInsertDocObjectsLoop(D)(D doc) { + string _uid = SQLinsertDelimiter!()(doc.matters.src.doc_uid); + auto url_html = spineUrlsHTML!()(doc.matters.conf_make_meta.conf.w_srv_data_root_url_html, doc.matters.src.language); string insertDocObjectsRow(O)(O obj) { <<sqlite_formatted_insertions_doc_objects_format>> <<sqlite_formatted_insertions_doc_objects_sql>> @@ -525,8 +506,8 @@ template SQLiteDbDrop() { #+NAME: sqlite_db_statement_composite_collection #+BEGIN_SRC d string _db_statement; -if ((doc_matters.opt.action.sqlite_db_create)) { - auto pth_sqlite = spinePathsSQLite!()(doc_matters.sqlite.filename, doc_matters.sqlite.path); +if ((doc.matters.opt.action.sqlite_db_create)) { + auto pth_sqlite = spinePathsSQLite!()(doc.matters.sqlite.filename, doc.matters.sqlite.path); if ((isValidPath(pth_sqlite.base) && exists(pth_sqlite.base) != 0 && pth_sqlite.base.isDir)) { } else { try { @@ -534,27 +515,27 @@ if ((doc_matters.opt.action.sqlite_db_create)) { } catch (FileException ex) { } } _db_statement ~= SQLiteTablesReCreate!()(); - SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "TABLE RE-CREATE"); + SQLiteDbRun!()(db, _db_statement, doc.matters.opt.action, "TABLE RE-CREATE"); _db_statement = []; } -if (doc_matters.opt.action.sqlite_delete) { - _db_statement ~= SQLiteDeleteDocument!()(doc_matters); - SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "DELETE Document"); +if (doc.matters.opt.action.sqlite_delete) { + _db_statement ~= SQLiteDeleteDocument!()(doc.matters); + SQLiteDbRun!()(db, _db_statement, doc.matters.opt.action, "DELETE Document"); _db_statement = []; } -if (doc_matters.opt.action.sqlite_update) { - _db_statement ~= SQLiteDeleteDocument!()(doc_matters); - SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "DELETE Document"); +if (doc.matters.opt.action.sqlite_update) { + _db_statement ~= SQLiteDeleteDocument!()(doc.matters); + SQLiteDbRun!()(db, _db_statement, doc.matters.opt.action, "DELETE Document"); _db_statement = []; - _db_statement ~= SQLiteInsertMetadata!()(doc_matters); - SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "INSERT MetaData"); + _db_statement ~= SQLiteInsertMetadata!()(doc.matters); + SQLiteDbRun!()(db, _db_statement, doc.matters.opt.action, "INSERT MetaData"); _db_statement = []; - /+ get tid (lastrowid or max) for use in doc_objects table +/ - _db_statement ~= doc_abstraction.SQLiteInsertDocObjectsLoop!()(doc_matters); - SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "INSERT DocObjects"); + /+ get tid (lastrowid or max) for use in doc.objects table +/ + _db_statement ~= doc.SQLiteInsertDocObjectsLoop!(); + SQLiteDbRun!()(db, _db_statement, doc.matters.opt.action, "INSERT DocObjects"); _db_statement = []; - _db_statement ~= SQLiteInsertMetadataTopics!()(doc_matters); - SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "INSERT MetaDataTopics"); + _db_statement ~= SQLiteInsertMetadataTopics!()(doc.matters); + SQLiteDbRun!()(db, _db_statement, doc.matters.opt.action, "INSERT MetaDataTopics"); _db_statement = []; } db.close; @@ -567,10 +548,10 @@ db.close; { string _db_statement; _db_statement ~= SQLiteTablesReCreate!()(); - _db_statement ~= SQLiteInsertMetadata!()(doc_matters); - _db_statement ~= SQLiteInsertMetadataTopics!()(doc_matters); - _db_statement ~= doc_abstraction.SQLiteInsertDocObjectsLoop!()(doc_matters); - SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "table CREATE Tables, INSERT DocObjects"); + _db_statement ~= SQLiteInsertMetadata!()(doc.matters); + _db_statement ~= SQLiteInsertMetadataTopics!()(doc.matters); + _db_statement ~= doc.SQLiteInsertDocObjectsLoop!(); + SQLiteDbRun!()(db, _db_statement, doc.matters.opt.action, "table CREATE Tables, INSERT DocObjects"); } db.close; #+END_SRC @@ -1534,23 +1515,23 @@ string[string] table(M,O)( #+NAME: sqlite_objects_loop #+BEGIN_SRC d -auto format_and_sqlite_load = SQLiteFormatAndLoadObject!()(doc_matters); +auto format_and_sqlite_load = SQLiteFormatAndLoadObject!()(doc.matters); string[string] obj_txt; string doc_text; string[] _insert_doc_objects; -foreach (part; doc_matters.has.keys_seq.sql) { - foreach (obj; doc_abstraction[part]) { +foreach (part; doc.matters.has.keys_seq.sql) { + foreach (obj; doc.abstraction[part]) { switch (obj.metainfo.is_of_part) { case "frontmatter": assert(part == "head", part); switch (obj.metainfo.is_of_type) { case "para": switch (obj.metainfo.is_a) { case "heading": - obj_txt = format_and_sqlite_load.heading(doc_matters, obj); + obj_txt = format_and_sqlite_load.heading(doc.matters, obj); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite) { + if (doc.matters.opt.action.debug_do_sqlite) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -1559,7 +1540,7 @@ foreach (part; doc_matters.has.keys_seq.sql) { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite) { + if (doc.matters.opt.action.debug_do_sqlite) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -1576,14 +1557,14 @@ foreach (part; doc_matters.has.keys_seq.sql) { writeln(__LINE__, ": ", obj.text); } } - obj_txt = format_and_sqlite_load.heading(doc_matters, obj); + obj_txt = format_and_sqlite_load.heading(doc.matters, obj); break; case "para": - obj_txt = format_and_sqlite_load.para(doc_matters, obj); + obj_txt = format_and_sqlite_load.para(doc.matters, obj); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite) { + if (doc.matters.opt.action.debug_do_sqlite) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -1593,28 +1574,28 @@ foreach (part; doc_matters.has.keys_seq.sql) { case "block": switch (obj.metainfo.is_a) { case "quote": - obj_txt = format_and_sqlite_load.quote(doc_matters, obj); + obj_txt = format_and_sqlite_load.quote(doc.matters, obj); break; case "group": - obj_txt = format_and_sqlite_load.group(doc_matters, obj); + obj_txt = format_and_sqlite_load.group(doc.matters, obj); break; case "block": - obj_txt = format_and_sqlite_load.block(doc_matters, obj); + obj_txt = format_and_sqlite_load.block(doc.matters, obj); break; case "poem": // double check on keeping both poem & verse break; case "verse": - obj_txt = format_and_sqlite_load.verse(doc_matters, obj); + obj_txt = format_and_sqlite_load.verse(doc.matters, obj); break; case "code": - obj_txt = format_and_sqlite_load.code(doc_matters, obj); + obj_txt = format_and_sqlite_load.code(doc.matters, obj); break; case "table": - obj_txt = format_and_sqlite_load.table(doc_matters, obj); + obj_txt = format_and_sqlite_load.table(doc.matters, obj); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite) { + if (doc.matters.opt.action.debug_do_sqlite) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -1623,7 +1604,7 @@ foreach (part; doc_matters.has.keys_seq.sql) { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite) { + if (doc.matters.opt.action.debug_do_sqlite) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -1636,23 +1617,23 @@ foreach (part; doc_matters.has.keys_seq.sql) { case "para": switch (obj.metainfo.is_a) { case "heading": - obj_txt = format_and_sqlite_load.heading(doc_matters, obj); + obj_txt = format_and_sqlite_load.heading(doc.matters, obj); break; case "glossary": assert(part == "glossary", part); - obj_txt = format_and_sqlite_load.para(doc_matters, obj); + obj_txt = format_and_sqlite_load.para(doc.matters, obj); break; case "bibliography": assert(part == "bibliography", part); - obj_txt = format_and_sqlite_load.para(doc_matters, obj); + obj_txt = format_and_sqlite_load.para(doc.matters, obj); break; case "bookindex": assert(part == "bookindex", part); - obj_txt = format_and_sqlite_load.para(doc_matters, obj); + obj_txt = format_and_sqlite_load.para(doc.matters, obj); break; case "blurb": assert(part == "blurb", part); - obj_txt = format_and_sqlite_load.para(doc_matters, obj); + obj_txt = format_and_sqlite_load.para(doc.matters, obj); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite) { + if (doc.matters.opt.action.debug_do_sqlite) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -1661,7 +1642,7 @@ foreach (part; doc_matters.has.keys_seq.sql) { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite) { + if (doc.matters.opt.action.debug_do_sqlite) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -1672,7 +1653,7 @@ foreach (part; doc_matters.has.keys_seq.sql) { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite) { + if (doc.matters.opt.action.debug_do_sqlite) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); // check where empty value could come from writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); writeln(__FILE__, ":", __LINE__, ": ", obj.text); // check where empty value could come from @@ -1681,9 +1662,9 @@ foreach (part; doc_matters.has.keys_seq.sql) { break; } if (obj.metainfo.is_a == "heading") { - if (doc_matters.opt.action.show_sqlite) { + if (doc.matters.opt.action.show_sqlite) { if (obj.metainfo.heading_lev_markup == 0) { - writeln(doc_matters.src.filename); + writeln(doc.matters.src.filename); } writeln( "markup: ", obj.metainfo.heading_lev_markup, diff --git a/org/out_xmls.org b/org/out_xmls.org index b3b16d7..8d0b475 100644 --- a/org/out_xmls.org +++ b/org/out_xmls.org @@ -1766,10 +1766,7 @@ module sisudoc.io_out.html; template outputHTML() { <<output_imports_xml>> mixin outputXHTMLs; - void scroll(D,M)( - const D doc_abstraction, - M doc_matters, - ) { + void scroll(D)(D doc) { <<output_html_scroll_0>> <<output_html_scroll_loop_parts>> <<output_html_scroll_is_frontmatter>> @@ -1778,10 +1775,7 @@ template outputHTML() { <<output_html_scroll_close_is_case>> } <<output_html_scroll_scroll_write_output>> - void seg(D,M)( - const D doc_abstraction, - M doc_matters, - ) { + void seg(D)(D doc) { <<output_html_seg_0>> <<output_html_seg_loop_parts>> <<output_html_seg_is_heading>> @@ -1808,7 +1802,7 @@ auto xhtml_format = outputXHTMLs(); static auto rgx = RgxO(); static auto rgx_xhtml = RgxXHTML(); string[] doc_html; -string[] doc; +string[] doc_out; string suffix = ".html"; string previous_section = ""; string delimit = ""; @@ -1818,8 +1812,8 @@ string delimit = ""; #+NAME: output_html_scroll_loop_parts #+BEGIN_SRC d -foreach (section; doc_matters.has.keys_seq.scroll) { - foreach (obj; doc_abstraction[section]) { +foreach (section; doc.matters.has.keys_seq.scroll) { + foreach (obj; doc.abstraction[section]) { delimit = xhtml_format.div_delimit(section, previous_section); string _txt = xhtml_format.special_characters_breaks_indents_bullets(obj); switch (obj.metainfo.is_of_part) { @@ -1834,14 +1828,14 @@ case "frontmatter": assert(section == "head" || "toc"); case "para": switch (obj.metainfo.is_a) { case "heading": - doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc_matters, suffix); + doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc.matters, suffix); break; case "toc": - doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc.matters, suffix); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -1850,7 +1844,7 @@ case "frontmatter": assert(section == "head" || "toc"); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -1868,14 +1862,14 @@ case "body": assert(section == "body" || "head"); case "para": switch (obj.metainfo.is_a) { case "heading": - doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc_matters, suffix); + doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc.matters, suffix); break; case "para": - doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc.matters, suffix); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -1885,28 +1879,28 @@ case "body": assert(section == "body" || "head"); case "block": switch (obj.metainfo.is_a) { case "quote": - doc_html ~= xhtml_format.quote_scroll(_txt, obj, doc_matters); + doc_html ~= xhtml_format.quote_scroll(_txt, obj, doc.matters); break; case "group": - doc_html ~= xhtml_format.group_scroll(_txt, obj, doc_matters); + doc_html ~= xhtml_format.group_scroll(_txt, obj, doc.matters); break; case "block": - doc_html ~= xhtml_format.block_scroll(_txt, obj, doc_matters); + doc_html ~= xhtml_format.block_scroll(_txt, obj, doc.matters); break; case "poem": break; case "verse": - doc_html ~= xhtml_format.verse_scroll(_txt, obj, doc_matters, suffix); + doc_html ~= xhtml_format.verse_scroll(_txt, obj, doc.matters, suffix); break; case "code": - doc_html ~= xhtml_format.code(_txt, obj, doc_matters); + doc_html ~= xhtml_format.code(_txt, obj, doc.matters); break; case "table": - doc_html ~= xhtml_format.table(_txt, obj, doc_matters); + doc_html ~= xhtml_format.table(_txt, obj, doc.matters); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -1915,7 +1909,7 @@ case "body": assert(section == "body" || "head"); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -1934,29 +1928,29 @@ case "backmatter": case "para": switch (obj.metainfo.is_a) { case "heading": - doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc_matters, suffix); + doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc.matters, suffix); break; case "endnote": assert(section == "endnotes"); - doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc.matters, suffix); break; case "glossary": assert(section == "glossary"); - doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc.matters, suffix); break; case "bibliography": assert(section == "bibliography"); - doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc.matters, suffix); break; case "bookindex": assert(section == "bookindex"); - doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc.matters, suffix); break; case "blurb": assert(section == "blurb"); - doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc.matters, suffix); break; case "tail": assert(section == "tail"); - doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc.matters, suffix); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -1965,7 +1959,7 @@ case "backmatter": break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -1976,7 +1970,7 @@ case "comment": break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); writeln(__FILE__, ":", __LINE__, ": ", obj.text); @@ -1992,23 +1986,23 @@ default: } } } -doc = xhtml_format.html_head(doc_matters, "scroll") +doc_out = xhtml_format.html_head(doc.matters, "scroll") ~ doc_html ~ xhtml_format.dom_close -~ xhtml_format.tail(doc_matters); -scroll_write_output(doc, doc_matters); +~ xhtml_format.tail(doc.matters); +scroll_write_output(doc_out, doc.matters); #+END_SRC *** write output file #+NAME: output_html_scroll_scroll_write_output #+BEGIN_SRC d -@trusted void scroll_write_output(D,M)( - D doc, +@trusted void scroll_write_output(O,M)( + O doc_out, M doc_matters, ) { debug(asserts) { - static assert(is(typeof(doc) == string[])); + static assert(is(typeof(doc_out) == string[])); } auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language); try { @@ -2017,7 +2011,7 @@ scroll_write_output(doc, doc_matters); } { auto f = File(pth_html.fn_scroll(doc_matters.src.filename), "w"); - foreach (o; doc) { + foreach (o; doc_out) { f.writeln(o); } } @@ -2054,7 +2048,6 @@ static auto rgx_xhtml = RgxXHTML(); auto xhtml_format = outputXHTMLs(); string[][string] doc_html; string[][string] doc_html_endnotes; -string[] doc; string segment_filename; string[] top_level_headings = ["","","",""]; string previous_seg_filename = ""; @@ -2067,8 +2060,8 @@ string delimit = ""; #+NAME: output_html_seg_loop_parts #+BEGIN_SRC d -foreach (section; doc_matters.has.keys_seq.seg) { - foreach (obj; doc_abstraction[section]) { +foreach (section; doc.matters.has.keys_seq.seg) { + foreach (obj; doc.abstraction[section]) { delimit = xhtml_format.div_delimit(section, previous_section); string _txt = xhtml_format.special_characters_breaks_indents_bullets(obj); #+END_SRC @@ -2102,33 +2095,33 @@ if (obj.metainfo.is_a == "heading") { top_level_headings[3] = ""; goto default; default: - Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "seg"); + Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc.matters, suffix, "seg"); top_level_headings[obj.metainfo.heading_lev_markup] = t[0]; break; } break; 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(obj, doc_matters); + doc_html[segment_filename] ~= xhtml_format.html_head(doc.matters, "seg"); + 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; } - Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "seg"); + Tuple!(string, string[]) 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(obj, doc_matters); + doc_html[segment_filename] ~= xhtml_format.lev4_heading_subtoc(obj, doc.matters); doc_html_endnotes[segment_filename] ~= t[1]; break; case 5: .. case 7: - Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "seg"); + Tuple!(string, string[]) 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; case 8: .. case 9: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); writeln(__FILE__, ":", __LINE__, ": ", obj.text); } @@ -2136,7 +2129,7 @@ if (obj.metainfo.is_a == "heading") { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); } } @@ -2163,12 +2156,12 @@ case "frontmatter": assert(section == "head" || "toc"); case "para": switch (obj.metainfo.is_a) { case "toc": - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); + t = xhtml_format.para_seg(_txt, obj, doc.matters, suffix, "seg"); doc_html[segment_filename] ~= t[0].to!string; break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -2177,7 +2170,7 @@ case "frontmatter": assert(section == "head" || "toc"); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -2195,13 +2188,13 @@ case "body": assert(section == "body"); case "para": switch (obj.metainfo.is_a) { case "para": - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); + 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; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -2211,24 +2204,24 @@ case "body": assert(section == "body"); case "block": switch (obj.metainfo.is_a) { case "quote": - t = xhtml_format.quote_seg(_txt, obj, doc_matters, suffix, "seg"); + t = xhtml_format.quote_seg(_txt, obj, doc.matters, suffix, "seg"); goto default; case "group": - t = xhtml_format.group_seg(_txt, obj, doc_matters, suffix, "seg"); + t = xhtml_format.group_seg(_txt, obj, doc.matters, suffix, "seg"); goto default; case "block": - t = xhtml_format.block_seg(_txt, obj, doc_matters, suffix, "seg"); + t = xhtml_format.block_seg(_txt, obj, doc.matters, suffix, "seg"); goto default; case "poem": break; case "verse": - t = xhtml_format.verse_seg(_txt, obj, doc_matters, suffix, "seg"); + t = xhtml_format.verse_seg(_txt, obj, doc.matters, suffix, "seg"); goto default; case "code": - doc_html[segment_filename] ~= xhtml_format.code(_txt, obj, doc_matters); + doc_html[segment_filename] ~= xhtml_format.code(_txt, obj, doc.matters); break; case "table": - doc_html[segment_filename] ~= xhtml_format.table(_txt, obj, doc_matters); + doc_html[segment_filename] ~= xhtml_format.table(_txt, obj, doc.matters); doc_html_endnotes[segment_filename] ~= ""; break; default: @@ -2240,7 +2233,7 @@ case "body": assert(section == "body"); doc_html[segment_filename] ~= t[0].to!string; doc_html_endnotes[segment_filename] ~= t[1]; } else { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -2249,7 +2242,7 @@ case "body": assert(section == "body"); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -2268,37 +2261,37 @@ case "backmatter": case "para": switch (obj.metainfo.is_a) { case "endnote": assert(section == "endnotes"); - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); + t = xhtml_format.para_seg(_txt, obj, doc.matters, suffix, "seg"); doc_html[segment_filename] ~= t[0]; break; case "glossary": assert(section == "glossary"); - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); + 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(section == "bibliography"); - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); + 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(section == "bookindex"); - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); + 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(section == "blurb"); - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); + 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 "tail": assert(section == "tail"); - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); + 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; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -2307,7 +2300,7 @@ case "backmatter": break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -2318,7 +2311,7 @@ case "comment": break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); } } @@ -2333,7 +2326,7 @@ default: } } } -seg_write_output(doc_html, doc_html_endnotes, doc_matters); +seg_write_output(doc_html, doc_html_endnotes, doc.matters); #+END_SRC *** write output files @@ -2418,9 +2411,7 @@ void css(M)(M doc_matters) { #+NAME: copy_html_images #+BEGIN_SRC d -@trusted void images_cp(M)( // @system - M doc_matters, -) { +@trusted void images_cp(M)(M doc_matters) { // @system { /+ (copy html images) +/ auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language); if (!exists(pth_html.image)) { @@ -2562,10 +2553,10 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> #+NAME: output_epub3_constructs_oebps_content #+HEADER: :noweb yes #+BEGIN_SRC d -string epub3_oebps_content(D,M,P)(D doc_abstraction, M doc_matters, P parts) { +string epub3_oebps_content(D,P)(D doc, P parts) { auto xhtml_format = outputXHTMLs(); - auto pth_epub3 = spinePathsEPUB!()(doc_matters.output_path, doc_matters.src.language); - string _uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO sort uuid in doc_matters! + auto pth_epub3 = spinePathsEPUB!()(doc.matters.output_path, doc.matters.src.language); + string _uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO sort uuid in doc.matters! string content = format(q"┃<?xml version="1.0" encoding="utf-8"?> <<epub3_package_version>> <metadata @@ -2589,25 +2580,25 @@ string epub3_oebps_content(D,M,P)(D doc_abstraction, M doc_matters, P parts) { <item id="nav" href="toc_nav.xhtml" media-type="application/xhtml+xml" properties="nav" /> ┃", _uuid, - xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.title_main), - (doc_matters.conf_make_meta.meta.title_sub.empty) - ? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.title_sub), - (doc_matters.conf_make_meta.meta.creator_author.empty) - ? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.creator_author), - (doc_matters.conf_make_meta.meta.creator_author.empty) - ? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.creator_author), - doc_matters.src.language, // language, fix (needed in dochead metadata) - (doc_matters.conf_make_meta.meta.date_published.empty) - ? "" : xhtml_format.special_characters_date(doc_matters.conf_make_meta.meta.date_published), - (doc_matters.conf_make_meta.meta.rights_copyright.empty) - ? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.rights_copyright), + xhtml_format.special_characters_text(doc.matters.conf_make_meta.meta.title_main), + (doc.matters.conf_make_meta.meta.title_sub.empty) + ? "" : xhtml_format.special_characters_text(doc.matters.conf_make_meta.meta.title_sub), + (doc.matters.conf_make_meta.meta.creator_author.empty) + ? "" : xhtml_format.special_characters_text(doc.matters.conf_make_meta.meta.creator_author), + (doc.matters.conf_make_meta.meta.creator_author.empty) + ? "" : xhtml_format.special_characters_text(doc.matters.conf_make_meta.meta.creator_author), + doc.matters.src.language, // language, fix (needed in dochead metadata) + (doc.matters.conf_make_meta.meta.date_published.empty) + ? "" : xhtml_format.special_characters_date(doc.matters.conf_make_meta.meta.date_published), + (doc.matters.conf_make_meta.meta.rights_copyright.empty) + ? "" : xhtml_format.special_characters_text(doc.matters.conf_make_meta.meta.rights_copyright), _uuid, _uuid, (pth_epub3.fn_oebps_css).chompPrefix("OEBPS/"), ); content ~= parts["manifest_documents"]; // TODO sort jpg & png - foreach (image; doc_matters.srcs.image_list) { + foreach (image; doc.matters.srcs.image_list) { content ~= format(q"┃ <item id="%s" href="%s/%s" media-type="image/%s" /> ┃", image.baseName.stripExtension, @@ -2625,8 +2616,8 @@ string epub3_oebps_content(D,M,P)(D doc_abstraction, M doc_matters, P parts) { content ~= " " ~ "</guide>" ~ "\n "; content ~= "" ~ "</package>"; debug(epubmanifest) { - foreach (section; doc_matters.has.keys_seq.seg) { // TODO - foreach (obj; doc_abstraction[section]) { + foreach (section; doc.matters.has.keys_seq.seg) { // TODO + foreach (obj; doc.abstraction[section]) { if (obj.metainfo.is_a == "heading") { if (obj.metainfo.heading_lev_markup == 4) { writefln( @@ -2658,7 +2649,7 @@ string epub3_oebps_content(D,M,P)(D doc_abstraction, M doc_matters, P parts) { #+NAME: output_epub3_constructs_oebps_toc_nav_xhtml #+BEGIN_SRC d -string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) { +string epub3_oebps_toc_nav_xhtml(D)(D doc) { enum DomTags { none, open, close, close_and_open, open_still, } auto markup = InlineMarkup(); static auto rgx = RgxO(); @@ -2677,12 +2668,12 @@ string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) { </header> <nav epub:type="toc" id="toc"> ┃", - (doc_matters.conf_make_meta.meta.title_full).special_characters_text, + (doc.matters.conf_make_meta.meta.title_full).special_characters_text, ); string _toc_nav_tail = ""; - // writeln(doc_matters.has.keys_seq.seg); // DEBUG line - foreach (sect; doc_matters.has.keys_seq.seg) { - foreach (obj; doc_abstraction[sect]) { + // writeln(doc.matters.has.keys_seq.seg); // DEBUG line + foreach (sect; doc.matters.has.keys_seq.seg) { + foreach (obj; doc.abstraction[sect]) { if ((sect == "head") && (obj.metainfo.is_a == "heading")) { toc = toc_head; } @@ -2738,7 +2729,7 @@ string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) { } break; } - if (doc_matters.has.keys_seq.seg[doc_matters.has.keys_seq.seg.length - 2] == sect) { + if (doc.matters.has.keys_seq.seg[doc.matters.has.keys_seq.seg.length - 2] == sect) { // writeln(n, ": ", sect, ": ", _txt, " - ", obj.metainfo.dom_structure_collapsed_tags_status); // DEBUG // read last heading (heading prior to closing) and determine what those instructions imply still need to be done // CLOSE // DomTags { 0 none, 1 open, 2 close, 3 close_and_open, 4 open_still, } @@ -2778,16 +2769,12 @@ string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) { #+NAME: output_epub3_xhtml_seg_output #+BEGIN_SRC d -@system void outputEPub3(D,I)( - const D doc_abstraction, - I doc_matters, -) { +@system void outputEPub3(D)(D doc) { mixin spineRgxOut; mixin spineRgxXHTML; auto xhtml_format = outputXHTMLs(); static auto rgx = RgxO(); static auto rgx_xhtml = RgxXHTML(); - string[] doc; string segment_filename; string[] top_level_headings = ["","","",""]; string[string] oepbs_content_parts; @@ -2810,8 +2797,8 @@ string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) { #+NAME: output_epub3_xhtml_seg_output_loop #+BEGIN_SRC d -foreach (section; doc_matters.has.keys_seq.seg) { - foreach (obj; doc_abstraction[section]) { +foreach (section; doc.matters.has.keys_seq.seg) { + foreach (obj; doc.abstraction[section]) { string _txt = xhtml_format.special_characters_breaks_indents_bullets(obj); #+END_SRC @@ -2845,8 +2832,8 @@ if (obj.metainfo.is_a == "heading") { goto default; 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); - Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "epub"); + epubWrite.doc_epub3[obj.tags.segment_anchor_tag_epub] ~= xhtml_format.epub3_seg_head(doc.matters); + Tuple!(string, string[]) 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; @@ -2854,19 +2841,19 @@ if (obj.metainfo.is_a == "heading") { break; case 4: segment_filename = obj.tags.segment_anchor_tag_epub; - epubWrite.doc_epub3[segment_filename] ~= xhtml_format.epub3_seg_head(doc_matters); - Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "epub"); + epubWrite.doc_epub3[segment_filename] ~= xhtml_format.epub3_seg_head(doc.matters); + Tuple!(string, string[]) 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: - Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "epub"); + Tuple!(string, string[]) 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 8: .. case 9: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub) { + if (doc.matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); writeln(__FILE__, ":", __LINE__, ": ", obj.text); } @@ -2874,7 +2861,7 @@ if (obj.metainfo.is_a == "heading") { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub) { + if (doc.matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); } } @@ -2901,13 +2888,13 @@ case "frontmatter": assert(section == "head" || "toc"); case "para": switch (obj.metainfo.is_a) { case "toc": - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); + 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; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub) { + if (doc.matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -2916,7 +2903,7 @@ case "frontmatter": assert(section == "head" || "toc"); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub) { + if (doc.matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -2934,13 +2921,13 @@ case "body": assert(section == "body"); case "para": switch (obj.metainfo.is_a) { case "para": - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); + 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; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub) { + if (doc.matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -2950,37 +2937,37 @@ case "body": assert(section == "body"); case "block": switch (obj.metainfo.is_a) { case "quote": - t = xhtml_format.quote_seg(_txt, obj, doc_matters, suffix, "epub"); + 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": - t = xhtml_format.group_seg(_txt, obj, doc_matters, suffix, "epub"); + 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": - t = xhtml_format.block_seg(_txt, obj, doc_matters, suffix, "epub"); + 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": - t = xhtml_format.verse_seg(_txt, obj, doc_matters, suffix, "epub"); + 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(_txt, obj, doc_matters); + epubWrite.doc_epub3[segment_filename] ~= xhtml_format.code(_txt, obj, doc.matters); break; case "table": - epubWrite.doc_epub3[segment_filename] ~= xhtml_format.table(_txt, obj, doc_matters); + epubWrite.doc_epub3[segment_filename] ~= xhtml_format.table(_txt, obj, doc.matters); epubWrite.doc_epub3_endnotes[segment_filename] ~= ""; break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub) { + if (doc.matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -2989,7 +2976,7 @@ case "body": assert(section == "body"); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub) { + if (doc.matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -3008,37 +2995,37 @@ case "backmatter": case "para": switch (obj.metainfo.is_a) { case "endnote": assert(section == "endnotes"); - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); + t = xhtml_format.para_seg(_txt, obj, doc.matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; break; case "glossary": assert(section == "glossary"); - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); + 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(section == "bibliography"); - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); + 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(section == "bookindex"); - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); + 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(section == "blurb"); - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); + 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 "tail": assert(section == "tail"); - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); + 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; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub) { + if (doc.matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -3047,7 +3034,7 @@ case "backmatter": break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub) { + if (doc.matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -3064,7 +3051,7 @@ case "backmatter": break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub) { + if (doc.matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); } } @@ -3133,9 +3120,9 @@ if (obj.metainfo.is_a == "heading") { /+ epub specific documents +/ epubWrite.mimetypes = epub3_mimetypes; epubWrite.meta_inf_container_xml = epub3_container_xml; - 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); + epubWrite.oebps_toc_nav_xhtml = doc.epub3_oebps_toc_nav_xhtml; + epubWrite.oebps_content_opf = doc.epub3_oebps_content(oepbs_content_parts); + epubWrite.epub3_write_output_files(doc.matters); } #+END_SRC diff --git a/org/output_hub.org b/org/output_hub.org index fb9453a..c87c757 100644 --- a/org/output_hub.org +++ b/org/output_hub.org @@ -32,15 +32,12 @@ module sisudoc.io_out.hub; @safe: template outputHub() { <<output_imports>> - @system void outputHub(D,I)( - const D doc_abstraction, - I doc_matters - ) { + @system void outputHub(D)(D doc) { mixin Msg; - auto msg = Msg!()(doc_matters); + auto msg = Msg!()(doc.matters); enum outTask { source_or_pod, sqlite, sqlite_multi, latex, odt, epub, html_scroll, html_seg, html_stuff } - void Scheduled(D,I)(int sched, D doc_abstraction, I doc_matters) { - auto msg = Msg!()(doc_matters); + void Scheduled(D)(int sched, D doc) { + auto msg = Msg!()(doc.matters); <<output_scheduled_task_source_or_pod>> <<output_scheduled_task_epub>> <<output_scheduled_task_html_meta>> @@ -51,15 +48,15 @@ template outputHub() { <<output_scheduled_task_odt>> <<output_scheduled_task_sqlite>> } - if (doc_matters.opt.action.vox_gt0) { writeln(doc_matters.src.filename_base); } - if (!(doc_matters.opt.action.parallelise_subprocesses)) { - foreach(schedule; doc_matters.opt.action.output_task_scheduler) { - Scheduled!()(schedule, doc_abstraction, doc_matters); + if (doc.matters.opt.action.vox_gt0) { writeln(doc.matters.src.filename_base); } + if (!(doc.matters.opt.action.parallelise_subprocesses)) { + foreach(schedule; doc.matters.opt.action.output_task_scheduler) { + Scheduled!()(schedule, doc); } } else { import std.parallelism; - foreach(schedule; parallel(doc_matters.opt.action.output_task_scheduler)) { - Scheduled!()(schedule, doc_abstraction, doc_matters); + foreach(schedule; parallel(doc.matters.opt.action.output_task_scheduler)) { + Scheduled!()(schedule, doc); } } <<output_shared_sqlite_db>> @@ -134,11 +131,11 @@ import sisudoc.io_out, #+BEGIN_SRC d if (sched == outTask.source_or_pod) { msg.v("spine (doc reform) source processing... "); - if (doc_matters.opt.action.pod) { msg.v("spine (doc reform) source pod processing... "); } + if (doc.matters.opt.action.pod) { msg.v("spine (doc reform) source pod processing... "); } import sisudoc.io_out.source_pod; - spinePod!()(doc_matters); - if (doc_matters.opt.action.source) { msg.vv("spine (doc reform) source done"); } - if (doc_matters.opt.action.pod) { msg.vv("spine (doc reform) source pod done"); } + spinePod!()(doc.matters); + if (doc.matters.opt.action.source) { msg.vv("spine (doc reform) source done"); } + if (doc.matters.opt.action.pod) { msg.vv("spine (doc reform) source pod done"); } } #+END_SRC @@ -149,7 +146,7 @@ if (sched == outTask.source_or_pod) { if (sched == outTask.epub) { msg.v("epub3 processing... "); import sisudoc.io_out.epub3; - doc_abstraction.outputEPub3!()(doc_matters); + doc.outputEPub3!(); msg.vv("epub3 done"); } #+END_SRC @@ -160,7 +157,7 @@ if (sched == outTask.epub) { #+NAME: output_scheduled_task_html_meta #+BEGIN_SRC d if (sched == outTask.html_stuff) { - outputMetadata!()(doc_matters); + outputMetadata!()(doc.matters); msg.vv("html metadata done"); } #+END_SRC @@ -172,7 +169,7 @@ if (sched == outTask.html_stuff) { if (sched == outTask.html_scroll) { msg.v("html scroll processing... "); import sisudoc.io_out.html; - outputHTML!().scroll(doc_abstraction, doc_matters); + outputHTML!().scroll(doc); msg.vv("html scroll done"); } #+END_SRC @@ -184,7 +181,7 @@ if (sched == outTask.html_scroll) { if (sched == outTask.html_seg) { msg.v("html seg processing... "); import sisudoc.io_out.html; - outputHTML!().seg(doc_abstraction, doc_matters); + outputHTML!().seg(doc); msg.vv("html seg done"); } #+END_SRC @@ -195,8 +192,8 @@ if (sched == outTask.html_seg) { #+BEGIN_SRC d if (sched == outTask.html_stuff) { import sisudoc.io_out.html; - outputHTML!().css(doc_matters); - outputHTML!().images_cp(doc_matters); + outputHTML!().css(doc.matters); + outputHTML!().images_cp(doc.matters); msg.vv("html css & images done"); } #+END_SRC @@ -218,17 +215,17 @@ if (sched == outTask.latex) { msg.v("latex processing... (available for downstream processing & pdf output"); import sisudoc.io_out.latex; import std.file; - if ((isValidPath(doc_matters.output_path ~ "/latex/sty")) - && (!(exists(doc_matters.output_path ~ "/latex/sty"))) + if ((isValidPath(doc.matters.output_path ~ "/latex/sty")) + && (!(exists(doc.matters.output_path ~ "/latex/sty"))) ) { outputLaTeXstyInit!()( - doc_matters.output_path, - doc_matters.opt.action.generated_by, - doc_matters.generator_program.name_version_and_compiler, - doc_matters.generator_program.time_output_generated, + doc.matters.output_path, + doc.matters.opt.action.generated_by, + doc.matters.generator_program.name_version_and_compiler, + doc.matters.generator_program.time_output_generated, ); } - outputLaTeX!()(doc_abstraction, doc_matters); + outputLaTeX!()(doc.abstraction, doc.matters); msg.vv("latex done"); } #+END_SRC @@ -240,7 +237,7 @@ if (sched == outTask.latex) { if (sched == outTask.odt) { msg.v("odf:odt processing... "); import sisudoc.io_out.odt; - outputODT!()(doc_abstraction, doc_matters); + outputODT!()(doc.abstraction, doc.matters); msg.vv("odf:odt done"); } #+END_SRC @@ -252,7 +249,7 @@ if (sched == outTask.odt) { if (sched == outTask.sqlite) { msg.v("sqlite processing... "); import sisudoc.io_out.sqlite; - doc_abstraction.SQLiteHubDiscreteBuildTablesAndPopulate!()(doc_matters); + doc.SQLiteHubDiscreteBuildTablesAndPopulate!(); msg.vv("sqlite done"); } #+END_SRC @@ -263,15 +260,15 @@ if (sched == outTask.sqlite) { #+NAME: output_shared_sqlite_db #+BEGIN_SRC d -if (doc_matters.opt.action.sqlite_update) { +if (doc.matters.opt.action.sqlite_update) { msg.v("sqlite update processing..."); import sisudoc.io_out.sqlite; - doc_abstraction.SQLiteHubBuildTablesAndPopulate!()(doc_matters); + doc.SQLiteHubBuildTablesAndPopulate!(); msg.vv("sqlite update done"); -} else if (doc_matters.opt.action.sqlite_delete) { +} else if (doc.matters.opt.action.sqlite_delete) { msg.v("sqlite delete processing..."); import sisudoc.io_out.sqlite; - doc_abstraction.SQLiteHubBuildTablesAndPopulate!()(doc_matters); + doc.SQLiteHubBuildTablesAndPopulate!(); msg.vv("sqlite delete done"); } #+END_SRC diff --git a/org/output_show.org b/org/output_show.org index 607f668..6f54451 100644 --- a/org/output_show.org +++ b/org/output_show.org @@ -28,10 +28,8 @@ module sisudoc.meta.metadoc_show_summary; @safe: template spineMetaDocSummary() { - void spineMetaDocSummary(S,T)( - const S doc_abstraction, - T doc_matters, - ) { + void spineMetaDocSummary(D)(D doc) { + auto doc_matters = doc.matters; <<metadoc_show_summary_imports>> <<metadoc_show_imports_shared>> mixin InternalMarkup; @@ -55,7 +53,7 @@ string[string] check = [ "last_object_number_book_index" : "0", ]; foreach (k; doc_matters.has.keys_seq.seg) { - foreach (obj; doc_abstraction[k]) { + foreach (obj; doc.abstraction[k]) { if (obj.metainfo.is_of_part != "empty") { if (!empty(obj.metainfo.object_number)) { if (k == "body") { @@ -92,9 +90,9 @@ writefln( doc_matters.src.language, markup.repeat_character_by_number_provided("-", char_repeat_number), "- toc arr length:", - to!int(doc_abstraction["toc"].length), - "- doc_abstraction arr length:", - to!int(doc_abstraction["body"].length), + to!int(doc.abstraction["toc"].length), + "- doc.abstraction arr length:", + to!int(doc.abstraction["body"].length), " doc body last obj on.#:", to!int(check["last_object_number_body"]), " - number of tables:", @@ -110,26 +108,26 @@ writefln( " - number of images:", doc_matters.has.images, "- endnotes length:", // subtract headings - (doc_abstraction["endnotes"].length > 2) - ? (to!int(doc_abstraction["endnotes"].length - 2)) + (doc.abstraction["endnotes"].length > 2) + ? (to!int(doc.abstraction["endnotes"].length - 2)) : 0, "- glossary length:", - (doc_abstraction["glossary"].length > 1) - ? (to!int(doc_abstraction["glossary"].length)) + (doc.abstraction["glossary"].length > 1) + ? (to!int(doc.abstraction["glossary"].length)) : 0, "- biblio length:", - (doc_abstraction["bibliography"].length > 1) - ? (to!int(doc_abstraction["bibliography"].length)) + (doc.abstraction["bibliography"].length > 1) + ? (to!int(doc.abstraction["bibliography"].length)) : 0, "- bookindex length:", - (doc_abstraction["bookindex"].length > 1) - ? (to!int(doc_abstraction["bookindex"].length)) + (doc.abstraction["bookindex"].length > 1) + ? (to!int(doc.abstraction["bookindex"].length)) : 0, " book idx last obj on.#:", to!int(check["last_object_number_book_index"]), "- blurb length:", - (doc_abstraction["blurb"].length > 1) - ? (to!int(doc_abstraction["blurb"].length)) + (doc.abstraction["blurb"].length > 1) + ? (to!int(doc.abstraction["blurb"].length)) : 0, "* last obj on.#:", to!int(check["last_object_number"]), @@ -252,9 +250,7 @@ writefln( #+HEADER: :noweb yes #+BEGIN_SRC d template spineShowConfig() { - void spineShowConfig(T)( - T doc_matters, - ) { + void spineShowConfig(T)(T doc_matters) { <<metadoc_show_summary_imports>> <<metadoc_show_imports_shared>> mixin InternalMarkup; @@ -348,9 +344,7 @@ writefln( module sisudoc.meta.metadoc_show_make; @safe: template spineShowMake() { - void spineShowMake(T)( - T doc_matters, - ) { + void spineShowMake(T)(T doc_matters) { <<metadoc_show_summary_imports>> <<metadoc_show_imports_shared>> mixin InternalMarkup; @@ -422,9 +416,7 @@ writefln( module sisudoc.meta.metadoc_show_metadata; @safe: template spineShowMetaData() { - void spineShowMetaData(T)( - T doc_matters, - ) { + void spineShowMetaData(T)(T doc_matters) { <<metadoc_show_summary_imports>> <<metadoc_show_imports_shared>> mixin InternalMarkup; diff --git a/org/spine.org b/org/spine.org index f1fc7b2..51c649c 100644 --- a/org/spine.org +++ b/org/spine.org @@ -1282,7 +1282,7 @@ enforce( *** 1. _document abstraction_ [#A] - return tuple of: - - doc_abstraction (the document) + - doc.abstraction (the document) - doc_matters #+NAME: spine_each_file_do_abstraction @@ -1292,11 +1292,8 @@ if ((_opt_action.debug_do) ) { writeln("--->\nstepX commence → (document abstraction) [", manifest.src.filename, "]"); } -auto t = spineAbstraction!()(_env, program_info, _opt_action, _cfg, manifest, _make_and_meta_struct); -static assert(t.length==2); -auto doc_abstraction = t[dAM.abstraction]; -auto doc_matters = t[dAM.matters]; -if ((doc_matters.opt.action.debug_do) +auto doc = spineAbstraction!()(_env, program_info, _opt_action, _cfg, manifest, _make_and_meta_struct); +if ((doc.matters.opt.action.debug_do) || (_opt_action.debug_do_stages) ) { writeln("- stepX complete for [", manifest.src.filename, "]"); @@ -1323,9 +1320,9 @@ if ((doc_matters.opt.action.debug_do) #+NAME: spine_each_file_do_debugs_checkdoc_0 #+BEGIN_SRC d /+ ↓ debugs +/ -if (doc_matters.opt.action.show_summary) { +if (doc.matters.opt.action.show_summary) { import sisudoc.meta.metadoc_show_summary; - spineMetaDocSummary!()(doc_abstraction, doc_matters); + spineMetaDocSummary!()(doc); } #+END_SRC @@ -1335,9 +1332,9 @@ if (doc_matters.opt.action.show_summary) { #+NAME: spine_each_file_do_debugs_checkdoc_1 #+BEGIN_SRC d /+ ↓ debugs +/ -if (doc_matters.opt.action.show_metadata) { +if (doc.matters.opt.action.show_metadata) { import sisudoc.meta.metadoc_show_metadata; - spineShowMetaData!()(doc_matters); + spineShowMetaData!()(doc.matters); } #+END_SRC @@ -1347,9 +1344,9 @@ if (doc_matters.opt.action.show_metadata) { #+NAME: spine_each_file_do_debugs_checkdoc_2 #+BEGIN_SRC d /+ ↓ debugs +/ -if (doc_matters.opt.action.show_make) { +if (doc.matters.opt.action.show_make) { import sisudoc.meta.metadoc_show_make; - spineShowMake!()(doc_matters); + spineShowMake!()(doc.matters); } #+END_SRC @@ -1359,9 +1356,9 @@ if (doc_matters.opt.action.show_make) { #+NAME: spine_each_file_do_debugs_checkdoc_3 #+BEGIN_SRC d /+ ↓ debugs +/ -if (doc_matters.opt.action.show_config) { +if (doc.matters.opt.action.show_config) { import sisudoc.meta.metadoc_show_config; - spineShowConfig!()(doc_matters); + spineShowConfig!()(doc.matters); } #+END_SRC @@ -1370,17 +1367,17 @@ if (doc_matters.opt.action.show_config) { #+NAME: spine_each_file_do_debugs_checkdoc_4 #+BEGIN_SRC d -if (doc_matters.opt.action.curate) { - auto _hvst = spineMetaDocCurate!()(doc_matters, hvst); +if (doc.matters.opt.action.curate) { + auto _hvst = spineMetaDocCurate!()(doc.matters, hvst); if ( _hvst.title.length > 0 && _hvst.author_surname_fn.length > 0 ) { hvst.curates ~= _hvst; } else { - if ((doc_matters.opt.action.debug_do) + if ((doc.matters.opt.action.debug_do) || (_opt_action.debug_do_curate) - || (doc_matters.opt.action.vox_gt2) + || (doc.matters.opt.action.vox_gt2) ) { writeln("WARNING curate: document header yaml does not contain information related to: title or author: ", _hvst.path_html_segtoc); } @@ -1394,8 +1391,8 @@ if (doc_matters.opt.action.curate) { #+NAME: spine_each_file_do_debugs_checkdoc_5 #+BEGIN_SRC d /+ ↓ debugs +/ -if (doc_matters.opt.action.debug_do) { - spineDebugs!()(doc_abstraction, doc_matters); +if (doc.matters.opt.action.debug_do) { + spineDebugs!()(doc.abstraction, doc.matters); } #+END_SRC @@ -1413,16 +1410,12 @@ if (!(_opt_action.skip_output)) { #+NAME: spine_each_file_do_selected_output #+BEGIN_SRC d /+ ↓ output hub +/ -if (!(doc_matters.opt.action.skip_output)) { - if ((_opt_action.debug_do) - || (_opt_action.debug_do_stages) - ) { +if (!(doc.matters.opt.action.skip_output)) { + if ((_opt_action.debug_do) || (_opt_action.debug_do_stages)) { writeln("step5 commence → (process outputs) [", manifest.src.filename, "]"); } - doc_abstraction.outputHub!()(doc_matters); - if ((_opt_action.debug_do) - || (_opt_action.debug_do_stages) - ) { + doc.outputHub!(); + if ((_opt_action.debug_do) || (_opt_action.debug_do_stages)) { writeln("- step5 complete for [", manifest.src.filename, "]"); } } @@ -1489,8 +1482,19 @@ template spineAbstraction() { } auto doc_matters = ST_DocumentMatters(); <<spine_each_file_do_document_matters_msg_step4_end>> - auto t = tuple(doc_abstraction, doc_matters); - return t; + auto theDOC() { + struct ST_DOC { + const auto abstraction() { + return doc_abstraction; + } + auto matters() { + return doc_matters; + } + } + return ST_DOC(); + } + auto the_doc = theDOC(); + return the_doc; } } #+END_SRC @@ -1589,12 +1593,12 @@ if ((_opt_action.debug_do) - prepare the document abstraction used in downstream processing - _return tuple of_: - - document abstraction (_the_document_ or doc_abstraction) + - document abstraction (_the_document_ or doc.abstraction) - document abstraction keys - (head, toc, body, endnotes, glossary, bibliography, bookindex, blurb, tail) - - (transfer to _doc_matters_) - - segnames for html epub (transfer to _doc_matters_) - - image list (transfer to _doc_matters_) + - (transfer to _doc.matters_) + - segnames for html epub (transfer to _doc.matters_) + - image list (transfer to _doc.matters_) #+NAME: spine_each_file_do_document_abstraction #+BEGIN_SRC d @@ -1632,7 +1636,7 @@ if ((_opt_action.debug_do) if ((_opt_action.debug_do) || (_opt_action.debug_do_stages) ) { - writeln("step4 commence → (doc_matters) [", _manifest.src.filename, "]"); + writeln("step4 commence → (doc.matters) [", _manifest.src.filename, "]"); } #+END_SRC |