aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sisudoc
diff options
context:
space:
mode:
Diffstat (limited to 'src/sisudoc')
-rw-r--r--src/sisudoc/io_in/read_source_files.d35
-rw-r--r--src/sisudoc/meta/metadoc.d7
-rw-r--r--src/sisudoc/meta/metadoc_from_src.d6
3 files changed, 27 insertions, 21 deletions
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);
}