aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/ao_read_source_files.org
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2017-05-09 13:01:06 -0400
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:14 -0400
commit60d6073bcfc4fa91253428094813de0dac41a2b4 (patch)
treecef8e223469724d9e42dea81d6ded5ffc75a9be2 /org/ao_read_source_files.org
parentmodules, collective imports (diff)
0.16.0 files/modules re-arrangeddoc-reform_v0.0.16
Diffstat (limited to 'org/ao_read_source_files.org')
-rw-r--r--org/ao_read_source_files.org137
1 files changed, 63 insertions, 74 deletions
diff --git a/org/ao_read_source_files.org b/org/ao_read_source_files.org
index 9b9e863..b53fdc5 100644
--- a/org/ao_read_source_files.org
+++ b/org/ao_read_source_files.org
@@ -13,65 +13,77 @@
#+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n)
[[./sdp.org][sdp]] [[./][org/]]
+* imports
+
+#+name: imports_std
+#+BEGIN_SRC d
+import
+ sdp.ao,
+ std.file,
+ std.path;
+#+END_SRC
+
* 1. get config file (read in) :module:sdp:ao_read_config_files:
** 0. module template
-#+BEGIN_SRC d :tangle ../src/sdp/ao_read_config_files.d
+#+BEGIN_SRC d :tangle ../src/sdp/ao/read_config_files.d
/++
read configuration files<BR>
- read config files<BR>
ao_config_files.d
+/
-module sdp.ao_read_config_files;
-template ConfigIn() {
- <<imports_std>>
- import std.file;
- <<ao_config_file_in>>
-}
+module sdp.ao.read_config_files;
+<<ao_config_file_in>>
+<<ao_config_file_sdl>>
+<<ao_config_file_hub>>
#+END_SRC
-** read config file, (conf.sdl & sisu_document_make) :file:config:
+** 1. read config file, (conf.sdl & sisu_document_make) :file:config:
#+name: ao_config_file_in
#+BEGIN_SRC d
-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,
- dot_home,
- "/etc/sisu"
- ];
- string config_file_str;
- foreach(pth; possible_config_path_locations) {
- auto conf_file = format(
- "%s/%s",
- pth,
- conf_sdl,
- );
- try {
- if (exists(conf_file)) {
- debug(configfile) {
- writeln(conf_file);
+template ConfigIn() {
+ <<imports_std>>
+ 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,
+ dot_home,
+ "/etc/sisu"
+ ];
+ string config_file_str;
+ foreach(pth; possible_config_path_locations) {
+ auto conf_file = format(
+ "%s/%s",
+ pth,
+ conf_sdl,
+ );
+ try {
+ if (exists(conf_file)) {
+ debug(configfile) {
+ writeln(conf_file);
+ }
+ config_file_str = conf_file.readText;
+ break;
}
- config_file_str = conf_file.readText;
- break;
+ }
+ catch (ErrnoException ex) {
+ }
+ catch (FileException ex) {
}
}
- catch (ErrnoException ex) {
- }
- catch (FileException ex) {
- }
+ return config_file_str;
}
- return config_file_str;
}
#+END_SRC
-** 0. config files get sdlang root tag
-
-#+BEGIN_SRC d :tangle ../src/sdp/ao_read_config_files.d
+** 2. config files get sdlang root tag
+*** 0. template
+#+name: ao_config_file_sdl
+#+BEGIN_SRC d
/+
+/
@@ -82,7 +94,7 @@ template ConfigSDLang() {
}
#+END_SRC
-** config file get sdl root tag :file:conf:sdlang:
+*** config file get sdl root tag :file:conf:sdlang:
#+name: ao_config_file_sdlang
#+BEGIN_SRC d
@@ -106,10 +118,11 @@ auto ConfigSDLang(string configuration, string conf_sdl_filename) {
}
#+END_SRC
-** config file (conf.sdl & sisu_document_make) :file:config:hub:
-*** config hub template
+** 3. config file (conf.sdl & sisu_document_make) :file:config:hub:
+*** 0. template
-#+BEGIN_SRC d :tangle ../src/sdp/ao_read_config_files.d
+#+name: ao_config_file_hub
+#+BEGIN_SRC d
/+
+/
template ConfigHub() {
@@ -119,32 +132,10 @@ template ConfigHub() {
}
#+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;
+import sdlang;
#+END_SRC
*** config hub function
@@ -159,19 +150,18 @@ final auto ConfigHub(C,E)(C conf_sdl, E env) {
#+END_SRC
* 2. get markup source, read file :module:sdp:ao_read_source_files:
-
** 0. module template
-#+BEGIN_SRC d :tangle ../src/sdp/ao_read_source_files.d
+#+BEGIN_SRC d :tangle ../src/sdp/ao/read_source_files.d
/++
module ao_read_source_files;<BR>
- open markup files<BR>
- if master file scan for addional files to import/insert
+/
-module sdp.ao_read_source_files;
+module sdp.ao.read_source_files;
template SiSUrawMarkupContent() {
- private import
- sdp.ao_rgx;
+ import
+ sdp.ao.rgx;
<<imports_std>>
mixin SiSUrgxInit;
auto rgx = Rgx();
@@ -213,7 +203,7 @@ template SiSUrawMarkupContent() {
}
}
struct MarkupRawUnit {
- private import std.file;
+ import std.file;
<<ao_markup_source_raw_read_file_source_string>>
<<ao_markup_source_raw_doc_header_and_content_split>>
<<ao_markup_source_raw_source_line_array>>
@@ -222,7 +212,7 @@ template SiSUrawMarkupContent() {
<<ao_markup_source_raw_get_insert_source_line_array>>
}
struct Inserts {
- private import sdp.ao_defaults;
+ import sdp.ao.defaults;
auto scan_subdoc_source(
char[][] markup_sourcefile_insert_content,
string fn_src
@@ -559,4 +549,3 @@ auto t = tuple(
return t;
#+END_SRC
-* 3. config files (conf.sdl & sisu_document_make) :ao_config_files: