aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sdp/ao_conf_make_meta.d
blob: 4056914b2c89a46e954b5d1f0b85276c1acb7a41 (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
/++
  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 native header or sdlang one
  with a regex check if whether it contains the "native header" required tag/field
  @title: then process accordingly as a "native header" or "sdlang header"
  converting the metadata and make instructions to a common json format used by
  program internally. Moved to associative array.
+/
template SiSUheaderExtractHub() {
  private import
    std.regex;
  private import
    ao_rgx;
  struct HeaderDocMetadataAndMake {
    mixin SiSUheaderExtractNative;
    mixin SiSUheaderExtractSDLang;
    auto rgx = Rgx();
    private auto headerContentAA(char[] header_src, string[string][string] conf_doc_make_aa) {
      auto head_native = HeaderDocMetadataAndMakeNativeToAA();
      auto head_sdlang = HeaderExtractSDL();
      auto header_make_and_meta_tuple = (match(header_src, rgx.native_header_meta_title))
      ? (head_native.headerNativeToAA(header_src))
      : (head_sdlang.headerSDLangToAA(header_src, conf_doc_make_aa));
      static assert(!isTypeTuple!(header_make_and_meta_tuple));
      static assert(header_make_and_meta_tuple.length==2);
      return header_make_and_meta_tuple;
    }
  }
}