diff options
| author | Ralph Amissah <ralph.amissah@gmail.com> | 2019-05-08 18:45:02 -0400 | 
|---|---|---|
| committer | Ralph Amissah <ralph.amissah@gmail.com> | 2019-08-19 14:42:40 -0400 | 
| commit | 6b46ba599b7f687a592e2e50fdd007ed31319243 (patch) | |
| tree | 9ba93fc931804a14506bae682eadaaef413f0024 /src/doc_reform | |
| parent | book index sort: Aa-Zz (replaces A-Za-z) (diff) | |
0.7.0 meta_abstruction, doc "has" struct replaces several tuples
Diffstat (limited to 'src/doc_reform')
| -rwxr-xr-x | src/doc_reform/doc_reform.d | 1 | ||||
| -rw-r--r-- | src/doc_reform/meta/doc_debugs.d | 18 | ||||
| -rw-r--r-- | src/doc_reform/meta/metadoc.d | 57 | ||||
| -rw-r--r-- | src/doc_reform/meta/metadoc_from_src.d | 121 | ||||
| -rw-r--r-- | src/doc_reform/meta/metadoc_summary.d | 44 | ||||
| -rw-r--r-- | src/doc_reform/meta/object_setter.d | 3 | ||||
| -rw-r--r-- | src/doc_reform/output/epub3.d | 11 | ||||
| -rw-r--r-- | src/doc_reform/output/html.d | 6 | ||||
| -rw-r--r-- | src/doc_reform/output/sqlite.d | 8 | ||||
| -rw-r--r-- | src/doc_reform/output/xmls.d | 6 | 
10 files changed, 167 insertions, 108 deletions
| diff --git a/src/doc_reform/doc_reform.d b/src/doc_reform/doc_reform.d index baffbc9..ae92a97 100755 --- a/src/doc_reform/doc_reform.d +++ b/src/doc_reform/doc_reform.d @@ -384,6 +384,7 @@ void main(string[] args) {          || manifest          || pod          || source +        || sqlite_discrete        ) {          _is = true;        } else { _is = false; } diff --git a/src/doc_reform/meta/doc_debugs.d b/src/doc_reform/meta/doc_debugs.d index 5ca5c39..f96a942 100644 --- a/src/doc_reform/meta/doc_debugs.d +++ b/src/doc_reform/meta/doc_debugs.d @@ -37,7 +37,7 @@ template DocReformDebugs() {          __FILE__,          __LINE__,        ); -      foreach (key; doc_matters.xml.keys_seq.seg) { +      foreach (key; doc_matters.has.keys_seq.seg) {          foreach (obj; contents[key]) {            if (obj.metainfo.is_of_part != "empty") {              if (obj.metainfo.is_a == "heading") { @@ -100,7 +100,7 @@ template DocReformDebugs() {      }      debug(toc_nav_dom) {        enum DomTags { none, open, close, close_and_open, open_still, } -      foreach (sect; doc_matters.xml.keys_seq.seg) { +      foreach (sect; doc_matters.has.keys_seq.seg) {          foreach (obj; contents[sect]) {            if (obj.metainfo.is_a == "heading") {              foreach_reverse (k; 0 .. 7) { @@ -127,7 +127,7 @@ template DocReformDebugs() {          }        }        writeln("--------------------"); -      foreach (sect; doc_matters.xml.keys_seq.seg) { +      foreach (sect; doc_matters.has.keys_seq.seg) {          foreach (obj; contents[sect]) {            if (obj.metainfo.is_a == "heading") {              foreach_reverse (k; 0 .. 7) { @@ -155,7 +155,7 @@ template DocReformDebugs() {        }      }      debug(decendants) { -      foreach (sect; doc_matters.xml.keys_seq.scroll) { +      foreach (sect; doc_matters.has.keys_seq.scroll) {          foreach (obj; contents[sect]) {            if (obj.metainfo.is_a == "heading") {              writeln(obj.metainfo.ocn, " .. ", obj.metainfo.last_decendant_ocn); @@ -393,7 +393,7 @@ template DocReformDebugs() {          __FILE__,          __LINE__,        ); -      foreach (k; doc_matters.xml.keys_seq.seg) { +      foreach (k; doc_matters.has.keys_seq.seg) {          foreach (obj; contents[k]) {            if (obj.metainfo.is_a == "heading") {              writefln( @@ -408,7 +408,7 @@ template DocReformDebugs() {        }      }      debug(heading) {                         // heading -      foreach (k; doc_matters.xml.keys_seq.seg) { +      foreach (k; doc_matters.has.keys_seq.seg) {          foreach (o; contents[k]) {            if (o.metainfo.is_a == "heading") {              writefln( @@ -428,7 +428,7 @@ template DocReformDebugs() {          __FILE__,          __LINE__,        ); -      foreach (k; doc_matters.xml.keys_seq.seg) { +      foreach (k; doc_matters.has.keys_seq.seg) {          foreach (obj; contents[k]) {            if (obj.metainfo.is_a == "heading") {              writefln( @@ -580,11 +580,11 @@ template DocReformDebugs() {              const S  contents,                    T  doc_matters,            ) { -            foreach (key; doc_matters.xml.keys_seq.seg) { +            foreach (key; doc_matters.has.keys_seq.seg) {                if (contents[key].length > 1) {                  foreach (obj; contents[key]) {                    if (obj.heading_lev_markup == 4) { -                    writeln(obj.ptr_html_segnames, ". (", doc_matters.xml.segnames[obj.ptr_html_segnames], ") -> ",  obj.text); +                    writeln(obj.ptr_html_segnames, ". (", doc_matters.has.segnames_lv4[obj.ptr_html_segnames], ") -> ",  obj.text);                    }                  }                } diff --git a/src/doc_reform/meta/metadoc.d b/src/doc_reform/meta/metadoc.d index a57159d..d8cc19f 100644 --- a/src/doc_reform/meta/metadoc.d +++ b/src/doc_reform/meta/metadoc.d @@ -27,7 +27,7 @@ template DocReformAbstraction() {    mixin outputHub;    enum headBody { header, body_content, insert_file_list, image_list }    enum makeMeta { make, meta } -  enum docAbst  { doc_abstraction, section_keys, segnames, segnames_0_4, tag_assoc, images } +  enum docAbst  { doc_abstract_obj, doc_has }    static auto rgx = Rgx();    auto DocReformAbstraction(E,P,O,M)(      E _env, @@ -92,17 +92,9 @@ template DocReformAbstraction() {        true,      );      static assert(!isTypeTuple!(da)); -    static assert(da.length==6); -    auto doc_abstraction = da[docAbst.doc_abstraction]; /+ head ~ toc ~ body ~ endnotes_seg ~ glossary ~ bibliography ~ bookindex ~ blurb; +/ -    auto _document_section_keys_sequenced = da[docAbst.section_keys]; -    string[] _doc_html_segnames = da[docAbst.segnames]; -    string[] _doc_epub_segnames_0_4 = da[docAbst.segnames_0_4]; -    debug(segnames) { -      writeln("segnames lv4:      ", _doc_html_segnames); -      writeln("segnames lv0 to 4: ", _doc_epub_segnames_0_4); -    } -    auto _doc_tag_assoc = da[docAbst.tag_assoc]; -    auto _images = da[docAbst.images]; +    static assert(da.length==2); +    auto doc_abstraction = da[docAbst.doc_abstract_obj]; /+ head ~ toc ~ body ~ endnotes_seg ~ glossary ~ bibliography ~ bookindex ~ blurb; +/ +    auto _doc_has_struct = da[docAbst.doc_has];      if ((_opt_action.debug_do)      || (_opt_action.very_verbose)      ) { @@ -152,6 +144,9 @@ template DocReformAbstraction() {        auto conf_make_meta() { // TODO meld with all make instructions          return _make_and_meta_struct;        } +      auto has() { +        return _doc_has_struct; +      }        auto env() {          struct Env_ {            auto pwd() { @@ -181,17 +176,6 @@ template DocReformAbstraction() {        auto src_path_info() {          return DocReformPathsSRC!()(_manifest.env.pwd, _manifest.src.file_with_absolute_path); // would like (to have and use) relative path        } -      auto srcs() { -        struct SRC_ { -          auto file_insert_list() { -            return _header_body_insertfilelist_imagelist[headBody.insert_file_list]; -          } -          auto image_list() { -            return _images; -          } -        } -        return SRC_(); -      }        auto pod() {          return _manifest.pod;        } @@ -203,26 +187,19 @@ template DocReformAbstraction() {          }          return SQLite_();        } -      auto xml() { -        struct XML_ { -          auto keys_seq() { -            /+ contains .seg & .scroll sequences +/ -            return _document_section_keys_sequenced; -          } -          string[] segnames() { -            return _doc_html_segnames; -          } -          string[] segnames_lv_0_to_4() { -            return _doc_epub_segnames_0_4; +      auto output_path() { +        return _manifest.output.path; +      } +      auto srcs() { +        struct SRC_ { +          auto file_insert_list() { +            return _header_body_insertfilelist_imagelist[headBody.insert_file_list];            } -          auto tag_associations() { -            return _doc_tag_assoc; +          auto image_list() { +            return _doc_has_struct.imagelist;            }          } -        return XML_(); -      } -      auto output_path() { -        return _manifest.output.path; +        return SRC_();        }      }      auto doc_matters = DocumentMatters(); diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index 3d6b441..6a10534 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -347,6 +347,18 @@ template DocReformDocAbstraction() {        "glossary" : 0,        "blurb"    : 0,      ]; +    uint[string] dochas = [ +      "inline_links" : 0, +      "inline_notes" : 0, +      "inline_notes_star" : 0, +      "codeblock" : 0, +      "table" : 0, +      "block" : 0, +      "group" : 0, +      "poem" : 0, +      "quote" : 0, +      "images" : 0, +    ];      auto obj_type_status = flags_type_init;      string[string] object_number_poem = [        "start" : "", @@ -807,7 +819,7 @@ template DocReformDocAbstraction() {                processing.remove("verse");                object_number_poem["start"] = obj_cite_digits.object_number.to!string;              } -            line.flow_txt_block_start(obj_type_status, object_number_poem); +            line.flow_txt_block_start(obj_type_status, dochas, object_number_poem);              continue;            } else if (!line.empty) {                                                    /+ line not empty +/              /+ non blocks (headings, paragraphs) & closed blocks +/ @@ -1753,7 +1765,7 @@ template DocReformDocAbstraction() {        }        return images_;      } -    string[] segnames_lv0_to_4; +    string[] segnames_0_to_4;      auto _image_dimensions(O,M)(O obj, M manifest_matter) {        if (obj.has.image_without_dimensions) {          import std.math; @@ -1819,7 +1831,7 @@ template DocReformDocAbstraction() {            writeln(obj.text);          }          if (obj.metainfo.heading_lev_markup <= 4) { -          segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub; +          segnames_0_to_4 ~= obj.tags.segment_anchor_tag_epub;          }          if (obj.metainfo.heading_lev_markup == 0) {            /+ TODO second hit (of two) with same assertion failure, check, fix and reinstate @@ -1851,7 +1863,7 @@ template DocReformDocAbstraction() {        foreach (ref obj; the_table_of_contents_section) {          if (obj.metainfo.is_a == "heading") {            if (obj.metainfo.heading_lev_markup <= 4) { -            segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub; +            segnames_0_to_4 ~= obj.tags.segment_anchor_tag_epub;              if (obj.metainfo.heading_lev_markup == 4) {                obj.tags.segname_next = segnames["html"][obj.ptr.html_segnames + 1];                assert(obj.tags.anchor_tag_html == segnames["html"][obj.ptr.html_segnames], @@ -1891,7 +1903,7 @@ template DocReformDocAbstraction() {              writeln(obj.text);            }            if (obj.metainfo.heading_lev_markup <= 4) { -            segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub; +            segnames_0_to_4 ~= obj.tags.segment_anchor_tag_epub;              if (obj.metainfo.heading_lev_markup == 4) {                obj.tags.lev4_subtoc = lev4_subtoc[obj.tags.anchor_tag_html];                obj.tags.segname_prev = segnames["html"][obj.ptr.html_segnames - 1]; @@ -1920,7 +1932,7 @@ template DocReformDocAbstraction() {          obj = _links(obj);        }      } -    auto images=uniq(_images.sort()); +    auto image_list = (_images.sort()).uniq;      /+ optional only one 1~ level +/      if (the_endnotes_section.length > 1) {        dom_structure_markedup_tags_status_buffer  = dom_structure_markedup_tags_status.dup; @@ -1936,7 +1948,7 @@ template DocReformDocAbstraction() {            obj.metainfo.ocn        = obj_cite_digits.object_number;            obj.metainfo.identifier = obj_cite_digits.identifier;            if (obj.metainfo.heading_lev_markup <= 4) { -            segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub; +            segnames_0_to_4 ~= obj.tags.segment_anchor_tag_epub;              if (obj.metainfo.heading_lev_markup == 4) {                obj.tags.segname_prev = segnames["html"][obj.ptr.html_segnames - 1];                if (segnames["html"].length > obj.ptr.html_segnames + 1) { @@ -1972,7 +1984,7 @@ template DocReformDocAbstraction() {            obj.metainfo.ocn        = obj_cite_digits.object_number;            obj.metainfo.identifier = obj_cite_digits.identifier;            if (obj.metainfo.heading_lev_markup <= 4) { -            segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub; +            segnames_0_to_4 ~= obj.tags.segment_anchor_tag_epub;              if (obj.metainfo.heading_lev_markup == 4) {                obj.tags.segname_prev = segnames["html"][obj.ptr.html_segnames - 1];                if (segnames["html"].length > obj.ptr.html_segnames + 1) { @@ -2012,7 +2024,7 @@ template DocReformDocAbstraction() {            obj.metainfo.ocn        = obj_cite_digits.object_number;            obj.metainfo.identifier = obj_cite_digits.identifier;            if (obj.metainfo.heading_lev_markup <= 4) { -            segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub; +            segnames_0_to_4 ~= obj.tags.segment_anchor_tag_epub;              if (obj.metainfo.heading_lev_markup == 4) {                obj.tags.segname_prev = segnames["html"][obj.ptr.html_segnames - 1];                if (segnames["html"].length > obj.ptr.html_segnames + 1) { @@ -2053,7 +2065,7 @@ template DocReformDocAbstraction() {            debug(dom) {            }            if (obj.metainfo.heading_lev_markup <= 4) { -            segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub; +            segnames_0_to_4 ~= obj.tags.segment_anchor_tag_epub;            }            obj_cite_digits         = ocn_emit(OCNstatus.on);            obj.metainfo.ocn        = obj_cite_digits.object_number; @@ -2104,7 +2116,7 @@ template DocReformDocAbstraction() {            obj.metainfo.ocn        = obj_cite_digits.object_number;            obj.metainfo.identifier = obj_cite_digits.identifier;            if (obj.metainfo.heading_lev_markup <= 4) { -            segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub; +            segnames_0_to_4 ~= obj.tags.segment_anchor_tag_epub;              if (obj.metainfo.heading_lev_markup == 4) {                obj.tags.segname_prev = segnames["html"][obj.ptr.html_segnames - 1];                if (segnames["html"].length > obj.ptr.html_segnames + 1) { @@ -2306,11 +2318,10 @@ template DocReformDocAbstraction() {        document_section_keys_sequenced["scroll"] ~= "tail";        document_section_keys_sequenced["seg"]    ~= "tail";      } -    auto sequenced_document_keys = docSectKeysSeq!()(document_section_keys_sequenced); -    auto segnames_lv4 = segnames["html"].dup; +    auto segnames_4 = segnames["html"].dup;      auto segnames_lv1_to_4 = segnames["epub"].dup;      debug(segnames) { -      writeln("segnames_lv4:      ", segnames_lv4); +      writeln("segnames_lv4:      ", segnames_4);        writeln("segnames_lv1_to_4: ", segnames_lv1_to_4);      }      destroy(the_document_head_section); @@ -2335,13 +2346,59 @@ template DocReformDocAbstraction() {      dom_structure_collapsed_tags_status          = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,];      dom_structure_collapsed_tags_status_buffer   = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; +    auto doc_has() { +      struct DocHas_ { +        uint inline_links() { +          return dochas["inline_links"]; +        } +        uint inline_notes_reg() { +          return dochas["inline_notes"]; +        } +        uint inline_notes_star() { +          return dochas["inline_notes_star"]; +        } +        uint codeblocks() { +          return dochas["codeblock"]; +        } +        uint tables() { +          return dochas["table"]; +        } +        uint blocks() { +          return dochas["block"]; +        } +        uint groups() { +          return dochas["group"]; +        } +        uint poems() { +          return dochas["poem"]; +        } +        uint quotes() { +          return dochas["quote"]; +        } +        ulong images() { // TODO not ideal rethink +          return (image_list.to!string.strip("[","]").split(",").length); +        } +        auto imagelist() { +          return image_list; +        } +        auto keys_seq() { +          return docSectKeysSeq!()(document_section_keys_sequenced); +        } +        string[] segnames_lv4() { +          return segnames_4; +        } +        string[] segnames_lv_0_to_4() { +          return segnames_0_to_4; +        } +        string[string][string] tag_associations() { +          return tag_assoc; +        } +      } +      return DocHas_(); +    }      auto t = tuple(        document_the, -      sequenced_document_keys, -      segnames_lv4, -      segnames_lv0_to_4, -      tag_assoc, -      images, +      doc_has,      );      return t;      /+ post loop markup document/text ↑ +/ @@ -2484,9 +2541,10 @@ template DocReformDocAbstraction() {      return line;    }    void flow_txt_block_start(L,T,N)( -               L line, -    return ref T obj_type_status, -    return ref N object_number_poem +               L              line, +    return ref T              obj_type_status, +    return ref uint[string]   dochas, +    return ref N              object_number_poem    ) {      debug(asserts) {        static assert(is(typeof(line)                 == char[])); @@ -2495,6 +2553,7 @@ template DocReformDocAbstraction() {      }      static auto rgx = Rgx();      if (auto m = line.matchFirst(rgx.block_curly_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 : ""; @@ -2508,6 +2567,7 @@ template DocReformDocAbstraction() {        obj_type_status["code"]       = TriState.on;        obj_type_status["curly_code"] = TriState.on;      } else if (auto m = line.matchFirst(rgx.block_curly_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 : ""; @@ -2523,6 +2583,7 @@ template DocReformDocAbstraction() {        obj_type_status["poem"]       = TriState.on;        obj_type_status["curly_poem"] = TriState.on;      } else if (auto m = line.matchFirst(rgx.block_curly_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 : ""; @@ -2536,6 +2597,7 @@ template DocReformDocAbstraction() {        obj_type_status["group"]       = TriState.on;        obj_type_status["curly_group"] = TriState.on;      } else if (auto m = line.matchFirst(rgx.block_curly_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 : ""; @@ -2549,6 +2611,7 @@ template DocReformDocAbstraction() {        obj_type_status["block"]       = TriState.on;        obj_type_status["curly_block"] = TriState.on;      } else if (auto m = line.matchFirst(rgx.block_curly_quote_open)) { +      dochas["quote"]++;        an_object["syntax"]            = "";        an_object["attrib"]            = m["attrib"].to!string;        an_object["lang"]              = m["lang"].to!string; @@ -2568,18 +2631,21 @@ template DocReformDocAbstraction() {            line          );        } +      dochas["table"] ++;        an_object["table_head"]        = m["attrib"].to!string;        an_object["block_type"]        = "curly";        obj_type_status["blocks"]      = TriState.on;        obj_type_status["table"]       = TriState.on;        obj_type_status["curly_table"] = TriState.on;      } else if (auto m = line.matchFirst(rgx.block_curly_table_special_markup)) { /+ table: special table block markup syntax! +/ +      dochas["table"]++;        an_object["table_head"]                       = m["attrib"].to!string;        an_object["block_type"]                       = "special";        obj_type_status["blocks"]                     = TriState.on;        obj_type_status["table"]                      = TriState.on;        obj_type_status["curly_table_special_markup"] = TriState.on;      } else if (auto m = line.matchFirst(rgx.block_tic_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 : ""; @@ -2593,6 +2659,7 @@ template DocReformDocAbstraction() {        obj_type_status["code"]     = TriState.on;        obj_type_status["tic_code"] = TriState.on;      } else if (auto m = line.matchFirst(rgx.block_tic_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 : ""; @@ -2608,6 +2675,7 @@ template DocReformDocAbstraction() {        obj_type_status["poem"]      = TriState.on;        obj_type_status["tic_poem"]  = TriState.on;      } else if (auto m = line.matchFirst(rgx.block_tic_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 : ""; @@ -2621,6 +2689,7 @@ template DocReformDocAbstraction() {        obj_type_status["group"]     = TriState.on;        obj_type_status["tic_group"] = TriState.on;      } else if (auto m = line.matchFirst(rgx.block_tic_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 : ""; @@ -2634,6 +2703,7 @@ template DocReformDocAbstraction() {        obj_type_status["block"]     = TriState.on;        obj_type_status["tic_block"] = TriState.on;      } else if (auto m = line.matchFirst(rgx.block_tic_quote_open)) { +      dochas["quote"]++;        an_object["syntax"]            = "";        an_object["attrib"]            = m["attrib"].to!string;        an_object["lang"]              = m["lang"].to!string; @@ -2653,6 +2723,7 @@ template DocReformDocAbstraction() {            line          );        } +      dochas["table"] ++;        an_object["table_head"]      = m["attrib"].to!string;        an_object["block_type"]      = "tic";        obj_type_status["blocks"]    = TriState.on; @@ -6341,13 +6412,13 @@ template DocReformDocAbstraction() {  template docSectKeysSeq() {    auto docSectKeysSeq(string[][string] document_section_keys_sequenced) {      struct doc_sect_keys_seq { -      auto scroll() { +      string[] scroll() {          return document_section_keys_sequenced["scroll"];        } -      auto seg() { +      string[] seg() {          return document_section_keys_sequenced["seg"];        } -      auto sql() { +      string[] sql() {          return document_section_keys_sequenced["sql"];        }      } diff --git a/src/doc_reform/meta/metadoc_summary.d b/src/doc_reform/meta/metadoc_summary.d index e44a12c..30f4a83 100644 --- a/src/doc_reform/meta/metadoc_summary.d +++ b/src/doc_reform/meta/metadoc_summary.d @@ -26,7 +26,7 @@ template DocReformAbstractionSummary() {          "last_object_number_body"  : "0",          "last_object_number_book_index" : "0",        ]; -      foreach (k; doc_matters.xml.keys_seq.seg) { +      foreach (k; doc_matters.has.keys_seq.seg) {          foreach (obj; doc_abstraction[k]) {            if (obj.metainfo.is_of_part != "empty") {              if (!empty(obj.metainfo.object_number)) { @@ -52,48 +52,58 @@ template DocReformAbstractionSummary() {        ? char_repeat_number        : min_repeat_number;        writefln( -        "%s\n\"%s\", %s\n%s\n%s\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n(%s: %s)\n%s", +        "%s\n\"%s\", %s\n%s\n%s\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%s",          markup.repeat_character_by_number_provided("-", char_repeat_number),          doc_matters.conf_make_meta.meta.title_full,          doc_matters.conf_make_meta.meta.creator_author,          doc_matters.src.filename,          markup.repeat_character_by_number_provided("-", char_repeat_number), -        "length toc arr:", +        "- toc arr length:",          to!int(doc_abstraction["toc"].length), -        "length doc_abstraction arr:", +        "- doc_abstraction arr length:",          to!int(doc_abstraction["body"].length), -        "last doc body ocn:", +        "  doc body last obj on.#:",          to!int(check["last_object_number_body"]), -        "last object_number:", -        to!int(check["last_object_number"]), -        "length endnotes:",                                // subtract headings +        "  - number of tables:", +        doc_matters.has.tables, +        "  - number of codeblocks:", +        doc_matters.has.codeblocks, +        "  - number of poems:", +        doc_matters.has.poems, +        "  - number of blocks:", +        doc_matters.has.blocks, +        "  - number of groups:", +        doc_matters.has.groups, +        "  - number of images:", +        doc_matters.has.images, +        "- endnotes length:",                                // subtract headings          (doc_abstraction["endnotes"].length > 2)          ? (to!int(doc_abstraction["endnotes"].length - 2))          : 0, -        "length glossary:", +        "- glossary length:",          (doc_abstraction["glossary"].length > 1)          ? (to!int(doc_abstraction["glossary"].length))          : 0, -        "length biblio:", +        "- biblio length:",          (doc_abstraction["bibliography"].length > 1)          ? (to!int(doc_abstraction["bibliography"].length))          : 0, -        "length bookindex:", +        "- bookindex length:",          (doc_abstraction["bookindex"].length > 1)          ? (to!int(doc_abstraction["bookindex"].length))          : 0, -        "  last book idx ocn:", +        "  book idx last obj on.#:",          to!int(check["last_object_number_book_index"]), -        "length blurb:", +        "- blurb length:",          (doc_abstraction["blurb"].length > 1)          ? (to!int(doc_abstraction["blurb"].length))          : 0, +        "* last obj on.#:", +        to!int(check["last_object_number"]),          "number of segments:", -        (doc_matters.xml.segnames.length > 1) -        ? (to!int(doc_matters.xml.segnames.length)) +        (doc_matters.has.segnames_lv4.length > 1) +        ? (to!int(doc_matters.has.segnames_lv4.length))          : 0, -        __FILE__, -        __LINE__,          markup.repeat_character_by_number_provided("-", min_repeat_number),        );      } diff --git a/src/doc_reform/meta/object_setter.d b/src/doc_reform/meta/object_setter.d index dac10da..264d439 100644 --- a/src/doc_reform/meta/object_setter.d +++ b/src/doc_reform/meta/object_setter.d @@ -86,10 +86,11 @@ template ObjectSetter() {      bool                   bullet                              = false;      string                 language                            = ""; // not implemented, consider    } -  struct DocObj_Has_ {                                         // has +  struct DocObj_Has_ {                                         // doc object has      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_ { diff --git a/src/doc_reform/output/epub3.d b/src/doc_reform/output/epub3.d index a49bb5d..cdfd2a6 100644 --- a/src/doc_reform/output/epub3.d +++ b/src/doc_reform/output/epub3.d @@ -103,7 +103,7 @@ template outputEPub3() {      content ~= "  " ~ "</guide>"            ~ "\n  ";      content ~= ""   ~ "</package>";      debug(epubmanifest) { -      foreach (part; doc_matters.xml.keys_seq.seg) { // TODO +      foreach (part; doc_matters.has.keys_seq.seg) { // TODO          foreach (obj; doc_abstraction[part]) {            if (obj.metainfo.is_a == "heading") {              if (obj.metainfo.heading_lev_markup == 4) { @@ -145,7 +145,7 @@ template outputEPub3() {        <nav epub:type=\"toc\" id=\"toc\">\n",        doc_matters.conf_make_meta.meta.title_full,      ); -    foreach (sect; doc_matters.xml.keys_seq.seg) { +    foreach (sect; doc_matters.has.keys_seq.seg) {        foreach (obj; doc_abstraction[sect]) {          if (obj.metainfo.is_a == "heading") {            string _txt = obj.text.replaceAll(rgx.inline_notes_al_gen, "").strip; @@ -242,7 +242,7 @@ template outputEPub3() {        (doc_matters.conf_make_meta.meta.creator_author.empty) ? ""          : doc_matters.conf_make_meta.meta.creator_author,                  // author      ); -    foreach (sect; doc_matters.xml.keys_seq.seg) { +    foreach (sect; doc_matters.has.keys_seq.seg) {        foreach (obj; doc_abstraction[sect]) {          if (obj.metainfo.is_a == "heading") {            string _txt = obj.text.replaceAll(rgx.inline_notes_al_gen, "").strip; @@ -322,8 +322,7 @@ template outputEPub3() {        string[] doc_parts;      }      auto epubWrite = writeOut(); -    // writeln(doc_matters.xml.keys_seq.seg); -    foreach (part; doc_matters.xml.keys_seq.seg) { +    foreach (part; doc_matters.has.keys_seq.seg) {        foreach (obj; doc_abstraction[part]) {          string _txt = xhtml_format.special_characters(obj);          if (obj.metainfo.is_a == "heading") { @@ -659,7 +658,7 @@ template outputEPub3() {          }        }        { /+ OEBPS/[segments].xhtml (the document contents) +/ -        foreach (seg_filename; doc_matters.xml.segnames_lv_0_to_4) { +        foreach (seg_filename; doc_matters.has.segnames_lv_0_to_4) {            string fn = pth_epub3.fn_oebps_content_xhtml(doc_matters.src.filename, seg_filename);            auto zip_arc_member_file = new ArchiveMember();            zip_arc_member_file.name = fn; diff --git a/src/doc_reform/output/html.d b/src/doc_reform/output/html.d index 45b95ce..c9032e5 100644 --- a/src/doc_reform/output/html.d +++ b/src/doc_reform/output/html.d @@ -25,7 +25,7 @@ template outputHTML() {      string suffix = ".html";      string previous_part = "";      string delimit = ""; -    foreach (part; doc_matters.xml.keys_seq.scroll) { +    foreach (part; doc_matters.has.keys_seq.scroll) {        foreach (obj; doc_abstraction[part]) {          delimit = xhtml_format.div_delimit(part, previous_part);          string _txt = xhtml_format.special_characters(obj); @@ -222,7 +222,7 @@ template outputHTML() {      string suffix = ".html";      string previous_part = "";      string delimit = ""; -    foreach (part; doc_matters.xml.keys_seq.seg) { +    foreach (part; doc_matters.has.keys_seq.seg) {        foreach (obj; doc_abstraction[part]) {          delimit = xhtml_format.div_delimit(part, previous_part);          string _txt = xhtml_format.special_characters(obj); @@ -476,7 +476,7 @@ template outputHTML() {        if (!exists(pth_html.seg(doc_matters.src.filename))) {          pth_html.seg(doc_matters.src.filename).mkdirRecurse;        } -      foreach (seg_filename; doc_matters.xml.segnames) { +      foreach (seg_filename; doc_matters.has.segnames_lv4) {          auto f = File(pth_html.fn_seg(doc_matters.src.filename, seg_filename), "w");          foreach (docseg; doc_html[seg_filename]) {            f.writeln(docseg); diff --git a/src/doc_reform/output/sqlite.d b/src/doc_reform/output/sqlite.d index 0be198b..832e2e7 100644 --- a/src/doc_reform/output/sqlite.d +++ b/src/doc_reform/output/sqlite.d @@ -299,8 +299,8 @@ template SQLiteFormatAndLoadObject() {            auto pth_html = DocReformPathsHTML!()(doc_matters.output_path, doc_matters.src.language);            if (_xml_type == "seg") {              foreach (m; _txt.match(rgx.inline_link_hash)) { -              if (m.captures[3] in doc_matters.xml.tag_associations) { -                if (m.captures[3] == doc_matters.xml.tag_associations[(m.captures[3])]["seg_lv4"]) { +              if (m.captures[3] in doc_matters.has.tag_associations) { +                if (m.captures[3] == doc_matters.has.tag_associations[(m.captures[3])]["seg_lv4"]) {                    _txt = _txt.replaceFirst(                      rgx.inline_link_hash,                      "┥$1┝┤" @@ -315,7 +315,7 @@ template SQLiteFormatAndLoadObject() {                      "┥$1┝┤"                        ~ doc_matters.conf_make_meta.conf.webserv_url_doc_root                        ~ "/" -                      ~ doc_matters.xml.tag_associations[(m.captures[3])]["seg_lv4"] +                      ~ doc_matters.has.tag_associations[(m.captures[3])]["seg_lv4"]                        ~ ".html"                        ~ "#" ~ "$3"                      ~ "├" @@ -1212,7 +1212,7 @@ template SQLiteInsertDocObjectsLoop() {      string[string] obj_txt;      string doc_text;      string[] _insert_doc_objects; -    foreach (part; doc_matters.xml.keys_seq.sql) { +    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); diff --git a/src/doc_reform/output/xmls.d b/src/doc_reform/output/xmls.d index f27b0f4..90f4e7d 100644 --- a/src/doc_reform/output/xmls.d +++ b/src/doc_reform/output/xmls.d @@ -372,10 +372,10 @@ template outputXHTMLs() {          if (_xml_type == "seg" || _xml_type == "epub") {            seg_lvs = (_xml_type == "epub") ? "seg_lv1_to_4" : "seg_lv4";            foreach (m; _txt.match(rgx.inline_link_hash)) { -            if (m.captures[3] in doc_matters.xml.tag_associations) { +            if (m.captures[3] in doc_matters.has.tag_associations) {                if (                  m.captures[3] -                == doc_matters.xml.tag_associations[(m.captures[3])][seg_lvs] +                == doc_matters.has.tag_associations[(m.captures[3])][seg_lvs]                ) {                  _txt = _txt.replaceFirst(                    rgx.inline_link_hash, @@ -385,7 +385,7 @@ template outputXHTMLs() {                  _txt = _txt.replaceFirst(                    rgx.inline_link_hash,                    "┥$1┝┤" -                  ~ doc_matters.xml.tag_associations[(m.captures[3])][seg_lvs] +                  ~ doc_matters.has.tag_associations[(m.captures[3])][seg_lvs]                    ~ _suffix ~ "#" ~ "$3"                    ~ "├"                  ); | 
