aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/in_source_files.org
diff options
context:
space:
mode:
Diffstat (limited to 'org/in_source_files.org')
-rw-r--r--org/in_source_files.org141
1 files changed, 72 insertions, 69 deletions
diff --git a/org/in_source_files.org b/org/in_source_files.org
index 6275ed4..baffefb 100644
--- a/org/in_source_files.org
+++ b/org/in_source_files.org
@@ -283,7 +283,7 @@ static template configReadDocYAML() {
#+END_SRC
* B. get _markup source_, read file (.readText) [#A]:module:source_files:
-** _module template_ (includes tuple)
+** _module template_
#+HEADER: :tangle "../src/sisudoc/io_in/read_source_files.d"
#+HEADER: :noweb yes
@@ -310,14 +310,6 @@ template spineRawMarkupContent() {
static auto rgx = RgxI();
mixin spineRgxFiles;
static auto rgx_files = RgxFiles();
- struct ST_doc_parts {
- char[] header_raw;
- char[][] sourcefile_body_content;
- string[] insert_file_list;
- string[] images_list;
- ubyte[32] header_raw_digest;
- ubyte[32] src_txt_digest;
- }
string[] _images=[];
string[] _extract_images(S)(S content_block) {
string[] images_;
@@ -328,23 +320,31 @@ template spineRawMarkupContent() {
return images_;
}
auto rawsrc = RawMarkupContent();
- alias ContentsInsertsImages = Tuple!(
- char[][], "contents",
- string[], "insert_files",
- string[], "images"
- );
- alias HeaderContentInsertsImages = Tuple!(
- char[], "header",
- char[][], "src_txt",
- string[], "insert_files",
- string[], "images",
- ubyte[32], "header_digest",
- ubyte[32], "src_txt_digest"
- );
+ struct ST_contents_inserts_images {
+ char[][] contents;
+ string[] insert_files;
+ string[] images;
+ }
+ struct ST_header_content_inserts_images {
+ char[] header;
+ char[][] src_txt;
+ string[] insert_files;
+ string[] images;
+ ubyte[32] header_digest;
+ ubyte[32] src_txt_digest;
+ }
+ struct ST_doc_parts {
+ char[] header_raw;
+ char[][] sourcefile_body_content;
+ string[] insert_file_list;
+ string[] images_list;
+ ubyte[32] header_raw_digest;
+ ubyte[32] src_txt_digest;
+ }
auto spineRawMarkupContent(O,Fn)(O _opt_action, Fn fn_src) {
- auto _0_header_1_body_content_2_insert_filelist_tuple
+ ST_doc_parts _0_header_1_body_content_2_insert_filelist_struct
= rawsrc.sourceContentSplitIntoHeaderAndBody(_opt_action, rawsrc.sourceContent(fn_src), fn_src);
- return _0_header_1_body_content_2_insert_filelist_tuple;
+ return _0_header_1_body_content_2_insert_filelist_struct;
}
struct RawMarkupContent {
final sourceContent(in string fn_src) {
@@ -361,33 +361,33 @@ template spineRawMarkupContent() {
auto raw = MarkupRawUnit();
string[] insert_file_list_get;
string[] images_list_get;
- HeaderContentInsertsImages t
- = raw.markupSourceHeaderContentRawLineTupleArray(source_txt_str);
- char[] header_raw = t.header;
- ubyte[32] header_raw_digest = t.header.sha256Of;
- char[][] sourcefile_body_content = t.src_txt;
+ ST_header_content_inserts_images st
+ = raw.markupSourceHeaderContentRawLineStructArray(source_txt_str);
+ char[] header_raw = st.header;
+ ubyte[32] header_raw_digest = st.header.sha256Of;
+ char[][] sourcefile_body_content = st.src_txt;
if (fn_src.match(rgx_files.src_fn_master)) { // filename with path needed if master file (.ssm) not otherwise
auto ins = Inserts();
- ContentsInsertsImages tu
+ ST_contents_inserts_images _cii
= ins.scan_master_src_for_insert_files_and_import_content(_opt_action, sourcefile_body_content, fn_src);
- sourcefile_body_content = tu.contents;
- insert_file_list_get = tu.insert_files.dup;
- images_list_get = tu.images.dup;
+ sourcefile_body_content = _cii.contents;
+ insert_file_list_get = _cii.insert_files.dup;
+ images_list_get = _cii.images.dup;
} else if (_opt_action.source || _opt_action.pod) {
auto ins = Inserts();
- ContentsInsertsImages tu
+ ST_contents_inserts_images _cii
= ins.scan_master_src_for_insert_files_and_import_content(_opt_action, sourcefile_body_content, fn_src);
- images_list_get = tu.images.dup;
+ images_list_get = _cii.images.dup;
} // image_list, if path could take sha256 digests already here?
ubyte[32] src_txt_digest = sourcefile_body_content.sha256Of;
string header_type = "";
ST_doc_parts ret;
{
- ret.header_raw = t.header;
+ ret.header_raw = st.header;
ret.sourcefile_body_content = sourcefile_body_content;
ret.insert_file_list = insert_file_list_get;
ret.images_list = images_list_get;
- ret.header_raw_digest = t.header.sha256Of;
+ ret.header_raw_digest = st.header.sha256Of;
ret.src_txt_digest = sourcefile_body_content.sha256Of;
}
return ret;
@@ -401,15 +401,15 @@ template spineRawMarkupContent() {
<<meta_markup_source_raw_doc_header_and_content_split>>
<<meta_markup_source_raw_source_line_array>>
<<meta_markup_source_raw_read_in_file>>
- <<meta_markup_source_raw_tuple_of_header_and_body>>
+ <<meta_markup_source_raw_struct_of_header_and_body>>
<<meta_markup_source_raw_get_insert_source_line_array>>
}
struct Inserts {
- alias ContentsAndImages = Tuple!(
- char[][], "insert_contents",
- string[], "images"
- );
- ContentsAndImages scan_subdoc_source(O)(
+ struct ST_contents_and_images {
+ char[][] insert_contents;
+ string[] images;
+ }
+ ST_contents_and_images scan_subdoc_source(O)(
O _opt_action,
char[][] markup_sourcefile_insert_content,
string fn_src
@@ -420,7 +420,7 @@ template spineRawMarkupContent() {
} // end src subdoc (inserts) loop
<<meta_inserts_scan_post>>
}
- ContentsInsertsImages scan_master_src_for_insert_files_and_import_content(O)(
+ ST_contents_inserts_images scan_master_src_for_insert_files_and_import_content(O)(
O _opt_action,
char[][] sourcefile_body_content,
string fn_src
@@ -526,9 +526,9 @@ string markupSourceReadIn(in string fn_src) {
- file insert list
- [image list?]
-#+NAME: meta_markup_source_raw_tuple_of_header_and_body
+#+NAME: meta_markup_source_raw_struct_of_header_and_body
#+BEGIN_SRC d
-HeaderContentInsertsImages markupSourceHeaderContentRawLineTupleArray(in string source_txt_str) {
+ST_header_content_inserts_images markupSourceHeaderContentRawLineStructArray(in string source_txt_str) {
string[] file_insert_list = [];
string[] images_list = [];
char[][] hc = header0Content1(source_txt_str);
@@ -537,15 +537,16 @@ HeaderContentInsertsImages markupSourceHeaderContentRawLineTupleArray(in string
char[][] source_line_arr = markupSourceLineArray(source_txt);
ubyte[32] header_digest;
ubyte[32] src_txt_digest;
- HeaderContentInsertsImages t = tuple(
- header,
- source_line_arr,
- file_insert_list,
- images_list,
- header_digest,
- src_txt_digest
- );
- return t;
+ ST_header_content_inserts_images ret;
+ {
+ ret.header = header;
+ ret.src_txt = source_line_arr;
+ ret.insert_files = file_insert_list;
+ ret.images = images_list;
+ ret.header_digest = header_digest;
+ ret.src_txt_digest = src_txt_digest;
+ }
+ return ret;
}
#+END_SRC
@@ -649,11 +650,12 @@ if (code_block_status == codeBlock.curly) {
#+NAME: meta_inserts_scan_post
#+BEGIN_SRC d
-ContentsAndImages t = tuple(
- contents_insert,
- _images
-);
-return t;
+ST_contents_and_images ret;
+{
+ ret.insert_contents = contents_insert;
+ ret.images = _images;
+}
+return ret;
#+END_SRC
*** scan document source :scan_src:
@@ -710,14 +712,14 @@ if (code_block_status == codeBlock.curly) {
);
}
auto ins = Inserts();
- ContentsAndImages contents_insert_tu = ins.scan_subdoc_source(
+ ST_contents_and_images contents_insert_st = ins.scan_subdoc_source(
_opt_action,
markup_sourcefile_insert_content,
fn_src_insert.to!string
);
- contents ~= contents_insert_tu.insert_contents;
+ contents ~= contents_insert_st.insert_contents;
if (_opt_action.source || _opt_action.pod) {
- string[] _image_linelist = _extract_images(contents_insert_tu.images);
+ string[] _image_linelist = _extract_images(contents_insert_st.images);
if (_image_linelist.length > 0) {
_images ~= _image_linelist;
}
@@ -755,12 +757,13 @@ debug(insert_file) {
writeln(__LINE__);
writeln(contents.length);
}
-ContentsInsertsImages t = tuple(
- contents,
- insert_file_list,
- images
-);
-return t;
+ST_contents_inserts_images ret;
+{
+ ret.contents = contents;
+ ret.insert_files = insert_file_list;
+ ret.images = images;
+}
+return ret;
#+END_SRC
* document header including copyright & license