diff options
| author | Ralph Amissah <ralph.amissah@gmail.com> | 2026-09-21 14:29:48 -0400 |
|---|---|---|
| committer | Ralph Amissah <ralph.amissah@gmail.com> | 2026-09-22 17:16:20 -0400 |
| commit | 9f93ed4ced8e7434b89e93b50c3464e34e4767fb (patch) | |
| tree | 39b0762b86687888b9438db61d26051048f9274f | |
| parent | check required tools; skipped test is incomplete (diff) | |
cleanup: misc. (previously deferred)
dr_document_make in three identifier spellings becomes document_make,
which is what the file has been called since the rename.
The mixin import audit, a template declares its imports at template
scope and they are then visible in every scope it is mixed into (which
is how a template-level split once hijacked a UFCS lookup in code that
had not been touched). Disabling htmlSnippet's imports and rebuilding
names the consumers that were relying on them rather than on their own:
across twelve mixin sites, exactly one. metadata.d now imports the `to`
it uses. The templates keep their imports, their own functions needing
them, and narrowing those is a change of its own rather than a cleanup.
And the standing FIX in source_pod.d: the insert digest line for a non
pod source recorded the insert's path, where every other line in
digests.txt is a filename and a digest naming a file that is not in
the pod under that name cannot be checked against it.
(assisted by Claude-Code)
| -rw-r--r-- | org/default_paths.org | 2 | ||||
| -rw-r--r-- | org/default_shared_snippets.org | 7 | ||||
| -rw-r--r-- | org/in_markup_source_files.org | 2 | ||||
| -rw-r--r-- | org/out_metadata.org | 6 | ||||
| -rw-r--r-- | org/out_src_pod.org | 12 | ||||
| -rw-r--r-- | src/sisudoc/ocda/io_in/paths_source.d | 2 | ||||
| -rw-r--r-- | src/sisudoc/ocda/io_in/read_config_files.d | 2 | ||||
| -rw-r--r-- | src/sisudoc/outputs/io_out/html_snippet.d | 7 | ||||
| -rw-r--r-- | src/sisudoc/outputs/io_out/metadata.d | 6 | ||||
| -rw-r--r-- | src/sisudoc/outputs/io_out/source_pod.d | 12 |
10 files changed, 48 insertions, 10 deletions
diff --git a/org/default_paths.org b/org/default_paths.org index 27caf8b..f10f131 100644 --- a/org/default_paths.org +++ b/org/default_paths.org @@ -524,7 +524,7 @@ template configFilePaths() { } auto possible_config_path_locations() { struct _ConfFilePaths { - string[] dr_document_make() { + string[] document_make() { /+ FIX clean up conf paths ↓ +/ /+ config local site (file system only, not in pod) +/ /+ return paths +/ diff --git a/org/default_shared_snippets.org b/org/default_shared_snippets.org index a4a09cc..acdcee0 100644 --- a/org/default_shared_snippets.org +++ b/org/default_shared_snippets.org @@ -26,6 +26,13 @@ <<doc_header_including_copyright_and_license>> module sisudoc.outputs.io_out.html_snippet; @safe: +/+ ↓ these are at template scope, so they are visible in every scope this + template is mixed into: twelve of them, across the output writers. + Removing them leaves one consumer that was relying on the leak rather than + on its own imports, and that one now imports what it uses. They stay here + because the template's own functions need them, and narrowing them to those + functions is a change of its own rather than a cleanup. FIX later. ++/ template htmlSnippet() { import std.file; import std.outbuffer; diff --git a/org/in_markup_source_files.org b/org/in_markup_source_files.org index 8d8367e..68de6fb 100644 --- a/org/in_markup_source_files.org +++ b/org/in_markup_source_files.org @@ -198,7 +198,7 @@ static template readConfigDoc() { string config_file_str; string conf_filename = "NONE"; auto _conf_file_details = configFilePaths!()(_manifested, _env); - string[] possible_config_path_locations = _conf_file_details.possible_config_path_locations.dr_document_make; + string[] possible_config_path_locations = _conf_file_details.possible_config_path_locations.document_make; foreach(conf_fn; [_conf_file_details.config_filename_document]) { foreach(pth; possible_config_path_locations) { char[] conf_file = ((chainPath(pth.to!string, conf_fn)).asNormalizedPath).array; diff --git a/org/out_metadata.org b/org/out_metadata.org index 3a17ffe..2c210e6 100644 --- a/org/out_metadata.org +++ b/org/out_metadata.org @@ -29,6 +29,12 @@ module sisudoc.outputs.io_out.metadata; // @safe: template outputMetadata() { void outputMetadata(T)(T doc_matters) { + /+ ↓ this module used to get `to` from htmlSnippet, which it mixes in below + and which imports it at template scope (a module should not depend on + what a mixin happens to bring with it: the name could go with a change + to that template, and until then it is invisible here). + +/ + import std.conv : to; <<curated_html_search>> <<output_imports>> <<curated_html_themes_0>> diff --git a/org/out_src_pod.org b/org/out_src_pod.org index b4bbde3..c1fc178 100644 --- a/org/out_src_pod.org +++ b/org/out_src_pod.org @@ -490,12 +490,18 @@ auto pod_zipMakeReady(M,P,S)(M doc_matters, P pths_pod, S _st) { auto fn_src_in = insert_file; /+ ↓ keyed on the document's own language, not on hard-coded "en". The emit loop looks each key up in the manifest's language list. - FIX likely bug: insert_file still includes its path, and the - line wants the filename as the pod carries it. + . + Named as the pod carries it, by filename: insert_file is a path + here, where every other line in digests.txt is a filename, and a + digest line naming a file that is not in the pod under that name + cannot be checked against it. The import is local, not added to + this template's imports, which are visible in every scope it is + mixed into. +/ if (exists(fn_src_in)) { // take DIGEST write to pod file digests.txt + import std.path : baseName; ST_file_stat file_ = getFileStat(fn_src_in); - _digests[doc_matters.src.language]["ssi"] ~= file_.sha256hash.toHexString ~ "::" ~ file_.fileSize.to!string ~ " - " ~ insert_file ~ "\n"; + _digests[doc_matters.src.language]["ssi"] ~= file_.sha256hash.toHexString ~ "::" ~ file_.fileSize.to!string ~ " - " ~ insert_file.baseName ~ "\n"; } auto fn_src_out_pod_zip_base = pths_pod.fn_doc_insert( diff --git a/src/sisudoc/ocda/io_in/paths_source.d b/src/sisudoc/ocda/io_in/paths_source.d index 125d6f1..c2ac0ab 100644 --- a/src/sisudoc/ocda/io_in/paths_source.d +++ b/src/sisudoc/ocda/io_in/paths_source.d @@ -506,7 +506,7 @@ template configFilePaths() { } auto possible_config_path_locations() { struct _ConfFilePaths { - string[] dr_document_make() { + string[] document_make() { /+ FIX clean up conf paths ↓ +/ /+ config local site (file system only, not in pod) +/ /+ return paths +/ diff --git a/src/sisudoc/ocda/io_in/read_config_files.d b/src/sisudoc/ocda/io_in/read_config_files.d index 849705a..00c054c 100644 --- a/src/sisudoc/ocda/io_in/read_config_files.d +++ b/src/sisudoc/ocda/io_in/read_config_files.d @@ -202,7 +202,7 @@ static template readConfigDoc() { string config_file_str; string conf_filename = "NONE"; auto _conf_file_details = configFilePaths!()(_manifested, _env); - string[] possible_config_path_locations = _conf_file_details.possible_config_path_locations.dr_document_make; + string[] possible_config_path_locations = _conf_file_details.possible_config_path_locations.document_make; foreach(conf_fn; [_conf_file_details.config_filename_document]) { foreach(pth; possible_config_path_locations) { char[] conf_file = ((chainPath(pth.to!string, conf_fn)).asNormalizedPath).array; diff --git a/src/sisudoc/outputs/io_out/html_snippet.d b/src/sisudoc/outputs/io_out/html_snippet.d index f960cea..462e78a 100644 --- a/src/sisudoc/outputs/io_out/html_snippet.d +++ b/src/sisudoc/outputs/io_out/html_snippet.d @@ -49,6 +49,13 @@ +/ module sisudoc.outputs.io_out.html_snippet; @safe: +/+ ↓ these are at template scope, so they are visible in every scope this + template is mixed into: twelve of them, across the output writers. + Removing them leaves one consumer that was relying on the leak rather than + on its own imports, and that one now imports what it uses. They stay here + because the template's own functions need them, and narrowing them to those + functions is a change of its own rather than a cleanup. FIX later. ++/ template htmlSnippet() { import std.file; import std.outbuffer; diff --git a/src/sisudoc/outputs/io_out/metadata.d b/src/sisudoc/outputs/io_out/metadata.d index c54c9af..e90ea8f 100644 --- a/src/sisudoc/outputs/io_out/metadata.d +++ b/src/sisudoc/outputs/io_out/metadata.d @@ -51,6 +51,12 @@ module sisudoc.outputs.io_out.metadata; // @safe: template outputMetadata() { void outputMetadata(T)(T doc_matters) { + /+ ↓ this module used to get `to` from htmlSnippet, which it mixes in below + and which imports it at template scope (a module should not depend on + what a mixin happens to bring with it: the name could go with a change + to that template, and until then it is invisible here). + +/ + import std.conv : to; string inline_search_form(M)( M doc_matters, ) { diff --git a/src/sisudoc/outputs/io_out/source_pod.d b/src/sisudoc/outputs/io_out/source_pod.d index f6d7765..09ddc74 100644 --- a/src/sisudoc/outputs/io_out/source_pod.d +++ b/src/sisudoc/outputs/io_out/source_pod.d @@ -521,12 +521,18 @@ template spinePod() { auto fn_src_in = insert_file; /+ ↓ keyed on the document's own language, not on hard-coded "en". The emit loop looks each key up in the manifest's language list. - FIX likely bug: insert_file still includes its path, and the - line wants the filename as the pod carries it. + . + Named as the pod carries it, by filename: insert_file is a path + here, where every other line in digests.txt is a filename, and a + digest line naming a file that is not in the pod under that name + cannot be checked against it. The import is local, not added to + this template's imports, which are visible in every scope it is + mixed into. +/ if (exists(fn_src_in)) { // take DIGEST write to pod file digests.txt + import std.path : baseName; ST_file_stat file_ = getFileStat(fn_src_in); - _digests[doc_matters.src.language]["ssi"] ~= file_.sha256hash.toHexString ~ "::" ~ file_.fileSize.to!string ~ " - " ~ insert_file ~ "\n"; + _digests[doc_matters.src.language]["ssi"] ~= file_.sha256hash.toHexString ~ "::" ~ file_.fileSize.to!string ~ " - " ~ insert_file.baseName ~ "\n"; } auto fn_src_out_pod_zip_base = pths_pod.fn_doc_insert( |
