aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sdp/ao_read_markup_source.d
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2016-04-19 03:15:41 -0400
committerRalph Amissah <ralph@amissah.com>2016-04-24 08:30:48 -0400
commit86fcc0b6cff68ed461027ac82bcc238fbbf32483 (patch)
tree7dbc1e80238fc2b5d94eda587d38a039dfa5fb83 /lib/sdp/ao_read_markup_source.d
parentorg header (diff)
base ... tagdoc-reform_v0.0.0
Diffstat (limited to 'lib/sdp/ao_read_markup_source.d')
-rw-r--r--lib/sdp/ao_read_markup_source.d55
1 files changed, 55 insertions, 0 deletions
diff --git a/lib/sdp/ao_read_markup_source.d b/lib/sdp/ao_read_markup_source.d
new file mode 100644
index 0000000..1c574ea
--- /dev/null
+++ b/lib/sdp/ao_read_markup_source.d
@@ -0,0 +1,55 @@
+/*
+ read markup source
+ ao_read_markup_source.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;
+ try {
+ if (exists(fn_src)) {
+ source_txt_str = readText(fn_src); // ok
+ }
+ }
+ catch (ErrnoException ex) {
+ // Handle errors
+ }
+ catch (UTFException ex) {
+ // Handle validation errors
+ }
+ catch (FileException ex) {
+ // Handle errors
+ }
+ 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;
+ }
+ }
+}