aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--org/ao_read_source_files.org13
-rw-r--r--src/sdp/ao_read_source_files.d8
2 files changed, 14 insertions, 7 deletions
diff --git a/org/ao_read_source_files.org b/org/ao_read_source_files.org
index 233599a..4663b87 100644
--- a/org/ao_read_source_files.org
+++ b/org/ao_read_source_files.org
@@ -184,14 +184,19 @@ catch (ErrnoException ex) {
// }
}
-** array[0..1]: split header content :array:
+** document header & content, array.length == 2 :array:
+
+here you split document header and body, an array.length == 2
+split is on first match of level A~ (which is required)
#+name: ao_markup_source_raw
#+BEGIN_SRC d
final private char[][] header0Content1(in string src_text) {
- /+ split string on _first_ match of "^:?A~\s" into [header, content] tuple +/
- char[][] header_and_content =
- split(cast(char[]) src_text, rgx.heading_a); // this splits on each occurance of "^:?A~\s" (does not recognize when it appears in a code block)
+ /+ split string on _first_ match of "^:?A~\s" into [header, content] array/tuple +/
+ char[][] header_and_content;
+ auto m = matchFirst(cast(char[]) src_text, rgx.heading_a);
+ header_and_content ~= m.pre;
+ header_and_content ~= m.hit ~ m.post;
assert(header_and_content.length == 2,
"document markup is broken, header body split == " ~ to!string(header_and_content.length) ~
"; (header / body array split should == 2 (split is on level A~))"
diff --git a/src/sdp/ao_read_source_files.d b/src/sdp/ao_read_source_files.d
index ce3c7bd..eabc4dc 100644
--- a/src/sdp/ao_read_source_files.d
+++ b/src/sdp/ao_read_source_files.d
@@ -75,9 +75,11 @@ template SiSUmarkupRaw() {
return source_txt_str;
}
final private char[][] header0Content1(in string src_text) {
- /+ split string on _first_ match of "^:?A~\s" into [header, content] tuple +/
- char[][] header_and_content =
- split(cast(char[]) src_text, rgx.heading_a); // this splits on each occurance of "^:?A~\s" (does not recognize when it appears in a code block)
+ /+ split string on _first_ match of "^:?A~\s" into [header, content] array/tuple +/
+ char[][] header_and_content;
+ auto m = matchFirst(cast(char[]) src_text, rgx.heading_a);
+ header_and_content ~= m.pre;
+ header_and_content ~= m.hit ~ m.post;
assert(header_and_content.length == 2,
"document markup is broken, header body split == " ~ to!string(header_and_content.length) ~
"; (header / body array split should == 2 (split is on level A~))"