blob: 3d937ac36c9081742644764830433631ce37c24a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/*
#+OPTIONS: ^:nil _:nil#+OPTIONS: ^:nil _:nil
* sisu_markup_source_raw.d
*/
mixin template SiSUmarkupRaw() {
class MarkupRaw {
auto rgx = new Rgx();
final private string markupSourceString(in char[] fn_src) {
enforce(
exists(fn_src)!=0,
"file not found"
);
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) {
char[][] source_line_arr =
split(cast(char[]) src_text, rgx.line_delimiter);
return source_line_arr;
}
final char[][] markupInsertSourceContentRawLineArray(in char[] fn_src) {
enforce(
match(fn_src, rgx.src_fn_find_inserts),
"not a sisu markup filename"
);
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;
}
}
}
|