diff options
author | Ralph Amissah <ralph@amissah.com> | 2017-07-13 07:44:03 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:14 -0400 |
commit | 22cea68385b57a1593f5751e49cfdd41d8067997 (patch) | |
tree | 9e61339eb58679977c24962b1cfd2f50aa7f2998 /src/sdp/meta/conf_make_meta.d | |
parent | sdl extract and composite conf (make) (diff) |
0.18.0 rename meta from ao (considered adr)
Diffstat (limited to 'src/sdp/meta/conf_make_meta.d')
-rw-r--r-- | src/sdp/meta/conf_make_meta.d | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/sdp/meta/conf_make_meta.d b/src/sdp/meta/conf_make_meta.d new file mode 100644 index 0000000..5beeae2 --- /dev/null +++ b/src/sdp/meta/conf_make_meta.d @@ -0,0 +1,49 @@ +/++ + 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. ++/ +module sdp.meta.conf_make_meta; +template docHeaderMakeAndMetaTupExtractAndConvertToAA() { + import + std.exception, + std.regex, + std.stdio, + std.traits, + std.typecons, + std.utf, + std.conv : to; + import sdlang; + import + sdp.meta.conf_make_meta_native, + sdp.meta.conf_make_meta_sdlang, + sdp.meta.rgx; + mixin SiSUrgxInit; + mixin SiSUheaderExtractNative; + mixin SiSUextractSDLang; + auto rgx = Rgx(); + auto docHeaderMakeAndMetaTupExtractAndConvertToAA(DocMake, Src)( + DocMake conf_doc_make_aa, + Src header_src, + ) { + debug(asserts){ + static assert(is(typeof(header_src) == char[])); + static assert(is(typeof(conf_doc_make_aa) == string[string][string])); + } + auto head_native = HeaderDocMetadataAndMakeNativeToAA(); + auto header_sdlang_tag = (!(header_src.match(rgx.native_header_meta_title))) + ? extractSDL().docHeaderSDLtagGet(header_src) // sdlang.ast.Tag + : null; + auto header_make_and_meta_tuple = (header_src.match(rgx.native_header_meta_title)) + ? (head_native.headerNativeToAA(header_src)) + : (extractSDL().docHeaderSDLtoAA(conf_doc_make_aa, header_sdlang_tag)); + static assert(!isTypeTuple!(header_make_and_meta_tuple)); + static assert(header_make_and_meta_tuple.length==2); + return header_make_and_meta_tuple; + } +} |