diff options
author | Ralph Amissah <ralph@amissah.com> | 2016-09-19 12:03:19 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:13 -0400 |
commit | caddd5b53a7d94b29a022b0cc03587edfc6934e9 (patch) | |
tree | fa462bfb4ef7eb29559ea20aaaef2ddc72a60813 /src/sdp | |
parent | heading anchor_tags and cleaning (diff) |
header, body split a more reliable regex solution
Diffstat (limited to 'src/sdp')
-rw-r--r-- | src/sdp/ao_read_source_files.d | 8 |
1 files changed, 5 insertions, 3 deletions
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~))" |