aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc_reform/meta/metadochead.d
blob: 42f4845b421eb322d870319996cd195bb31ff416 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
module doc_reform.meta.metadochead;
template DocReformHarvestGetFromHead() { // TODO
  import
    std.datetime,
    std.getopt,
    std.file,
    std.path,
    std.process;
  import
    doc_reform.meta,
    doc_reform.meta.metadoc_summary,
    doc_reform.meta.metadoc_from_src,
    doc_reform.meta.conf_make_meta_structs,
    doc_reform.meta.conf_make_meta_toml,
    doc_reform.meta.conf_make_meta_json,
    doc_reform.meta.defaults,
    doc_reform.meta.doc_debugs,
    doc_reform.meta.rgx,
    doc_reform.source.paths_source,
    doc_reform.source.read_config_files,
    doc_reform.source.read_source_files,
    doc_reform.output.hub;
  mixin DocReformRgxInit;
  mixin contentJSONtoDocReformStruct;
  mixin DocReformBiblio;
  mixin DocReformRgxInitFlags;
  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, images }
  static auto rgx = Rgx();
  auto DocReformHarvestGetFromHead(E,O,M)( // TODO
    E _env,
    O _opt_action,
    M _manifest
  ){
    auto _config_document_struct = readConfigDoc!()(_manifest, _env);    // document config file
    auto _config_local_site_struct = readConfigSite!()(_manifest, _env); // local site config
    ConfCompositePlus _make_and_meta_struct;
    _make_and_meta_struct = configParseTOMLreturnDocReformStruct!()(_make_and_meta_struct, _config_document_struct);
    _make_and_meta_struct = configParseTOMLreturnDocReformStruct!()(_make_and_meta_struct, _config_local_site_struct);
    /+ ↓ read file (filename with path) +/
    /+ ↓ file tuple of header and content +/
    if ((_opt_action.debug_do)
    || (_opt_action.very_verbose)
    ) {
      writeln("step1 commence → (get document header & body & insert file list & if needed image list)"
      );
    }
    auto _header_body_insertfilelist_imagelist
      = DocReformRawMarkupContent!()(_opt_action, _manifest.src.path_and_fn);
    static assert(!isTypeTuple!(_header_body_insertfilelist_imagelist));
    static assert(_header_body_insertfilelist_imagelist.length==4);
    if ((_opt_action.debug_do)
    || (_opt_action.very_verbose)
    ) {
      writeln("- step1 complete");
    }
    debug(header_and_body) {
      writeln(header);
      writeln(_header_body_insertfilelist_imagelist.length);
      writeln(_header_body_insertfilelist_imagelist.length[headBody.body_content][0]);
    }
    /+ ↓ split header into make and meta +/
    if ((_opt_action.debug_do)
    || (_opt_action.very_verbose)
    ) {
      writeln("step2 commence → (read document header - toml, return struct)");
    }
    _make_and_meta_struct =
    docHeaderMakeAndMetaTupTomlExtractAndConvertToStruct!()(
      _make_and_meta_struct,
      _header_body_insertfilelist_imagelist[headBody.header]
    );
    if ((_opt_action.debug_do)
    || (_opt_action.very_verbose)
    ) {
      writeln("- step2 complete");
    }
    
    auto t = tuple(doc_matters_shared, doc_matters_abridged_collected);
    static assert(t.length==2);
    return t;
  }
}