From ccaf140b378c7286672c1e11c707049247e98911 Mon Sep 17 00:00:00 2001 From: Thomas Walker Lynch Date: Tue, 30 Jun 2026 09:07:33 +0000 Subject: [PATCH] fix Roman numeral start of count, manual update, Roman counting test --- .../Manuscript.copy/Document/manual.html | 60 ++++--------------- .../Manuscript.copy/Element/constraint.js | 25 -------- .../Manuscript.copy/Element/counter.js | 17 ++++-- .../Manuscript.copy/Element/crossref.js | 29 --------- .../Manuscript.copy/Theme/inverse_wheat.js | 4 +- 5 files changed, 26 insertions(+), 109 deletions(-) delete mode 100644 developer/authored/Manuscript.copy/Element/constraint.js delete mode 100644 developer/authored/Manuscript.copy/Element/crossref.js diff --git a/developer/authored/Manuscript.copy/Document/manual.html b/developer/authored/Manuscript.copy/Document/manual.html index bf37759..add892a 100644 --- a/developer/authored/Manuscript.copy/Document/manual.html +++ b/developer/authored/Manuscript.copy/Document/manual.html @@ -17,7 +17,7 @@ @@ -89,10 +89,6 @@ - - <RT·term-index> - Inserts a list of the terms used in the paper and the pages they occur on. - <RT·endnotes> Inserts a compiled list of the endnotes. @@ -119,18 +115,6 @@ - - <RT·term-em> - Forces visual emphasis for a term subsequent to its first occurrence. - - - <RT·neologism> - Project specific vocabulary. Styled distinctly from conventional terms. Auto-generates an anchor ID prefixed with "def-neo-". - - - <RT·neologism-em> - Forces visual emphasis for a neologism subsequent to its first occurrence. - <RT·code> Code span or pre formatted code block with theme aware borders. Automatically dedents block content. @@ -143,14 +127,13 @@ <RT·symbol> Technical symbol wrapper enforcing strict font weight and character spacing. - - <RT·constraint> - Highlights architectural limits or hard requirements in a distinct block. -

Declarative 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. +

