diff options
-rw-r--r-- | org/in_source_files.org | 35 | ||||
-rw-r--r-- | org/ocda.org | 4 | ||||
-rw-r--r-- | org/spine.org | 12 | ||||
-rw-r--r-- | src/sisudoc/io_in/read_source_files.d | 35 | ||||
-rw-r--r-- | src/sisudoc/meta/metadoc.d | 7 | ||||
-rw-r--r-- | src/sisudoc/meta/metadoc_from_src.d | 6 |
6 files changed, 56 insertions, 43 deletions
diff --git a/org/in_source_files.org b/org/in_source_files.org index baffefb..8df3ded 100644 --- a/org/in_source_files.org +++ b/org/in_source_files.org @@ -330,18 +330,20 @@ template spineRawMarkupContent() { char[][] src_txt; string[] insert_files; string[] images; - ubyte[32] header_digest; - ubyte[32] src_txt_digest; + } + struct ST_doc_digest { + ubyte[32] markup_doc; + ubyte[32] header; + ubyte[32] text; } 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; + char[] header_raw; + char[][] sourcefile_body_content; + string[] insert_file_list; + string[] images_list; + ST_doc_digest doc_digest; } - auto spineRawMarkupContent(O,Fn)(O _opt_action, Fn fn_src) { + ST_doc_parts spineRawMarkupContent(O,Fn)(O _opt_action, Fn fn_src) { 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_struct; @@ -364,7 +366,6 @@ template spineRawMarkupContent() { 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(); @@ -379,16 +380,20 @@ template spineRawMarkupContent() { = ins.scan_master_src_for_insert_files_and_import_content(_opt_action, sourcefile_body_content, fn_src); 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_digest dig; + { + dig.markup_doc = source_txt_str.sha256Of; + dig.header = st.header.sha256Of; + dig.text = sourcefile_body_content.sha256Of; + } ST_doc_parts ret; { 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 = st.header.sha256Of; - ret.src_txt_digest = sourcefile_body_content.sha256Of; + ret.doc_digest = dig; } return ret; } @@ -535,16 +540,12 @@ ST_header_content_inserts_images markupSourceHeaderContentRawLineStructArray(in char[] header = hc[0]; char[] source_txt = hc[1]; char[][] source_line_arr = markupSourceLineArray(source_txt); - ubyte[32] header_digest; - ubyte[32] src_txt_digest; 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; } diff --git a/org/ocda.org b/org/ocda.org index 9811545..946dcb9 100644 --- a/org/ocda.org +++ b/org/ocda.org @@ -1075,8 +1075,8 @@ if (_images.length > 0) { // read_image auto data = (cast(byte[]) (manifested.src.image_dir_path ~ "/" ~ img).read); // calculate, digest, hash - writefln("%s\n%-(%02x%)::%s ⋅ %s", img, data.sha256Of, data.length, img); - writefln("%-(%02x%) ⋅ %s ⋅ %s", data.sha256Of, img, data.length); + writeln(img, "\n", data.sha256Of.toHexString, "::", data.length, " ", img); + writeln(data.sha256Of.toHexString, " ", img, " ", data.length); } catch (Exception ex) { writeln("WARNING, image not found: ", img, "\n ", manifested.src.image_dir_path ~ "/" ~ img); } diff --git a/org/spine.org b/org/spine.org index 56cb3f7..879424b 100644 --- a/org/spine.org +++ b/org/spine.org @@ -161,7 +161,9 @@ import #+NAME: imports_spine_metadoc #+BEGIN_SRC d import - std.datetime; + std.datetime, + std.digest.crc, + std.digest.sha; import sisudoc.meta, sisudoc.meta.metadoc_from_src, @@ -1478,13 +1480,14 @@ template spineAbstraction() { <<spine_each_file_do_split_dr_markup_file_header_into_make_and_meta_structs>> <<spine_each_file_do_document_abstraction>> <<spine_each_file_do_document_matters_msg_step4_start>> - <<spine_each_file_do_document_matters_0_struct_open>> + struct DocumentMatters { <<spine_each_file_do_document_matters_1_detail_program_time>> <<spine_each_file_do_document_matters_2_meta>> <<spine_each_file_do_document_matters_3_env>> <<spine_each_file_do_document_matters_4_opt>> <<spine_each_file_do_document_matters_5_doc>> - <<spine_each_file_do_document_matters_6_struct_close_gather>> + } + auto doc_matters = DocumentMatters(); <<spine_each_file_do_document_matters_msg_step4_end>> auto t = tuple(doc_abstraction, doc_matters); return t; @@ -1530,6 +1533,9 @@ if ((_opt_action.debug_do) } auto _header_body_insertfilelist_imagelist = spineRawMarkupContent!()(_opt_action, _manifest.src.path_and_fn); +writeln("src doc digest: ", _header_body_insertfilelist_imagelist.doc_digest.markup_doc.toHexString, " ", _header_body_insertfilelist_imagelist.doc_digest.markup_doc.toHexString.length); +writeln("header: ", _header_body_insertfilelist_imagelist.doc_digest.header.toHexString, " ", _header_body_insertfilelist_imagelist.doc_digest.header.toHexString.length); +writeln("text: ", _header_body_insertfilelist_imagelist.doc_digest.text.toHexString, " ", _header_body_insertfilelist_imagelist.doc_digest.text.toHexString.length); if ((_opt_action.debug_do) || (_opt_action.debug_do_stages) ) { diff --git a/src/sisudoc/io_in/read_source_files.d b/src/sisudoc/io_in/read_source_files.d index 34ec9a9..80b3d71 100644 --- a/src/sisudoc/io_in/read_source_files.d +++ b/src/sisudoc/io_in/read_source_files.d @@ -88,18 +88,20 @@ template spineRawMarkupContent() { char[][] src_txt; string[] insert_files; string[] images; - ubyte[32] header_digest; - ubyte[32] src_txt_digest; + } + struct ST_doc_digest { + ubyte[32] markup_doc; + ubyte[32] header; + ubyte[32] text; } 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; + char[] header_raw; + char[][] sourcefile_body_content; + string[] insert_file_list; + string[] images_list; + ST_doc_digest doc_digest; } - auto spineRawMarkupContent(O,Fn)(O _opt_action, Fn fn_src) { + ST_doc_parts spineRawMarkupContent(O,Fn)(O _opt_action, Fn fn_src) { 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_struct; @@ -122,7 +124,6 @@ template spineRawMarkupContent() { 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(); @@ -137,16 +138,20 @@ template spineRawMarkupContent() { = ins.scan_master_src_for_insert_files_and_import_content(_opt_action, sourcefile_body_content, fn_src); 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_digest dig; + { + dig.markup_doc = source_txt_str.sha256Of; + dig.header = st.header.sha256Of; + dig.text = sourcefile_body_content.sha256Of; + } ST_doc_parts ret; { 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 = st.header.sha256Of; - ret.src_txt_digest = sourcefile_body_content.sha256Of; + ret.doc_digest = dig; } return ret; } @@ -213,16 +218,12 @@ template spineRawMarkupContent() { char[] header = hc[0]; char[] source_txt = hc[1]; char[][] source_line_arr = markupSourceLineArray(source_txt); - ubyte[32] header_digest; - ubyte[32] src_txt_digest; 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; } diff --git a/src/sisudoc/meta/metadoc.d b/src/sisudoc/meta/metadoc.d index ed9a5b1..035f57e 100644 --- a/src/sisudoc/meta/metadoc.d +++ b/src/sisudoc/meta/metadoc.d @@ -51,7 +51,9 @@ module sisudoc.meta.metadoc; @safe: template spineAbstraction() { import - std.datetime; + std.datetime, + std.digest.crc, + std.digest.sha; import sisudoc.meta, sisudoc.meta.metadoc_from_src, @@ -88,6 +90,9 @@ template spineAbstraction() { } auto _header_body_insertfilelist_imagelist = spineRawMarkupContent!()(_opt_action, _manifest.src.path_and_fn); + writeln("src doc digest: ", _header_body_insertfilelist_imagelist.doc_digest.markup_doc.toHexString, " ", _header_body_insertfilelist_imagelist.doc_digest.markup_doc.toHexString.length); + writeln("header: ", _header_body_insertfilelist_imagelist.doc_digest.header.toHexString, " ", _header_body_insertfilelist_imagelist.doc_digest.header.toHexString.length); + writeln("text: ", _header_body_insertfilelist_imagelist.doc_digest.text.toHexString, " ", _header_body_insertfilelist_imagelist.doc_digest.text.toHexString.length); if ((_opt_action.debug_do) || (_opt_action.debug_do_stages) ) { diff --git a/src/sisudoc/meta/metadoc_from_src.d b/src/sisudoc/meta/metadoc_from_src.d index 4bd747d..c9112ef 100644 --- a/src/sisudoc/meta/metadoc_from_src.d +++ b/src/sisudoc/meta/metadoc_from_src.d @@ -971,7 +971,7 @@ template docAbstraction() { } obj = _links(obj); } - if (the_document_toc_section.length > 1) { // writeln("toc"); // scroll + if (the_document_toc_section.length > 1) { // writeln("toc"); // scroll dom_structure_markedup_tags_status_buffer = dom_structure_markedup_tags_status.dup; dom_structure_collapsed_tags_status_buffer = dom_structure_collapsed_tags_status.dup; foreach (ref obj; the_document_toc_section) { @@ -1044,8 +1044,8 @@ template docAbstraction() { // read_image auto data = (cast(byte[]) (manifested.src.image_dir_path ~ "/" ~ img).read); // calculate, digest, hash - writefln("%s\n%-(%02x%)::%s ⋅ %s", img, data.sha256Of, data.length, img); - writefln("%-(%02x%) ⋅ %s ⋅ %s", data.sha256Of, img, data.length); + writeln(img, "\n", data.sha256Of.toHexString, "::", data.length, " ", img); + writeln(data.sha256Of.toHexString, " ", img, " ", data.length); } catch (Exception ex) { writeln("WARNING, image not found: ", img, "\n ", manifested.src.image_dir_path ~ "/" ~ img); } |