diff options
Diffstat (limited to 'src/doc_reform/meta')
| -rw-r--r-- | src/doc_reform/meta/conf_make_meta_toml.d | 81 | ||||
| -rw-r--r-- | src/doc_reform/meta/metadoc.d | 18 | ||||
| -rw-r--r-- | src/doc_reform/meta/metadoc_summary.d | 113 | ||||
| -rw-r--r-- | src/doc_reform/meta/rgx.d | 2 | 
4 files changed, 2 insertions, 212 deletions
| diff --git a/src/doc_reform/meta/conf_make_meta_toml.d b/src/doc_reform/meta/conf_make_meta_toml.d deleted file mode 100644 index 0df63d3..0000000 --- a/src/doc_reform/meta/conf_make_meta_toml.d +++ /dev/null @@ -1,81 +0,0 @@ -/++ -  extract native/orig header return associative array<BR> - -  the header is passed as text (lopped off top of a sisu markup file until the -  required first heading ^A~), determine whether is a yaml header or toml one -  with a regex check if whether it contains the "yaml header" required tag/field -  title: then process accordingly as a "yaml header" or "toml header" -  converting the metadata and make instructions to a common json format used by -  program internally. Moved to associative array. -+/ -module doc_reform.meta.conf_make_meta_toml; -static template configParseTOMLreturnJSON() { -  import -    toml, -    toml.json; -  auto configParseTOMLreturnJSON(T)( -    T _text -  ){ -    TOMLDocument _doc; -    _doc = parseTOML(cast(string)(_text.content)); -    auto _doc_json = _doc.toJSON; -    return _doc_json; -  } -} -static template configParseTOMLreturnDocReformStruct() { -  import -    toml, -    toml.json; -  import -    doc_reform.meta.conf_make_meta_structs, -    doc_reform.meta.conf_make_meta_json; -  mixin contentJSONtoDocReformStruct; -  auto configParseTOMLreturnDocReformStruct(T,CCm,M)( -    T       _document_struct, -    CCm     _make_and_meta_struct, -    M       _manifest -  ){ -    TOMLDocument _doc = parseTOML(cast(string)(_document_struct.content)); -    auto _doc_json = _doc.toJSON; -    _make_and_meta_struct -      = contentJSONtoDocReformStruct!()(_make_and_meta_struct, _doc_json, _manifest, _document_struct.filename); // struct from json -    return _make_and_meta_struct; -  } -} -static template docHeaderMakeAndMetaTupTomlExtractAndConvertToStruct() { -  import -    std.exception, -    std.regex, -    std.stdio, -    std.traits, -    std.typecons, -    std.utf, -    std.conv : to; -  import -    toml, -    toml.json; -  import -    doc_reform.meta.conf_make_meta_structs, -    doc_reform.meta.conf_make_meta_json, -    doc_reform.meta.rgx; -  mixin DocReformRgxInit; -  mixin contentJSONtoDocReformStruct; -  static auto rgx = Rgx(); -  auto docHeaderMakeAndMetaTupTomlExtractAndConvertToStruct(CCm,Src,M)( -    Src     header_src, -    CCm     _make_and_meta_struct, -    M       _manifest, -  ) { -    TOMLDocument _doc_toml; -    if (header_src.match(rgx.toml_header_meta_title)) { -      debug (json) { -        writeln(">>> document header is toml, convert to JSON"); -      } -      _doc_toml = parseTOML(cast(string)(header_src)); -    } -    auto _doc_json = _doc_toml.toJSON; -    auto _header_and_make_and_meta_struct -      = contentJSONtoDocReformStruct!()(_make_and_meta_struct, _doc_json, _manifest, "header"); -    return _header_and_make_and_meta_struct; -  } -} diff --git a/src/doc_reform/meta/metadoc.d b/src/doc_reform/meta/metadoc.d index a4ff476..115ab9f 100644 --- a/src/doc_reform/meta/metadoc.d +++ b/src/doc_reform/meta/metadoc.d @@ -42,9 +42,6 @@ template DocReformAbstraction() {        if (_config_document_struct.filetype == "yaml") {          import doc_reform.meta.conf_make_meta_yaml;          _make_and_meta_struct = _config_document_struct.configParseYAMLreturnDocReformStruct!()(_make_and_meta_struct, _manifest); -      } else if (_config_document_struct.filetype == "toml") { -        import doc_reform.meta.conf_make_meta_toml; -        _make_and_meta_struct = _config_document_struct.configParseTOMLreturnDocReformStruct!()(_make_and_meta_struct, _manifest);        }      }      { /+ local site config +/ @@ -52,9 +49,6 @@ template DocReformAbstraction() {        if (_config_local_site_struct.filetype == "yaml") {          import doc_reform.meta.conf_make_meta_yaml;          _make_and_meta_struct = _config_local_site_struct.configParseYAMLreturnDocReformStruct!()(_make_and_meta_struct, _manifest); -      } else if (_config_local_site_struct.filetype == "toml") { -        import doc_reform.meta.conf_make_meta_toml; -        _make_and_meta_struct = _config_local_site_struct.configParseTOMLreturnDocReformStruct!()(_make_and_meta_struct, _manifest);        }      }      /+ ↓ read file (filename with path) +/ @@ -83,17 +77,9 @@ template DocReformAbstraction() {      if ((_opt_action.debug_do)      || (_opt_action.very_verbose)      ) { -      writeln("step2 commence → (read document header - yaml or toml, return struct)"); +      writeln("step2 commence → (read document header (yaml) return struct)");      } -    if (_header_body_insertfilelist_imagelist[headBody.header_type] == "toml") { -      import doc_reform.meta.conf_make_meta_toml; -      _make_and_meta_struct = -        docHeaderMakeAndMetaTupTomlExtractAndConvertToStruct!()( -          _header_body_insertfilelist_imagelist[headBody.header], -          _make_and_meta_struct, -          _manifest, -        ); -    } else if (_header_body_insertfilelist_imagelist[headBody.header_type] == "yaml") { +    if (_header_body_insertfilelist_imagelist[headBody.header_type] == "yaml") {        import doc_reform.meta.conf_make_meta_yaml;        _make_and_meta_struct =          docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct!()( diff --git a/src/doc_reform/meta/metadoc_summary.d b/src/doc_reform/meta/metadoc_summary.d deleted file mode 100644 index 7395e81..0000000 --- a/src/doc_reform/meta/metadoc_summary.d +++ /dev/null @@ -1,113 +0,0 @@ -module doc_reform.meta.metadoc_summary; -template DocReformMetaDocSummary() { -  void DocReformMetaDocSummary(S,T)( -    const S  doc_abstraction, -          T  doc_matters, -  ) { -    import -      doc_reform.meta.defaults, -      doc_reform.meta.rgx; -    import -      std.array, -      std.exception, -      std.regex, -      std.stdio, -      std.string, -      std.traits, -      std.typecons, -      std.uni, -      std.utf, -      std.conv : to; -    mixin InternalMarkup; -    auto markup = InlineMarkup(); -    if (doc_matters.opt.action.verbose -      || doc_matters.opt.action.show_summary -    ) { -      string[string] check = [ -        "last_object_number" : "NA [debug \"checkdoc\" not run]", -        "last_object_number_body"  : "0", -        "last_object_number_book_index" : "0", -      ]; -      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)) { -              if (k == "body") { -                check["last_object_number_body"] = obj.metainfo.object_number; -              } -              if (!(obj.metainfo.object_number.empty)) { -                check["last_object_number"] = obj.metainfo.object_number; -              } -            } -            if (k == "bookindex") { -              if (obj.metainfo.object_number_type == 2) { -                check["last_object_number_book_index"] = obj.metainfo.object_number_book_index; -              } -            } -          } -        } -      } -      auto min_repeat_number = 66; -      auto char_repeat_number = (doc_matters.conf_make_meta.meta.title_full.length -        + doc_matters.conf_make_meta.meta.creator_author.length + 4); -      char_repeat_number = (char_repeat_number > min_repeat_number) -      ? 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%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), -        "- toc arr 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:", -        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, -        "- 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)) -        : 0, -        "- 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)) -        : 0, -        "* last obj on.#:", -        to!int(check["last_object_number"]), -        "number of segments:", -        (doc_matters.has.segnames_lv4.length > 1) -        ? (to!int(doc_matters.has.segnames_lv4.length)) -        : 0, -        markup.repeat_character_by_number_provided("-", min_repeat_number), -      ); -    } -  } -} diff --git a/src/doc_reform/meta/rgx.d b/src/doc_reform/meta/rgx.d index 0168a08..11f4aa5 100644 --- a/src/doc_reform/meta/rgx.d +++ b/src/doc_reform/meta/rgx.d @@ -49,9 +49,7 @@ static template DocReformRgxInit() {      static variable_doc_title                             = ctRegex!(`@title`);      static variable_doc_author                            = ctRegex!(`@author|@creator`);      static raw_author_munge                               = ctRegex!(`(?P<last>\S.+?),\s+(?P<first>.+)`,"i"); -    static toml_header_meta_title                         = ctRegex!(`^\s*(?:title\s*=\s*"|\[title\])`, "m");      static yaml_header_meta_title                         = ctRegex!(`^\s*(?:title\s*:\s*(?:"?\w|$))`, "m"); -    static toml_config                                    = ctRegex!(`^\s*(?:[a-z]+\s*=\s*"|\[\w+?\])`, "m");      static yaml_config                                    = ctRegex!(`^[a-z]+\s*:\s*(?:"?\w|$)`, "m");      /+ heading & paragraph operators +/      static heading_a                                      = ctRegex!(`^:?[A][~] `, "m"); | 