@@ -166,27 +149,18 @@
Attributes:
counter: Required identifier.
- style: "Natural", "roman", "Roman", "alpha", "Alpha", or "roman-outline". (Default: "Natural")
- on-first-step: The starting value. (Default: "1")
- separator: The string separating depth counts. (Default: ".")
- separator-placement: "embedded" or "embedded-after". (Default: "embedded") + 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")
+ 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")
- - - - @@ -227,18 +201,10 @@ - - - - - - - -
<RT·Counter·step> - Advances the counter from empty or increments to the next ordinal address.
-
- Attributes:
- counter: Required identifier. -
-
<RT·Counter·indent> - Scope within tag pairs counts at a new depth. Must be closed with </RT·Counter·indent>.
+ 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.
Attributes:
counter: Required identifier. @@ -196,7 +170,7 @@
<RT·Counter·snapshot> - Deep copies the active count and styling parameters to a dictionary key.
+ Clones the entire active state machine, including its current 0-indexed numerical array, operational status, and presentation configurations, saving it to a dictionary key.
Attributes:
counter: Required identifier.
@@ -207,11 +181,11 @@
<RT·Counter·read> - Reads a field from a snapshot as innerHTML. A snapshot can be recalled from anywhere in the document.
+ Recalls information from a snapshot and outputs it as innerHTML. A snapshot can be recalled from anywhere in the document.
Attributes:
snapshot: Required snapshot name.
- key: The state property to read. (Default: "count") + key: The state property to read. Dot-notation permits querying nested attributes (e.g., "count.status", "count.list"). Querying "count" outputs the style-mapped, separator-joined visual string. (Default: "count")
<RT·crossref>Context aware internal anchor link. Visual styling applied automatically.
<RT·endnote> Tag pair contents added as an item to the endnote list. Replaces the inline text with an anchor link.
<RT·footnote>Tag pair contents are automatically extracted and appended to the bottom of the active printed page container.
diff --git a/developer/authored/Manuscript.copy/Element/constraint.js b/developer/authored/Manuscript.copy/Element/constraint.js deleted file mode 100644 index 41b12c7..0000000 --- a/developer/authored/Manuscript.copy/Element/constraint.js +++ /dev/null @@ -1,25 +0,0 @@ -// developer/authored/RT/element/constraint.js -(function() { - - if (!RT) { - console.error("RT not defined – was RT-Manuscript_make run?"); - return; - } - if (!RT.Element) { - console.error("RT.Element not defined – was the state_manager run?"); - return; - } - - RT.Element.add( function(){ - document.querySelectorAll('RT·constraint').forEach( (el) => { - el.style.display = 'block'; - el.style.borderLeft = `4px solid ${RT.theme('read', 'state', 'warning')}`; - el.style.backgroundColor = RT.theme('read', 'surface', '1'); - el.style.padding = '1rem'; - el.style.margin = '1.5rem 0'; - el.style.color = RT.theme('read', 'content', 'main'); - }); - }); - -})(); - diff --git a/developer/authored/Manuscript.copy/Element/counter.js b/developer/authored/Manuscript.copy/Element/counter.js index 2c00aca..94d355e 100644 --- a/developer/authored/Manuscript.copy/Element/counter.js +++ b/developer/authored/Manuscript.copy/Element/counter.js @@ -170,7 +170,11 @@ write(dict) { for (const [key, value] of Object.entries(dict)) { if (key === 'style') { - this.style = Array.isArray(value) ? value : [value]; + let parsed = Array.isArray(value) ? value : [value]; + if (parsed.length === 1 && parsed[0] === 'outline') { + parsed = ['Roman', 'Alpha', 'roman', 'alpha', 'CountingNumber']; + } + this.style = parsed; } else if (key === 'Count' || key === 'count') { // Support copying from another CounterMachine or Count object const source_count = value instanceof CounterMachine ? value.count : (value instanceof Count ? value : null); @@ -263,13 +267,14 @@ from_roman(val) { return this.from_Roman(val.toUpperCase()); } to_Roman(num) { - if (num < 1) return num.toString(); + let n = num + 1; // 0-indexed to 1-indexed + if (n < 1) return n.toString(); const lookup = {M:1000, CM:900, D:500, CD:400, C:100, XC:90, L:50, XL:40, X:10, IX:9, V:5, IV:4, I:1}; let roman = ''; for (let i in lookup) { - while (num >= lookup[i]) { + while (n >= lookup[i]) { roman += i; - num -= lookup[i]; + n -= lookup[i]; } } return roman; @@ -289,7 +294,7 @@ i++; } } - return num; + return Math.max(0, num - 1); // 1-indexed to 0-indexed } to_Alpha(num) { return String.fromCharCode(65 + num); } @@ -342,7 +347,7 @@ const on_first_step_str = node.getAttribute('on-first-step'); if (on_first_step_str) { - const top_style = parsed_style[0]; + const top_style = RT.dict_instance[name].style[0]; const method_name = `from_${top_style}`; const active_machine = RT.dict_instance[name]; const initial_val = typeof active_machine[method_name] === 'function' diff --git a/developer/authored/Manuscript.copy/Element/crossref.js b/developer/authored/Manuscript.copy/Element/crossref.js deleted file mode 100644 index bf7cded..0000000 --- a/developer/authored/Manuscript.copy/Element/crossref.js +++ /dev/null @@ -1,29 +0,0 @@ -/* - Processes tags. - Applies default styling and interaction cues using the active RT theme. -*/ - -(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('crossref', 'Processing cross-references'); - - document.querySelectorAll('rt·crossref').forEach( (el) => { - el.style.color = window.RT.theme('read', 'brand', 'link'); - el.style.textDecoration = 'underline'; - el.style.cursor = 'pointer'; - el.style.fontWeight = '500'; - }); - }); - -})(); diff --git a/developer/authored/Manuscript.copy/Theme/inverse_wheat.js b/developer/authored/Manuscript.copy/Theme/inverse_wheat.js index 5c5c05a..d4e72a8 100644 --- a/developer/authored/Manuscript.copy/Theme/inverse_wheat.js +++ b/developer/authored/Manuscript.copy/Theme/inverse_wheat.js @@ -1,4 +1,4 @@ -// Theme/inverse_wheat_DS.js +// Theme/inverse_wheat.js window.RT = window.RT || {}; window.RT.theme_library = window.RT.theme_library || {}; @@ -6,7 +6,7 @@ window.RT.theme_library = window.RT.theme_library || {}; window.RT.theme_library['inverse_wheat'] = { meta: { is_dark: true, - name: "inverse_wheat_DS" + name: "inverse_wheat" }, surface: { 0: "oklch(0.157 0 0)", -- 2.20.1