From deac702d85c5bbe68a8acf762a01939028e65320 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 7 Oct 2016 12:59:49 -0400 Subject: 0.7.1 re-arranging for unittests; tuple tests; read in files; obt --- org/sdp.org | 99 ++++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 59 insertions(+), 40 deletions(-) (limited to 'org/sdp.org') diff --git a/org/sdp.org b/org/sdp.org index 47cecf8..ebf427e 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -24,7 +24,7 @@ struct Version { int minor; int patch; } -enum ver = Version(0, 7, 0); +enum ver = Version(0, 7, 1); #+END_SRC * sdp.d sisu document parser :sdp.d: @@ -131,13 +131,21 @@ std.path, std.stdio, std.variant, -**** version.txt :version: +**** mixins +***** version.txt :version: #+NAME: sdp_version_mixin #+BEGIN_SRC d mixin(import("version.txt")); #+END_SRC +***** std mixins +#+NAME: std_mixins +#+BEGIN_SRC d +mixin CompileTimeInfo; +mixin RgxInit; +#+END_SRC + *** mixin :mixin: #+NAME: sdp_mixin @@ -289,7 +297,7 @@ auto conf_doc_make_aa = confsdl.documentMakeSDLangToAAmake(sdl_root_doc_make); *** filename provided [+1] :file:process: **** scope (loop) :scope: -#+NAME: sdp_each_file_do +#+NAME: sdp_each_file_do_scope #+BEGIN_SRC d scope(success) { debug(checkdoc) { @@ -314,39 +322,47 @@ enforce( ); #+END_SRC -**** [#A] read file :file:read: +**** [#A] read in raw file (using filename with path) :file:read: [[./ao_markup_source_raw.org][ao_markup_source_raw]] -#+NAME: sdp_each_file_do +#+NAME: sdp_each_file_do_read_sisu_markup_file #+BEGIN_SRC d /+ ↓ read file +/ -auto header_and_content_tuple = raw.sourceContent(fn_src); -static assert(!isTypeTuple!(header_and_content_tuple)); -auto header = header_and_content_tuple[0]; -auto sourcefile_content = header_and_content_tuple[1]; -debug(header_and_content) { +auto read_in_file_string = raw.sourceContent(fn_src); +#+END_SRC + +**** [#A] split raw content file into: doc header & doc content :file:read: + +#+NAME: sdp_each_file_do_split_sisu_markup_file_content_into_header_and_body +#+BEGIN_SRC d +/+ ↓ file tuple of header and content +/ +auto header_and_body_tuple = raw.sourceContentSplitIntoHeaderAndBody(read_in_file_string, fn_src); +auto header = header_and_body_tuple[0]; +auto content_body = header_and_body_tuple[1]; +debug(header_and_body) { writeln(header); - writeln(header_and_content_tuple.length); - writeln(sourcefile_content[0]); + writeln(header_and_body_tuple.length); + writeln(content_body[0]); } #+END_SRC -**** [#A] read doc header: metadata & make :doc:header:metadata:make: +**** [#A] split doc header into: metadata & make :doc:header:metadata:make: -#+NAME: sdp_each_file_do +#+NAME: sdp_each_file_do_split_sisu_markup_file_header_into_make_and_meta #+BEGIN_SRC d +/+ ↓ split header into make and meta +/ auto header_make_and_meta_tuple = head.headerContentAA(header, conf_doc_make_aa); static assert(!isTypeTuple!(header_make_and_meta_tuple)); -string[string][string] dochead_make_aa = header_make_and_meta_tuple[0]; -string[string][string] dochead_meta_aa = header_make_and_meta_tuple[1]; +string[string][string] dochead_make = header_make_and_meta_tuple[0]; +string[string][string] dochead_meta = header_make_and_meta_tuple[1]; #+END_SRC **** [#A] processing: document abstraction, tuple :processing: -#+NAME: sdp_each_file_do +#+NAME: sdp_each_file_do_document_abstraction #+BEGIN_SRC d -/+ ↓ process document, return abstraction as tuple +/ -auto t = abs.abstract_doc_source(sourcefile_content, dochead_make_aa, dochead_meta_aa); +/+ ↓ document abstraction: process document, return abstraction as tuple +/ +auto t = abs.abstract_doc_source(content_body, dochead_make, dochead_meta); static assert(!isTypeTuple!(t)); auto doc_ao_contents = t[0]; // contents ~ endnotes ~ bookindex; // static assert(!isIterable!(doc_ao_contents)); @@ -355,19 +371,18 @@ auto doc_ao_biblio = t[2]; // destroy(t); #+END_SRC -**** TODO debug :debug: -***** [#A] debug document parts (checkdoc) :checkdoc: +**** TODO debug (document parts, checkdoc) :debug:checkdoc: -#+NAME: sdp_each_file_do +#+NAME: sdp_each_file_do_debugs_checkdoc #+BEGIN_SRC d -/+ ↓ document parts +/ +/+ ↓ debugs +/ debug(checkdoc) { // checkbook & dumpdoc dbg.abstract_doc_source_debugs( doc_ao_contents, doc_ao_bookindex_unordered_hashes, doc_ao_biblio, - dochead_make_aa, - dochead_meta_aa, + dochead_make, + dochead_meta, fn_src, opt_action_bool ); @@ -376,15 +391,15 @@ debug(checkdoc) { // checkbook & dumpdoc **** TODO process outputs :outputs: -#+NAME: sdp_each_file_do +#+NAME: sdp_each_file_do_selected_output #+BEGIN_SRC d /+ ↓ output hub +/ output.hub( doc_ao_contents, doc_ao_bookindex_unordered_hashes, doc_ao_biblio, - dochead_make_aa, - dochead_meta_aa, + dochead_make, + dochead_meta, fn_src, opt_action_bool ); @@ -392,7 +407,7 @@ output.hub( **** scope (on loop exit) :scope:exit: -#+NAME: sdp_each_file_do +#+NAME: sdp_each_file_do_scope_exit #+BEGIN_SRC d scope(exit) { debug(checkdoc) { @@ -401,7 +416,7 @@ scope(exit) { fn_src ); } - destroy(sourcefile_content); + destroy(content_body); destroy(t); destroy(doc_ao_contents); // destroy(doc_ao_make_aa); @@ -422,21 +437,18 @@ break; #+END_SRC * tangles (code structure) :tangle: -** sdp :sdp.d: -*** TODO src/sdp.d +** TODO sdp src/sdp.d :sdp.d: #+BEGIN_SRC d :tangle ../src/sdp.d :shebang #!/usr/bin/env rdmd /+ sdp - sdp.d +/ <> <> <> <> <> -mixin CompileTimeInfo; -mixin RgxInit; +<> /++ A SiSU document parser writen in D. +/ void main(string[] args) { <> @@ -444,7 +456,14 @@ void main(string[] args) { <> foreach(fn_src; fns_src) { if (!empty(fn_src)) { - <> + <> + <> + <> + <> + <> + <> + <> + <> } else { <> } @@ -640,12 +659,12 @@ democratizing_innovation.eric_von_hippel.sst #+END_SRC ** read markup files -**** regular .sst +*** regular .sst relatively straight forward -**** master .ssm +*** master .ssm master files have been able to read in inser files .ssi and regular files .sst -***** reading in .ssi files is straightforward -***** reading in .sst files is more problematic +**** reading in .ssi files is straightforward +**** reading in .sst files is more problematic .sst files have their own root (structure) either - the root needs to be disabled - not used -- cgit v1.2.3