diff options
author | Ralph Amissah <ralph@amissah.com> | 2017-01-29 11:57:41 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:14 -0400 |
commit | c8c141d8abf715c9a697d2e3dd949d4621cfea7b (patch) | |
tree | 7124b76ac74734dbe9265151a874822c70eef12f /src/sdp.d | |
parent | defaults org, reorganize (diff) |
0.12.1 abstraction template
Diffstat (limited to 'src/sdp.d')
-rwxr-xr-x | src/sdp.d | 93 |
1 files changed, 21 insertions, 72 deletions
@@ -2,9 +2,11 @@ /+ sdp +/ -/+ sdp: sisu document parser, see http://sisudoc.org +/ import compile_time_info, + abstraction; +/+ sdp: sisu document parser, see http://sisudoc.org +/ +import ao_abstract_doc_source, ao_conf_make_meta, ao_conf_make_meta_native, @@ -47,7 +49,6 @@ void main(string[] args) { mixin SiSUnode; mixin SiSUbiblio; mixin SiSUrgxInitFlags; - mixin SiSUconfigSDLangHub; mixin outputHub; /+ struct DocumentParts { @@ -161,9 +162,12 @@ void main(string[] args) { arg_unrecognized ~= " " ~ arg; } } - auto conf = ConfigHub(); - auto sdl_root_configuration = conf.configSDLang("conf.sdl"); - auto sdl_root_doc_make = conf.configSDLang("sisu_document_make"); + auto env = [ + "pwd" : environment["PWD"], + "home" : environment["HOME"], + ]; + auto sdl_root_configuration = ConfigHub!()("conf.sdl", env); + auto sdl_root_doc_make = ConfigHub!()("sisu_document_make", env); auto confsdl = HeaderExtractSDL(); auto conf_settings_aa = confsdl.configSettingsSDLangToAAmake(sdl_root_configuration); auto conf_doc_make_aa = confsdl.documentMakeSDLangToAAmake(sdl_root_doc_make); @@ -191,69 +195,12 @@ void main(string[] args) { match(fn_src, rgx.src_pth), "not a sisu markup filename" ); - /+ ↓ read file (filename with path) +/ - /+ ↓ file tuple of header and content +/ - auto _0_header_1_body_content_2_insert_filelist_tuple = - SiSUmarkupRaw!()(fn_src); - static assert(!isTypeTuple!(_0_header_1_body_content_2_insert_filelist_tuple)); - static assert(_0_header_1_body_content_2_insert_filelist_tuple.length==3); - debug(header_and_body) { - writeln(header); - writeln(_0_header_1_body_content_2_insert_filelist_tuple.length); - writeln(_0_header_1_body_content_2_insert_filelist_tuple.length[1][0]); - } - /+ ↓ split header into make and meta +/ - auto _0_make_1_dochead_meta_tuple = - SiSUheaderExtractHub!()(_0_header_1_body_content_2_insert_filelist_tuple[0], conf_doc_make_aa); - static assert(!isTypeTuple!(_0_make_1_dochead_meta_tuple)); - static assert(_0_make_1_dochead_meta_tuple.length==2); - /+ ↓ document abstraction: process document, return abstraction as tuple +/ - auto t = SiSUdocAbstraction!()( - (_0_header_1_body_content_2_insert_filelist_tuple[1]), - (_0_make_1_dochead_meta_tuple[0]), - (_0_make_1_dochead_meta_tuple[1]), - _opt_action_bool - ); + auto t = + SiSUabstraction!()(fn_src, _opt_action_bool, env); static assert(!isTypeTuple!(t)); - static assert(t.length==3); - auto doc_abstraction = t[0]; // head ~ toc ~ contents ~ endnotes_seg ~ glossary ~ bibliography ~ bookindex ~blurb; - string[][string] _document_section_keys_sequenced = t[1]; - string[] _doc_html_segnames = t[2]; - struct DocumentMatters { - string[] keys_seq_seg() { - string[] _k = _document_section_keys_sequenced["seg"]; - return _k; - } - string[] keys_seq_scroll() { - string[] _k = _document_section_keys_sequenced["scroll"]; - return _k; - } - string[] segnames() { - string[] _k = _doc_html_segnames; - return _k; - } - auto dochead_make() { - string[string][string] _k = _0_make_1_dochead_meta_tuple[0]; - return _k; - } - auto dochead_meta() { - string[string][string] _k = _0_make_1_dochead_meta_tuple[1]; - return _k; - } - auto source_filename() { - string _k = fn_src; - return _k; - } - auto file_insert_list() { - string[] _k = _0_header_1_body_content_2_insert_filelist_tuple[2]; - return _k; - } - auto opt_action_bool() { - bool[string] _k = _opt_action_bool; - return _k; - } - } - auto doc_matters = DocumentMatters(); + static assert(t.length==2); + auto doc_abstraction = t[0]; + auto doc_matters = t[1]; /+ ↓ debugs +/ debug(checkdoc) { SiSUdebugs!()(doc_abstraction, doc_matters); @@ -269,16 +216,18 @@ void main(string[] args) { fn_src ); } - destroy(_0_header_1_body_content_2_insert_filelist_tuple); - destroy(t); - destroy(doc_abstraction); - destroy(_doc_html_segnames); + // destroy(_0_header_1_body_content_2_insert_filelist_tuple); + // destroy(t); + // destroy(doc_abstraction); + // // destroy(doc_ao_make_aa); + // // destroy(doc_ao_meta_aa); + // destroy(_doc_html_segnames); destroy(fn_src); } } else { /+ no recognized filename provided +/ writeln("no recognized filename"); - break; + break; // terminate, stop } } } |