From aeab925725fccb58df17f716ea0e5e8fd6dcd275 Mon Sep 17 00:00:00 2001 From: Thomas Walker Lynch Date: Tue, 30 Jun 2026 13:32:43 +0000 Subject: [PATCH] working - some cleanup and syncing the manual to the code --- .../Manuscript.copy/Core/state_manager-0.js | 178 -------- .../Manuscript.copy/Core/theme_make.js | 205 +++++---- .../Manuscript.copy/Document/manual.html | 181 +++++--- .../Manuscript.copy/Element/footnote.js | 4 + .../authored/Manuscript.copy/Element/noop.js | 6 + .../Manuscript.copy/Element/symbol.js | 28 -- .../Layout/article_tech_ref.js | 39 +- .../Manuscript.copy/Layout/memo_State.js | 6 +- .../Manuscript.copy/Layout/paginate-0.js | 419 ------------------ .../Manuscript.copy/Theme/golden_wheat.js | 126 +++--- .../Manuscript.copy/Theme/inverse_wheat.js | 127 +++--- .../authored/Manuscript.copy/Theme/wheat.js | 123 ++--- developer/tool/promote | 15 +- tester/authored/Counter/test_1.html | 184 ++++++++ tester/authored/Counter/test_2.html | 184 ++++++++ 15 files changed, 864 insertions(+), 961 deletions(-) delete mode 100644 developer/authored/Manuscript.copy/Core/state_manager-0.js create mode 100644 developer/authored/Manuscript.copy/Element/footnote.js create mode 100644 developer/authored/Manuscript.copy/Element/noop.js delete mode 100644 developer/authored/Manuscript.copy/Element/symbol.js delete mode 100644 developer/authored/Manuscript.copy/Layout/paginate-0.js create mode 100644 tester/authored/Counter/test_1.html create mode 100644 tester/authored/Counter/test_2.html diff --git a/developer/authored/Manuscript.copy/Core/state_manager-0.js b/developer/authored/Manuscript.copy/Core/state_manager-0.js deleted file mode 100644 index f28bf8b..0000000 --- a/developer/authored/Manuscript.copy/Core/state_manager-0.js +++ /dev/null @@ -1,178 +0,0 @@ -/* - Core/stage_manager.js - Orchestrates the execution pipeline to resolve layout dependencies, - manages MathJax async typesetting, and handles scroll restoration. -*/ - -window.RT = window.RT || {}; -window.RT.Element = window.RT.Element || new Set(); -window.RT.PageStyle = window.RT.PageStyle || new Set(); -window.RT.paginate = null; - -(function(){ - const debug = window.RT.Debug || { log: function(){}, warn: function(){}, error: function(){} }; - - let target_y = 0; - let is_reload = false; - let is_layout_locked = false; - let scroll_timer; - - function lock_layout() { - is_layout_locked = true; - document.documentElement.style.visibility = "hidden"; - } - - function unlock_layout() { - if (!is_layout_locked) return; - is_layout_locked = false; - - document.documentElement.style.visibility = ""; - window.removeEventListener("load", unlock_layout); - document.dispatchEvent(new Event("RT_layout_complete")); - } - - function configure_history(){ - if ('scrollRestoration' in history) { - history.scrollRestoration = 'manual'; - } - } - - function capture_scroll_target(){ - const raw_target = sessionStorage.getItem('RT_saved_y'); - target_y = raw_target !== null ? parseInt(raw_target ,10) : 0; - - if (window.performance) { - const nav_entries = performance.getEntriesByType("navigation"); - if (nav_entries.length > 0) { - is_reload = (nav_entries[0].type === "reload"); - } else if (performance.navigation) { - is_reload = (performance.navigation.type === 1); - } - } - } - - function enforce_scroll(target ,use_hash ,attempts){ - if (attempts > 15) { - unlock_layout(); - return; - } - - if (use_hash) { - const hash_target = document.getElementById(window.location.hash.substring(1)); - if (hash_target) { - hash_target.scrollIntoView(); - } - } else { - window.scrollTo(0 ,target); - } - - let is_successful = use_hash ? true : (Math.abs(window.scrollY - target) < 5 || target === 0); - if (is_successful && document.body.scrollHeight > 1000) { - setTimeout(() => { - if (!use_hash && Math.abs(window.scrollY - target) >= 5) { - enforce_scroll(target ,use_hash ,attempts + 1); - } else { - unlock_layout(); - } - }, 100); - } else { - setTimeout(() => enforce_scroll(target ,use_hash ,attempts + 1) ,50); - } - } - - function bind_window_events(){ - window.addEventListener('scroll' ,() => { - if (is_layout_locked) return; - clearTimeout(scroll_timer); - scroll_timer = setTimeout(() => { - sessionStorage.setItem('RT_saved_y' ,window.scrollY); - }, 200); - }, { passive: true }); - - window.addEventListener('beforeunload' ,() => { - lock_layout(); - }); - } - - // ========================================================= - // PIPELINE EXECUTION - // ========================================================= - - // Phase 2 & 3: Pagination and Page Styling - function execute_phase_2_and_3(){ - debug.log('stage_manager', 'Phase 2: Executing Pagination'); - if (typeof window.RT.paginate === 'function') { - try { window.RT.paginate(); } - catch (e) { debug.error('stage_manager', "Pagination failed: " + e); } - } - - debug.log('stage_manager', 'Phase 3: Executing PageStyle tasks'); - if (window.RT.PageStyle instanceof Set) { - window.RT.PageStyle.forEach(task => { - if (typeof task === 'function') { - try { task(); } - catch (e) { debug.error('stage_manager', "PageStyle task failed: " + e); } - } - }); - } - - // Now that final layout geometry exists, execute scroll mapping - debug.log('scroll' ,`Pagination layout complete. Enforcing scroll target.`); - let final_target = target_y; - let use_hash = false; - if (window.location.hash && !is_reload) { - const hash_target = document.getElementById(window.location.hash.substring(1)); - if (hash_target) { - use_hash = true; - } - } - - enforce_scroll(final_target ,use_hash ,0); - } - - // Phase 1: Base Elements - function process_elements_and_layout() { - debug.log('stage_manager', 'Phase 1: Executing Element tasks'); - - if (window.RT.Element instanceof Set && window.RT.Element.size > 0) { - for (const element_fn of window.RT.Element) { - if (typeof element_fn === 'function') { - try { element_fn(); } - catch (e) { debug.error('stage_manager', "Element task failed: " + e); } - } else { - debug.warn('stage_manager', 'Invalid element in RT.Element Set: ' + element_fn); - } - } - } - - // Check for MathJax (Handles both v3 Promises and v2 Hub Queues) - // We must wait for typesetting to finish before paginating, as equations change element heights. - if (window.MathJax) { - if (typeof window.MathJax.typesetPromise === 'function') { - window.MathJax.typesetPromise().then(execute_phase_2_and_3).catch((err) => { - debug.error('stage_manager', 'MathJax typeset failed: ' + err); - execute_phase_2_and_3(); - }); - } else if (window.MathJax.Hub && window.MathJax.Hub.Queue) { - MathJax.Hub.Queue(["Typeset", MathJax.Hub], execute_phase_2_and_3); - } else { - execute_phase_2_and_3(); - } - } else { - execute_phase_2_and_3(); - } - } - - - // Initial Execution Sequence - lock_layout(); - configure_history(); - capture_scroll_target(); - bind_window_events(); - - document.addEventListener('DOMContentLoaded', process_elements_and_layout); - - // Safety Net: restore visibility on load if the async layout engine hangs - window.addEventListener("load", unlock_layout); - -})(); diff --git a/developer/authored/Manuscript.copy/Core/theme_make.js b/developer/authored/Manuscript.copy/Core/theme_make.js index 7edb5e1..9ed48af 100644 --- a/developer/authored/Manuscript.copy/Core/theme_make.js +++ b/developer/authored/Manuscript.copy/Core/theme_make.js @@ -1,121 +1,130 @@ // see Theme/manifest, all themes are registered in the library by name -RT.theme_library = RT.theme_library || {}; - -// 'read' or 'write' the active theme fields, or 'load' a new theme -RT.theme = (function() { - - const dictionary = { - meta: { is_dark: false, name: "" }, - surface: { 0: "", 1: "", 2: "", 3: "", input: "", code: "", select: "" }, - content: { main: "", muted: "", subtle: "", inverse: "" }, - brand: { primary: "", secondary: "", tertiary: "", link: "" }, - border: { faint: "", regular: "", strong: "" }, - state: { success: "", warning: "", error: "", info: "" }, - syntax: { keyword: "", string: "", func: "", comment: "" }, - page: { width: "", min_height: "", padding: "", margin: "", bg_color: "", border_color: "", text_color: "", shadow: "" }, - custom_css: "" - }; - function resolve_path(path_array) { - let current = dictionary; - for (let i = 0; i < path_array.length - 1; i++) { - const step = path_array[i]; - if (current[step] === undefined) return null; - current = current[step]; - } - return { container: current, key: path_array[path_array.length - 1] }; +(function() { + + if (!window.RT) { + console.error("RT not defined - was RT-Manuscript_make run?"); + return; } - function apply_and_validate_theme(new_theme, fallback_color) { - const debug = RT.Debug || { error: function(){} }; - - // Pass 1: Walk the structure of the active dictionary - function walk_current(curr, source, path) { - for (const key in curr) { - const current_path = path ? path + "." + key : key; - if (typeof curr[key] === 'object' && curr[key] !== null) { - walk_current(curr[key], source[key] || {}, current_path); - } else { - if (source[key] !== undefined && source[key] !== "") { - curr[key] = source[key]; + RT.theme_library = RT.theme_library || {}; + + // 'read' or 'write' the active theme fields, or 'load' a new theme + RT.theme = (function() { + + const dictionary = { + meta: { is_dark: false, name: "" }, + surface: { 0: "", 1: "", 2: "", 3: "", input: "", code: "", select: "" }, + content: { main: "", muted: "", subtle: "", inverse: "" }, + brand: { primary: "", secondary: "", tertiary: "", link: "" }, + border: { faint: "", regular: "", strong: "" }, + state: { success: "", warning: "", error: "", info: "" }, + syntax: { keyword: "", string: "", func: "", comment: "" }, + page: { width: "", min_height: "", padding: "", margin: "", bg_color: "", border_color: "", text_color: "", shadow: "" }, + custom_css: "" + }; + + function resolve_path(path_array) { + let current = dictionary; + for (let i = 0; i < path_array.length - 1; i++) { + const step = path_array[i]; + if (current[step] === undefined) return null; + current = current[step]; + } + return { container: current, key: path_array[path_array.length - 1] }; + } + + function apply_and_validate_theme(new_theme, fallback_color) { + const debug = RT.Debug || { error: function(){} }; + + // Pass 1: Walk the structure of the active dictionary + function walk_current(curr, source, path) { + for (const key in curr) { + const current_path = path ? path + "." + key : key; + if (typeof curr[key] === 'object' && curr[key] !== null) { + walk_current(curr[key], source[key] || {}, current_path); } else { - debug.error('theme', `Missing key in loaded theme: ${current_path}. Assigning fallback.`); - curr[key] = fallback_color; + if (source[key] !== undefined && source[key] !== "") { + curr[key] = source[key]; + } else { + debug.error('theme', `Missing key in loaded theme: ${current_path}. Assigning fallback.`); + curr[key] = fallback_color; + } } } } - } - // Pass 2: Walk the structure of the incoming theme dictionary - function walk_new(source, curr, path) { - for (const key in source) { - const current_path = path ? path + "." + key : key; - if (typeof source[key] === 'object' && source[key] !== null) { - if (curr[key] === undefined) { - debug.error('theme', `Unexpected structure in loaded theme: ${current_path} is an object.`); + // Pass 2: Walk the structure of the incoming theme dictionary + function walk_new(source, curr, path) { + for (const key in source) { + const current_path = path ? path + "." + key : key; + if (typeof source[key] === 'object' && source[key] !== null) { + if (curr[key] === undefined) { + debug.error('theme', `Unexpected structure in loaded theme: ${current_path} is an object.`); + } else { + walk_new(source[key], curr[key] || {}, current_path); + } } else { - walk_new(source[key], curr[key] || {}, current_path); - } - } else { - if (curr[key] === undefined) { - debug.error('theme', `Unexpected key in loaded theme: ${current_path}.`); + if (curr[key] === undefined) { + debug.error('theme', `Unexpected key in loaded theme: ${current_path}.`); + } } } } - } - walk_current(dictionary, new_theme, ""); - walk_new(new_theme, dictionary, ""); - } + walk_current(dictionary, new_theme, ""); + walk_new(new_theme, dictionary, ""); + } - return function(command, ...args) { - if (command === 'read') { - const target = resolve_path(args); - return (target && target.container.hasOwnProperty(target.key)) ? target.container[target.key] : null; - } - - if (command === 'write') { - if (args.length < 2) return; - const value = args.pop(); - const target = resolve_path(args); - if (target && target.container.hasOwnProperty(target.key)) { - target.container[target.key] = value; + return function(command, ...args) { + if (command === 'read') { + const target = resolve_path(args); + return (target && target.container.hasOwnProperty(target.key)) ? target.container[target.key] : null; + } + + if (command === 'write') { + if (args.length < 2) return; + const value = args.pop(); + const target = resolve_path(args); + if (target && target.container.hasOwnProperty(target.key)) { + target.container[target.key] = value; + } + return; } - return; - } - if (command === 'load') { - const theme_name = args[0]; - const fallback = args[1] || "#FF00FF"; + if (command === 'load') { + const theme_name = args[0]; + const fallback = args[1] || "#FF00FF"; - if (!RT.theme_library.hasOwnProperty(theme_name)) { - RT.Debug.error('theme', `Load aborted: Theme '${theme_name}' is not in the theme_library.`); - return false; - } + if (!RT.theme_library.hasOwnProperty(theme_name)) { + RT.Debug.error('theme', `Load aborted: Theme '${theme_name}' is not in the theme_library.`); + return false; + } - apply_and_validate_theme(RT.theme_library[theme_name], fallback); - - // --- CSS Fallback for Pseudo-Elements and External Libraries --- - let style_el = document.getElementById('rt-theme-custom-css'); - if (!style_el) { - style_el = document.createElement('style'); - style_el.id = 'rt-theme-custom-css'; - document.head.appendChild(style_el); + apply_and_validate_theme(RT.theme_library[theme_name], fallback); + + // --- CSS Fallback for Pseudo-Elements and External Libraries --- + let style_el = document.getElementById('rt-theme-custom-css'); + if (!style_el) { + style_el = document.createElement('style'); + style_el.id = 'rt-theme-custom-css'; + document.head.appendChild(style_el); + } + // Write the string if it exists, otherwise clear the block + style_el.textContent = dictionary.custom_css || ''; + + return true; } - // Write the string if it exists, otherwise clear the block - style_el.textContent = dictionary.custom_css || ''; - - return true; - } - RT.Debug.error('theme', 'Invalid command passed to theme dictionary: ' + command); - }; -})(); + RT.Debug.error('theme', 'Invalid command passed to theme dictionary: ' + command); + }; + })(); -RT.theme_preference = function(author_pref, default_color = "#FF00FF") { - const reader_pref = localStorage.getItem('RT-Manuscript·theme_preference'); - const theme_to_load = reader_pref ? reader_pref : author_pref; - - RT.theme('load', theme_to_load, default_color); -}; + RT.theme_preference = function(author_pref, default_color = "#FF00FF") { + const reader_pref = localStorage.getItem('RT-Manuscript·theme_preference'); + const theme_to_load = reader_pref ? reader_pref : author_pref; + + RT.theme('load', theme_to_load, default_color); + }; +})(); diff --git a/developer/authored/Manuscript.copy/Document/manual.html b/developer/authored/Manuscript.copy/Document/manual.html index add892a..7c86051 100644 --- a/developer/authored/Manuscript.copy/Document/manual.html +++ b/developer/authored/Manuscript.copy/Document/manual.html @@ -16,17 +16,38 @@ -

Layout Environments

+

Leonardo·da·Vinci and other notes

+ +

+ The middle dot used as a namespace separator is the middle dot of typography. On macOS: Option + Shift + 9. On Windows: Hold Alt and type 0183 on the numeric keypadLinux: Compose Key followed by . and -. In Emacs it can be defined on a key, I have it on C-x g cdot, along with many other C-x g characters. It can also be + copied then pasted from the heading above. +

+ +

+ Content is found between the opening HTML tag and the closing HTML tag. E.g. <RT·noop>This is content.</RT·noop>. +

+ +

+ An attribute is a name value pair found within an opening HTML tag. E.g. <RT·noop><RT·noop>. Here the attribute name is name and the attribute value is value. This examples shows a name attribute. +

+ + +

+ All tags must be given in pairs, but not all have scoped content. +

+ + +

Manuscript Types

- These are the current top level semantic tag environments. + These are the current top level semantic tag environments. They affect the formatting of scoped content. This includes the custom semantic tags, and can also include standard HTML tags.

@@ -39,7 +60,7 @@ - + @@ -47,17 +68,39 @@ - +
<RT·article>Standard technical document layout with dynamic pagination.A technical article.
<RT·memo>
<RT·book>Multi chapter compilation layout (Upcoming).Book layout. Does not yet exist, planned to be broken out of the article layout.
-

Article Environment

-

- The <RT·article> container provides the standard toolset for technical documentation, whitepapers, and specifications. It utilizes dynamic soft limit pagination and responsive ink ratio balancing. -

+

Article Manuscript

+ +

Here is an example header for an article

-

Section Generators

+ + <!DOCTYPE html> + <html lang="en"> + <head> + <meta charset="UTF-8"> + <title>RT Manuscript: Reference Manual</title> + <script src="RT-Manuscript_locator.js"></script> + <script> + window.RT.theme_preference('inverse_wheat'); + window.RT.load('Layout/paginate'); + window.RT.load('Layout/article_tech_ref'); + window.RT.load('Element/theme_selector'); + </script> + </head> + <body> + <RT·theme-selector></RT·theme-selector> + <RT·article> + … + </RT·article> + </body> + </html> + + +

Decorators

@@ -67,36 +110,56 @@ - + - + + +
<RT·title><RT·term> - Assembles the standardized title block and metadata header.
+ Standard technical term. Decorates first occurrence and establishes an anchor. Author should mark all occurrences of the term.
Attributes:
- title: (Default: "Untitled Document")
- author: (Default: None)
- date: (Default: None)
- copyright: (Default: None) + id: (Default: Auto-generated from text content, e.g., "def-my-term")
<RT·TOC><RT·neologism> - Compiles an automatic table of contents by scanning heading depths.
+ Technical term coined in this document. Decorates first occurrence and establishes an anchor. Author should mark all occurrences of the term.
Attributes:
- level: Target heading level "N" or range "A-B". (Default: Context-aware. Looks backward for the nearest heading H(N) and targets H(N+1)). + id: (Default: Auto-generated from text content, e.g., "def-my-term")
+ +

Layout Environments

+

+ This can be written inline with text, or as blocks. +

+ + - - + + + + + + + + + + + +
<RT·endnotes>Inserts a compiled list of the endnotes.TagDescription & Arguments
<RT·code>Code span or pre formatted code block with theme aware borders. Automatically dedents block content.
<RT·math>Inline or block mathematics evaluated by MathJax.
-

Semantic Tags

+ +

Generators

+ +

The generators have no content between the opening and closing tags, rather generation is guided through attributes.

+ @@ -106,33 +169,39 @@ - + - - - - - - + + - - + +
<RT·term><RT·title> - Standard technical term. Decorates first occurrence and establishes an anchor. Author should mark all occurrences of the term.
Attributes:
- id: (Default: Auto-generated from text content, e.g., "def-my-term") + title: (Default: "Untitled Document")
+ author: (Default: None)
+ date: (Default: None)
+ copyright: (Default: None)
<RT·code>Code span or pre formatted code block with theme aware borders. Automatically dedents block content.
<RT·math>Inline or block mathematics evaluated by MathJax.<RT·TOC> + Compiles an automatic table of contents by scanning heading depths.
+
+ Attributes:
+ level: Target heading level "N" or range "A-B". (Default: Context-aware. Looks backward for the nearest heading H(N) and targets H(N+1)). +
+
<RT·symbol>Technical symbol wrapper enforcing strict font weight and character spacing.<RT·endnotes>Inserts a numbered list of the endnotes. Citations to the endnotes found in th text are replaced by their numbers in square brackets.
-

Declarative Counters

+ +

Counters

- The counter object establishes an isolated state machine. It separates the strict numerical sequence data from the visual formatting layer, permitting precise state queries alongside heavily customizable output formatting. + A counter is made with the make tag. A distinct name attribute is required. + When a step occurs witin the content of another step, there will be a nested count. There is one internal representation for a count, but there are many styles of presentation available when the count is read.

@@ -145,22 +214,24 @@ - +
<RT·Counter·make> - Initializes an empty named counter sequence.
+ Initializes an empty named counter.
Attributes:
- counter: Required identifier.
- style: A comma-separated list defining the formatting at each depth. Valid options: "NaturalNumber", "CountingNumber", "Roman", "roman", "Alpha", "alpha". The keyword "outline" maps to a standard mixed array. (Default: "NaturalNumber")
+ counter: Name of the counter.
+ style: Either a single style, or a comma-separated list defining the formatting at each nesting level. The last format in the list applies to all yet higher nesting levels. Valid options: "NaturalNumber", "CountingNumber", "Roman", "roman", "Alpha", "alpha". The keyword "outline" maps to a standard mixed array. (Default: "NaturalNumber")
on-first-step: The initial starting value, supplied in the format of the top-level style. (Default: "0")
separator: The string joining depth sequence segments. (Default: ".")
separator-placement: "embedded" or "embedded-after". (Default: "embedded")
- mode: "scoped" (omits the rightmost sequence digit when reading outside a closed node) or "milestone" (reports the full completed sequence path). (Default: "scoped") + mode: "scoped" text between count scopes gets the count of the outer scope (like scope in code), or "milestone" between scopes continue with the prior scoped count (like sections of a document).
<RT·Counter·step> - Advances the counter state. When applied as a parent tag, the contents within its scope define a sub-level; the machine automatically pushes into a nested depth on entry and pops back to the parent container upon exit.
+ <RT·Counter·step> +
+ Count is available within scope. Th next scope will have one greater count. Any embedded steps will count at the next depth level.
Attributes:
counter: Required identifier. @@ -170,7 +241,7 @@
<RT·Counter·snapshot> - Clones the entire active state machine, including its current 0-indexed numerical array, operational status, and presentation configurations, saving it to a dictionary key.
+ Clones count into a dictionary. Snapshots are processed by a separate document walk, so can can be referenced from anywhere.
Attributes:
counter: Required identifier.
@@ -181,7 +252,7 @@
<RT·Counter·read> - Recalls information from a snapshot and outputs it as innerHTML. A snapshot can be recalled from anywhere in the document.
+ Accesses specified field from a snapshotted counter and renders it as innerHTML.
Attributes:
snapshot: Required snapshot name.
@@ -192,7 +263,7 @@
-

Notation

+

Annotation

@@ -202,13 +273,21 @@ - - + + + + + +
<RT·endnote>Tag pair contents added as an item to the endnote list. Replaces the inline text with an anchor link. + <RT·endnote> + Scoped contents added to the list of endnotes.
+ <RT·footnote> + Scoped contents moved to the bottom of the page.
-

Pagination Control

+

Pagination

@@ -228,14 +307,14 @@
-

Memo Environment

+

Memo environment

- The <RT·memo> container inherits all valid tags from the Article environment but overrides the global CSS to enforce a static, print ready monochrome aesthetic. + The <RT·memo> container inherits all valid tags from the Article environment but overrides the global CSS to enforce a static, print ready monochrome aesthetic. Yeah, at one time this was working.

-

Book Environment

+

Book environment

- The <RT·book> container is reserved for multi chapter compilations. It introduces tags designed exclusively for macro level document orchestration. + The <RT·book> container is reserved for multi chapter compilations. It introduces tags designed exclusively for macro level document orchestration. (Does not currently exist, rather using the Article Tech Ref format.)

Book Specific Tags

diff --git a/developer/authored/Manuscript.copy/Element/footnote.js b/developer/authored/Manuscript.copy/Element/footnote.js new file mode 100644 index 0000000..6da5212 --- /dev/null +++ b/developer/authored/Manuscript.copy/Element/footnote.js @@ -0,0 +1,4 @@ +/* +Currently built into the paginator + +*/ diff --git a/developer/authored/Manuscript.copy/Element/noop.js b/developer/authored/Manuscript.copy/Element/noop.js new file mode 100644 index 0000000..ac84a64 --- /dev/null +++ b/developer/authored/Manuscript.copy/Element/noop.js @@ -0,0 +1,6 @@ +/* + RT·noop. + + Nothing need be done, as HTML ignores undefined tags. + +*/ diff --git a/developer/authored/Manuscript.copy/Element/symbol.js b/developer/authored/Manuscript.copy/Element/symbol.js deleted file mode 100644 index 123d3ec..0000000 --- a/developer/authored/Manuscript.copy/Element/symbol.js +++ /dev/null @@ -1,28 +0,0 @@ -/* - Processes tags. - Applies standard monospaced formatting to code symbols inline. -*/ - -(function() { - - if (!window.RT) { - console.error("RT not defined - was RT-Manuscript_make run?"); - return; - } - if (!window.RT.Element) { - console.error("RT.Element not defined - was the state_manager run?"); - return; - } - - RT.Element.add( function() { - const debug = window.RT.Debug || { log: function(){} }; - if (debug.log) debug.log('symbol', 'Processing symbols'); - - document.querySelectorAll('rt·symbol').forEach( (el) => { - el.style.fontFamily = '"Courier New", Courier, monospace'; - el.style.fontWeight = '600'; - el.style.padding = '0 0.1em'; - }); - }); - -})(); diff --git a/developer/authored/Manuscript.copy/Layout/article_tech_ref.js b/developer/authored/Manuscript.copy/Layout/article_tech_ref.js index e868ab8..42d5c7f 100644 --- a/developer/authored/Manuscript.copy/Layout/article_tech_ref.js +++ b/developer/authored/Manuscript.copy/Layout/article_tech_ref.js @@ -5,21 +5,23 @@ */ (function(){ - const RT = window.RT = window.RT || {}; + + if (!window.RT) { + console.error("RT not defined - was RT-Manuscript_make run?"); + return; + } // 1. The Explicit Element Roster const required_elements = [ - 'counter', - 'chapter', - 'endnote', - 'math', - 'code', - 'term', - 'TOC', - 'title', - 'symbol', - 'constraint', - 'crossref' + 'chapter' + ,'code' + ,'counter' + ,'endnote' + ,'math' + ,'symbol' + ,'term' + ,'title' + ,'TOC' ]; // Shared utility functions @@ -128,7 +130,20 @@ height: "auto", display: "block", margin: "1.5rem auto" + }], + + [ 'RT·article table', { + width: "100%", + borderCollapse: "collapse", + marginBottom: "1.5rem" + }], + + [ 'RT·article th, RT·article td', { + verticalAlign: "top", + padding: "0.75rem 1rem 0.75rem 0", + textAlign: "left" }] + ]; element_styles.forEach(rule => apply(rule[0], rule[1])); diff --git a/developer/authored/Manuscript.copy/Layout/memo_State.js b/developer/authored/Manuscript.copy/Layout/memo_State.js index 29629d6..42a41e5 100644 --- a/developer/authored/Manuscript.copy/Layout/memo_State.js +++ b/developer/authored/Manuscript.copy/Layout/memo_State.js @@ -11,7 +11,11 @@ */ (function(){ - const RT = window.RT = window.RT || {}; + + if (!window.RT) { + console.error("RT not defined - was RT-Manuscript_make run?"); + return; + } // 1. Declare Dependencies RT.load('Core/utility'); diff --git a/developer/authored/Manuscript.copy/Layout/paginate-0.js b/developer/authored/Manuscript.copy/Layout/paginate-0.js deleted file mode 100644 index c5d36ee..0000000 --- a/developer/authored/Manuscript.copy/Layout/paginate-0.js +++ /dev/null @@ -1,419 +0,0 @@ -/* - Processes tags and paginates their contents. - Handles inline footnotes and element splitting to enforce page height limits. -*/ - -(function() { - - if (!window.RT) { - console.error("RT not defined - was RT-Style_make run?"); - return; - } - if (!window.RT.Element) { - console.error("RT.Element not defined - was the state_manager run?"); - return; - } - - RT.Element.add( function() { - const RT = window.RT; - const debug = RT.Debug || { log: function(){}, error: function(){} }; - const page_conf = (RT.config && RT.config.page) ? RT.config.page : {}; - const page_height_limit = page_conf.height_limit || 1000; - - if (debug.log) debug.log('paginate', 'Running document pagination'); - - let measureContainer = null; - - // ========================================================= - // 1. DOM Measurement Utilities - // ========================================================= - function getElHeight(el) { - const wasInDOM = el.parentNode !== null; - if (!wasInDOM) document.body.appendChild(el); - const rect = el.getBoundingClientRect(); - const style = window.getComputedStyle(el); - const margin = parseFloat(style.marginTop) + parseFloat(style.marginBottom); - if (!wasInDOM) el.remove(); - return (rect.height || 0) + (margin || 0); - } - - function getMeasureContainer() { - if (measureContainer && measureContainer.parentNode) return measureContainer; - const article = document.querySelector('RT·article'); - if (!article) { - const temp = document.createElement('div'); - temp.style.visibility = 'hidden'; - temp.style.position = 'absolute'; - temp.style.width = '100%'; - document.body.appendChild(temp); - measureContainer = temp; - return temp; - } - const container = document.createElement('div'); - const articleStyle = window.getComputedStyle(article); - container.style.visibility = 'hidden'; - container.style.position = 'absolute'; - container.style.width = articleStyle.width; - container.style.fontFamily = articleStyle.fontFamily; - container.style.fontSize = articleStyle.fontSize; - container.style.lineHeight = articleStyle.lineHeight; - container.style.fontWeight = articleStyle.fontWeight; - document.body.appendChild(container); - measureContainer = container; - return container; - } - - function measureFragment(frag) { - const container = getMeasureContainer(); - container.appendChild(frag); - const h = getElHeight(frag); - container.removeChild(frag); - return h; - } - - // ========================================================= - // STEP 1: PREPARE FOOTNOTES (Strip and tag) - // ========================================================= - const article_seq = document.querySelectorAll('RT·article'); - if (article_seq.length === 0) { - debug.error('pagination', 'No elements found. Pagination aborted.'); - return; - } - - const footnote_registry = {}; - let footnote_counter = 1; - - Array.from(article_seq).forEach(article => { - // Bulletproof extraction: immune to XML/HTML case-sensitivity parsing quirks - const all_nodes = Array.from(article.querySelectorAll('*')); - const raw_footnotes = all_nodes.filter(node => node.tagName.toLowerCase() === 'RT·footnote'); - - raw_footnotes.forEach(fn => { - const id = footnote_counter++; - footnote_registry[id] = fn.innerHTML; // Save the payload - - // Trim any standard HTML whitespace immediately preceding the tag - const prev = fn.previousSibling; - if (prev && prev.nodeType === Node.TEXT_NODE) { - prev.textContent = prev.textContent.replace(/\s+$/, ''); - } - - // Replace with a zero-height marker that rides along with the text - const marker = document.createElement('RT·fn-marker'); - marker.setAttribute('data-id', id); - - if (fn.parentNode) { - fn.parentNode.replaceChild(marker, fn); - } - }); - }); - - // ========================================================= - // Splitting Logic (Clean and undisturbed) - // ========================================================= - function isSplittable(el) { - const tag = el.tagName; - if (tag === 'UL' || tag === 'OL') { - const items = Array.from(el.children).filter(c => c.tagName === 'LI'); - if (items.length === 0) return null; - - const itemHeights = items.map(li => getElHeight(li)); - const emptyClone = el.cloneNode(false); - const overhead = getElHeight(emptyClone); - - el._splitInfo = { type: 'list', itemHeights, overhead, offset: 0 }; - return makeListSplitter(el, el._splitInfo); - } - - if (tag === 'TABLE') { - const thead = el.querySelector('thead'); - const tbody = el.querySelector('tbody'); - const rows = tbody ? Array.from(tbody.rows) : Array.from(el.rows); - if (rows.length === 0) return null; - - const theadHeight = thead ? getElHeight(thead) : 0; - const rowHeights = rows.map(row => getElHeight(row)); - - const emptyClone = el.cloneNode(false); - if (thead) emptyClone.appendChild(thead.cloneNode(true)); - emptyClone.appendChild(document.createElement('tbody')); - const overhead = getElHeight(emptyClone) - theadHeight; - - el._splitInfo = { type: 'table', rowHeights, overhead, theadHeight, offset: 0 }; - return makeTableSplitter(el, el._splitInfo); - } - return null; - } - - function makeListSplitter(el, info) { - return (remaining) => { - const children = Array.from(el.children).filter(c => c.tagName === 'LI'); - const start = info.offset; - - let bestCount = 0; - let bestHeight = 0; - const tempList = el.cloneNode(false); - - for (let i = 0; i < children.length; i++) { - const itemClone = children[i].cloneNode(true); - tempList.appendChild(itemClone); - const fragHeight = measureFragment(tempList); - if (fragHeight <= remaining) { - bestCount = i + 1; - bestHeight = fragHeight; - } else { - tempList.removeChild(itemClone); - break; - } - } - - if (bestCount === 0) return { first: null, rest: el, firstHeight: 0 }; - - const first = el.cloneNode(false); - for (let i = 0; i < bestCount; i++) { - first.appendChild(children[i].cloneNode(true)); - } - - let rest = null; - if (bestCount < children.length) { - rest = el.cloneNode(false); - for (let i = bestCount; i < children.length; i++) { - rest.appendChild(children[i].cloneNode(true)); - } - - if (el.tagName === 'OL') { - const currentStart = parseInt(el.getAttribute('start'), 10) || 1; - rest.setAttribute('start', currentStart + bestCount); - } - - rest._splitInfo = { - type: 'list', - itemHeights: info.itemHeights, - overhead: info.overhead, - offset: start + bestCount - }; - } - - return { first, rest, firstHeight: bestHeight }; - }; - } - - function makeTableSplitter(el, info) { - const thead = el.querySelector('thead'); - const createShell = () => { - const shell = el.cloneNode(false); - if (thead) shell.appendChild(thead.cloneNode(true)); - const newTbody = document.createElement('tbody'); - shell.appendChild(newTbody); - return shell; - }; - - return (remaining) => { - const tbody = el.querySelector('tbody'); - const rows = tbody ? Array.from(tbody.rows) : Array.from(el.rows); - const start = info.offset; - - let bestCount = 0; - let bestHeight = 0; - const tempTable = createShell(); - const tempBody = tempTable.querySelector('tbody'); - - for (let i = 0; i < rows.length; i++) { - tempBody.appendChild(rows[i].cloneNode(true)); - const h = measureFragment(tempTable); - if (h <= remaining) { - bestCount = i + 1; - bestHeight = h; - } else { - tempBody.removeChild(tempBody.lastChild); - break; - } - } - - if (bestCount === 0) return { first: null, rest: el, firstHeight: 0 }; - - const first = createShell(); - const firstBody = first.querySelector('tbody'); - for (let i = 0; i < bestCount; i++) { - firstBody.appendChild(rows[i].cloneNode(true)); - } - - let rest = null; - if (bestCount < rows.length) { - rest = createShell(); - const restBody = rest.querySelector('tbody'); - for (let i = bestCount; i < rows.length; i++) { - restBody.appendChild(rows[i].cloneNode(true)); - } - - rest._splitInfo = { - type: 'table', - rowHeights: info.rowHeights, - overhead: info.overhead, - theadHeight: info.theadHeight, - offset: start + bestCount - }; - } - - return { first, rest, firstHeight: bestHeight }; - }; - } - - // ========================================================= - // STEP 2: NORMAL PAGINATOR - // ========================================================= - function paginateArticle(article) { - const raw_element_seq = Array.from(article.children).filter(el => - !['SCRIPT', 'STYLE', 'RT·PAGE'].includes(el.tagName) - ); - - if (raw_element_seq.length === 0) return; - - const page_seq = []; - let current_batch_seq = []; - let current_h = 0; - let i = 0; - - while (i < raw_element_seq.length) { - const el = raw_element_seq[i]; - const splitter = isSplittable(el); - - if (splitter) { - const remaining = page_height_limit - current_h; - const { first, rest, firstHeight } = splitter(remaining); - - if (first) { - current_batch_seq.push(first); - current_h += firstHeight; - - if (rest) { - raw_element_seq.splice(i, 1, rest); - } else { - raw_element_seq.splice(i, 1); - } - } else { - if (current_batch_seq.length === 0) { - const frame = document.createElement('RT·scroll-frame'); - frame.style.display = 'block'; - frame.style.overflowY = 'auto'; - frame.style.maxHeight = page_height_limit + 'px'; - frame.appendChild(el); - current_batch_seq.push(frame); - i++; - } else { - page_seq.push(current_batch_seq); - current_batch_seq = []; - current_h = 0; - raw_element_seq[i] = rest || el; - } - } - continue; - } - - - // --- Ordinary (non-splittable) element --- - const h = getElHeight(el); - const is_RT_page_break = el.tagName && el.tagName.toLowerCase() === 'rt·page-break'; - - if( (is_RT_page_break || current_h + h > page_height_limit) && current_batch_seq.length > 0 ){ - let backtrack_seq = []; - let backtrack_h = 0; - - while (current_batch_seq.length > 0) { - const last = current_batch_seq[current_batch_seq.length - 1]; - if (!/^H[1-6]/.test(last.tagName)) break; - const popped = current_batch_seq.pop(); - backtrack_seq.unshift(popped); - backtrack_h += getElHeight(popped); - } - - if (current_batch_seq.length > 0) { - page_seq.push(current_batch_seq); - current_batch_seq = backtrack_seq; - current_h = backtrack_h; - } else { - page_seq.push(backtrack_seq); - current_batch_seq = []; - current_h = 0; - } - } - - current_batch_seq.push(el); - current_h += h; - i++; - } - - if (current_batch_seq.length > 0) { - page_seq.push(current_batch_seq); - } - - // Rebuild article with wrappers - article.innerHTML = ''; - let p = 0; - while (p < page_seq.length) { - const batch = page_seq[p]; - const page_el = document.createElement('RT·page'); - page_el.id = `page-${p + 1}`; - batch.forEach(item => page_el.appendChild(item)); - article.appendChild(page_el); - p++; - } - } - - // Execute pagination - Array.from(article_seq).forEach(article => paginateArticle(article)); - - // ========================================================= - // STEP 3: RESOLVE FOOTNOTES & EXPAND PAGES - // ========================================================= - Array.from(article_seq).forEach(article => { - const rendered_pages = article.querySelectorAll('RT·page'); - - Array.from(rendered_pages).forEach(page => { - // Bulletproof extraction for the markers - const all_page_nodes = Array.from(page.querySelectorAll('*')); - const markers = all_page_nodes.filter(node => node.tagName.toLowerCase() === 'rt·fn-marker'); - - if (markers.length === 0) return; - - // Construct the footer block for this page - const fn_container = document.createElement('div'); - fn_container.className = 'RT·footnote-container'; - fn_container.style.borderTop = '1px solid var(--RT·border-default)'; - fn_container.style.marginTop = '2rem'; - fn_container.style.paddingTop = '1rem'; - fn_container.style.fontSize = '0.9em'; - - markers.forEach(marker => { - const id = marker.getAttribute('data-id'); - const html = footnote_registry[id]; - - // Replace the invisible marker with the visible naked superscript link - const sup = document.createElement('sup'); - sup.innerHTML = `${id}`; - - if (marker.parentNode) { - marker.parentNode.replaceChild(sup, marker); - } - - // Append the actual text to the footer with a clean, print-ready number format - const fn_line = document.createElement('div'); - fn_line.id = `fn-${id}`; - fn_line.style.marginBottom = '0.5rem'; - fn_line.innerHTML = `${id}.${html}`; - fn_container.appendChild(fn_line); - }); - - // Attach the footer. The page organically stretches to fit. - page.appendChild(fn_container); - }); - }); - - // Cleanup - if (measureContainer && measureContainer.parentNode) { - measureContainer.remove(); - measureContainer = null; - } - }); - -})(); diff --git a/developer/authored/Manuscript.copy/Theme/golden_wheat.js b/developer/authored/Manuscript.copy/Theme/golden_wheat.js index fa5cf47..4e281a1 100644 --- a/developer/authored/Manuscript.copy/Theme/golden_wheat.js +++ b/developer/authored/Manuscript.copy/Theme/golden_wheat.js @@ -1,62 +1,72 @@ // Theme/golden_wheat.js -window.RT = window.RT || {}; -window.RT.theme_library = window.RT.theme_library || {}; +(function(){ -window.RT.theme_library['golden_wheat'] = { - meta: { - is_dark: false, - name: "golden_wheat" - }, - surface: { - 0: "oklch(0.95 0.02 90)", - 1: "oklch(0.92 0.02 90)", - 2: "oklch(0.97 0.01 90)", - 3: "oklch(0.99 0 0)", - input: "oklch(0.94 0.01 90)", - code: "oklch(0.90 0.02 90)", - select: "oklch(0.85 0.05 25)" - }, - content: { - main: "oklch(0.20 0.02 25)", - muted: "oklch(0.35 0.03 25)", - subtle: "oklch(0.55 0.02 25)", - inverse: "oklch(0.92 0.02 90)" - }, - brand: { - primary: "oklch(0.40 0.15 25)", - secondary: "oklch(0.45 0.14 25)", - tertiary: "oklch(0.50 0.12 25)", - link: "oklch(0.40 0.16 25)" - }, - border: { - faint: "oklch(0.85 0.02 90)", - regular: "oklch(0.75 0.03 90)", - strong: "oklch(0.50 0.08 25)" - }, - state: { - success: "oklch(0.45 0.10 130)", - warning: "oklch(0.55 0.15 45)", - error: "oklch(0.45 0.15 25)", - info: "oklch(0.50 0.12 240)" - }, - syntax: { - keyword: "oklch(0.45 0.15 25)", - string: "oklch(0.40 0.10 130)", - func: "oklch(0.45 0.12 35)", - comment: "oklch(0.60 0.02 90)" - }, - page: { - width: "6.5in", - min_height: "9in", - padding: "0.5in 1in", - margin: "20px auto", - bg_color: "oklch(0.95 0.02 90)", - border_color: "oklch(0.85 0.02 90)", - text_color: "oklch(0.20 0.02 25)", - shadow: "0 4px 15px rgba(0,0,0,0.1)" - }, - custom_css: ` + if (!window.RT) { + console.error("RT not defined - was RT-Manuscript_make run?"); + return; + } + + // Prevent duplicate initialization + if (window.RT.theme_library instanceof Set) { + console.error("RT.theme_library missing,- was theme_make run?"); + return; + } + + window.RT.theme_library['golden_wheat'] = { + meta: { + is_dark: false, + name: "golden_wheat" + }, + surface: { + 0: "oklch(0.95 0.02 90)", + 1: "oklch(0.92 0.02 90)", + 2: "oklch(0.97 0.01 90)", + 3: "oklch(0.99 0 0)", + input: "oklch(0.94 0.01 90)", + code: "oklch(0.90 0.02 90)", + select: "oklch(0.85 0.05 25)" + }, + content: { + main: "oklch(0.20 0.02 25)", + muted: "oklch(0.35 0.03 25)", + subtle: "oklch(0.55 0.02 25)", + inverse: "oklch(0.92 0.02 90)" + }, + brand: { + primary: "oklch(0.40 0.15 25)", + secondary: "oklch(0.45 0.14 25)", + tertiary: "oklch(0.50 0.12 25)", + link: "oklch(0.40 0.16 25)" + }, + border: { + faint: "oklch(0.85 0.02 90)", + regular: "oklch(0.75 0.03 90)", + strong: "oklch(0.50 0.08 25)" + }, + state: { + success: "oklch(0.45 0.10 130)", + warning: "oklch(0.55 0.15 45)", + error: "oklch(0.45 0.15 25)", + info: "oklch(0.50 0.12 240)" + }, + syntax: { + keyword: "oklch(0.45 0.15 25)", + string: "oklch(0.40 0.10 130)", + func: "oklch(0.45 0.12 35)", + comment: "oklch(0.60 0.02 90)" + }, + page: { + width: "6.5in", + min_height: "9in", + padding: "0.5in 1in", + margin: "20px auto", + bg_color: "oklch(0.95 0.02 90)", + border_color: "oklch(0.85 0.02 90)", + text_color: "oklch(0.20 0.02 25)", + shadow: "0 4px 15px rgba(0,0,0,0.1)" + }, + custom_css: ` rt-article p, rt-article li { text-shadow: 0px 0px 0.5px rgba(0,0,0, 0.2); } .MathJax, .MathJax_Display, .mjx-chtml { color: oklch(0.20 0.02 25) !important; @@ -64,4 +74,6 @@ window.RT.theme_library['golden_wheat'] = { stroke: oklch(0.20 0.02 25) !important; } ` -}; + }; + +})(); diff --git a/developer/authored/Manuscript.copy/Theme/inverse_wheat.js b/developer/authored/Manuscript.copy/Theme/inverse_wheat.js index d4e72a8..4568d4d 100644 --- a/developer/authored/Manuscript.copy/Theme/inverse_wheat.js +++ b/developer/authored/Manuscript.copy/Theme/inverse_wheat.js @@ -1,62 +1,75 @@ // Theme/inverse_wheat.js -window.RT = window.RT || {}; -window.RT.theme_library = window.RT.theme_library || {}; +(function(){ -window.RT.theme_library['inverse_wheat'] = { - meta: { - is_dark: true, - name: "inverse_wheat" - }, - surface: { - 0: "oklch(0.157 0 0)", - 1: "oklch(0.198 0 0)", - 2: "oklch(0.221 0 0)", - 3: "oklch(0.240 0 0)", - input: "oklch(0.210 0 0)", - code: "oklch(0.204 0 0)", - select: "oklch(0.358 0.073 88)" - }, - content: { - main: "oklch(0.927 0.050 97)", - muted: "oklch(0.699 0.030 78)", - subtle: "oklch(0.522 0.022 82)", - inverse: "oklch(0.157 0 0)" - }, - brand: { - primary: "oklch(0.841 0.173 85)", - secondary: "oklch(0.827 0.135 78)", - tertiary: "oklch(0.795 0.081 66)", - link: "oklch(0.865 0.177 90)" - }, - border: { - faint: "oklch(0.280 0.018 78)", - regular: "oklch(0.386 0.028 82)", - strong: "oklch(0.533 0.041 77)" - }, - state: { - success: "oklch(0.671 0.168 137)", - warning: "oklch(0.767 0.159 68)", - error: "oklch(0.591 0.172 24)", - info: "oklch(0.661 0.078 232)" - }, - syntax: { - keyword: "oklch(0.825 0.146 72)", - string: "oklch(0.804 0.132 122)", - func: "oklch(0.756 0.134 39)", - comment: "oklch(0.573 0.035 78)" - }, - page: { - width: "6.5in", - min_height: "9in", - padding: "0.5in 1in", - margin: "20px auto", - bg_color: "oklch(0.95 0.02 90)", - border_color: "oklch(0.85 0.02 90)", - text_color: "oklch(0.20 0.02 25)", - shadow: "0 4px 15px rgba(0,0,0,0.1)" - }, - custom_css: ` + if (!window.RT) { + console.error("RT not defined - was RT-Manuscript_make run?"); + return; + } + + // Prevent duplicate initialization + if (window.RT.theme_library instanceof Set) { + console.error("RT.theme_library missing,- was theme_make run?"); + return; + } + + window.RT.theme_library['inverse_wheat'] = { + meta: { + is_dark: true, + name: "inverse_wheat" + }, + surface: { + 0: "oklch(0.157 0 0)", + 1: "oklch(0.198 0 0)", + 2: "oklch(0.221 0 0)", + 3: "oklch(0.240 0 0)", + input: "oklch(0.210 0 0)", + code: "oklch(0.204 0 0)", + select: "oklch(0.358 0.073 88)" + }, + content: { + main: "oklch(0.927 0.050 97)", + muted: "oklch(0.699 0.030 78)", + subtle: "oklch(0.522 0.022 82)", + inverse: "oklch(0.157 0 0)" + }, + brand: { + primary: "oklch(0.841 0.173 85)", + secondary: "oklch(0.827 0.135 78)", + tertiary: "oklch(0.795 0.081 66)", + link: "oklch(0.865 0.177 90)" + }, + border: { + faint: "oklch(0.280 0.018 78)", + regular: "oklch(0.386 0.028 82)", + strong: "oklch(0.533 0.041 77)" + }, + state: { + success: "oklch(0.671 0.168 137)", + warning: "oklch(0.767 0.159 68)", + error: "oklch(0.591 0.172 24)", + info: "oklch(0.661 0.078 232)" + }, + syntax: { + keyword: "oklch(0.825 0.146 72)", + string: "oklch(0.804 0.132 122)", + func: "oklch(0.756 0.134 39)", + comment: "oklch(0.573 0.035 78)" + }, + page: { + width: "6.5in", + min_height: "9in", + padding: "0.5in 1in", + margin: "20px auto", + bg_color: "oklch(0.95 0.02 90)", + border_color: "oklch(0.85 0.02 90)", + text_color: "oklch(0.20 0.02 25)", + shadow: "0 4px 15px rgba(0,0,0,0.1)" + }, + custom_css: ` img.rt-diagram { filter: invert(1) hue-rotate(180deg); } ` -}; + }; + +})(); + diff --git a/developer/authored/Manuscript.copy/Theme/wheat.js b/developer/authored/Manuscript.copy/Theme/wheat.js index 1dd017f..4a4ad9b 100644 --- a/developer/authored/Manuscript.copy/Theme/wheat.js +++ b/developer/authored/Manuscript.copy/Theme/wheat.js @@ -1,59 +1,70 @@ // Theme/wheat.js -window.RT = window.RT || {}; -window.RT.theme_library = window.RT.theme_library || {}; +(function(){ -window.RT.theme_library['wheat'] = { - meta: { - is_dark: false, - name: "wheat" - }, - surface: { - 0: "oklch(0.95 0.02 80)", - 1: "oklch(0.92 0.02 80)", - 2: "oklch(0.97 0.01 80)", - 3: "oklch(0.99 0 0)", - input: "oklch(0.96 0.01 80)", - code: "oklch(0.92 0.01 80)", - select: "oklch(0.88 0.06 80)" - }, - content: { - main: "oklch(0.25 0.02 60)", - muted: "oklch(0.45 0.03 60)", - subtle: "oklch(0.65 0.02 60)", - inverse: "oklch(0.94 0.02 80)" - }, - brand: { - primary: "oklch(0.50 0.15 50)", - secondary: "oklch(0.55 0.12 60)", - tertiary: "oklch(0.60 0.10 45)", - link: "oklch(0.50 0.16 50)" - }, - border: { - faint: "oklch(0.85 0.02 80)", - regular: "oklch(0.75 0.02 80)", - strong: "oklch(0.55 0.04 80)" - }, - state: { - success: "oklch(0.50 0.10 130)", - warning: "oklch(0.60 0.15 50)", - error: "oklch(0.50 0.15 25)", - info: "oklch(0.55 0.10 240)" - }, - syntax: { - keyword: "oklch(0.50 0.14 50)", - string: "oklch(0.45 0.10 130)", - func: "oklch(0.50 0.10 320)", - comment: "oklch(0.65 0.02 80)" - }, - page: { - width: "6.5in", - min_height: "9in", - padding: "0.5in 1in", - margin: "20px auto", - bg_color: "oklch(0.95 0.02 90)", - border_color: "oklch(0.85 0.02 90)", - text_color: "oklch(0.20 0.02 25)", - shadow: "0 4px 15px rgba(0,0,0,0.1)" - }, -}; + if (!window.RT) { + console.error("RT not defined - was RT-Manuscript_make run?"); + return; + } + + // Prevent duplicate initialization + if (window.RT.theme_library instanceof Set) { + console.error("RT.theme_library missing,- was theme_make run?"); + return; + } + + window.RT.theme_library['wheat'] = { + meta: { + is_dark: false, + name: "wheat" + }, + surface: { + 0: "oklch(0.95 0.02 80)", + 1: "oklch(0.92 0.02 80)", + 2: "oklch(0.97 0.01 80)", + 3: "oklch(0.99 0 0)", + input: "oklch(0.96 0.01 80)", + code: "oklch(0.92 0.01 80)", + select: "oklch(0.88 0.06 80)" + }, + content: { + main: "oklch(0.25 0.02 60)", + muted: "oklch(0.45 0.03 60)", + subtle: "oklch(0.65 0.02 60)", + inverse: "oklch(0.94 0.02 80)" + }, + brand: { + primary: "oklch(0.50 0.15 50)", + secondary: "oklch(0.55 0.12 60)", + tertiary: "oklch(0.60 0.10 45)", + link: "oklch(0.50 0.16 50)" + }, + border: { + faint: "oklch(0.85 0.02 80)", + regular: "oklch(0.75 0.02 80)", + strong: "oklch(0.55 0.04 80)" + }, + state: { + success: "oklch(0.50 0.10 130)", + warning: "oklch(0.60 0.15 50)", + error: "oklch(0.50 0.15 25)", + info: "oklch(0.55 0.10 240)" + }, + syntax: { + keyword: "oklch(0.50 0.14 50)", + string: "oklch(0.45 0.10 130)", + func: "oklch(0.50 0.10 320)", + comment: "oklch(0.65 0.02 80)" + }, + page: { + width: "6.5in", + min_height: "9in", + padding: "0.5in 1in", + margin: "20px auto", + bg_color: "oklch(0.95 0.02 90)", + border_color: "oklch(0.85 0.02 90)", + text_color: "oklch(0.20 0.02 25)", + shadow: "0 4px 15px rgba(0,0,0,0.1)" + }, + }; +})(); diff --git a/developer/tool/promote b/developer/tool/promote index fa97a2c..56e8cea 100755 --- a/developer/tool/promote +++ b/developer/tool/promote @@ -10,7 +10,11 @@ import pwd import grp import filecmp -sys.path.insert(0, os.path.join(os.path.abspath("tool"), "build_component")) +# Calculate the path relative to this script's location +SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) +# Assumes this script is in developer/tool/ +# sync_engine is in developer/tool/build_component +sys.path.insert(0, os.path.join(SCRIPT_DIR, "build_component")) import sync_engine HELP = """usage: promote {write|clean|ls|diff|help|dry write} @@ -117,7 +121,6 @@ def list_tree(root_dp): print(f"{TM_perms} {TM_ownergrp:<{ogw}} {indent}{TM_name}") def cmd_write(dry=False): - assert_setup() dst_root = cpath() ensure_dir(dst_root, DEFAULT_DIR_MODE, dry=dry) src_root = dpath("scratchpad") @@ -132,7 +135,6 @@ def cmd_write(dry=False): ) def cmd_diff(): - assert_setup() dst_root = cpath() src_root = dpath("scratchpad") @@ -184,7 +186,6 @@ def cmd_diff(): print("No differences found. Consumer matches developer scratchpad.") def cmd_clean(): - assert_setup() consumer_root_dir = cpath() if not os.path.isdir(consumer_root_dir): return @@ -199,6 +200,12 @@ def cmd_clean(): except FileNotFoundError: pass def CLI(): + assert_setup() + + repo_home = os.environ.get("REPO_HOME", ".") + dev_dir = os.path.join(repo_home, "developer") + os.chdir(dev_dir) + if len(sys.argv) < 2: print(HELP) return diff --git a/tester/authored/Counter/test_1.html b/tester/authored/Counter/test_1.html new file mode 100644 index 0000000..e8eb51f --- /dev/null +++ b/tester/authored/Counter/test_1.html @@ -0,0 +1,184 @@ + + + + + Counter Status Machine Diagnostics (Outline Style) + + + + + + + + + + +
// Initialize scoped counter with mixed outline styles
+ +
make("A"){} :
+ +
// attempt to snapshot an empty counter will generate an error in the console
+
+ snapshot() -> ( + + , + [] , + "" + ) +
+ +
step("A"){
+ +
+
+ snapshot() == ( + + , + [] , + "" + ) + // Expected: ( preamble ,[0] , "0" ) +
+ +
step("A"){
+ +
+
+ snapshot() == ( + + , + [] , + "" + ) + // Expected: ( preamble ,[0,0] , "0.A" ) +
+
+
+
}
+ +
+ snapshot() == ( + + , + [] , + "" + ) + // Expected: ( between ,[0,0] , "0" ) +
+ +
step("A"){
+ +
+
+ snapshot() == ( + + , + [] , + "" + ) + // Expected: ( preamble ,[0,1] , "0.B" ) +
+
+
+
}
+ +
+ snapshot() == ( + + , + [] , + "" + ) + // Expected: ( between ,[0,1] , "0" ) +
+
+
+
}
+ +
+ snapshot() == ( + + , + [] , + "" + ) // Expected: ( between ,[0] , "" ) +
+ +
step("A"){
+ +
+
+ snapshot() == ( + + , + [] , + "" + ) // Expected: ( preamble ,[1] , "I" ) +
+ +
step("A"){
+ +
+
+ snapshot() == ( + + , + [] , + "" + ) // Expected: ( preamble ,[1,0] , "I.A" ) +
+
+
+
}
+ +
+ snapshot() == ( + + , + [] , + "" + ) // Expected: ( between ,[1,0] , "I" ) +
+ +
step("A"){
+ +
+
+ snapshot() == ( + + , + [] , + "" + ) // Expected: ( preamble ,[1,1] , "I.B" ) +
+
+
+
}
+
+
+
}
+ +
+ snapshot() == ( + + , + [] , + "" + ) // Expected: ( between ,[1] , "" ) +
+ +
+ + diff --git a/tester/authored/Counter/test_2.html b/tester/authored/Counter/test_2.html new file mode 100644 index 0000000..8056556 --- /dev/null +++ b/tester/authored/Counter/test_2.html @@ -0,0 +1,184 @@ + + + + + Counter Status Machine Diagnostics (Milestone Mode) + + + + + + + + + + +
// Initialize milestone counter with outline style
+ +
make("A"){} :
+ +
// attempt to snapshot an empty counter will generate an error in the console
+
+ snapshot() -> ( + + , + [] , + "" + ) +
+ +
step("A"){
+ +
+
+ snapshot() == ( + + , + [] , + "" + ) + // Expected: ( preamble ,[0] , "I" ) +
+ +
step("A"){
+ +
+
+ snapshot() == ( + + , + [] , + "" + ) + // Expected: ( preamble ,[0,0] , "I.A" ) +
+
+
+
}
+ +
+ snapshot() == ( + + , + [] , + "" + ) + // Expected: ( between ,[0,0] , "I.A" ) +
+ +
step("A"){
+ +
+
+ snapshot() == ( + + , + [] , + "" + ) + // Expected: ( preamble ,[0,1] , "I.B" ) +
+
+
+
}
+ +
+ snapshot() == ( + + , + [] , + "" + ) + // Expected: ( between ,[0,1] , "I.B" ) +
+
+
+
}
+ +
+ snapshot() == ( + + , + [] , + "" + ) // Expected: ( between ,[0] , "I" ) +
+ +
step("A"){
+ +
+
+ snapshot() == ( + + , + [] , + "" + ) // Expected: ( preamble ,[1] , "II" ) +
+ +
step("A"){
+ +
+
+ snapshot() == ( + + , + [] , + "" + ) // Expected: ( preamble ,[1,0] , "II.A" ) +
+
+
+
}
+ +
+ snapshot() == ( + + , + [] , + "" + ) // Expected: ( between ,[1,0] , "II.A" ) +
+ +
step("A"){
+ +
+
+ snapshot() == ( + + , + [] , + "" + ) // Expected: ( preamble ,[1,1] , "II.B" ) +
+
+
+
}
+
+
+
}
+ +
+ snapshot() == ( + + , + [] , + "" + ) // Expected: ( between ,[1] , "II" ) +
+ +
+ + -- 2.20.1