<RT·title
author="Thomas Walker Lynch"
- date="2026-06-26 09:35Z"
+ date="2026-06-30 16:49Z"
title="RT Style System: Reference Manual"
copyright="2026 Reasoning Technology">
</RT·title>
</div>
</td>
</tr>
- <tr>
- <td><RT·code><RT·term-index></RT·code></td>
- <td>Inserts a list of the terms used in the paper and the pages they occur on.</td>
- </tr>
<tr>
<td><RT·code><RT·endnotes></RT·code></td>
<td>Inserts a compiled list of the endnotes.</td>
</div>
</td>
</tr>
- <tr>
- <td><RT·code><RT·term-em></RT·code></td>
- <td>Forces visual emphasis for a term subsequent to its first occurrence.</td>
- </tr>
- <tr>
- <td><RT·code><RT·neologism></RT·code></td>
- <td>Project specific vocabulary. Styled distinctly from conventional terms. Auto-generates an anchor ID prefixed with "def-neo-".</td>
- </tr>
- <tr>
- <td><RT·code><RT·neologism-em></RT·code></td>
- <td>Forces visual emphasis for a neologism subsequent to its first occurrence.</td>
- </tr>
<tr>
<td><RT·code><RT·code></RT·code></td>
<td>Code span or pre formatted code block with theme aware borders. Automatically dedents block content.</td>
<td><RT·code><RT·symbol></RT·code></td>
<td>Technical symbol wrapper enforcing strict font weight and character spacing.</td>
</tr>
- <tr>
- <td><RT·code><RT·constraint></RT·code></td>
- <td>Highlights architectural limits or hard requirements in a distinct block.</td>
- </tr>
</tbody>
</table>
<h3>Declarative Counters</h3>
+ <p>
+ 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.
+ </p>
<table>
<thead>
<tr>
<div class="attr-list">
<strong>Attributes:</strong><br>
<code>counter</code>: Required identifier.<br>
- <code>style</code>: "Natural", "roman", "Roman", "alpha", "Alpha", or "roman-outline". (Default: "Natural")<br>
- <code>on-first-step</code>: The starting value. (Default: "1")<br>
- <code>separator</code>: The string separating depth counts. (Default: ".")<br>
- <code>separator-placement</code>: "embedded" or "embedded-after". (Default: "embedded")
+ <code>style</code>: 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")<br>
+ <code>on-first-step</code>: The initial starting value, supplied in the format of the top-level style. (Default: "0")<br>
+ <code>separator</code>: The string joining depth sequence segments. (Default: ".")<br>
+ <code>separator-placement</code>: "embedded" or "embedded-after". (Default: "embedded")<br>
+ <code>mode</code>: "scoped" (omits the rightmost sequence digit when reading outside a closed node) or "milestone" (reports the full completed sequence path). (Default: "scoped")
</div>
</td>
</tr>
<tr>
<td><RT·code><RT·Counter·step></RT·code></td>
<td>
- Advances the counter from empty or increments to the next ordinal address.<br>
- <div class="attr-list">
- <strong>Attributes:</strong><br>
- <code>counter</code>: Required identifier.
- </div>
- </td>
- </tr>
- <tr>
- <td><RT·code><RT·Counter·indent></RT·code></td>
- <td>
- Scope within tag pairs counts at a new depth. Must be closed with <code></RT·Counter·indent></code>.<br>
+ 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.<br>
<div class="attr-list">
<strong>Attributes:</strong><br>
<code>counter</code>: Required identifier.
<tr>
<td><RT·code><RT·Counter·snapshot></RT·code></td>
<td>
- Deep copies the active count and styling parameters to a dictionary key.<br>
+ Clones the entire active state machine, including its current 0-indexed numerical array, operational status, and presentation configurations, saving it to a dictionary key.<br>
<div class="attr-list">
<strong>Attributes:</strong><br>
<code>counter</code>: Required identifier.<br>
<tr>
<td><RT·code><RT·Counter·read></RT·code></td>
<td>
- Reads a field from a snapshot as innerHTML. A snapshot can be recalled from anywhere in the document.<br>
+ Recalls information from a snapshot and outputs it as innerHTML. A snapshot can be recalled from anywhere in the document.<br>
<div class="attr-list">
<strong>Attributes:</strong><br>
<code>snapshot</code>: Required snapshot name.<br>
- <code>key</code>: The state property to read. (Default: "count")
+ <code>key</code>: 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")
</div>
</td>
</tr>
</tr>
</thead>
<tbody>
- <tr>
- <td><RT·code><RT·crossref></RT·code></td>
- <td>Context aware internal anchor link. Visual styling applied automatically.</td>
- </tr>
<tr>
<td><RT·code><RT·endnote></RT·code></td>
<td>Tag pair contents added as an item to the endnote list. Replaces the inline text with an anchor link.</td>
</tr>
- <tr>
- <td><RT·code><RT·footnote></RT·code></td>
- <td>Tag pair contents are automatically extracted and appended to the bottom of the active printed page container.</td>
- </tr>
</tbody>
</table>
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);
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;
i++;
}
}
- return num;
+ return Math.max(0, num - 1); // 1-indexed to 0-indexed
}
to_Alpha(num) { return String.fromCharCode(65 + num); }
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'