diff options
Diffstat (limited to 'org/ao_read_source_files.org')
-rw-r--r-- | org/ao_read_source_files.org | 133 |
1 files changed, 60 insertions, 73 deletions
diff --git a/org/ao_read_source_files.org b/org/ao_read_source_files.org index c362f9a..f537e6a 100644 --- a/org/ao_read_source_files.org +++ b/org/ao_read_source_files.org @@ -23,17 +23,10 @@ - read config files<BR> ao_config_files.d +/ -template SiSUconfigIn() { - private import - std.exception, - std.stdio, - std.utf, - std.conv : to; - private - struct ConfigIn { - private import std.file; - <<ao_config_file_in>> - } +template ConfigIn() { + <<imports_std>> + import std.file; + <<ao_config_file_in>> } #+END_SRC @@ -43,25 +36,10 @@ template SiSUconfigIn() { /+ +/ -template SiSUconfigSDLang() { - struct ConfigSDLangRootTag { - <<ao_config_file_sdlang>> - } -} -#+END_SRC - -*** config files hub - -#+BEGIN_SRC d :tangle ../src/sdp/ao_read_config_files.d -/+ - -+/ -template SiSUconfigSDLangHub() { - mixin SiSUconfigIn; - mixin SiSUconfigSDLang; - struct ConfigHub { - <<ao_config_file_sdlang_hub>> - } +template ConfigSDLang() { + import sdlang; + <<imports_std>> + <<ao_config_file_sdlang>> } #+END_SRC @@ -76,16 +54,7 @@ template SiSUconfigSDLangHub() { template SiSUmarkupRaw() { private import ao_rgx; - private import - std.array, - std.exception, - std.path, - std.regex, - std.stdio, - std.traits, - std.typecons, - std.utf, - std.conv : to; + <<imports_std>> mixin SiSUrgxInit; auto rgx = Rgx(); auto rawsrc = MarkupRaw(); @@ -125,7 +94,6 @@ template SiSUmarkupRaw() { return t; } } - private struct MarkupRawUnit { private import std.file; <<ao_markup_source_raw_read_file_source_string>> @@ -168,10 +136,10 @@ template SiSUmarkupRaw() { #+name: ao_config_file_in #+BEGIN_SRC d -final private string readInConfigFile(string conf_sdl) { - string dot_pwd = chainPath(to!string(environment["PWD"]), ".sisu").array; - string underscore_pwd = chainPath(to!string(environment["PWD"]), "_sisu").array; - string dot_home = chainPath(to!string(environment["HOME"]), ".sisu").array; +final string ConfigIn(C,E)(C conf_sdl, E env) { + string dot_pwd = chainPath(to!string(env["pwd"]), ".sisu").array; + string underscore_pwd = chainPath(to!string(env["pwd"]), "_sisu").array; + string dot_home = chainPath(to!string(env["home"]), ".sisu").array; string[] possible_config_path_locations = [ dot_pwd, underscore_pwd, @@ -207,7 +175,7 @@ final private string readInConfigFile(string conf_sdl) { #+name: ao_config_file_sdlang #+BEGIN_SRC d -private auto configSDLangRootTag(string configuration, string conf_sdl_filename) { +auto ConfigSDLang(string configuration, string conf_sdl_filename) { Tag sdl_root_conf; try { sdl_root_conf = parseSource(configuration); @@ -228,14 +196,55 @@ private auto configSDLangRootTag(string configuration, string conf_sdl_filename) #+END_SRC ** config file (conf.sdl & sisu_document_make) :file:config:hub: +*** config hub template + +#+BEGIN_SRC d :tangle ../src/sdp/ao_read_config_files.d +/+ + ++/ +template ConfigHub() { + <<imports_std>> + <<ao_config_file_import_sdlang>> + <<ao_config_file_sdlang_hub>> +} +#+END_SRC + +*** imports + +#+name: imports_std +#+BEGIN_SRC d +private import + std.algorithm, + std.array, + std.container, + std.exception, + std.stdio, + std.file, + std.path, + std.range, + std.regex, + std.string, + std.traits, + std.typecons, + std.uni, + std.utf, + std.conv : to; +#+END_SRC + + +*** config hub import sdlang +#+name: ao_config_file_import_mixin +#+BEGIN_SRC d +private import sdlang; +#+END_SRC + +*** config hub function #+name: ao_config_file_sdlang_hub #+BEGIN_SRC d -final private auto configSDLang(string conf_sdl) { - auto conf_get = ConfigIn(); - auto configuration = conf_get.readInConfigFile(conf_sdl); - auto conf = ConfigSDLangRootTag(); - auto sdl_root = conf.configSDLangRootTag(configuration, conf_sdl); +final auto ConfigHub(C,E)(C conf_sdl, E env) { + auto configuration = ConfigIn!()(conf_sdl, env); + auto sdl_root = ConfigSDLang!()(configuration, conf_sdl); return sdl_root; } #+END_SRC @@ -549,25 +558,3 @@ auto t = tuple( ); return t; #+END_SRC - -* figure out -** break up file here to sisu markup content and header - -break up file here to sisu markup content and header - -*** header -take master and single sst file, read in as header until the required header 0~ -keep separate (from content) for extraction of header metadata & make detail -also now may be sdlang or old sisu markup! - -*** content -from 0~ read in as content - -** what -# #+NAME: sdp_each_file_do -# #+BEGIN_SRC d -/+ ↓ read file +/ -auto conf = ConfigIn(); -auto configfile_content = - conf.sourceConfig(fn_src); -# #+END_SRC |