From f0c845eba3718fd0c732aebf25eb33e689798e03 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 25 Jun 2016 06:37:22 -0400 Subject: step6 headers (&config), native & sdlang to json internally --- src/sdp.d | 57 +++++++++++++-------------------------------------------- 1 file changed, 13 insertions(+), 44 deletions(-) (limited to 'src/sdp.d') diff --git a/src/sdp.d b/src/sdp.d index e19a21e..127a8ad 100755 --- a/src/sdp.d +++ b/src/sdp.d @@ -9,6 +9,8 @@ import ao_abstract_doc_source, // sdp/ao_abstract_doc_source.d ao_defaults, // sdp/ao_defaults.d ao_header_extract, // sdp/ao_header_extract.d + ao_header_extract_native, // sdp/ao_header_extract_native.d + ao_header_extract_sdlang, // sdp/ao_header_extract_sdlang.d ao_read_config_files, // sdp/ao_read_config_files.d ao_read_source_files, // sdp/ao_read_source_files.d ao_output_debugs, // sdp/ao_output_debugs.d @@ -18,9 +20,6 @@ import // std.conv; /+ sdlang http://sdlang.org +/ import sdlang; // sdlang.d - // sdlang.parser, // sdlang/parser.d - // sdlang.exceptions; // sdp/ao_ansi_colors.d - // // std.conv; /+ sdp sisu document parser +/ private import std.getopt, @@ -98,20 +97,18 @@ mixin CompileTimeInfo; mixin RgxInit; void main(string[] args) { - mixin SiSUheaderSkel; - mixin SiSUheaderExtractNative; - mixin SiSUheaderExtractSDLang; + mixin SiSUheaderRegister; + mixin SiSUheaderExtractHub; mixin SiSUbiblio; mixin SiSUrgxInitFlags; - mixin SiSUconfiguration; + mixin SiSUconfigSDLangHub; mixin SiSUmarkupRaw; mixin SiSUdocAbstraction; mixin SiSUoutputDebugs; mixin SiSUoutputHub; mixin ScreenTxtColors; auto raw = MarkupRaw(); - auto head_native = HeaderDocMetadataAndMakeNativeToJson(); - auto headsdl = HeaderExtractSDL(); + auto head = HeaderDocMetadataAndMake(); auto abs = Abstraction(); auto dbg = SDPoutputDebugs(); auto output = SDPoutput(); @@ -208,34 +205,9 @@ void main(string[] args) { arg_unrecognized ~= " " ~ arg; } } - auto conf = Config(); - auto configuration = conf.readInConfigFile(); - /+ sdlang config +/ - Tag sdl_root_conf; - try { - sdl_root_conf = parseSource(configuration); - } - catch(SDLangParseException e) { - stderr.writeln("SDLang problem with config.sdl content"); - // Error messages of the form: - // myFile.sdl(5:28): Error: Invalid integer suffix. - stderr.writeln(e.msg); - } - debug(sdlang) { - // Value is a std.variant.Algebraic - Value output_dir_structure_by = sdl_root_conf.tags["output_dir_structure_by"][0].values[0]; - assert(output_dir_structure_by.type == typeid(string)); - writeln(output_dir_structure_by); - - // Tag person = sdl_root_conf.namespaces["myNamespace"].tags["person"][0]; - // writeln("Name: ", person.attributes["name"][0].value); - // - // int age = person.tags["age"][0].values[0].get!int(); - // writeln("Age: ", age); - - writeln("config SDL:"); - writeln(sdl_root_conf.toSDLDocument()); - } + auto conf = ConfigHub(); + auto sdl_root_configuration = conf.configSDLang("conf.sdl"); + auto sdl_root_document_make = conf.configSDLang("sisu_document_make"); foreach(fn_src; fns_src) { // foreach(fn_src; fns_src) { if (!empty(fn_src)) { @@ -270,15 +242,12 @@ void main(string[] args) { writeln(header_and_content_tuple.length); writeln(sourcefile_content[0]); } - // Tuple!(JSONValue[string], JSONValue[string]) header_make_and_meta_tuple; - auto header_make_and_meta_tuple = (match(header, rgx.native_header_meta_title)) - ? (head_native.headerContentJSON(header)) - : (headsdl.headerSDLangToJSON(header)); + auto header_make_and_meta_tuple = head.headerContentJSON(header); static assert(!isTypeTuple!(header_make_and_meta_tuple)); JSONValue[string] dochead_make_json = header_make_and_meta_tuple[0]; JSONValue[string] dochead_meta_json = header_make_and_meta_tuple[1]; /+ ↓ process document, return abstraction as tuple +/ - auto t = abs.abstract_doc_source(sourcefile_content); + auto t = abs.abstract_doc_source(sourcefile_content, dochead_make_json, dochead_meta_json); static assert(!isTypeTuple!(t)); auto doc_ao_contents = t[0]; // contents ~ endnotes ~ bookindex; // static assert(!isIterable!(doc_ao_contents)); @@ -291,8 +260,8 @@ void main(string[] args) { doc_ao_contents, doc_ao_bookindex_unordered_hashes, doc_ao_biblio, - // doc_ao_make_json, - // doc_ao_metadata_json, + dochead_make_json, + dochead_meta_json, fn_src, opt_action_bool ); -- cgit v1.2.3