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 --- org/sdp.org | 106 ++++++++++++++++++++---------------------------------------- 1 file changed, 35 insertions(+), 71 deletions(-) (limited to 'org/sdp.org') diff --git a/org/sdp.org b/org/sdp.org index 2d4b7b9..89cd588 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -28,7 +28,7 @@ struct Version { int minor; int patch; } -enum ver = Version(0, 5, 1); +enum ver = Version(0, 6, 0); #+END_SRC ** pre loop init @@ -41,7 +41,7 @@ enum ver = Version(0, 5, 1); [[./ao_read_source_files.org][ao_read_source_files]] [[./output_hub.org][output hub]] -**** sdp :import:sdp: +**** sdp :import:sdp: ***** TODO src/sdp.d ├── src @@ -61,6 +61,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 @@ -70,14 +72,11 @@ import // std.conv; #+END_SRC -**** sdlang :import:sdlang: +**** sdlang :import:sdlang: #+NAME: sdlang_imports_use #+BEGIN_SRC d /+ sdlang http://sdlang.org +/ import sdlang; // sdlang.d - // sdlang.parser, // sdlang/parser.d - // sdlang.exceptions; // sdp/ao_ansi_colors.d - // // std.conv; #+END_SRC **** std :import:std: @@ -163,7 +162,7 @@ struct SDPoutput { } #+END_SRC -**** version.txt :version: +**** version.txt :version: #+NAME: sdp_version_mixin #+BEGIN_SRC d @@ -174,12 +173,11 @@ mixin(import("version.txt")); #+NAME: sdp_args #+BEGIN_SRC d -mixin SiSUheaderSkel; -mixin SiSUheaderExtractNative; -mixin SiSUheaderExtractSDLang; +mixin SiSUheaderRegister; +mixin SiSUheaderExtractHub; mixin SiSUbiblio; mixin SiSUrgxInitFlags; -mixin SiSUconfiguration; +mixin SiSUconfigSDLangHub; mixin SiSUmarkupRaw; mixin SiSUdocAbstraction; mixin SiSUoutputDebugs; @@ -192,8 +190,7 @@ mixin ScreenTxtColors; #+NAME: sdp_args #+BEGIN_SRC d auto raw = MarkupRaw(); -auto head_native = HeaderDocMetadataAndMakeNativeToJson(); -auto headsdl = HeaderExtractSDL(); +auto head = HeaderDocMetadataAndMake(); auto abs = Abstraction(); auto dbg = SDPoutputDebugs(); auto output = SDPoutput(); @@ -308,60 +305,13 @@ foreach(arg; args) { } #+END_SRC -*** config files (load) :config:files: -#+BEGIN_SRC text -./.sisu ./_sisu ~/.sisu /etc/.sisu -#+END_SRC - -#+BEGIN_SRC d -// string[string] envVars = environment.toAA(); -// writeln(envVars); -/+ -writefln( - "pwd: %s; home: %s", - environment["PWD"], - environment["HOME"] -); -+/ -#+END_SRC +*** TODO config files (load & read) (so far only SDLang) :config:files: -**** config load #+NAME: sdp_config_files #+BEGIN_SRC d -auto conf = Config(); -auto configuration = conf.readInConfigFile(); -#+END_SRC - -**** config read - -#+NAME: sdp_config_files -#+BEGIN_SRC d -/+ 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"); #+END_SRC ** each file (loop) [+2] :loop:files: @@ -412,10 +362,7 @@ debug(header_and_content) { **** [#A] read doc header: metadata & make :doc:header:metadata:make: #+NAME: sdp_each_file_do #+BEGIN_SRC d -// 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]; @@ -425,7 +372,7 @@ JSONValue[string] dochead_meta_json = header_make_and_meta_tuple[1]; #+NAME: sdp_each_file_do #+BEGIN_SRC d /+ ↓ 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)); @@ -444,8 +391,8 @@ debug(checkdoc) { // checkbook & dumpdoc 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 ); @@ -674,3 +621,20 @@ democratizing_innovation.eric_von_hippel.sst └── di_evh.png #+END_SRC + +** check +#+BEGIN_SRC text +./.sisu ./_sisu ~/.sisu /etc/.sisu +#+END_SRC + +#+BEGIN_SRC d +// string[string] envVars = environment.toAA(); +// writeln(envVars); +/+ +writefln( + "pwd: %s; home: %s", + environment["PWD"], + environment["HOME"] +); ++/ +#+END_SRC -- cgit v1.2.3