From: Thomas Walker Lynch Date: Wed, 24 Jun 2026 08:57:37 +0000 (+0000) Subject: docs config X-Git-Url: https://git.reasoningtechnology.com/machine%20fig.png?a=commitdiff_plain;h=bdde8fae0770ffa158df9d11adba0735933c8be1;p=RT-Style docs config --- diff --git a/.gitignore b/.gitignore index 5194c58..010247a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,8 +2,6 @@ **/scratchpad/* !**/scratchpad/.gitignore -# so that .gitignore is not required in consumer/release -/consumer/made # Python __pycache__/ diff --git a/0pus_RT-Style b/0pus_RT-Style new file mode 100644 index 0000000..e69de29 diff --git a/0pus_RT-style b/0pus_RT-style deleted file mode 100644 index e69de29..0000000 diff --git a/README.md b/README.md index d899fee..22bad4b 100644 --- a/README.md +++ b/README.md @@ -1,111 +1,27 @@ -# RT-style +# RT-Style -A JavaScript based layout, themes, and semantic elements for HTML documents. Used for documents on RT projects. +RT-Style is a client-side, JavaScript-driven publishing framework designed for Reasoning Technology projects. It transforms raw HTML into high-readability technical documentation. -## To build the library +Instead of wrestling with complex CSS classes or static site generators, authors write structural HTML using custom semantic tags. The RT-Style engine intercepts the DOM at load time to handle complex layout tasks, dynamic pagination, and theme injection. -This project is based on RT's **Harmony** project skeleton. Hence there are role directories. After cloning the repo, go to the top of the project and type: +## Capabilities -```bash -. setup developer -make -release write -``` - -The resulting JavaScript library will be located in `consumer/release/RT`. - -## To use the library - -Using the library requires creating two files, and then including one of them in the document. - -One file is a js dictionary that maps names to style directory paths. The other does some setup and loads the dictionary. - -### 1. The Style Dictionary - -First, create a `style_directory_dict.js` file at a central location in the project. We will refer to this location as ``. This dictionary tells the inclusion engine where the named style directories are located. Suppose that a style directory is located at ``, the dictionary will appear as: - -```javascript -window.StyleRT_namespaces = { - "RT": window.RT_REPO_ROOT + "/consumer/release/RT" -}; -``` - -In the Harmony skeleton, there is a good example of a style dictionary located at `shared/style_directory_dict.js`. The style dictionary in this project is probably not a good example, because, for practical reasons, it points back into the developer's code. - -### 2. The Document Setup Script - -Next, create a `setup.js` script in the same directory with the HTML document. In our projects, this is typically a general document directory that can have many documents. This `setup.js` script sets the relative path back to the project root, loads the `style_directory_dict.js` file, and pulls in the core js code needed for all documents. - -Here is an example `setup.js`. Find other examples in the document directories in this project and other RT projects, such as the Harmony project. - -```javascript -window.RT_REPO_ROOT = ""; -document.write(''); -document.write(''); -document.write(''); -``` +By linking a document to the RT-Style engine, authors can accomplish the following natively in the browser: -### 3. The HTML Document +* **Semantic Abstraction:** Separate structure from presentation using tags like ``, ``, and ``. +* **Dynamic Typography:** Automatically format mathematical equations (``), code blocks (``), and technical symbols without manual styling. +* **Smart Terminology:** Use `` and `` to automatically emphasize and anchor the first occurrence of technical jargon for future indexing. +* **Automated Navigation:** Generate document-aware Tables of Contents (``) that scan heading depths dynamically. +* **Intelligent Pagination:** Break long documents into readable, soft-limited pages that respect paragraph and heading boundaries. +* **Hot-Swappable Themes:** Toggle between dark and light modes seamlessly. -Typically the `style_directory_dict.js` and `setup.js` files are created by an administrator in advance. The same person who creates the `document` directory that the documents live in. +## Initial Setup (Reading the Manuals) -With the bootstrap script in place alongside the HTML file, the document authoring using the style library requires only that `setup.js` is included, as shown in the example code below. +This repository is built on the **Harmony** project skeleton. Because the layout engine is an artifact that must be built, a freshly cloned repository will display raw, unstyled HTML if you attempt to read the manuals immediately. -```html - - - - - Example Document - - +To view the project documentation locally, you must first compile and stage the semantic engine. Navigate to the root of the project and execute: - - - - - - - - - -

Introduction

-

- This is a demonstration of the RT-style engine in action. -

-
- - -``` - -### Using Harmony Conventions - -If the project utilizes the **Harmony** skeleton, these paths map directly to standard locations: - -* `` is `shared/`. -* `` is `shared/third_party/RT-style`. -* The `setup.js` script is placed in the role-specific document folder (e.g., `administrator/document/setup.js`). -* `` is `../../` (stepping up out of `document/` and `administrator/` back to the root). - -Hence, when starting with the Harmony skeleton the `style_directory_dict.js` file will already exist in the `shared` directory, and existing `document` directories will already have a `setup.js` file. - -## Semantic Elements - -The engine targets custom HTML tags to apply formatting and behavior. - -* `` : The primary container for standard documentation. -* `` : Generates a standardized document header. Accepts `title`, `author`, and `date` attributes. -* `` : Automatically generates a Table of Contents. Uses the `level` attribute to target specific heading depths. -* `` / `` : Italicizes the first occurrence of a specific term and generates an anchor ID for indexing. -* `` : Code block formatting with auto-dedentation and syntax highlighting hooks. -* `` : Integration hooks for MathJax rendering. - -## Developer information - -This project follows the **RT Code Format** convention for all JavaScript source files. See the documents in the `developer/document` directory for more information. +```bash +. setup developer +build Manuscript +promote write diff --git a/administrator/document/RT-Style_locator.js b/administrator/document/RT-Style_locator.js index 4ded0e8..39b2706 100644 --- a/administrator/document/RT-Style_locator.js +++ b/administrator/document/RT-Style_locator.js @@ -1,31 +1,48 @@ /* 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 + immediate - used in the RT-Style distribution itself (authored, consumer, 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 + URL-only - always pulls style through a URL, a webserver must be present */ window.RT = window.RT || {}; +// --- Configuration --- +// Define the consumer project name to allow dynamic local file:// calculation. +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/Manuscript"; + (function() { - const project_name = "RT-Style"; - const path = window.location.pathname; - const project_root_index = path.indexOf('/' + project_name + '/'); - - if (project_root_index !== -1) { - // substring(0, x) excludes the trailing slash. We must prepend it to the payload. - const absolute_project_root = path.substring(0, project_root_index + project_name.length + 1); - window.RT.dirpr_library = absolute_project_root + "/consumer/made/Manuscript"; - } else { - // Fallback for when served via local Python HTTP daemon from the project root - window.RT.dirpr_library = "../consumer/made/Manuscript"; + 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) { + // 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); + + // The symlink 'RT-Style' already drops us inside the 'consumer/' directory, + // so we proceed directly to 'Manuscript'. + style_path = absolute_project_root + "/shared/linked-project/RT-Style/Manuscript"; + } else { + console.warn("RT-Style: Cannot locate project root '/" + window.RT.project_name + "/' in URI. Falling back to server_url."); + } } + window.RT.dirpr_library = style_path; + + // 1. Inject the loader script document.write('