From 6d974ce7ba46cdf7410cab462dd1222111942d74 Mon Sep 17 00:00:00 2001 From: Thomas Walker Lynch Date: Tue, 23 Jun 2026 10:53:28 +0000 Subject: [PATCH] docs working --- RT-style.js | 38 -------- .../document/RT-Style_locator.js | 20 +++- administrator/document/how-to_release.html | 2 +- .../tool/deploy_RT-Style_indirect_locators.py | 43 +++++++++ .../document/RT-Style_locator.js | 20 +++- .../document/naming_file-and-directory.html | 2 +- .../single-file_C-module-and-namespace.html | 2 +- .../RT-Style_locator.js | 20 +++- document/introduction_Harmony.html | 2 +- ...role-and-workflow_product-development.html | 2 +- ...role-and-workflow_product-maintenance.html | 2 +- fix.py | 95 ------------------- .../document/RT-Style_locator.js | 20 +++- 13 files changed, 113 insertions(+), 155 deletions(-) delete mode 100644 RT-style.js rename shared/document/RT-style.js => administrator/document/RT-Style_locator.js (71%) create mode 100644 administrator/tool/deploy_RT-Style_indirect_locators.py rename administrator/document/RT-style.js => developer/document/RT-Style_locator.js (71%) rename developer/document/RT-style.js => document/RT-Style_locator.js (71%) delete mode 100755 fix.py rename document/RT-style.js => shared/document/RT-Style_locator.js (71%) diff --git a/RT-style.js b/RT-style.js deleted file mode 100644 index 94ebd32..0000000 --- a/RT-style.js +++ /dev/null @@ -1,38 +0,0 @@ -// RT-style.js -window.RT = window.RT || {}; - -// Configuration -window.RT.project_name = "RT-style"; -window.RT.server_url = "http://localhost:8000/shared/linked-project/RT-style/consumer/made"; - -(function() { - let style_path = window.RT.server_url; - - if (window.RT.project_name) { - const path = window.location.pathname; - const project_root_index = path.indexOf('/' + window.RT.project_name + '/'); - - if (project_root_index !== -1) { - const absolute_project_root = path.substring(0, project_root_index + window.RT.project_name.length + 1); - style_path = absolute_project_root + "/shared/linked-project/RT-style/consumer/made"; - } else { - console.warn("RT-style: Cannot locate project root '/" + window.RT.project_name + "/'. Falling back to server URL."); - } - } - - window.RT.dirpr_library = style_path; - - // 1. Inject the loader script - document.write(' + diff --git a/administrator/tool/deploy_RT-Style_indirect_locators.py b/administrator/tool/deploy_RT-Style_indirect_locators.py new file mode 100644 index 0000000..0f98eae --- /dev/null +++ b/administrator/tool/deploy_RT-Style_indirect_locators.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python3 +import sys +import os +import stat +import shutil +from pathlib import Path + +def deploy_RT_Style_indirect_locators(locator_dir_path): + locator_dir = Path(locator_dir_path) + if not locator_dir.is_dir(): + print(f"Error: Locator directory not found at {locator_dir_path}") + sys.exit(1) + + indirect_js = locator_dir / "indirect.js" + if not indirect_js.exists(): + print("Error: indirect.js missing in the specified directory.") + sys.exit(1) + + repo_home = Path(os.environ.get("REPO_HOME", ".")) + IGNORED_DIRS = {".git"} + + for root, dirs, files in os.walk(repo_home): + # Prune ignored directories in place + dirs[:] = [d for d in dirs if d not in IGNORED_DIRS] + + current_path = Path(root) + if current_path.name.lower() == "document": + target_file = current_path / "RT-Style_locator.js" + + # Eliminate permission denial on read-only artifacts + if target_file.exists(): + target_file.chmod(target_file.stat().st_mode | stat.S_IWUSR) + + shutil.copyfile(indirect_js, target_file) + print(f"Copied indirect.js -> {target_file}") + +if __name__ == "__main__": + if len(sys.argv) != 2: + print("Usage: python3 deploy_RT_Style_indirect_locators.py ") + sys.exit(1) + + deploy_RT_Style_indirect_locators(sys.argv[1]) + diff --git a/administrator/document/RT-style.js b/developer/document/RT-Style_locator.js similarity index 71% rename from administrator/document/RT-style.js rename to developer/document/RT-Style_locator.js index f5a7c75..f338031 100644 --- a/administrator/document/RT-style.js +++ b/developer/document/RT-Style_locator.js @@ -1,4 +1,13 @@ -// RT-style.js (External consumer project router) +/* + We have four scenarios + + immediate - used in the RT-Style distribution itself (authored, consummer, staged) + direct - used in the RT-Style project itself, but not in the distribution + indirect - the version all Harmony projects use + URL_only - always pulls style through a URL, a webserver must be present + +*/ + window.RT = window.RT || {}; // --- Configuration --- @@ -6,7 +15,7 @@ window.RT = window.RT || {}; window.RT.project_name = "Harmony"; // Fallback URL when served over a network where the project root is not in the URI. -window.RT.server_url = "http://localhost:8000/shared/linked-project/RT-style/consumer/made/Manuscript"; +window.RT.server_url = "http://localhost:8000/shared/linked-project/RT-Style/made/Manuscript"; (function() { let style_path = window.RT.server_url; @@ -19,9 +28,12 @@ window.RT.server_url = "http://localhost:8000/shared/linked-project/RT-style/con // substring(0, stop) extracts up to the project name, leaving off the trailing slash. // We append the explicit forward slash before navigating into the shared boundary. const absolute_project_root = path.substring(0, project_root_index + window.RT.project_name.length + 1); - style_path = absolute_project_root + "/shared/linked-project/RT-style/consumer/made/Manuscript"; + + // The symlink 'RT-Style' already drops us inside the 'consumer/' directory, + // so we proceed directly to 'made/Manuscript'. + style_path = absolute_project_root + "/shared/linked-project/RT-Style/made/Manuscript"; } else { - console.warn("RT-style: Cannot locate project root '/" + window.RT.project_name + "/' in URI. Falling back to server_url."); + console.warn("RT-Style: Cannot locate project root '/" + window.RT.project_name + "/' in URI. Falling back to server_url."); } } diff --git a/developer/document/naming_file-and-directory.html b/developer/document/naming_file-and-directory.html index a8fad1e..07e8d67 100644 --- a/developer/document/naming_file-and-directory.html +++ b/developer/document/naming_file-and-directory.html @@ -3,7 +3,7 @@ File and directory naming conventions - + diff --git a/developer/document/single-file_C-module-and-namespace.html b/developer/document/single-file_C-module-and-namespace.html index db0e657..61acebe 100644 --- a/developer/document/single-file_C-module-and-namespace.html +++ b/developer/document/single-file_C-module-and-namespace.html @@ -3,7 +3,7 @@ C modules, namespaces, and the build lifecycle - + diff --git a/developer/document/RT-style.js b/document/RT-Style_locator.js similarity index 71% rename from developer/document/RT-style.js rename to document/RT-Style_locator.js index f5a7c75..f338031 100644 --- a/developer/document/RT-style.js +++ b/document/RT-Style_locator.js @@ -1,4 +1,13 @@ -// RT-style.js (External consumer project router) +/* + We have four scenarios + + immediate - used in the RT-Style distribution itself (authored, consummer, staged) + direct - used in the RT-Style project itself, but not in the distribution + indirect - the version all Harmony projects use + URL_only - always pulls style through a URL, a webserver must be present + +*/ + window.RT = window.RT || {}; // --- Configuration --- @@ -6,7 +15,7 @@ window.RT = window.RT || {}; window.RT.project_name = "Harmony"; // Fallback URL when served over a network where the project root is not in the URI. -window.RT.server_url = "http://localhost:8000/shared/linked-project/RT-style/consumer/made/Manuscript"; +window.RT.server_url = "http://localhost:8000/shared/linked-project/RT-Style/made/Manuscript"; (function() { let style_path = window.RT.server_url; @@ -19,9 +28,12 @@ window.RT.server_url = "http://localhost:8000/shared/linked-project/RT-style/con // substring(0, stop) extracts up to the project name, leaving off the trailing slash. // We append the explicit forward slash before navigating into the shared boundary. const absolute_project_root = path.substring(0, project_root_index + window.RT.project_name.length + 1); - style_path = absolute_project_root + "/shared/linked-project/RT-style/consumer/made/Manuscript"; + + // The symlink 'RT-Style' already drops us inside the 'consumer/' directory, + // so we proceed directly to 'made/Manuscript'. + style_path = absolute_project_root + "/shared/linked-project/RT-Style/made/Manuscript"; } else { - console.warn("RT-style: Cannot locate project root '/" + window.RT.project_name + "/' in URI. Falling back to server_url."); + console.warn("RT-Style: Cannot locate project root '/" + window.RT.project_name + "/' in URI. Falling back to server_url."); } } diff --git a/document/introduction_Harmony.html b/document/introduction_Harmony.html index e0ff0ca..1bf20f4 100644 --- a/document/introduction_Harmony.html +++ b/document/introduction_Harmony.html @@ -3,7 +3,7 @@ Introduction to Harmony - + diff --git a/document/role-and-workflow_product-development.html b/document/role-and-workflow_product-development.html index 47c5b2a..2a4f655 100644 --- a/document/role-and-workflow_product-development.html +++ b/document/role-and-workflow_product-development.html @@ -3,7 +3,7 @@ Product development roles and workflow - + diff --git a/document/role-and-workflow_product-maintenance.html b/document/role-and-workflow_product-maintenance.html index e2c59db..1f76dd0 100644 --- a/document/role-and-workflow_product-maintenance.html +++ b/document/role-and-workflow_product-maintenance.html @@ -3,7 +3,7 @@ Product maintenance roles and workflow - + diff --git a/fix.py b/fix.py deleted file mode 100755 index 555cbe6..0000000 --- a/fix.py +++ /dev/null @@ -1,95 +0,0 @@ -#!/usr/bin/env python3 -# -*- mode: python; coding: utf-8; python-indent-offset: 2; indent-tabs-mode: nil -*- - -import os ,sys - -def process_file(file_path ,replacements) -> bool: - try: - with open(file_path ,"r" ,encoding="utf-8") as f: - content = f.read() - except UnicodeDecodeError: - return False - - new_content = content - for old_str ,new_str in replacements: - new_content = new_content.replace(old_str ,new_str) - - if new_content != content: - with open(file_path ,"w" ,encoding="utf-8") as f: - f.write(new_content) - return True - return False - -def work(root_dir: str) -> list[str]: - replacements = [ - ("shared/linked-project" ,"shared/linked-project") - ,("linked-project/" ,"linked-project/") - ,("how-to_release.html" ,"how-to_release.html") - ,("naming_file-and-directory.html" ,"naming_file-and-directory.html") - ,("format_RT-code.html" ,"format_RT-code.html") - ,("format_RT-code.html" ,"format_RT-code.html") - ,("format_RT-code-Lisp.html" ,"format_RT-code-Lisp.html") - ,("single-file_C-module-and-namespace.html" ,"single-file_C-module-and-namespace.html") - ,("developer/tool/do-all" ,"developer/tool/do-all") - ,("introduction_Harmony.html" ,"introduction_Harmony.html") - ,("role-and-workflow_product-development.html" ,"role-and-workflow_product-development.html") - ,("role-and-workflow_product-development.html" ,"role-and-workflow_product-development.html") - ,("role-and-workflow_product-maintenance.html" ,"role-and-workflow_product-maintenance.html") - ,("installation_Python.org" ,"installation_Python.org") - ,("installation_generic.org" ,"installation_generic.org") - ,("dictionary_style-directory.js" ,"dictionary_style-directory.js") - ,("target_kernel-module.mk" ,"target_kernel-module.mk") - ,("tester/RT-formatter" ,"tester/RT-formatter") - ,("RT-formatter pipe" ,"RT-formatter pipe") - ,("RT-formatter pipe" ,"RT-formatter pipe") - ,("RT-formatter-buffer" ,"RT-formatter-buffer") - ,("RT-formatter-buffer" ,"RT-formatter-buffer") - ,("RT-formatter-buffer" ,"RT-formatter-buffer") - ,("RT-formatter-buffer" ,"RT-formatter-buffer") - ,("\"RTfmt\"" ,"\"RT-formatter\"") - ,("\"RTfmt0\"" ,"\"RT-formatter\"") - ,("\"RT_format\"" ,"\"RT-formatter\"") - ,("RT-formatter formatting" ,"RT-formatter formatting") - ,("RT-formatter failed" ,"RT-formatter failed") - ,("RT-formatter formatting" ,"RT-formatter formatting") - ,("RT-formatter failed" ,"RT-formatter failed") - ,("data_test-0.c" ,"data_test-0.c") - ,("data_test-1.py" ,"data_test-1.py") - ,("RT-formatter.el" ,"RT-formatter.el") - ,("RT-formatter.el" ,"RT-formatter.el") - ,("RT-formatter.el" ,"RT-formatter.el") - ] - - changed_files = [] - - for dirpath ,dirnames ,filenames in os.walk(root_dir): - path_parts = dirpath.split(os.sep) - if ".git" in path_parts or "scratchpad" in path_parts: - continue - - for fn in filenames: - if fn.endswith(".tar") or fn.endswith(".tar.gz") or fn.endswith(".zip"): - continue - - fp = os.path.join(dirpath ,fn) - if process_file(fp ,replacements): - changed_files.append(fp) - - return changed_files - -def CLI(argv=None) -> int: - root_dir = "." - print(f"Scanning '{root_dir}' for outdated internal references...") - changed = work(root_dir) - - if not changed: - print("No references needed updating.") - else: - print(f"Updated internal references in {len(changed)} files:") - for fp in changed: - print(f" {fp}") - - return 0 - -if __name__ == "__main__": - sys.exit(CLI()) diff --git a/document/RT-style.js b/shared/document/RT-Style_locator.js similarity index 71% rename from document/RT-style.js rename to shared/document/RT-Style_locator.js index f5a7c75..f338031 100644 --- a/document/RT-style.js +++ b/shared/document/RT-Style_locator.js @@ -1,4 +1,13 @@ -// RT-style.js (External consumer project router) +/* + We have four scenarios + + immediate - used in the RT-Style distribution itself (authored, consummer, staged) + direct - used in the RT-Style project itself, but not in the distribution + indirect - the version all Harmony projects use + URL_only - always pulls style through a URL, a webserver must be present + +*/ + window.RT = window.RT || {}; // --- Configuration --- @@ -6,7 +15,7 @@ window.RT = window.RT || {}; window.RT.project_name = "Harmony"; // Fallback URL when served over a network where the project root is not in the URI. -window.RT.server_url = "http://localhost:8000/shared/linked-project/RT-style/consumer/made/Manuscript"; +window.RT.server_url = "http://localhost:8000/shared/linked-project/RT-Style/made/Manuscript"; (function() { let style_path = window.RT.server_url; @@ -19,9 +28,12 @@ window.RT.server_url = "http://localhost:8000/shared/linked-project/RT-style/con // substring(0, stop) extracts up to the project name, leaving off the trailing slash. // We append the explicit forward slash before navigating into the shared boundary. const absolute_project_root = path.substring(0, project_root_index + window.RT.project_name.length + 1); - style_path = absolute_project_root + "/shared/linked-project/RT-style/consumer/made/Manuscript"; + + // The symlink 'RT-Style' already drops us inside the 'consumer/' directory, + // so we proceed directly to 'made/Manuscript'. + style_path = absolute_project_root + "/shared/linked-project/RT-Style/made/Manuscript"; } else { - console.warn("RT-style: Cannot locate project root '/" + window.RT.project_name + "/' in URI. Falling back to server_url."); + console.warn("RT-Style: Cannot locate project root '/" + window.RT.project_name + "/' in URI. Falling back to server_url."); } } -- 2.20.1