From bdcb9189e4cf221bec1efaf2e6e612b127e51f25 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 6 Jan 2018 20:34:42 -0500 Subject: 0.23.3 work on source & target file paths/locations --- src/sdp/meta/read_source_files.d | 43 +++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 20 deletions(-) (limited to 'src/sdp/meta/read_source_files.d') diff --git a/src/sdp/meta/read_source_files.d b/src/sdp/meta/read_source_files.d index 95a9dbe..0e53e73 100644 --- a/src/sdp/meta/read_source_files.d +++ b/src/sdp/meta/read_source_files.d @@ -25,37 +25,37 @@ static template SiSUrawMarkupContent() { } auto rawsrc = RawMarkupContent(); auto SiSUrawMarkupContent(O,Fn)(O _opt_action, Fn fn_src) { - auto _0_header_1_body_content_2_insert_filelist_tuple = - rawsrc.sourceContentSplitIntoHeaderAndBody(_opt_action, rawsrc.sourceContent(fn_src), fn_src); + auto _0_header_1_body_content_2_insert_filelist_tuple + = rawsrc.sourceContentSplitIntoHeaderAndBody(_opt_action, rawsrc.sourceContent(fn_src), fn_src); return _0_header_1_body_content_2_insert_filelist_tuple; } struct RawMarkupContent { final sourceContent(in string fn_src) { auto raw = MarkupRawUnit(); - auto source_txt_str = - raw.markupSourceReadIn(fn_src); + auto source_txt_str + = raw.markupSourceReadIn(fn_src); return source_txt_str; } final auto sourceContentSplitIntoHeaderAndBody(O)(O _opt_action, in string source_txt_str, in string fn_src="") { auto raw = MarkupRawUnit(); string[] insert_file_list; string[] images_list; - auto t = - raw.markupSourceHeaderContentRawLineTupleArray(source_txt_str); + auto t + = raw.markupSourceHeaderContentRawLineTupleArray(source_txt_str); auto header_raw = t[0]; auto sourcefile_body_content = t[1]; if (fn_src.match(rgx.src_fn_master)) { // filename with path needed if master file (.ssm) not otherwise auto ins = Inserts(); - auto tu = - ins.scan_master_src_for_insert_files_and_import_content(_opt_action, sourcefile_body_content, fn_src); + auto tu + = ins.scan_master_src_for_insert_files_and_import_content(_opt_action, sourcefile_body_content, fn_src); static assert(!isTypeTuple!(tu)); sourcefile_body_content = tu[0]; insert_file_list = tu[1].dup; images_list = tu[2].dup; } else if (_opt_action.source || _opt_action.sisupod) { auto ins = Inserts(); - auto tu = - ins.scan_master_src_for_insert_files_and_import_content(_opt_action, sourcefile_body_content, fn_src); + auto tu + = ins.scan_master_src_for_insert_files_and_import_content(_opt_action, sourcefile_body_content, fn_src); static assert(!isTypeTuple!(tu)); images_list = tu[2].dup; } @@ -80,6 +80,9 @@ static template SiSUrawMarkupContent() { string source_txt_str; try { if (exists(fn_src)) { + debug(io) { + writeln("in src, markup source file found: ", fn_src); + } source_txt_str = fn_src.readText; } } @@ -108,8 +111,8 @@ static template SiSUrawMarkupContent() { return header_and_content; } final private char[][] markupSourceLineArray(in char[] src_text) { - char[][] source_line_arr = - (cast(char[]) src_text).split(rgx.newline_eol_strip_preceding); + char[][] source_line_arr + = (cast(char[]) src_text).split(rgx.newline_eol_strip_preceding); return source_line_arr; } auto markupSourceReadIn(in string fn_src) { @@ -205,11 +208,11 @@ static template SiSUrawMarkupContent() { type1["header_meta"] = 0; auto insert_fn = m.captures[2]; auto insert_sub_pth = m.captures[1]; - auto fn_src_insert = - chainPath(markup_src_file_path, insert_sub_pth ~ insert_fn).array; + auto fn_src_insert + = chainPath(markup_src_file_path, insert_sub_pth ~ insert_fn).array; auto raw = MarkupRawUnit(); - auto markup_sourcesubfile_insert_content = - raw.getInsertMarkupSourceContentRawLineArray(fn_src_insert, rgx.src_fn_find_inserts); + auto markup_sourcesubfile_insert_content + = raw.getInsertMarkupSourceContentRawLineArray(fn_src_insert, rgx.src_fn_find_inserts); debug(insert_file) { tell_l("red", line); tell_l("red", fn_src_insert); @@ -285,8 +288,8 @@ static template SiSUrawMarkupContent() { } else if (auto m = line.match(rgx.insert_src_fn_ssi_or_sst)) { auto insert_fn = m.captures[2]; auto insert_sub_pth = m.captures[1]; - auto fn_src_insert = - chainPath(markup_src_file_path, insert_sub_pth ~ insert_fn).array; + auto fn_src_insert + = chainPath(markup_src_file_path, insert_sub_pth ~ insert_fn).array; insert_file_list ~= to!string(fn_src_insert); auto raw = MarkupRawUnit(); /+ TODO +/ @@ -294,8 +297,8 @@ static template SiSUrawMarkupContent() { /+ .sst when inserted, not used: headers and heading level ^:?A~ so remove +/ writeln(__LINE__); writeln(ma); } - auto markup_sourcefile_insert_content = - raw.getInsertMarkupSourceContentRawLineArray(fn_src_insert, rgx.src_fn_find_inserts); + auto markup_sourcefile_insert_content + = raw.getInsertMarkupSourceContentRawLineArray(fn_src_insert, rgx.src_fn_find_inserts); debug(insert_file) { tell_l("red", line); tell_l("red", fn_src_insert); -- cgit v1.2.3