aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2015-10-20 18:48:06 -0400
committerRalph Amissah <ralph@amissah.com>2015-10-20 18:48:06 -0400
commitde4b99eb241e72f1e8e142d3697397f8caae1337 (patch)
treedc7ab009ebffe78af86e6053abab6ee6b3dc78e7 /lib
parentalternative D compiler debug modes (diff)
update minor
Diffstat (limited to 'lib')
-rw-r--r--lib/sdp/ao_markup_source_raw.d40
-rw-r--r--lib/sdp/ao_scan_inserts.d8
2 files changed, 18 insertions, 30 deletions
diff --git a/lib/sdp/ao_markup_source_raw.d b/lib/sdp/ao_markup_source_raw.d
index 3710ff6..3d937ac 100644
--- a/lib/sdp/ao_markup_source_raw.d
+++ b/lib/sdp/ao_markup_source_raw.d
@@ -7,15 +7,16 @@ mixin template SiSUmarkupRaw() {
auto rgx = new Rgx();
final private string markupSourceString(in char[] fn_src) {
enforce(
- match(fn_src, rgx.src_pth),
- "not a sisu markup filename"
- );
- enforce(
exists(fn_src)!=0,
"file not found"
);
- string source_txt_str = cast(string) read(fn_src);
- std.utf.validate(source_txt_str);
+ string source_txt_str;
+ if (exists(fn_src)) {
+ source_txt_str = readText(fn_src); // ok
+ std.utf.validate(source_txt_str);
+ }
+ // string source_txt_str = cast(string) read(fn_src);
+ // std.utf.validate(source_txt_str);
return source_txt_str;
}
final private char[][] markupSourceLineArray(in string src_text) {
@@ -23,33 +24,20 @@ mixin template SiSUmarkupRaw() {
split(cast(char[]) src_text, rgx.line_delimiter);
return source_line_arr;
}
- final char[][] markupSourceContentRawLineArray(in char[] fn_src) {
- auto source_txt_str = markupSourceString(fn_src);
- auto source_line_arr = markupSourceLineArray(source_txt_str);
- return source_line_arr;
- }
- }
- class MarkupInsertRaw {
- auto rgx = new Rgx();
- final private string markupSourceString(in char[] fn_src) {
+ final char[][] markupInsertSourceContentRawLineArray(in char[] fn_src) {
enforce(
match(fn_src, rgx.src_fn_find_inserts),
"not a sisu markup filename"
);
- enforce(
- exists(fn_src)!=0,
- "file not found"
- );
- string source_txt_str = cast(string) read(fn_src);
- std.utf.validate(source_txt_str);
- return source_txt_str;
- }
- final private char[][] markupSourceLineArray(in string src_text) {
- char[][] source_line_arr =
- split(cast(char[]) src_text, rgx.line_delimiter);
+ auto source_txt_str = markupSourceString(fn_src);
+ auto source_line_arr = markupSourceLineArray(source_txt_str);
return source_line_arr;
}
final char[][] markupSourceContentRawLineArray(in char[] fn_src) {
+ enforce(
+ match(fn_src, rgx.src_pth),
+ "not a sisu markup filename"
+ );
auto source_txt_str = markupSourceString(fn_src);
auto source_line_arr = markupSourceLineArray(source_txt_str);
return source_line_arr;
diff --git a/lib/sdp/ao_scan_inserts.d b/lib/sdp/ao_scan_inserts.d
index 9111076..3f655c0 100644
--- a/lib/sdp/ao_scan_inserts.d
+++ b/lib/sdp/ao_scan_inserts.d
@@ -75,9 +75,9 @@ mixin template SiSUdocInserts() {
auto insert_sub_pth = m.captures[1];
auto fn_src_insert =
(markup_src_file_path ~ insert_sub_pth ~ insert_fn);
- auto raw = new MarkupInsertRaw();
+ auto raw = new MarkupRaw();
auto markup_sourcesubfile_insert_content =
- raw.markupSourceContentRawLineArray(fn_src_insert);
+ raw.markupInsertSourceContentRawLineArray(fn_src_insert);
debug(insert) { // insert file
tell_l("red", line);
tell_l("red", fn_src_insert);
@@ -181,9 +181,9 @@ mixin template SiSUdocInserts() {
auto insert_sub_pth = m.captures[1];
auto fn_src_insert =
(markup_src_file_path ~ insert_sub_pth ~ insert_fn);
- auto raw = new MarkupInsertRaw();
+ auto raw = new MarkupRaw();
auto markup_sourcefile_insert_content =
- raw.markupSourceContentRawLineArray(fn_src_insert);
+ raw.markupInsertSourceContentRawLineArray(fn_src_insert);
debug(insert) { // insert file
tell_l("red", line);
tell_l("red", fn_src_insert);