diff options
Diffstat (limited to 'src/sisudoc/meta')
-rw-r--r-- | src/sisudoc/meta/conf_make_meta_json.d | 28 | ||||
-rw-r--r-- | src/sisudoc/meta/conf_make_meta_structs.d | 26 | ||||
-rw-r--r-- | src/sisudoc/meta/conf_make_meta_yaml.d | 62 | ||||
-rw-r--r-- | src/sisudoc/meta/doc_debugs.d | 34 | ||||
-rw-r--r-- | src/sisudoc/meta/metadoc.d | 43 | ||||
-rw-r--r-- | src/sisudoc/meta/metadoc_curate.d | 24 | ||||
-rw-r--r-- | src/sisudoc/meta/metadoc_curate_authors.d | 20 | ||||
-rw-r--r-- | src/sisudoc/meta/metadoc_curate_topics.d | 20 | ||||
-rw-r--r-- | src/sisudoc/meta/metadoc_from_src.d | 82 | ||||
-rw-r--r-- | src/sisudoc/meta/metadoc_from_src_functions.d | 241 | ||||
-rw-r--r-- | src/sisudoc/meta/metadoc_object_setter.d | 97 | ||||
-rw-r--r-- | src/sisudoc/meta/metadoc_show_config.d | 60 | ||||
-rw-r--r-- | src/sisudoc/meta/metadoc_show_make.d | 32 | ||||
-rw-r--r-- | src/sisudoc/meta/metadoc_show_metadata.d | 32 | ||||
-rw-r--r-- | src/sisudoc/meta/metadoc_show_summary.d | 64 | ||||
-rw-r--r-- | src/sisudoc/meta/package.d | 24 | ||||
-rw-r--r-- | src/sisudoc/meta/rgx.d | 30 | ||||
-rw-r--r-- | src/sisudoc/meta/rgx_yaml.d (renamed from src/sisudoc/meta/rgx_yaml_tags.d) | 0 |
18 files changed, 563 insertions, 356 deletions
diff --git a/src/sisudoc/meta/conf_make_meta_json.d b/src/sisudoc/meta/conf_make_meta_json.d index 44f2c5e..4e9e5cd 100644 --- a/src/sisudoc/meta/conf_make_meta_json.d +++ b/src/sisudoc/meta/conf_make_meta_json.d @@ -54,21 +54,19 @@ module sisudoc.meta.conf_make_meta_json; @safe: static template contentJSONtoSpineStruct() { - import - std.algorithm, - std.array, - std.exception, - std.regex, - std.stdio, - std.string, - std.typecons, - std.utf, - std.conv : to; - import - sisudoc.meta.conf_make_meta_structs, - sisudoc.meta.conf_make_meta_json, - sisudoc.meta.defaults, - sisudoc.meta.rgx; + import std.algorithm; + import std.array; + import std.exception; + import std.regex; + import std.stdio; + import std.string; + import std.typecons; + import std.utf; + import std.conv : to; + import sisudoc.meta.conf_make_meta_structs; + import sisudoc.meta.conf_make_meta_json; + import sisudoc.meta.defaults; + import sisudoc.meta.rgx; ConfComposite _struct_composite; auto contentJSONtoSpineStruct(C,J,M)(C _struct_composite, J _json, M _manifested, string _identifier) { mixin spineRgxIn; diff --git a/src/sisudoc/meta/conf_make_meta_structs.d b/src/sisudoc/meta/conf_make_meta_structs.d index 4738a57..9503c83 100644 --- a/src/sisudoc/meta/conf_make_meta_structs.d +++ b/src/sisudoc/meta/conf_make_meta_structs.d @@ -49,20 +49,18 @@ +/ module sisudoc.meta.conf_make_meta_structs; @safe: -import - std.exception, - std.json, - std.path, - std.regex, - std.stdio, - std.string, - std.typecons, - std.utf, - std.conv : to; -import - sisudoc.meta.defaults, - sisudoc.meta.rgx_yaml, - sisudoc.meta.rgx; +import std.exception; +import std.json; +import std.path; +import std.regex; +import std.stdio; +import std.string; +import std.typecons; +import std.utf; +import std.conv : to; +import sisudoc.meta.defaults; +import sisudoc.meta.rgx_yaml; +import sisudoc.meta.rgx; mixin spineRgxIn; static auto rgx = RgxI(); mixin spineRgxYamlTags; diff --git a/src/sisudoc/meta/conf_make_meta_yaml.d b/src/sisudoc/meta/conf_make_meta_yaml.d index 98a92f9..4b56b51 100644 --- a/src/sisudoc/meta/conf_make_meta_yaml.d +++ b/src/sisudoc/meta/conf_make_meta_yaml.d @@ -54,22 +54,20 @@ module sisudoc.meta.conf_make_meta_yaml; @safe: template contentYAMLtoSpineStruct() { - import - std.algorithm, - std.array, - std.exception, - std.path, - std.regex, - std.stdio, - std.string, - std.typecons, - std.utf, - std.conv : to; - import - sisudoc.meta.conf_make_meta_structs, - sisudoc.meta.defaults, - sisudoc.meta.rgx_yaml, - sisudoc.meta.rgx; + import std.algorithm; + import std.array; + import std.exception; + import std.path; + import std.regex; + import std.stdio; + import std.string; + import std.typecons; + import std.utf; + import std.conv : to; + import sisudoc.meta.conf_make_meta_structs; + import sisudoc.meta.defaults; + import sisudoc.meta.rgx_yaml; + import sisudoc.meta.rgx; ConfComposite _struct_composite; @system ConfComposite contentYAMLtoSpineStruct(C,Y,M,O,Cfg)( C _struct_composite, @@ -896,9 +894,8 @@ template contentYAMLtoSpineStruct() { } template configParseYAMLreturnSpineStruct() { import dyaml; - import - sisudoc.meta.conf_make_meta_structs, - sisudoc.meta.conf_make_meta_json; + import sisudoc.meta.conf_make_meta_structs; + import sisudoc.meta.conf_make_meta_json; mixin contentYAMLtoSpineStruct; @system ConfComposite configParseYAMLreturnSpineStruct(T,M,O,Cfg)( T _document_struct, @@ -928,21 +925,18 @@ template configParseYAMLreturnSpineStruct() { } } template docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct() { - import - std.exception, - std.regex, - std.stdio, - // std.traits, - std.typecons, - std.utf, - std.conv : to; - import - dyaml; - import - sisudoc.meta.conf_make_meta_structs, - sisudoc.meta.conf_make_meta_json, - sisudoc.meta.rgx_yaml, - sisudoc.meta.rgx; + import std.exception; + import std.regex; + import std.stdio; + // import std.traits; + import std.typecons; + import std.utf; + import std.conv : to; + import dyaml; + import sisudoc.meta.conf_make_meta_structs; + import sisudoc.meta.conf_make_meta_json; + import sisudoc.meta.rgx_yaml; + import sisudoc.meta.rgx; mixin spineRgxIn; mixin contentJSONtoSpineStruct; static auto rgx = RgxI(); diff --git a/src/sisudoc/meta/doc_debugs.d b/src/sisudoc/meta/doc_debugs.d index 35fd3de..b28ba2e 100644 --- a/src/sisudoc/meta/doc_debugs.d +++ b/src/sisudoc/meta/doc_debugs.d @@ -52,24 +52,22 @@ +/ module sisudoc.meta.doc_debugs; template spineDebugs() { - import - sisudoc.meta.defaults, - sisudoc.meta.rgx_files; - import - std.algorithm, - std.array, - std.container, - std.exception, - std.json, - std.stdio, - std.file, - std.path, - std.range, - std.regex, - std.string, - std.typecons, - std.utf, - std.conv : to; + import sisudoc.meta.defaults; + import sisudoc.meta.rgx_files; + import std.algorithm; + import std.array; + import std.container; + import std.exception; + import std.json; + import std.stdio; + import std.file; + import std.path; + import std.range; + import std.regex; + import std.string; + import std.typecons; + import std.utf; + import std.conv : to; auto spineDebugs(S,T)( const S contents, T doc_matters, diff --git a/src/sisudoc/meta/metadoc.d b/src/sisudoc/meta/metadoc.d index 0d58c2e..ffe297e 100644 --- a/src/sisudoc/meta/metadoc.d +++ b/src/sisudoc/meta/metadoc.d @@ -50,20 +50,18 @@ module sisudoc.meta.metadoc; @safe: template spineAbstraction() { - import - std.datetime, - std.digest.crc, - std.digest.sha; - import - sisudoc.meta, - sisudoc.meta.metadoc_from_src, - sisudoc.meta.conf_make_meta_structs, - sisudoc.meta.conf_make_meta_json, - sisudoc.meta.defaults, - sisudoc.io_in.paths_source, - sisudoc.io_in.read_config_files, - sisudoc.io_in.read_source_files, - sisudoc.io_out.hub; + import std.datetime; + import std.digest.crc; + import std.digest.sha; + import sisudoc.meta; + import sisudoc.meta.metadoc_from_src; + import sisudoc.meta.conf_make_meta_structs; + import sisudoc.meta.conf_make_meta_json; + import sisudoc.meta.defaults; + import sisudoc.io_in.paths_source; + import sisudoc.io_in.read_config_files; + import sisudoc.io_in.read_source_files; + import sisudoc.io_out.hub; mixin spineBiblio; mixin outputHub; enum makeMeta { make, meta } @@ -144,7 +142,7 @@ template spineAbstraction() { 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, "]"); } struct ST_DocumentMatters { auto generator_program() { @@ -294,7 +292,18 @@ template spineAbstraction() { ) { writeln("- step4 complete for [", _manifest.src.filename, "]"); } - 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; } } diff --git a/src/sisudoc/meta/metadoc_curate.d b/src/sisudoc/meta/metadoc_curate.d index bb7452a..da20b3e 100644 --- a/src/sisudoc/meta/metadoc_curate.d +++ b/src/sisudoc/meta/metadoc_curate.d @@ -54,19 +54,17 @@ template spineMetaDocCurate() { T doc_matters, H hvst, ) { - import - sisudoc.meta.defaults, - sisudoc.meta.rgx; - import - std.array, - std.exception, - std.regex, - std.stdio, - std.string, - std.typecons, - std.uni, - std.utf, - std.conv : to; + import sisudoc.meta.defaults; + import sisudoc.meta.rgx; + import std.array; + import std.exception; + import std.regex; + import std.stdio; + import std.string; + import std.typecons; + import std.uni; + import std.utf; + import std.conv : to; mixin InternalMarkup; static auto mkup = InlineMarkup(); import sisudoc.io_out.paths_output; diff --git a/src/sisudoc/meta/metadoc_curate_authors.d b/src/sisudoc/meta/metadoc_curate_authors.d index c86d3e1..d8b5261 100644 --- a/src/sisudoc/meta/metadoc_curate_authors.d +++ b/src/sisudoc/meta/metadoc_curate_authors.d @@ -49,17 +49,15 @@ +/ module sisudoc.meta.metadoc_curate_authors; @safe: - import - std.algorithm, - std.array, - std.exception, - std.regex, - std.stdio, - std.string, - std.conv : to; - import - sisudoc.meta.defaults, - sisudoc.meta.rgx; + import std.algorithm; + import std.array; + import std.exception; + import std.regex; + import std.stdio; + import std.string; + import std.conv : to; + import sisudoc.meta.defaults; + import sisudoc.meta.rgx; mixin spineCurateMetadata; mixin InternalMarkup; template spineMetaDocCuratesAuthors() { diff --git a/src/sisudoc/meta/metadoc_curate_topics.d b/src/sisudoc/meta/metadoc_curate_topics.d index fca3ff2..3045dcb 100644 --- a/src/sisudoc/meta/metadoc_curate_topics.d +++ b/src/sisudoc/meta/metadoc_curate_topics.d @@ -49,17 +49,15 @@ +/ module sisudoc.meta.metadoc_curate_topics; @safe: - import - std.algorithm, - std.array, - std.exception, - std.regex, - std.stdio, - std.string, - std.conv : to; - import - sisudoc.meta.defaults, - sisudoc.meta.rgx; + import std.algorithm; + import std.array; + import std.exception; + import std.regex; + import std.stdio; + import std.string; + import std.conv : to; + import sisudoc.meta.defaults; + import sisudoc.meta.rgx; mixin spineCurateMetadata; mixin InternalMarkup; template spineMetaDocCuratesTopics() { diff --git a/src/sisudoc/meta/metadoc_from_src.d b/src/sisudoc/meta/metadoc_from_src.d index 012dd36..4240a3f 100644 --- a/src/sisudoc/meta/metadoc_from_src.d +++ b/src/sisudoc/meta/metadoc_from_src.d @@ -54,19 +54,17 @@ module sisudoc.meta.metadoc_from_src; @safe: template docAbstraction() { // ↓ abstraction imports - import - std.algorithm, - std.container, - std.digest.sha, - std.file, - std.json, - std.path; - import - sisudoc.meta, - sisudoc.meta.defaults, - sisudoc.meta.rgx, - sisudoc.meta.metadoc_object_setter, - sisudoc.meta.rgx; + import std.algorithm; + import std.container; + import std.digest.sha; + import std.file; + import std.json; + import std.path; + import sisudoc.meta; + import sisudoc.meta.defaults; + import sisudoc.meta.rgx; + import sisudoc.meta.metadoc_object_setter; + import sisudoc.meta.rgx; public import sisudoc.meta.metadoc_from_src_functions; mixin docAbstractionFunctions; @system auto docAbstraction(CMM,Opt,Mf) ( @@ -99,8 +97,8 @@ template docAbstraction() { 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, @@ -214,8 +212,8 @@ template docAbstraction() { } if (conf_make_meta.make.substitute) { foreach(substitution_pair; conf_make_meta.make.substitute) { - writeln("regex to match: ", substitution_pair[Substitute.match]); - writeln("substitution to make: ", substitution_pair[Substitute.markup]); + writeln("regex to match: ", substitution_pair[Substitute.match]); + writeln("substitution to make: ", substitution_pair[Substitute.markup]); } } if (conf_make_meta.make.bold) { @@ -231,7 +229,7 @@ template docAbstraction() { writeln("substitution to make: ", conf_make_meta.make.italics[Substitute.markup]); } } - auto loopMarkupSrcByLine( + _loopMarkupSrcByLineStruct loopMarkupSrcByLine( char[][] markup_sourcefile_content, string[string] an_object, uint[string] pith, @@ -340,7 +338,7 @@ template docAbstraction() { ._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; @@ -353,7 +351,7 @@ template docAbstraction() { ._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; @@ -369,7 +367,7 @@ template docAbstraction() { .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; @@ -378,7 +376,7 @@ template docAbstraction() { 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; @@ -412,7 +410,7 @@ template docAbstraction() { 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; @@ -442,7 +440,7 @@ template docAbstraction() { || 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; @@ -464,7 +462,7 @@ template docAbstraction() { 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; @@ -481,7 +479,7 @@ template docAbstraction() { && (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; @@ -496,7 +494,7 @@ template docAbstraction() { ) { // 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; @@ -534,7 +532,7 @@ template docAbstraction() { ._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; @@ -563,7 +561,7 @@ template docAbstraction() { } 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, @@ -679,7 +677,7 @@ template docAbstraction() { _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, @@ -700,7 +698,7 @@ template docAbstraction() { 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, @@ -721,7 +719,7 @@ template docAbstraction() { 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; @@ -742,7 +740,7 @@ template docAbstraction() { 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, @@ -772,9 +770,9 @@ template docAbstraction() { comp_obj_.has.inline_links = substantive_obj_misc_struct.has_links; comp_obj_.has.image_without_dimensions = substantive_obj_misc_struct.has_images_without_dimensions; the_document_body_section ~= comp_obj_; - tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); + 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; @@ -848,7 +846,7 @@ template docAbstraction() { 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; @@ -941,7 +939,7 @@ template docAbstraction() { } { // document segnames ST_segnames get_segnames; - get_segnames = the_document_body_section.after_doc_determine_segnames(the_document_endnotes_section, the_document_glossary_section, the_document_bibliography_section, the_document_bookindex_section, the_document_blurb_section, segnames, html_segnames_ptr_cntr, html_segnames_ptr); // + get_segnames = the_document_body_section.after_doc_determine_segnames(the_document_endnotes_section, the_document_glossary_section, the_document_bibliography_section, the_document_bookindex_section, the_document_blurb_section, segnames, html_segnames_ptr_cntr, html_segnames_ptr); segnames = get_segnames.segnames; html_segnames_ptr_cntr = get_segnames.html_segnames_ptr_cntr; html_segnames_ptr = get_segnames.html_segnames_ptr; @@ -1378,36 +1376,42 @@ template docAbstraction() { "scroll": ["head", "toc", "body",], "seg": ["head", "toc", "body",], "sql": ["head", "body",], - "latex": ["head", "toc", "body",] + "latex": ["head", "toc", "body",], + "text": ["head", "toc", "body",], ]; if (document_the["endnotes"].length > 1) { document_section_keys_sequenced["scroll"] ~= "endnotes"; document_section_keys_sequenced["seg"] ~= "endnotes"; document_section_keys_sequenced["latex"] ~= "endnotes"; + document_section_keys_sequenced["text"] ~= "endnotes"; } if (document_the["glossary"].length > 1) { document_section_keys_sequenced["scroll"] ~= "glossary"; document_section_keys_sequenced["seg"] ~= "glossary"; document_section_keys_sequenced["sql"] ~= "glossary"; document_section_keys_sequenced["latex"] ~= "glossary"; + document_section_keys_sequenced["text"] ~= "glossary"; } if (document_the["bibliography"].length > 1) { document_section_keys_sequenced["scroll"] ~= "bibliography"; document_section_keys_sequenced["seg"] ~= "bibliography"; document_section_keys_sequenced["sql"] ~= "bibliography"; document_section_keys_sequenced["latex"] ~= "bibliography"; + document_section_keys_sequenced["text"] ~= "bibliography"; } if (document_the["bookindex"].length > 1) { document_section_keys_sequenced["scroll"] ~= "bookindex"; document_section_keys_sequenced["seg"] ~= "bookindex"; document_section_keys_sequenced["sql"] ~= "bookindex"; document_section_keys_sequenced["latex"] ~= "bookindex"; + document_section_keys_sequenced["text"] ~= "bookindex"; } if (document_the["blurb"].length > 1) { document_section_keys_sequenced["scroll"] ~= "blurb"; document_section_keys_sequenced["seg"] ~= "blurb"; document_section_keys_sequenced["sql"] ~= "blurb"; document_section_keys_sequenced["latex"] ~= "blurb"; + document_section_keys_sequenced["text"] ~= "blurb"; } if ((opt_action.html) || (opt_action.html_scroll) @@ -1496,7 +1500,7 @@ template docAbstraction() { return tag_assoc; } } - auto doc_has() { + DocHas_ doc_has() { return DocHas_(); } // the doc to be returned diff --git a/src/sisudoc/meta/metadoc_from_src_functions.d b/src/sisudoc/meta/metadoc_from_src_functions.d index 8ccf21b..63143e9 100644 --- a/src/sisudoc/meta/metadoc_from_src_functions.d +++ b/src/sisudoc/meta/metadoc_from_src_functions.d @@ -453,6 +453,62 @@ template docAbstractionFunctions() { pith["block_is"] = eN.blk_is.table; pith["block_state"] = eN.blk_state.on; pith["block_delim"] = eN.blk_delim.curly_special; + } else if (auto m = line.matchFirst(rgx.block_quotemarks_code_open)) { + dochas["codeblock"]++; + an_object["lang"] = ""; + an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : ""; + an_object["syntax"] = (m["syntax"]) ? m["syntax"].to!string : ""; + debug(codequotemarks) { writefln( "* [code quotemarks] %s", line); } + pith["block_is"] = eN.blk_is.code; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.quotemarks; // + } else if (auto m = line.matchFirst(rgx.block_quotemarks_poem_open)) { + dochas["poem"]++; + an_object["syntax"] = ""; + an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : ""; + an_object["lang"] = (m["lang"]) ? m["lang"].to!string : ""; + debug(poem) { writefln( "* [poem quotemarks] %s", line); } + object_number_poem["start"] = obj_cite_digits.object_number.to!string; + pith["block_is"] = eN.blk_is.poem; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.quotemarks; // + pith["verse_new"] = eN.bi.on; + } else if (auto m = line.matchFirst(rgx.block_quotemarks_group_open)) { + dochas["group"]++; + an_object["syntax"] = ""; + an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : ""; + an_object["lang"] = (m["lang"]) ? m["lang"].to!string : ""; + debug(group) { writefln( "* [group quotemarks] %s", line); } + pith["block_is"] = eN.blk_is.group; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.quotemarks; + } else if (auto m = line.matchFirst(rgx.block_quotemarks_block_open)) { + dochas["block"]++; + an_object["syntax"] = ""; + an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : ""; + an_object["lang"] = (m["lang"]) ? m["lang"].to!string : ""; + debug(block) { writefln( "* [block quotemarks] %s", line); } + pith["block_is"] = eN.blk_is.block; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.quotemarks; + } else if (auto m = line.matchFirst(rgx.block_quotemarks_quote_open)) { + dochas["quote"]++; + an_object["syntax"] = ""; + an_object["attrib"] = m["attrib"].to!string; + an_object["lang"] = m["lang"].to!string; + debug(quote) { writefln( "* [quote quotemarks] %s", line); // quote (quotemarks) open + } + pith["block_is"] = eN.blk_is.quote; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.quotemarks; + } else if (auto m = line.matchFirst(rgx.block_quotemarks_table_open)) { // quotemarks table open + debug(table) { writefln( "* [table quotemarks] %s", line); } + dochas["table"] ++; + an_object["table_head"] = m["attrib"].to!string; + an_object["block_type"] = "quotemarks"; + pith["block_is"] = eN.blk_is.table; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.quotemarks; } else if (auto m = line.matchFirst(rgx.block_tic_code_open)) { dochas["codeblock"]++; an_object["lang"] = ""; @@ -536,6 +592,17 @@ template docAbstractionFunctions() { debug(group) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; } + } else if (pith["block_delim"] == eN.blk_delim.quotemarks) { + if (line.matchFirst(rgx.block_quotemarks_close)) { + debug(group) { writeln(line); } + an_object[an_object_key] = an_object[an_object_key].stripRight; + pith["block_is"] = eN.blk_is.group; + pith["block_state"] = eN.blk_state.closing; + pith["block_delim"] = eN.blk_delim.off; + } else { + debug(group) { writeln(line); } + an_object[an_object_key] ~= line ~= "\n"; + } } else if (pith["block_delim"] == eN.blk_delim.tic) { if (line.matchFirst(rgx.block_tic_close)) { debug(group) { writeln(line); } @@ -574,6 +641,17 @@ template docAbstractionFunctions() { debug(block) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; } + } else if (pith["block_delim"] == eN.blk_delim.quotemarks) { + if (line.matchFirst(rgx.block_quotemarks_close)) { + debug(block) { writeln(line); } + an_object[an_object_key] = an_object[an_object_key].stripRight; + pith["block_is"] = eN.blk_is.block; + pith["block_state"] = eN.blk_state.closing; + pith["block_delim"] = eN.blk_delim.off; + } else { + debug(block) { writeln(line); } + an_object[an_object_key] ~= line ~= "\n"; + } } else if (pith["block_delim"] == eN.blk_delim.tic) { if (line.matchFirst(rgx.block_tic_close)) { debug(block) { writeln(line); } @@ -698,6 +776,94 @@ template docAbstractionFunctions() { ++cntr; } } + } else if (pith["block_delim"] == eN.blk_delim.quotemarks) { + if (auto m = line.matchFirst(rgx.block_quotemarks_close)) { + an_object[an_object_key] = "verse"; + debug(poem) { writefln( "* [poem quotemarks] %s", line); } + if (processing.length > 0) { + an_object[an_object_key] = processing["verse"]; + } + if (an_object.length > 0) { + debug(poem) { writeln(__LINE__); writeln(obj_cite_digits.object_number, line); } + processing.remove("verse"); + an_object["is"] = "verse"; + ST_txtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_struct + = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); + an_object["substantive"] = substantive_obj_misc_struct.obj_txt; + anchor_tag = substantive_obj_misc_struct.anchor_tag; + comp_obj_ = set_object_generic("body", "body", "block", "verse", an_object["substantive"], obj_cite_digits.object_number); + comp_obj_.metainfo.identifier = obj_cite_digits.identifier; + comp_obj_.metainfo.object_number_off = obj_cite_digits.off; + comp_obj_.metainfo.o_n_book_index = obj_cite_digits.bkidx; + comp_obj_.metainfo.object_number_type = obj_cite_digits.type; + comp_obj_.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; + comp_obj_.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1to4"]; + comp_obj_.has.inline_notes_reg = substantive_obj_misc_struct.has_notes_reg; + comp_obj_.has.inline_notes_star = substantive_obj_misc_struct.has_notes_star; + comp_obj_.has.inline_links = substantive_obj_misc_struct.has_links; + the_document_body_section ~= comp_obj_; + 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"); + ++cntr; + } + pith["block_is"] = eN.blk_is.poem; + pith["block_state"] = eN.blk_state.closing; + pith["block_delim"] = eN.blk_delim.off; + } else { + processing["verse"] ~= line ~= "\n"; + if (pith["verse_new"] == eN.bi.on) { + obj_cite_digits = ocn_emit(pith["ocn"]); + pith["verse_new"] = eN.bi.off; + } else if (line.matchFirst(rgx.newline_eol_delimiter_only)) { + processing["verse"] = processing["verse"].stripRight; + pith["verse_new"] = eN.bi.on; + verse_line = eN.bi.off; + } + if (pith["verse_new"] == eN.bi.on) { + verse_line = 1; + an_object[an_object_key] = processing["verse"]; + debug(poem) { writefln( + "* %s tic\n%s", + obj_cite_digits.object_number, + an_object[an_object_key] + ); + } + processing.remove("verse"); + an_object["is"] = "verse"; + auto comp_obj_location + = node_construct.node_location_emitter( + content_non_header, + tag_in_seg, + lev_anchor_tag, + tag_assoc, + obj_cite_digits, + cntr, + heading_ptr-1, + an_object["is"] + ); + ST_txtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_struct + = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); + an_object["substantive"] = substantive_obj_misc_struct.obj_txt; + anchor_tag = substantive_obj_misc_struct.anchor_tag; + comp_obj_ = set_object_generic("body", "body", "block", "verse", an_object["substantive"], obj_cite_digits.object_number); + comp_obj_.metainfo.identifier = obj_cite_digits.identifier; + comp_obj_.metainfo.object_number_off = obj_cite_digits.off; + comp_obj_.metainfo.o_n_book_index = obj_cite_digits.bkidx; + comp_obj_.metainfo.object_number_type = obj_cite_digits.type; + comp_obj_.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; + comp_obj_.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1to4"]; + comp_obj_.has.inline_notes_reg = substantive_obj_misc_struct.has_notes_reg; + comp_obj_.has.inline_notes_star = substantive_obj_misc_struct.has_notes_star; + comp_obj_.has.inline_links = substantive_obj_misc_struct.has_links; + the_document_body_section ~= comp_obj_; + tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); + object_reset(an_object); + processing.remove("verse"); + ++cntr; + } + } } else if (pith["block_delim"] == eN.blk_delim.tic) { if (auto m = line.matchFirst(rgx.block_tic_close)) { an_object[an_object_key] = "verse"; @@ -816,6 +982,19 @@ template docAbstractionFunctions() { debug(codecurly) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; } + } else if (pith["block_delim"] == eN.blk_delim.quotemarks) { + if (line.matchFirst(rgx.block_quotemarks_close)) { + debug(codequotemarks) { writeln(line); } + an_object[an_object_key] = an_object[an_object_key] + .replaceFirst(rgx.newline_eol_delimiter_only, "") + .stripRight; + pith["block_is"] = eN.blk_is.code; + pith["block_state"] = eN.blk_state.closing; + pith["block_delim"] = eN.blk_delim.off; + } else { + debug(codequotemarks) { writeln(line); } + an_object[an_object_key] ~= line ~= "\n"; + } } else if (pith["block_delim"] == eN.blk_delim.tic) { if (line.matchFirst(rgx.block_tic_close)) { debug(codetic) { writeln(line); } @@ -884,6 +1063,16 @@ template docAbstractionFunctions() { debug(table) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; } + } else if (pith["block_delim"] == eN.blk_delim.quotemarks) { + if (line.matchFirst(rgx.block_quotemarks_close)) { + debug(table) { writeln(line); } + pith["block_is"] = eN.blk_is.table; + pith["block_state"] = eN.blk_state.closing; + pith["block_delim"] = eN.blk_delim.off; + } else { + debug(table) { writeln(line); } + an_object[an_object_key] ~= line ~= "\n"; + } } else if (pith["block_delim"] == eN.blk_delim.tic) { if (line.matchFirst(rgx.block_tic_close)) { debug(table) { writeln(line); } @@ -927,6 +1116,17 @@ template docAbstractionFunctions() { debug(quote) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; } + } else if (pith["block_delim"] == eN.blk_delim.quotemarks) { + if (line.matchFirst(rgx.block_quotemarks_close)) { + debug(quote) { writeln(line); } + an_object[an_object_key] = an_object[an_object_key].stripRight; + pith["block_is"] = eN.blk_is.quote; + pith["block_state"] = eN.blk_state.closing; + pith["block_delim"] = eN.blk_delim.off; + } else { + debug(quote) { writeln(line); } + an_object[an_object_key] ~= line ~= "\n"; + } } else if (pith["block_delim"] == eN.blk_delim.tic) { if (line.matchFirst(rgx.block_tic_close)) { debug(quote) { writeln(line); } @@ -2357,10 +2557,8 @@ template docAbstractionFunctions() { CMM conf_make_meta, Flag!"_new_doc" _new_doc ) { - obj_txt["munge"] = obj_[obj_key_].dup; - obj_txt["munge"] = (obj_["is"].match(ctRegex!(`verse|code`))) - ? obj_txt["munge"] - : obj_txt["munge"].strip; + obj_txt["munge"] = obj_[obj_key_].dup; + obj_txt["munge"] = (obj_["is"].match(ctRegex!(`verse|code`))) ? obj_txt["munge"] : obj_txt["munge"].strip; if (_new_doc) { anchor_tag = ""; } @@ -2379,8 +2577,8 @@ template docAbstractionFunctions() { || (obj_["is"] == "group") || (obj_["is"] == "block") || (obj_["is"] == "verse")) { - obj_txt["munge"] = (obj_txt["munge"]).inline_markup_faces; - obj_txt["munge"] = (obj_txt["munge"]).links_and_images; + obj_txt["munge"] = (obj_txt["munge"]).inline_markup_faces; + obj_txt["munge"] = (obj_txt["munge"]).links_and_images; } switch (obj_["is"]) { case "heading": @@ -3099,8 +3297,8 @@ template docAbstractionFunctions() { // ↓ - endnotes struct NotesSection { string[string] object_notes; - int previous_count; - int mkn; + int previous_count; + int mkn; static auto rgx = RgxI(); private auto gather_notes_for_endnote_section( ObjGenericComposite[] contents_am, @@ -3631,7 +3829,7 @@ template docAbstractionFunctions() { } } 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; @@ -3924,7 +4122,7 @@ template docAbstractionFunctions() { 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; @@ -4035,11 +4233,31 @@ template docAbstractionFunctions() { int html_segnames_ptr_cntr, int html_segnames_ptr, ) { + string[string][string] notes_; + if (the_document_body_section.length > 1) { + string _notes; + foreach (ref obj; the_document_body_section) { + if (obj.has.inline_notes_reg) { + if ((obj.text).matchFirst(rgx.inline_notes_al_gen)) { + foreach (m; (obj.text).matchAll(rgx.inline_notes_al_regular_number_note)) { + _notes ~= "\n\n" ~ m["num"] ~ ". " ~ m["note"]; + notes_[(m["num"])]["ocn"] = obj.metainfo.ocn.to!string; + } + } + } + } + } if (the_document_endnotes_section.length > 1) { segnames["html"] ~= "endnotes"; segnames["epub"] ~= "endnotes"; html_segnames_ptr = html_segnames_ptr_cntr; foreach (ref obj; the_document_endnotes_section) { + auto matches = (obj.text).matchAll(rgx.endnote_section_note); + foreach (m; matches) { + obj.metainfo.parent_ocn = notes_[(m["notenumber"])]["ocn"].to!int; + } + } + foreach (ref obj; the_document_endnotes_section) { if (obj.metainfo.is_a == "heading") { obj.metainfo.parent_ocn = obj.metainfo.markedup_ancestors[obj.metainfo.parent_lev_markup]; } @@ -5206,6 +5424,9 @@ template docSectKeysSeq() { string[] latex() { return document_section_keys_sequenced["latex"]; } + string[] text() { + return document_section_keys_sequenced["text"]; + } } return doc_sect_keys_seq(); } diff --git a/src/sisudoc/meta/metadoc_object_setter.d b/src/sisudoc/meta/metadoc_object_setter.d index 89ef856..abcb799 100644 --- a/src/sisudoc/meta/metadoc_object_setter.d +++ b/src/sisudoc/meta/metadoc_object_setter.d @@ -57,68 +57,68 @@ module sisudoc.meta.metadoc_object_setter; template ObjectSetter() { /+ structs +/ struct DocObj_TxtAttrib_ { - int indent_base = 0; - int indent_hang = 0; - bool bullet = false; - string language = ""; + int indent_base = 0; + int indent_hang = 0; + bool bullet = false; + string language = ""; } struct DocObj_Has_ { - bool inline_links = false; - bool inline_notes_reg = false; - bool inline_notes_star = false; - bool images = false; - bool image_without_dimensions = false; + bool inline_links = false; + bool inline_notes_reg = false; + bool inline_notes_star = false; + bool images = false; + bool image_without_dimensions = false; } struct DocObj_Table_ { - int number_of_columns = 0; - double[] column_widths = []; - string[] column_aligns = []; - bool heading = false; - bool walls = false; + int number_of_columns = 0; + double[] column_widths = []; + string[] column_aligns = []; + bool heading = false; + bool walls = false; } struct DocObj_CodeBlock_ { - string syntax = ""; - bool linenumbers = false; + string syntax = ""; + bool linenumbers = false; } struct DocObj_Stow_ { - string[] link = []; + string[] link = []; } struct DocObj_Pointer_ { - int doc_object = 0; - int html_segnames = 0; - int heading = 0; + int doc_object = 0; + int html_segnames = 0; + int heading = 0; } struct DocObj_Tags_ { - string[] heading_ancestors_text = [ "", "", "", "", "", "", "", "", ]; - string anchor_tag_html = ""; - string in_segment_html = ""; - string segment_anchor_tag_epub = ""; - string html_segment_anchor_tag_is = ""; - string epub_segment_anchor_tag_is = ""; - string heading_lev_anchor_tag = ""; - string segname_prev = ""; - string segname_next = ""; - string[] lev4_subtoc = []; - string[] anchor_tags = []; + string[] heading_ancestors_text = [ "", "", "", "", "", "", "", "", ]; + string anchor_tag_html = ""; + string in_segment_html = ""; + string segment_anchor_tag_epub = ""; + string html_segment_anchor_tag_is = ""; + string epub_segment_anchor_tag_is = ""; + string heading_lev_anchor_tag = ""; + string segname_prev = ""; + string segname_next = ""; + string[] lev4_subtoc = []; + string[] anchor_tags = []; } struct DocObj_MetaInfo_ { - string is_of_part = ""; // frontmatter, body, backmatter - string is_of_section = ""; // toc, body, glossary, biography, book index, blurb - string is_of_type = ""; // para, block ? - string is_a = ""; // heading, para, table, code block, group, verse/poem ... - alias of_part = is_of_part; - alias of_section = is_of_section; - alias is_of = is_of_type; - string attrib = ""; - string lang = ""; // blocks: group, block, quote; not codeblock; - string syntax = ""; // codeblock only + string is_of_part = ""; // frontmatter, body, backmatter + string is_of_section = ""; // toc, body, glossary, biography, book index, blurb + string is_of_type = ""; // para, block ? + string is_a = ""; // heading, para, table, code block, group, verse/poem ... + alias of_part = is_of_part; + alias of_section = is_of_section; + alias is_of = is_of_type; + string attrib = ""; + string lang = ""; // blocks: group, block, quote; not codeblock; + string syntax = ""; // codeblock only /+ o_n +/ - int o_n_substantive = 0; - int o_n_non_substantive = 0; - int o_n_glossary = 0; - int o_n_bibliography = 0; - int o_n_book_index = 0; - int o_n_blurb = 0; + int o_n_substantive = 0; + int o_n_non_substantive = 0; + int o_n_glossary = 0; + int o_n_bibliography = 0; + int o_n_book_index = 0; + int o_n_blurb = 0; string object_number_substantive() const @property { return (o_n_substantive == 0) ? "" : o_n_substantive.to!string; } @@ -176,7 +176,7 @@ template ObjectSetter() { ubyte[32] sha256; } struct ObjGenericComposite { - string text = ""; + string text = ""; DocObj_MetaInfo_ metainfo; DocObj_TxtAttrib_ attrib; DocObj_Tags_ tags; @@ -420,6 +420,7 @@ template ObjectSetter() { tic, curly_special, tic_special, + quotemarks, } } return _e(); diff --git a/src/sisudoc/meta/metadoc_show_config.d b/src/sisudoc/meta/metadoc_show_config.d index a56e632..5bbeea6 100644 --- a/src/sisudoc/meta/metadoc_show_config.d +++ b/src/sisudoc/meta/metadoc_show_config.d @@ -54,21 +54,19 @@ template spineShowSiteConfig() { O opt_action, T config, ) { - import - sisudoc.meta.defaults, - sisudoc.meta.rgx; - import - std.array, - std.digest.crc, - std.digest.sha, - std.exception, - std.regex, - std.stdio, - std.string, - std.typecons, - std.uni, - std.utf, - std.conv : to; + import sisudoc.meta.defaults; + import sisudoc.meta.rgx; + import std.array; + import std.digest.crc; + import std.digest.sha; + import std.exception; + import std.regex; + import std.stdio; + import std.string; + import std.typecons; + import std.uni; + import std.utf; + import std.conv : to; mixin InternalMarkup; auto markup = InlineMarkup(); auto char_repeat_number = 66; @@ -139,24 +137,20 @@ template spineShowSiteConfig() { } } template spineShowConfig() { - void spineShowConfig(T)( - T doc_matters, - ) { - import - sisudoc.meta.defaults, - sisudoc.meta.rgx; - import - std.array, - std.digest.crc, - std.digest.sha, - std.exception, - std.regex, - std.stdio, - std.string, - std.typecons, - std.uni, - std.utf, - std.conv : to; + void spineShowConfig(T)(T doc_matters) { + import sisudoc.meta.defaults; + import sisudoc.meta.rgx; + import std.array; + import std.digest.crc; + import std.digest.sha; + import std.exception; + import std.regex; + import std.stdio; + import std.string; + import std.typecons; + import std.uni; + import std.utf; + import std.conv : to; mixin InternalMarkup; auto markup = InlineMarkup(); auto min_repeat_number = 66; diff --git a/src/sisudoc/meta/metadoc_show_make.d b/src/sisudoc/meta/metadoc_show_make.d index d3271bf..57721cf 100644 --- a/src/sisudoc/meta/metadoc_show_make.d +++ b/src/sisudoc/meta/metadoc_show_make.d @@ -50,24 +50,20 @@ module sisudoc.meta.metadoc_show_make; @safe: template spineShowMake() { - void spineShowMake(T)( - T doc_matters, - ) { - import - sisudoc.meta.defaults, - sisudoc.meta.rgx; - import - std.array, - std.digest.crc, - std.digest.sha, - std.exception, - std.regex, - std.stdio, - std.string, - std.typecons, - std.uni, - std.utf, - std.conv : to; + void spineShowMake(T)(T doc_matters) { + import sisudoc.meta.defaults; + import sisudoc.meta.rgx; + import std.array; + import std.digest.crc; + import std.digest.sha; + import std.exception; + import std.regex; + import std.stdio; + import std.string; + import std.typecons; + import std.uni; + import std.utf; + import std.conv : to; mixin InternalMarkup; auto markup = InlineMarkup(); auto min_repeat_number = 66; diff --git a/src/sisudoc/meta/metadoc_show_metadata.d b/src/sisudoc/meta/metadoc_show_metadata.d index 1857df8..331ab7f 100644 --- a/src/sisudoc/meta/metadoc_show_metadata.d +++ b/src/sisudoc/meta/metadoc_show_metadata.d @@ -50,24 +50,20 @@ module sisudoc.meta.metadoc_show_metadata; @safe: template spineShowMetaData() { - void spineShowMetaData(T)( - T doc_matters, - ) { - import - sisudoc.meta.defaults, - sisudoc.meta.rgx; - import - std.array, - std.digest.crc, - std.digest.sha, - std.exception, - std.regex, - std.stdio, - std.string, - std.typecons, - std.uni, - std.utf, - std.conv : to; + void spineShowMetaData(T)(T doc_matters) { + import sisudoc.meta.defaults; + import sisudoc.meta.rgx; + import std.array; + import std.digest.crc; + import std.digest.sha; + import std.exception; + import std.regex; + import std.stdio; + import std.string; + import std.typecons; + import std.uni; + import std.utf; + import std.conv : to; mixin InternalMarkup; auto markup = InlineMarkup(); auto min_repeat_number = 66; diff --git a/src/sisudoc/meta/metadoc_show_summary.d b/src/sisudoc/meta/metadoc_show_summary.d index 0404af4..ceb4fd5 100644 --- a/src/sisudoc/meta/metadoc_show_summary.d +++ b/src/sisudoc/meta/metadoc_show_summary.d @@ -50,25 +50,21 @@ module sisudoc.meta.metadoc_show_summary; @safe: template spineMetaDocSummary() { - void spineMetaDocSummary(S,T)( - const S doc_abstraction, - T doc_matters, - ) { - import - sisudoc.meta.defaults, - sisudoc.meta.rgx; - import - std.array, - std.digest.crc, - std.digest.sha, - std.exception, - std.regex, - std.stdio, - std.string, - std.typecons, - std.uni, - std.utf, - std.conv : to; + void spineMetaDocSummary(D)(D doc) { + auto doc_matters = doc.matters; + import sisudoc.meta.defaults; + import sisudoc.meta.rgx; + import std.array; + import std.digest.crc; + import std.digest.sha; + import std.exception; + import std.regex; + import std.stdio; + import std.string; + import std.typecons; + import std.uni; + import std.utf; + import std.conv : to; mixin InternalMarkup; auto markup = InlineMarkup(); auto min_repeat_number = 66; @@ -77,7 +73,7 @@ template spineMetaDocSummary() { char_repeat_number = (char_repeat_number > min_repeat_number) ? char_repeat_number : min_repeat_number; - if (doc_matters.opt.action.vox_gt1 + if (doc_matters.opt.action.vox_gt_2 || doc_matters.opt.action.show_summary) { string[string] check = [ "last_object_number" : "NA [debug \"checkdoc\" not run]", @@ -85,7 +81,7 @@ template spineMetaDocSummary() { "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") { @@ -116,9 +112,9 @@ template spineMetaDocSummary() { 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:", @@ -134,26 +130,26 @@ template spineMetaDocSummary() { " - 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"]), diff --git a/src/sisudoc/meta/package.d b/src/sisudoc/meta/package.d index d24afbb..911952b 100644 --- a/src/sisudoc/meta/package.d +++ b/src/sisudoc/meta/package.d @@ -48,17 +48,15 @@ +/ module sisudoc.meta; -public import - sisudoc.meta.defaults; +public import sisudoc.meta.defaults; /+ std +/ -public import - std.array, - std.exception, - std.range, - std.regex, - std.stdio, - std.string, - std.typecons, - // std.uni, - std.utf, - std.conv : to; +public import std.array; +public import std.exception; +public import std.range; +public import std.regex; +public import std.stdio; +public import std.string; +public import std.typecons; +// public import std.uni; +public import std.utf; +public import std.conv : to; diff --git a/src/sisudoc/meta/rgx.d b/src/sisudoc/meta/rgx.d index eb6fc04..86ca40c 100644 --- a/src/sisudoc/meta/rgx.d +++ b/src/sisudoc/meta/rgx.d @@ -108,8 +108,8 @@ static template spineRgxIn() { static para_attribs = ctRegex!(`^_(?:(?:[0-9])(?:_([0-9]))?|(?:[1-9])?[*]) `); static para_inline_link_anchor = ctRegex!(`\*[~](?P<anchor>[a-z0-9_.-]+)(?= |$)`,"i"); /+ blocked markup +/ - static block_open = ctRegex!("^((code(?:[.][a-z][0-9a-z#+_]+)?|(?:poem|group|block|quote)(?:[.][a-z][0-9a-z_]+)?|table)(?:[(][ a-zA-Z0-9;:,]*[)])?[{][ ]*$)|^`{3} (code(?:[.][a-z][0-9a-z#+_]+)?|(?:poem|group|block|quote)(?:[.][a-z][0-9a-z_]+)?|table)(?:[(][ a-zA-Z0-9;:,]*[)])?|^[{]table[(](?:h;)?(?P<columns>(?:[ ,]+[0-9]+)+)[)][}]"); - static block_poem_open = ctRegex!("^((poem(?:[(][ a-zA-Z0-9;:,]*[)])?[{][ ]*$)|`{3} poem(?:[(][ a-zA-Z0-9;:,]*[)])?)"); + static block_open = ctRegex!("^((code(?:[.][a-z][0-9a-z#+_]+)?|(?:poem|group|block|quote)(?:[.][a-z][0-9a-z_]+)?|table)(?:[(][ a-zA-Z0-9;:,]*[)])?[{][ ]*$)|^[`']{3} (code(?:[.][a-z][0-9a-z#+_]+)?|(?:poem|group|block|quote)(?:[.][a-z][0-9a-z_]+)?|table)(?:[(][ a-zA-Z0-9;:,]*[)])?|^[{]table[(](?:h;)?(?P<columns>(?:[ ,]+[0-9]+)+)[)][}]"); + static block_poem_open = ctRegex!("^((poem(?:[(][ a-zA-Z0-9;:,]*[)])?[{][ ]*$)|[`']{3} poem(?:[(][ a-zA-Z0-9;:,]*[)])?)"); /+ blocked markup tics +/ static block_tic_code_open = ctRegex!("^`{3} code(?:[.](?P<syntax>[a-z][0-9a-z#+_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?"); static block_tic_poem_open = ctRegex!("^`{3} poem(?:[.](?P<lang>[a-z][0-9a-z_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?"); @@ -118,6 +118,14 @@ static template spineRgxIn() { static block_tic_quote_open = ctRegex!("^`{3} quote(?:[.](?P<lang>[a-z][0-9a-z_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?"); static block_tic_table_open = ctRegex!("^`{3} table(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?"); // ctRegex!("^`{3} table(?:\(.*?\))?"); static block_tic_close = ctRegex!("^(`{3})$","m"); + /+ blocked markup tics +/ + static block_quotemarks_code_open = ctRegex!(`^'{3} code(?:[.](?P<syntax>[a-z][0-9a-z#+_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?`); + static block_quotemarks_poem_open = ctRegex!(`^'{3} poem(?:[.](?P<lang>[a-z][0-9a-z_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?`); + static block_quotemarks_group_open = ctRegex!(`^'{3} group(?:[.](?P<lang>[a-z][0-9a-z_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?`); + static block_quotemarks_block_open = ctRegex!(`^'{3} block(?:[.](?P<lang>[a-z][0-9a-z_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?`); + static block_quotemarks_quote_open = ctRegex!(`^'{3} quote(?:[.](?P<lang>[a-z][0-9a-z_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?`); + static block_quotemarks_table_open = ctRegex!(`^'{3} table(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?`); // ctRegex!("^'{3} table(?:\(.*?\))?"); + static block_quotemarks_close = ctRegex!(`^('{3})$`,"m"); /+ blocked markup curly +/ static block_curly_code_open = ctRegex!(`^(?:code(?:[.](?P<syntax>[a-z][0-9a-z_]+))?(?:[(](?P<attrib>[ a-zA-Z0-9;:,]*)[)])?[{][ ]*$)`); static block_curly_code_close = ctRegex!(`^([}]code)`); @@ -140,16 +148,16 @@ static template spineRgxIn() { static table_col_separator_nl = ctRegex!(`[┊]$`, "mg"); /+ inline markup footnotes endnotes +/ static inline_notes_curly_gen = ctRegex!(`~\{.+?\}~`, "m"); - static inline_notes_curly = ctRegex!(`~\{\s*(.+?)\}~`, "mg"); - static inline_notes_curly_sp_asterisk = ctRegex!(`~\{[*]+\s+(.+?)\}~`, "m"); - static inline_notes_curly_sp_plus = ctRegex!(`~\{[+]+\s+(.+?)\}~`, "m"); + static inline_notes_curly = ctRegex!(`~\{\s*(.+?)\s*\}~`, "mg"); + static inline_notes_curly_sp_asterisk = ctRegex!(`~\{[*]+\s+(.+?)\s*\}~`, "m"); + static inline_notes_curly_sp_plus = ctRegex!(`~\{[+]+\s+(.+?)\s*\}~`, "m"); static note_ref = ctRegex!(`^\S+?noteref_(?P<ref>[0-9]+)`, "mg"); // {^{73.}^}#noteref_73 static smid_inline_url_generic = ctRegex!(`(?:^|[}(\[ ])(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)[a-zA-Z0-9_#]`, "mg"); static smid_inline_url = ctRegex!(`((?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)[a-zA-Z0-9_]\S*)`, "mg"); static smid_inline_link_naked_url = ctRegex!(`(?P<pre>^|[ (\[])(?P<link>(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤)\S+?)(?=[.,;:?!'"]?([ )\]]|$))`, "mg"); static smid_inline_link_markup_regular = ctRegex!(`(?P<pre>^|[ (\[])\{\s*(?P<content>.+?)\s*\}(?P<link>(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$))`, "mg"); - static smid_inline_link_endnote_url_helper_punctuated = ctRegex!(`\{~\^\s+(?P<content>.+?)\}(?P<link>(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[.,;:?!]?([ ]|$))`, "mg"); - static smid_inline_link_endnote_url_helper = ctRegex!(`\{~\^\s+(?P<content>.+?)\}(?P<link>(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+)`, "mg"); + static smid_inline_link_endnote_url_helper_punctuated = ctRegex!(`\{~\^\s+(?P<content>.+?)\s*\}(?P<link>(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[.,;:?!]?([ ]|$))`, "mg"); + static smid_inline_link_endnote_url_helper = ctRegex!(`\{~\^\s+(?P<content>.+?)\s*\}(?P<link>(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+)`, "mg"); static image = ctRegex!(`([a-zA-Z0-9._-]+?\.(?:png|gif|jpg))`, "mg"); static smid_image = ctRegex!(`(?P<pre>(?:^|[ ])[{┥](?:~\^\s+|\s*))(?P<image>[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))(?P<post>(?:.*?)\s*[}┝](?:image|┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg"); static smid_image_generic = ctRegex!(`(?:^|[ ])[{┥](?:~\^\s+|\s*)\S+\.(?:png|gif|jpg).*?[}┝](?:image|┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$))`, "mg"); @@ -213,9 +221,9 @@ static template spineRgxIn() { static br_empty_line = ctRegex!(`\n[ ]*\n`, "mg"); static br_linebreaks_newlines = ctRegex!(`[\n┘┙]`, "mg"); static br_linebreaks = ctRegex!(`[┘┙]`, "mg"); - static br_line = ctRegex!(`┘`, "mg"); - static br_line_inline = ctRegex!(`┙`, "mg"); - static br_line_spaced = ctRegex!(`┚`, "mg"); + static br_line = ctRegex!(`\s*┘\s*`, "mg"); + static br_line_inline = ctRegex!(`\s*┙\s*`, "mg"); + static br_line_spaced = ctRegex!(`\s*┚\s*`, "mg"); /+ inline markup footnotes endnotes +/ static inline_notes_al = ctRegex!(`【(?:[*+]\s+|\s*)(.+?)】`, "mg"); static inline_notes_al_special = ctRegex!(`【(?:[*+]\s+)(.+?)】`, "mg"); // TODO remove match when special footnotes are implemented @@ -228,6 +236,7 @@ static template spineRgxIn() { static inline_al_delimiter_open_symbol_star = ctRegex!(`【[*]\s`, "m"); static inline_al_delimiter_open_symbol_plus = ctRegex!(`【[+]\s`, "m"); static inline_text_and_note_al_ = ctRegex!(`(.+?(?:【[*+]*\s+.+?】|.+))`, "mg"); + static endnote_section_note = ctRegex!(`┥\s*⑆\^┨(?P<notenumber>\d+)\.┣\^┝┤(?P<link>¤?.+?)├.+`, "mg"); /+ inline markup links +/ static inline_image = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>\d+)h(?P<height>\d+))\s*(?P<post>.*?┝┤.*?├)`, "mg"); static inline_image_without_dimensions = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>0)h(?P<height>0))\s*(?P<post>.*?┝┤.*?├)`, "mg"); @@ -242,6 +251,7 @@ static template spineRgxIn() { static inline_link_seg_and_hash = ctRegex!(`┥(?P<text>.+?)┝┤(?P<link>(?P<seg>[^/#├]*)#(?P<hash>.+?))├`, "mg"); static inline_link_clean = ctRegex!(`┤(?:.+?)├|[┥┝]`, "mg"); static inline_link_toc_to_backmatter = ctRegex!(`┤#(?P<link>endnotes|bibliography|bookindex|glossary|blurb)├`, "mg"); + static find_bookindex_ocn_link_and_comma = ctRegex!(`[, ]*┥.+?┝┤#?\S+?├`, "mg"); static url = ctRegex!(`https?://`, "mg"); static uri = ctRegex!(`(?:https?|git)://`, "mg"); static uri_identify_components = ctRegex!(`(?P<type>(?:https?|git)://)(?P<path>\S+?/)(?P<file>[^/]+)$`, "mg"); diff --git a/src/sisudoc/meta/rgx_yaml_tags.d b/src/sisudoc/meta/rgx_yaml.d index ee57469..ee57469 100644 --- a/src/sisudoc/meta/rgx_yaml_tags.d +++ b/src/sisudoc/meta/rgx_yaml.d |