diff options
| -rw-r--r-- | .gitignore | 7 | ||||
| -rw-r--r-- | README | 34 | ||||
| -rw-r--r-- | dub.sdl | 2 | ||||
| -rw-r--r-- | dub.selections.json | 5 | ||||
| -rw-r--r-- | meson.build | 3 | ||||
| -rw-r--r-- | org/default_regex.org | 2 | ||||
| -rw-r--r-- | org/doc_reform.org | 26 | ||||
| -rw-r--r-- | org/dr_build_scaffold.org | 29 | ||||
| -rw-r--r-- | org/dr_info.org | 42 | ||||
| -rw-r--r-- | org/meta_conf_make_meta.org | 102 | ||||
| -rw-r--r-- | org/source_files_read.org | 135 | ||||
| -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 | ||||
| -rw-r--r-- | src/doc_reform/source/read_config_files.d | 123 | ||||
| -rw-r--r-- | src/doc_reform/source/read_source_files.d | 4 | ||||
| -rw-r--r-- | subprojects/README | 8 | ||||
| -rw-r--r-- | views/version.txt | 2 | 
19 files changed, 51 insertions, 687 deletions
| @@ -19,19 +19,14 @@  !src  !src/doc_reform  !src/doc_reform/* -!src_toml -!src_toml/doc_reform -!src_toml/doc_reform/*  !src_yaml  !src_yaml/doc_reform  !src_yaml/doc_reform/*  !data  !data/*  !data/src/** -!data/src_toml/**  !data/src_yaml/**  !data/pod/** -!data/pod_toml/**  !data/pod_yaml/**  !*.sst  !*.ssm @@ -43,8 +38,6 @@  !pod.manifest  !sisu_document_make  !config_local_site -!sisu_document_make.toml -!config_local_site.toml  !sisudoc  !views  !docs/*.html @@ -1,21 +1,21 @@ -- Name: Doc Reform -  - Description: documents, structuring, processing, publishing, search -    - static content generator +project_name:  Doc Reform +  description: [ +      "documents, structuring, processing, publishing", +      search, +      object numbering, +      static content generator, +      sisu markup +    ] -  - Author: Ralph Amissah -    [ralph.amissah@gmail.com] +    author: +      name:    Ralph Amissah +      email:   ralph.amissah@gmail.com -  - Copyright: (C) 2015 - 2019 Ralph Amissah, All Rights -    Reserved. +    copyright: "(C) 2015 - 2019 Ralph Amissah, All Rights Reserved." -  - Doc Reform (related to SiSU) uses standard: -    - docReform markup syntax -      - standard SiSU markup syntax with modified headers and minor modifications -    - docReform object numbering -      - standard SiSU object citation numbering & system +    license:   "AGPL 3 or later" -  - License: AGPL 3 or later - -  - Hompages: -    [http://www.doc_reform.org] -    [http://www.sisudoc.org] +    hompage: [ +        "http://www.doc_reform.org", +        "http://www.sisudoc.org" +      ] @@ -13,8 +13,6 @@ platforms           "posix"  dependency          "d2sqlite3"      version="~>0.18.3"      # https://code.dlang.org/packages/d2sqlite3     http://biozic.github.io/d2sqlite3/d2sqlite3.html    subconfiguration  "d2sqlite3"      "all-included"  dependency          "imageformats"   version="~>7.0.1"       # https://code.dlang.org/packages/imageformats  https://github.com/lgvz/imageformats -dependency          "toml"           version="~>1.0.0-rc.3"  # https://code.dlang.org/packages/toml          https://github.com/toml-lang/toml/wiki -dependency          "toml:json"      version="~>1.0.0-rc.3"  dependency          "dyaml"          version="~>0.8.0"  dependency          "tinyendian"     version="~>0.2.0" // for dyaml  configuration "default" { diff --git a/dub.selections.json b/dub.selections.json index 64508bf..3d16700 100644 --- a/dub.selections.json +++ b/dub.selections.json @@ -4,11 +4,6 @@  		"d2sqlite3": "0.18.3",  		"dyaml": "0.8.0",  		"imageformats": "7.0.1", -		"libinputvisitor": "1.2.2", -		"sdlang-d": "0.10.2", -		"taggedalgebraic": "0.10.9",  		"tinyendian": "0.2.0", -		"toml": "1.0.0-rc.3", -		"unit-threaded": "0.6.36"  	}  } diff --git a/meson.build b/meson.build index 21b34e1..c2a3859 100644 --- a/meson.build +++ b/meson.build @@ -8,7 +8,6 @@ doc_reform_sources = [    'src/doc_reform/conf/compile_time_info.d',    'src/doc_reform/meta/conf_make_meta_json.d',    'src/doc_reform/meta/conf_make_meta_structs.d', -  'src/doc_reform/meta/conf_make_meta_toml.d',    'src/doc_reform/meta/conf_make_meta_yaml.d',    'src/doc_reform/meta/defaults.d',    'src/doc_reform/meta/doc_debugs.d', @@ -46,7 +45,6 @@ sources_dir = include_directories('src/')  # Dependencies  dep_d2sqlite3    = dependency('d2sqlite3',      version: '>= 0.16.2', fallback: ['d2sqlite3',      'd2sqlite3_dep'])  dep_imageformats = dependency('imageformats-d', version: '>= 7.0.0',  fallback: ['imageformats-d', 'imageformats_dep']) -dep_toml         = dependency('toml-d',         version: '>= 1.0.0',  fallback: ['toml-d',         'toml_dep'])  # executable  doc_reform_exe = executable('rad',    [doc_reform_sources], @@ -55,7 +53,6 @@ doc_reform_exe = executable('rad',    dependencies : [      dep_d2sqlite3,      dep_imageformats, -    dep_toml    ],    install : true  ) diff --git a/org/default_regex.org b/org/default_regex.org index 63859f7..08af2ce 100644 --- a/org/default_regex.org +++ b/org/default_regex.org @@ -113,9 +113,7 @@ static make_simple_substitutions_d                    = ctRegex!(`(?P<substituti  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");  #+END_SRC diff --git a/org/doc_reform.org b/org/doc_reform.org index 1d853c1..abba098 100644 --- a/org/doc_reform.org +++ b/org/doc_reform.org @@ -28,7 +28,7 @@ struct Version {    int minor;    int patch;  } -enum _ver = Version(0, 8, 0); +enum _ver = Version(0, 8, 1);  #+END_SRC  ** compilation restrictions (supported compilers) @@ -880,7 +880,7 @@ foreach(arg; args[1..$]) {  *** config files load & read -#+NAME: doc_reform_conf_files_in_yaml_or_toml +#+NAME: doc_reform_conf_files_in_yaml  #+BEGIN_SRC d  ConfCompositePlus _make_and_meta_struct;  { /+ document config file +/ @@ -888,9 +888,6 @@ ConfCompositePlus _make_and_meta_struct;    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 +/ @@ -898,9 +895,6 @@ ConfCompositePlus _make_and_meta_struct;    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);    }  }  #+END_SRC @@ -1120,7 +1114,7 @@ template DocReformAbstraction() {      O _opt_action,      M _manifest    ){ -    <<doc_reform_conf_files_in_yaml_or_toml>> +    <<doc_reform_conf_files_in_yaml>>      <<doc_reform_each_file_do_read_and_split_dr_markup_file_content_into_header_and_body>>      <<doc_reform_each_file_do_split_dr_markup_file_header_into_make_and_meta_structs>>      <<doc_reform_each_file_do_document_abstraction>> @@ -1185,7 +1179,7 @@ debug(header_and_body) {  }  #+END_SRC -*** 2. _document metadata_ & _make instructions_ (struct from toml) +*** 2. _document metadata_ & _make instructions_ (struct from yaml)  - [[./meta_conf_make_meta.org][meta_conf_make_meta]] return tuple: document metadata; make instructions  - read _document header_, split into: @@ -1204,17 +1198,9 @@ debug(header_and_body) {  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/org/dr_build_scaffold.org b/org/dr_build_scaffold.org index 815be88..ca6b224 100644 --- a/org/dr_build_scaffold.org +++ b/org/dr_build_scaffold.org @@ -854,8 +854,6 @@ platforms           "posix"  dependency          "d2sqlite3"      version="~>0.18.3"      # https://code.dlang.org/packages/d2sqlite3     http://biozic.github.io/d2sqlite3/d2sqlite3.html    subconfiguration  "d2sqlite3"      "all-included"  dependency          "imageformats"   version="~>7.0.1"       # https://code.dlang.org/packages/imageformats  https://github.com/lgvz/imageformats -dependency          "toml"           version="~>1.0.0-rc.3"  # https://code.dlang.org/packages/toml          https://github.com/toml-lang/toml/wiki -dependency          "toml:json"      version="~>1.0.0-rc.3"  dependency          "dyaml"          version="~>0.8.0"  dependency          "tinyendian"     version="~>0.2.0" // for dyaml  #+END_SRC @@ -1010,7 +1008,6 @@ doc_reform_sources = [    'src/doc_reform/conf/compile_time_info.d',    'src/doc_reform/meta/conf_make_meta_json.d',    'src/doc_reform/meta/conf_make_meta_structs.d', -  'src/doc_reform/meta/conf_make_meta_toml.d',    'src/doc_reform/meta/conf_make_meta_yaml.d',    'src/doc_reform/meta/defaults.d',    'src/doc_reform/meta/doc_debugs.d', @@ -1048,7 +1045,6 @@ sources_dir = include_directories('src/')  # Dependencies  dep_d2sqlite3    = dependency('d2sqlite3',      version: '>= 0.16.2', fallback: ['d2sqlite3',      'd2sqlite3_dep'])  dep_imageformats = dependency('imageformats-d', version: '>= 7.0.0',  fallback: ['imageformats-d', 'imageformats_dep']) -dep_toml         = dependency('toml-d',         version: '>= 1.0.0',  fallback: ['toml-d',         'toml_dep'])  # executable  doc_reform_exe = executable('rad',    [doc_reform_sources], @@ -1057,7 +1053,6 @@ doc_reform_exe = executable('rad',    dependencies : [      dep_d2sqlite3,      dep_imageformats, -    dep_toml    ],    install : true  ) @@ -1081,14 +1076,6 @@ imageformats    - https://github.com/lgvz/imageformats  - mathias    - https://github.com/ximion/imageformats.git - -toml -- dub -  - https://code.dlang.org/packages/toml -- upstream -  - https://github.com/Kripth/toml -- mathias -  - https://github.com/ximion/toml.git  #+END_SRC  *** d2sqlite3 @@ -1109,15 +1096,6 @@ url       = https://github.com/ximion/imageformats.git  revision  = head  #+END_SRC -*** toml-d - -#+BEGIN_SRC sh :tangle ../subprojects/toml-d.wrap -[wrap-git] -directory = toml-d -url       = https://github.com/ximion/toml.git -revision  = head -#+END_SRC -  * .gitignore                                                      :gitignore:  #+BEGIN_SRC sh :tangle ../.gitignore @@ -1142,19 +1120,14 @@ revision  = head  !src  !src/doc_reform  !src/doc_reform/* -!src_toml -!src_toml/doc_reform -!src_toml/doc_reform/*  !src_yaml  !src_yaml/doc_reform  !src_yaml/doc_reform/*  !data  !data/*  !data/src/** -!data/src_toml/**  !data/src_yaml/**  !data/pod/** -!data/pod_toml/**  !data/pod_yaml/**  !*.sst  !*.ssm @@ -1166,8 +1139,6 @@ revision  = head  !pod.manifest  !sisu_document_make  !config_local_site -!sisu_document_make.toml -!config_local_site.toml  !sisudoc  !views  !docs/*.html diff --git a/org/dr_info.org b/org/dr_info.org index 10e0b25..dd5fa12 100644 --- a/org/dr_info.org +++ b/org/dr_info.org @@ -18,27 +18,27 @@  * README  #+BEGIN_SRC text  :tangle "../README" -- Name: Doc Reform -  - Description: documents, structuring, processing, publishing, search -    - static content generator - -  - Author: Ralph Amissah -    [ralph.amissah@gmail.com] - -  - Copyright: (C) 2015 - 2019 Ralph Amissah, All Rights -    Reserved. - -  - Doc Reform (related to SiSU) uses standard: -    - docReform markup syntax -      - standard SiSU markup syntax with modified headers and minor modifications -    - docReform object numbering -      - standard SiSU object citation numbering & system - -  - License: AGPL 3 or later - -  - Hompages: -    [http://www.doc_reform.org] -    [http://www.sisudoc.org] +project_name:  Doc Reform +  description: [ +      "documents, structuring, processing, publishing", +      search, +      object numbering, +      static content generator, +      sisu markup +    ] + +    author: +      name:    Ralph Amissah +      email:   ralph.amissah@gmail.com + +    copyright: "(C) 2015 - 2019 Ralph Amissah, All Rights Reserved." + +    license:   "AGPL 3 or later" + +    hompage: [ +        "http://www.doc_reform.org", +        "http://www.sisudoc.org" +      ]  #+END_SRC  * COPYRIGHT & LICENSE diff --git a/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org index a8a5876..6912a3b 100644 --- a/org/meta_conf_make_meta.org +++ b/org/meta_conf_make_meta.org @@ -1799,37 +1799,7 @@ if ("rights" in _json.object) {  }  #+END_SRC -* 2. TOML returns DocReformStruct (via JSON)   :module:conf_make_meta:struct: -** 0. parse TOML config return JSON - -#+BEGIN_SRC d :tangle "../src/doc_reform/meta/conf_make_meta_toml.d" -/++ -  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; -  } -} -#+END_SRC - -** 1. parse TOML config to JSON return DocReformStruct +** 1. parse Yaml config return DocReformStruct  #+BEGIN_SRC d :tangle "../src/doc_reform/meta/conf_make_meta_yaml.d"  static template configParseYAMLreturnDocReformStruct() { @@ -1851,73 +1821,6 @@ static template configParseYAMLreturnDocReformStruct() {  }  #+END_SRC -** 1. parse TOML config to JSON return DocReformStruct - -#+BEGIN_SRC d :tangle "../src/doc_reform/meta/conf_make_meta_toml.d" -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; -  } -} -#+END_SRC - -** 2. parse TOML header to JSON then Struct - -#+BEGIN_SRC d :tangle "../src/doc_reform/meta/conf_make_meta_toml.d" -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; -  } -} -#+END_SRC -  ** 2. parse YAML header to +(JSON then)+ Struct  #+BEGIN_SRC d :tangle "../src/doc_reform/meta/conf_make_meta_yaml.d" @@ -1965,9 +1868,8 @@ static template docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct() {  #+BEGIN_SRC d  /+    /+ -    unify internal representation of header info for yaml & toml document headers +    unify internal representation of header info for yaml document headers      represent either using struct, hashes or possibly json -    doc_reform internal representation should be identical for yaml & toml variants    +/  header.    ├── make                         // make instructions diff --git a/org/source_files_read.org b/org/source_files_read.org index 6106930..ecf6cc7 100644 --- a/org/source_files_read.org +++ b/org/source_files_read.org @@ -38,11 +38,10 @@ import  +/  module doc_reform.source.read_config_files;  <<meta_config_file_in>> -<<meta_config_file_toml>>  <<meta_config_file_hub>>  #+END_SRC -*** 0. read config files (config_local_site & dr_document_make) (yaml or toml) +*** 0. read config files (config_local_site & dr_document_make) (yaml)  **** 1. site configuration  #+name: meta_config_file_hub @@ -88,8 +87,6 @@ static template readConfigSite() {          string _ft = "";          if (content.match(rgx.yaml_config)) {            _ft = "yaml"; -        } else if (content.match(rgx.toml_config)) { -          _ft = "toml";          }          return _ft;        } @@ -150,8 +147,6 @@ static template readConfigDoc() {          string _ft = "";          if (content.match(rgx.yaml_config)) {            _ft = "yaml"; -        } else if (content.match(rgx.toml_config)) { -          _ft = "toml";          }          return _ft;        } @@ -161,82 +156,6 @@ static template readConfigDoc() {  }  #+END_SRC -** A. TOML                                                            :toml: -*** 1. TOML read config files (config_local_site & dr_document_make) :file:config: -**** TOML config_local_site - -#+name: meta_config_file_in -#+BEGIN_SRC d -static template configReadInSiteSTR() { -  <<imports_std>> -  final string configReadInSiteSTR(M,E)(M manifest, E env) { -    auto conf_file_details = ConfigFilePaths!()(manifest, env); -    string conf_toml = conf_file_details.config_filename_site; -    string[] possible_config_path_locations = conf_file_details.possible_config_path_locations.config_local_site; -    string config_file_str; -    debug(io) { -      writeln("WARNING (io debug) in config filename: ", conf_toml); -      writeln("WARNING (io debug) in config possible path locations: ", possible_config_path_locations); -    } -    foreach(pth; possible_config_path_locations) { -      auto conf_file = ((chainPath(pth.to!string, conf_toml)).asNormalizedPath).array; -      if (config_file_str.length > 0) { -        break; -      } -      try { -        if (exists(conf_file)) { -          debug(io) { -            writeln("WARNING (io debug) in config file found: ", conf_file); -          } -          config_file_str = conf_file.readText; -          break; -        } -      } catch (ErrnoException ex) { -      } catch (FileException ex) { -      } -    } -    return config_file_str; -  } -} -#+END_SRC - -**** TOML dr_document_make - -#+name: meta_config_file_in -#+BEGIN_SRC d -static template configReadInDocSTR() { -  <<imports_std>> -  final string configReadInDocSTR(M,E)(M manifest, E env) { -    auto conf_file_details = ConfigFilePaths!()(manifest, env); -    string conf_toml = conf_file_details.config_filename_document; -    string[] possible_config_path_locations = conf_file_details.possible_config_path_locations.dr_document_make; -    string config_file_str; -    debug(io) { -      writeln("WARNING (io debug) in config filename: ", conf_toml); -      writeln("WARNING (io debug) in config possible path locations: ", possible_config_path_locations); -    } -    foreach(pth; possible_config_path_locations) { -      auto conf_file = ((chainPath(pth.to!string, conf_toml)).asNormalizedPath).array; -      if (config_file_str.length > 0) { -        break; -      } -      try { -        if (exists(conf_file)) { -          debug(io) { -            writeln("WARNING (io debug) in config file found: ", conf_file); -          } -          config_file_str = conf_file.readText; -          break; -        } -      } catch (ErrnoException ex) { -      } catch (FileException ex) { -      } -    } -    return config_file_str; -  } -} -#+END_SRC -  *** 2. YAML config files get  #+name: meta_config_file_yaml @@ -285,54 +204,6 @@ static template configReadDocYAML() {  }  #+END_SRC -*** 2. TOML config files get - -#+name: meta_config_file_toml -#+BEGIN_SRC d -static template configTOML() { -  import toml; // -  <<imports_std>> -  TOMLDocument configTOML(string configuration, string conf_toml_filename) { -    TOMLDocument _toml_conf; -    try { -      _toml_conf = parseTOML(configuration); // parseTOML(cast(string)(configuration)); -    } catch(ErrnoException e) { -      stderr.writeln("Toml problem with content for ", conf_toml_filename); -      stderr.writeln(e.msg); -    } -    return _toml_conf; -  } -} -#+END_SRC - -*** 3. TOML config (config_local_site & dr_document_make) :file:config:hub: - -#+name: meta_config_file_hub -#+BEGIN_SRC d -static template configReadSiteTOML() { -  <<imports_std>> -  import toml; -  final TOMLDocument configReadSiteTOML(M,E)(M _manifest, E _env) { -    string _configuration = configReadInSiteSTR!()(_manifest, _env); -    auto _conf_file_details = ConfigFilePaths!()(_manifest, _env); -    string _conf_toml = _conf_file_details.config_filename_site; -    TOMLDocument _toml_conf = configTOML!()(_configuration, _conf_toml); -    return _toml_conf; -  } -} -static template configReadDocTOML() { -  <<imports_std>> -  import toml; -  final TOMLDocument configReadDocTOML(M,E)(M _manifest, E _env) { -    string _configuration = configReadInDocSTR!()(_manifest, _env); -    auto _conf_file_details = ConfigFilePaths!()(_manifest, _env); -    string _conf_toml = _conf_file_details.config_filename_document; -    TOMLDocument _toml_conf = configTOML!()(_configuration, _conf_toml); -    return _toml_conf; -  } -} -#+END_SRC -  * B. get _markup source_, read file                       :module:source_files:  ** 0. module template (includes tuple) @@ -397,8 +268,6 @@ static template DocReformRawMarkupContent() {        string header_type = "";        if (header_raw.match(rgx.yaml_config)) {          header_type = "yaml"; -      } else if (header_raw.match(rgx.toml_config)) { -        header_type = "toml";        }        t = tuple(          header_raw, @@ -552,8 +421,6 @@ auto markupSourceHeaderContentRawLineTupleArray(in string source_txt_str) {    string header_type = "";    if (header.match(rgx.yaml_config)) {      header_type = "yaml"; -  } else if (header.match(rgx.toml_config)) { -    header_type = "toml";    }    auto t = tuple(      header, 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"); diff --git a/src/doc_reform/source/read_config_files.d b/src/doc_reform/source/read_config_files.d index 93f8a35..787f6e0 100644 --- a/src/doc_reform/source/read_config_files.d +++ b/src/doc_reform/source/read_config_files.d @@ -4,94 +4,7 @@    meta_config_files.d  +/  module doc_reform.source.read_config_files; -static template configReadInSiteSTR() { -  import -    doc_reform.meta, -    doc_reform.source.paths_source, -    std.file, -    std.path; -  final string configReadInSiteSTR(M,E)(M manifest, E env) { -    auto conf_file_details = ConfigFilePaths!()(manifest, env); -    string conf_toml = conf_file_details.config_filename_site; -    string[] possible_config_path_locations = conf_file_details.possible_config_path_locations.config_local_site; -    string config_file_str; -    debug(io) { -      writeln("WARNING (io debug) in config filename: ", conf_toml); -      writeln("WARNING (io debug) in config possible path locations: ", possible_config_path_locations); -    } -    foreach(pth; possible_config_path_locations) { -      auto conf_file = ((chainPath(pth.to!string, conf_toml)).asNormalizedPath).array; -      if (config_file_str.length > 0) { -        break; -      } -      try { -        if (exists(conf_file)) { -          debug(io) { -            writeln("WARNING (io debug) in config file found: ", conf_file); -          } -          config_file_str = conf_file.readText; -          break; -        } -      } catch (ErrnoException ex) { -      } catch (FileException ex) { -      } -    } -    return config_file_str; -  } -} -static template configReadInDocSTR() { -  import -    doc_reform.meta, -    doc_reform.source.paths_source, -    std.file, -    std.path; -  final string configReadInDocSTR(M,E)(M manifest, E env) { -    auto conf_file_details = ConfigFilePaths!()(manifest, env); -    string conf_toml = conf_file_details.config_filename_document; -    string[] possible_config_path_locations = conf_file_details.possible_config_path_locations.dr_document_make; -    string config_file_str; -    debug(io) { -      writeln("WARNING (io debug) in config filename: ", conf_toml); -      writeln("WARNING (io debug) in config possible path locations: ", possible_config_path_locations); -    } -    foreach(pth; possible_config_path_locations) { -      auto conf_file = ((chainPath(pth.to!string, conf_toml)).asNormalizedPath).array; -      if (config_file_str.length > 0) { -        break; -      } -      try { -        if (exists(conf_file)) { -          debug(io) { -            writeln("WARNING (io debug) in config file found: ", conf_file); -          } -          config_file_str = conf_file.readText; -          break; -        } -      } catch (ErrnoException ex) { -      } catch (FileException ex) { -      } -    } -    return config_file_str; -  } -} -static template configTOML() { -  import toml; // -  import -    doc_reform.meta, -    doc_reform.source.paths_source, -    std.file, -    std.path; -  TOMLDocument configTOML(string configuration, string conf_toml_filename) { -    TOMLDocument _toml_conf; -    try { -      _toml_conf = parseTOML(configuration); // parseTOML(cast(string)(configuration)); -    } catch(ErrnoException e) { -      stderr.writeln("Toml problem with content for ", conf_toml_filename); -      stderr.writeln(e.msg); -    } -    return _toml_conf; -  } -} +  static template readConfigSite() {    import      doc_reform.meta.rgx; @@ -137,8 +50,6 @@ static template readConfigSite() {          string _ft = "";          if (content.match(rgx.yaml_config)) {            _ft = "yaml"; -        } else if (content.match(rgx.toml_config)) { -          _ft = "toml";          }          return _ft;        } @@ -197,8 +108,6 @@ static template readConfigDoc() {          string _ft = "";          if (content.match(rgx.yaml_config)) {            _ft = "yaml"; -        } else if (content.match(rgx.toml_config)) { -          _ft = "toml";          }          return _ft;        } @@ -236,33 +145,3 @@ static template configReadDocYAML() {      return _yaml_conf;    }  } -static template configReadSiteTOML() { -  import -    doc_reform.meta, -    doc_reform.source.paths_source, -    std.file, -    std.path; -  import toml; -  final TOMLDocument configReadSiteTOML(M,E)(M _manifest, E _env) { -    string _configuration = configReadInSiteSTR!()(_manifest, _env); -    auto _conf_file_details = ConfigFilePaths!()(_manifest, _env); -    string _conf_toml = _conf_file_details.config_filename_site; -    TOMLDocument _toml_conf = configTOML!()(_configuration, _conf_toml); -    return _toml_conf; -  } -} -static template configReadDocTOML() { -  import -    doc_reform.meta, -    doc_reform.source.paths_source, -    std.file, -    std.path; -  import toml; -  final TOMLDocument configReadDocTOML(M,E)(M _manifest, E _env) { -    string _configuration = configReadInDocSTR!()(_manifest, _env); -    auto _conf_file_details = ConfigFilePaths!()(_manifest, _env); -    string _conf_toml = _conf_file_details.config_filename_document; -    TOMLDocument _toml_conf = configTOML!()(_configuration, _conf_toml); -    return _toml_conf; -  } -} diff --git a/src/doc_reform/source/read_source_files.d b/src/doc_reform/source/read_source_files.d index 753612e..05f6630 100644 --- a/src/doc_reform/source/read_source_files.d +++ b/src/doc_reform/source/read_source_files.d @@ -62,8 +62,6 @@ static template DocReformRawMarkupContent() {        string header_type = "";        if (header_raw.match(rgx.yaml_config)) {          header_type = "yaml"; -      } else if (header_raw.match(rgx.toml_config)) { -        header_type = "toml";        }        t = tuple(          header_raw, @@ -139,8 +137,6 @@ static template DocReformRawMarkupContent() {        string header_type = "";        if (header.match(rgx.yaml_config)) {          header_type = "yaml"; -      } else if (header.match(rgx.toml_config)) { -        header_type = "toml";        }        auto t = tuple(          header, diff --git a/subprojects/README b/subprojects/README index cf3a335..59f89e7 100644 --- a/subprojects/README +++ b/subprojects/README @@ -13,11 +13,3 @@ imageformats    - https://github.com/lgvz/imageformats  - mathias    - https://github.com/ximion/imageformats.git - -toml -- dub -  - https://code.dlang.org/packages/toml -- upstream -  - https://github.com/Kripth/toml -- mathias -  - https://github.com/ximion/toml.git diff --git a/views/version.txt b/views/version.txt index e998997..8046d12 100644 --- a/views/version.txt +++ b/views/version.txt @@ -4,7 +4,7 @@ struct Version {    int minor;    int patch;  } -enum _ver = Version(0, 8, 0); +enum _ver = Version(0, 8, 1);  version (Posix) {    version (DigitalMars) {    } else version (LDC) { | 
