--- /dev/null
+#!/usr/bin/env python3
+import sys
+import os
+import re
+
+def migrate_rt_tags(file_path):
+ if not os.path.isfile(file_path):
+ print(f"Error: File '{file_path}' not found.")
+ sys.exit(1)
+
+ with open(file_path, 'r', encoding='utf-8') as f:
+ content = f.read()
+
+ # 1. Migrate legacy tag terminology to current vocabulary
+ content = re.sub(r'<(/?)(RT)-index(\b|/|>)', r'<\g<1>\g<2>⋅term-index\g<3>', content)
+ content = re.sub(r'<(/?)(RT-counter)[_-]init(\b|/|>)', r'<\g<1>\g<2>⋅make\g<3>', content)
+ content = re.sub(r'<(/?)(RT-counter)[_-]inc(\b|/|>)', r'<\g<1>\g<2>⋅step\g<3>', content)
+ content = re.sub(r'<(/?)(RT-counter)[_-]label(\b|/|>)', r'<\g<1>\g<2>⋅snapshot\g<3>', content)
+
+ # 2. Migrate the primary RT namespace separator
+ rt_tags = [
+ "article", "memo", "book", "title", "TOC", "term-index",
+ "endnotes", "term", "term-em", "neologism", "neologism-em",
+ "code", "math", "symbol", "constraint", "crossref", "ref",
+ "cite", "footnote", "page", "page-break", "chapter", "theme-selector"
+ ]
+ rt_pattern = "|".join(rt_tags)
+ content = re.sub(rf'<(/?)(RT)-({rt_pattern})(\b|/|>)', r'<\g<1>\g<2>⋅\g<3>\g<4>', content)
+
+ # 3. Migrate the secondary RT-counter namespace separator
+ counter_tags = ["make", "step", "indent", "snapshot", "read"]
+ counter_pattern = "|".join(counter_tags)
+ content = re.sub(rf'<(/?)(RT-counter)[_-]({counter_pattern})(\b|/|>)', r'<\g<1>\g<2>⋅\g<3>\g<4>', content)
+
+ # 4. Migrate the 'initial' parameter to 'on-first-step' within make tags
+ content = re.sub(r'(<RT-counter⋅make[^>]+)initial=', r'\g<1>on-first-step=', content)
+
+ # 5. Migrate 'key="initial"' to 'key="on-first-step"' within read tags
+ content = re.sub(r'(<RT-counter⋅read[^>]+key=[\'"])initial([\'"])', r'\g<1>on-first-step\g<2>', content)
+
+ backup_path = file_path + '.v2.bak'
+ os.rename(file_path, backup_path)
+
+ with open(file_path, 'w', encoding='utf-8') as f:
+ f.write(content)
+
+ print(f"Migration complete: {file_path}")
+ print(f"Original file backed up to: {backup_path}")
+
+if __name__ == "__main__":
+ if len(sys.argv) != 2:
+ print("Usage: python3 migrate_rt_v3.py <file_path>")
+ sys.exit(1)
+
+ migrate_rt_tags(sys.argv[1])
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8">
+ <title>RT Style System: Reference Manual</title>
+
+ <script src="RT-Style_locator.js"></script>
+ <script>
+ window.RT.load('Layout/article_tech_ref');
+ </script>
+ </head>
+ <body>
+ <RT⋅theme-selector></RT⋅theme-selector>
+
+ <RT⋅article>
+
+ <RT⋅title
+ author="Thomas Walker Lynch"
+ date="2026-06-25 15:37Z"
+ title="RT Style System: Reference Manual"
+ copyright="2026 Reasoning Technology">
+ </RT⋅title>
+
+ <RT⋅TOC level="1-2"></RT⋅TOC>
+
+ <h1>Layout Environments</h1>
+ <p>
+ The RT tags are available to be used inside of layout environments. They are:
+ </p>
+
+ <table>
+ <thead>
+ <tr>
+ <th>Tag</th>
+ <th>Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><RT⋅code><RT⋅article></RT⋅code></td>
+ <td>Standard technical document layout with dynamic pagination.</td>
+ </tr>
+ <tr>
+ <td><RT⋅code><RT⋅memo></RT⋅code></td>
+ <td>Strict print layout (6.5 inch width, serif typography, monochrome).</td>
+ </tr>
+ <tr>
+ <td><RT⋅code><RT⋅book></RT⋅code></td>
+ <td>Multi chapter compilation layout (Upcoming).</td>
+ </tr>
+ </tbody>
+ </table>
+
+ <h2>Article Environment</h2>
+ <p>
+ The <RT⋅code><RT⋅article></RT⋅code> container provides the standard toolset for technical documentation, whitepapers, and specifications. It utilizes dynamic soft limit pagination and responsive ink ratio balancing.
+ </p>
+
+ <h3>Section Generators</h3>
+ <table>
+ <thead>
+ <tr>
+ <th>Tag</th>
+ <th>Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><RT⋅code><RT⋅title></RT⋅code></td>
+ <td>Constructs the standardized title block and metadata header.</td>
+ </tr>
+ <tr>
+ <td><RT⋅code><RT⋅TOC></RT⋅code></td>
+ <td>Compiles an automatic table of contents by scanning heading depths.</td>
+ </tr>
+ <tr>
+ <td><RT⋅code><RT⋅term-index></RT⋅code></td>
+ <td>Compiles an alphabetized glossary of terms defined within the document.</td>
+ </tr>
+ <tr>
+ <td><RT⋅code><RT⋅endnotes></RT⋅code></td>
+ <td>Container for extracted bibliographic citations.</td>
+ </tr>
+ </tbody>
+ </table>
+
+ <h3>Semantic Tags</h3>
+ <table>
+ <thead>
+ <tr>
+ <th>Tag</th>
+ <th>Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><RT⋅code><RT⋅term></RT⋅code></td>
+ <td>Standard technical term. Decorates first occurrence and establishes an anchor.</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.</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.</td>
+ </tr>
+ <tr>
+ <td><RT⋅code><RT⋅math></RT⋅code></td>
+ <td>Inline or block mathematics evaluated by MathJax.</td>
+ </tr>
+ <tr>
+ <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>
+ <table>
+ <thead>
+ <tr>
+ <th>Tag</th>
+ <th>Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><RT⋅code><RT-counter⋅make></RT⋅code></td>
+ <td>Declares an empty named counter sequence (e.g., figure, equation).</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.</td>
+ </tr>
+ <tr>
+ <td><RT⋅code><RT-counter⋅indent></RT⋅code></td>
+ <td>Pushes a new structural depth onto the tracking stack.</td>
+ </tr>
+ <tr>
+ <td><RT⋅code><RT-counter⋅snapshot></RT⋅code></td>
+ <td>Deep copies the active count and styling parameters to a dictionary key.</td>
+ </tr>
+ <tr>
+ <td><RT⋅code><RT-counter⋅read></RT⋅code></td>
+ <td>Recalls a saved count or format parameter from the snapshot dictionary.</td>
+ </tr>
+ </tbody>
+ </table>
+
+ <h3>References and Citations</h3>
+ <table>
+ <thead>
+ <tr>
+ <th>Tag</th>
+ <th>Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><RT⋅code><RT⋅crossref></RT⋅code></td>
+ <td>Context aware internal anchor link.</td>
+ </tr>
+ <tr>
+ <td><RT⋅code><RT⋅ref></RT⋅code></td>
+ <td>Dynamic reference evaluating to a structural target.</td>
+ </tr>
+ <tr>
+ <td><RT⋅code><RT⋅cite></RT⋅code></td>
+ <td>Bibliographic citation marker mapping to the endnotes block.</td>
+ </tr>
+ <tr>
+ <td><RT⋅code><RT⋅footnote></RT⋅code></td>
+ <td>Inline text extracted and appended to the bottom of the active page.</td>
+ </tr>
+ </tbody>
+ </table>
+
+ <h3>Pagination Control</h3>
+ <table>
+ <thead>
+ <tr>
+ <th>Tag</th>
+ <th>Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><RT⋅code><RT⋅page></RT⋅code></td>
+ <td>Automatically generated boundary container. Do not author manually.</td>
+ </tr>
+ <tr>
+ <td><RT⋅code><RT⋅page-break></RT⋅code></td>
+ <td>Explicit directive forcing subsequent content to the next page container.</td>
+ </tr>
+ </tbody>
+ </table>
+
+ <h2>Memo Environment</h2>
+ <p>
+ The <RT⋅code><RT⋅memo></RT⋅code> container inherits all valid tags from the Article environment but overrides the global CSS to enforce a static, print ready monochrome aesthetic.
+ </p>
+
+ <h2>Book Environment</h2>
+ <p>
+ The <RT⋅code><RT⋅book></RT⋅code> container is reserved for multi chapter compilations. It introduces tags designed exclusively for macro level document orchestration.
+ </p>
+
+ <h3>Book Specific Tags</h3>
+ <table>
+ <thead>
+ <tr>
+ <th>Tag</th>
+ <th>Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><RT⋅code><RT⋅chapter></RT⋅code></td>
+ <td>Chapter heading. Implies a page break, inherits standard H1 typography, and registers as a top level division in the TOC.</td>
+ </tr>
+ </tbody>
+ </table>
+
+ <h1>Global Widgets</h1>
+ <table>
+ <thead>
+ <tr>
+ <th>Tag</th>
+ <th>Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><RT⋅code><RT⋅theme-selector></RT⋅code></td>
+ <td>Floating interactive widget permitting real time swapping of visual themes.</td>
+ </tr>
+ </tbody>
+ </table>
+
+ </RT⋅article>
+ </body>
+</html>
+++ /dev/null
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>RT Style System</title>
-
- <script src="RT-Style_locator.js"></script>
- <script>
- window.RT.load('Layout/article_tech_ref');
- </script>
- </head>
- <body>
- <rt-theme-selector></rt-theme-selector>
-
- <RT-article>
-
- <RT-title author="Gemini" date="2026-06-17 15:19:00Z" title="RT Style System: Reference Manual"></RT-title>
-
- <RT-TOC level="1"></RT-TOC>
-
- <RT-chapter>Table of custom tags</RT-chapter>
-
- <h2>Style tag reference</h2>
-
- <table>
- <thead>
- <tr>
- <th>Tag</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><RT-code><RT-article></RT-code></td>
- <td>Article container.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-title></RT-code></td>
- <td>
- Title block and metadata.
- </td>
- </tr>
-
- <tr>
- <td><RT-code><RT-TOC></RT-code></td>
- <td>Compiles TOC.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-index></RT-code></td>
- <td>Compiles an alphabetical glossary of defined terms.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-term></RT-code></td>
- <td>Conventional term.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-term-em></RT-code></td>
- <td>Forces emphasis for a term even after first occurrence.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-neologism></RT-code></td>
- <td>Project specific term.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-neologism-em></RT-code></td>
- <td>Forces emphasis for a neologism even after first occurrence.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-code></RT-code></td>
- <td>Code span or code block.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-math></RT-code></td>
- <td>Inline or block math.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-footnote></RT-code></td>
- <td>Inline text to be extracted and rendered at the bottom of the page.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-cite></RT-code></td>
- <td>Bibliographic citation marker.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-ref></RT-code></td>
- <td>Dynamic cross reference to another element in the document.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-page></RT-code></td>
- <td>Automatically inserted pagination container.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-chapter></RT-code></td>
- <td>Chapter heading with implied page break.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-page-break></RT-code></td>
- <td>Explicit page break directive. Must be explicitly closed.</td>
- </tr>
- </tbody>
- </table>
-
- <RT-chapter>Architecture overview</RT-chapter>
- <p>
- The <RT-term>RT Style System</RT-term> is a client-side, JavaScript-driven publishing framework designed to turn raw HTML into high-readability technical documentation. Unlike standard CSS frameworks, RT uses JavaScript to handle complex layout tasks like <RT-neologism>ink-ratio balancing</RT-neologism> and dynamic pagination.
- </p>
-
- <h2>Pulling style files into a document</h2>
- <p> Put `setup.js` in the directory, and include it at the top of the document,
- `setup.js` points at the style files and is installation specific.</p>
-
-
- <RT-chapter>Semantic tags</RT-chapter>
- <p>
- The system relies on a specific set of custom tags in the <RT-code>RT-</RT-code> namespace to separate meaning from presentation.
- </p>
-
- <h2>Terminology</h2>
-
- <h3>Conventional terms</h3>
- <p>
- Use <RT-code><RT-term></RT-code> for standard, industry accepted technical terms. The system decorates only the first occurrence of each unique term so that the first appearance functions as a definition point, and later appearances do not overload the page with styling.
- </p>
-
- <RT-code>
- The <RT-term>Singleton Pattern</RT-term> restricts instantiation...
- </RT-code>
-
- <p>
- <em>Renders as:</em> The <RT-term>Singleton Pattern</RT-term> restricts instantiation...
- </p>
-
- <h3>Neologisms</h3>
- <p>
- Use <RT-code><RT-neologism></RT-code> for terms invented specifically for the current document or project. Neologisms are styled more strongly than conventional terms, visually distinguishing "jargon you should know" from "jargon we invented."
- </p>
-
- <RT-code>
- We define the <RT-neologism>Hyper Tape</RT-neologism> as a construct...
- </RT-code>
-
- <p>
- <em>Renders as:</em> We define the <RT-neologism>Hyper Tape</RT-neologism> as a construct...
- </p>
-
- <h3>First occurrence rule</h3>
- <p>
- The term system is intentionally conservative. For the tags <RT-code><RT-term></RT-code> and <RT-code><RT-neologism></RT-code>, only the first occurrence of a unique term is decorated. Subsequent mentions are rendered as normal prose.
- </p>
-
- <p>
- Uniqueness is tracked by normalizing the term text (trimmed, then lowercased). This means that <RT-code>Symbol</RT-code> and <RT-code>symbol</RT-code> count as the same term.
- </p>
-
- <h3>Forced emphasis variants</h3>
- <p>
- Sometimes a later mention of a term should be emphasized again. For that purpose, the system provides explicit emphasis tags:
- </p>
-
- <ul>
- <li><RT-code><RT-term-em></RT-code></li>
- <li><RT-code><RT-neologism-em></RT-code></li>
- </ul>
-
- <p>
- These variants are always decorated, even if the term appeared earlier.
- </p>
-
- <h3>Automatic definition anchors</h3>
- <p>
- For first occurrences, the term module automatically assigns an <RT-code>id</RT-code> attribute if one does not already exist. This establishes stable anchors for future indexing and linking.
- </p>
-
- <RT-code>
- We define a <RT-term>Symbol</RT-term> as...
- </RT-code>
-
- <p>
- The first occurrence will be given an id similar to <RT-code>def-symbol</RT-code>. For neologisms, an additional marker is used, for example <RT-code>def-neo-hyper-tape</RT-code>.
- </p>
-
- <h2>Technical content</h2>
-
- <h3>Code</h3>
- <p>
- Use <RT-code><RT-code></RT-code>. If placed inline, it acts like a span. If placed as a block (with newlines), it acts like a pre formatted block with a theme aware border.
- </p>
-
- <RT-code>
- # Block Code Example
- def hello():
- return "World"
- </RT-code>
-
- <h3>Mathematics</h3>
- <p>
- Use <RT-code><RT-math></RT-code>. The system auto detects if it is a block equation or inline variable and wraps it in MathJax delimiters.
- </p>
- <p>
- Inline: Let <RT-math>x</RT-math> be the input.
- </p>
- <p>
- Block:
- </p>
- <RT-math>
- f(x) = \sum_{i=0}^{n} x_i
- </RT-math>
-
- <h2>References, citations, and indexing</h2>
-
- <h3>Footnotes</h3>
- <p>
- Use <RT-code><RT-footnote></RT-code> to author footnote content directly inline with the text it references. During the layout phase, the pagination engine extracts the text, replaces the element with an invisible structural marker, and compiles a formatted footnote container at the bottom of the active <RT-code><RT-page></RT-code>.
- </p>
-
- <h3>Citations</h3>
- <p>
- Use <RT-code><RT-cite></RT-code> with the <RT-code>ref</RT-code> attribute to insert bibliographic citations. This ensures formatting remains consistent and separates citation data from standard prose.
- </p>
- <RT-code>
- ... formalized as Basic Law V <RT-endnote ref="Gottlob Frege, Grundgesetze, 1903"></RT-endnote>.
- </RT-code>
-
- <h3>Dynamic cross referencing</h3>
- <p>
- A person authoring a technical document frequently refers back to tables, equations, or previous sections. Use <RT-code><RT-ref target="element-id"></RT-code> to link to specific content. This tag dynamically retrieves the numbering or caption of the target element, maintaining correct references even if preceding elements shift during editing.
- </p>
-
- <h3>Glossary indexing</h3>
- <p>
- Use <RT-code><RT-index></RT-code> at the end of the document to compile a glossary. Similar to the TOC compiler, this tag scans the DOM for automatic definition anchors produced by the term module and generates an alphabetized list of defined terms and neologisms.
- </p>
-
- <RT-chapter>Navigation and layout</RT-chapter>
-
- <h2>Automatic table of contents</h2>
- <p>
- Use <RT-code><RT-TOC></RT-code> to insert a compiled table of contents. The tag scans the document <em>forward</em> from its current position to collect headings.
- </p>
-
- <h3>Explicit mode</h3>
- <p>
- Use the <RT-code>level="N"</RT-code> attribute to target a specific heading depth.
- </p>
- <ul>
- <li><RT-code><RT-TOC level="1"></RT-code>: Collects all <RT-code><h1></RT-code> elements until the end of the document. Best for the main document index.</li>
- <li><RT-code><RT-TOC level="2"></RT-code>: Collects all <RT-code><h2></RT-code> elements until it encounters the next <RT-code><h1></RT-code>. Best for chapter summaries.</li>
- </ul>
-
- <h3>Implicit mode</h3>
- <p>
- If no level is specified, the TOC scans backwards to find the nearest heading (for example H1) and assumes you want to collect children one level deeper (for example H2).
- </p>
- <p>
- <em>Note: Implicit mode can fail if placed before the first heading of a section. Use explicit levels for robust results.</em>
- </p>
-
- <h2>The title block</h2>
- <p>
- Use <RT-code><RT-title></RT-code> as the first element in your <RT-code><body></RT-code> (before the article container). This tag produces a standardized, styled header block with the document title and metadata.
- </p>
-
- <h3>Attributes</h3>
- <ul>
- <li><RT-code>title</RT-code> (Required): The main heading of the document.</li>
- <li><RT-code>author</RT-code> (Optional): The author's name. Renders in a bold accent color.</li>
- <li><RT-code>date</RT-code> (Optional): The publication or revision date.</li>
- </ul>
-
- <h3>Example</h3>
- <RT-code>
- <RT-title
- title="RT Style System: Reference Manual"
- author="Gemini"
- date="2026-06-17 15:19:00Z">
- </RT-title>
- </RT-code>
-
- <p>
- <em>Renders as:</em> A centered, high contrast H1 followed by a serif styled metadata row containing the author and date.
- </p>
-
- <h2>The article container</h2>
- <p>
- The root element must be <RT-code><RT-article></RT-code>. This is the boundary for the pagination logic.
- </p>
-
- <h2>Pagination</h2>
- <p>
- The script <RT-code>paginate_by_element.js</RT-code> scans the article. It calculates the height of every element (including margins) and bundles them into <RT-code><RT-page></RT-code> elements.
- </p>
- <p>
- <RT-neologism>Soft Limit Pagination</RT-neologism>: The system attempts to keep headers with their following paragraphs. It will break a page early rather than stranding a header at the bottom.
- </p>
-
- <h2>Manual page breaks and chapters</h2>
- <p>
- A person can assert explicit control over the layout engine using the <RT-code><RT-page-break></RT-page-break></RT-code> tag. This tag forces the engine to close the current page and push all subsequent content to the top of the next page. Standard HTML5 parsing requires this custom tag to be explicitly closed; self-closing syntax will fail.
- </p>
- <p>
- For major document divisions, use <RT-code><RT-chapter></RT-code>. The semantic processor translates this tag into an <RT-code><RT-page-break></RT-code> followed by an <RT-code><h1 class="RT-chapter"></RT-code>. This ensures the chapter starts on a new page, inherits standard typography, and is automatically indexed by the TOC engine.
- </p>
-
- <RT-chapter>Debugging</RT-chapter>
-
- <h2>Debug tokens</h2>
- <p>
- RT provides a lightweight debug logging system in <RT-code>utility.js</RT-code>. Logging is controlled by a set of active debug tokens. Each log message is assigned a token, and the message prints only if that token is enabled.
- </p>
-
- <p>
- Examples of common tokens include <RT-code>style</RT-code>, <RT-code>layout</RT-code>, <RT-code>pagination</RT-code>, <RT-code>selector</RT-code>, <RT-code>config</RT-code>, and <RT-code>term</RT-code>.
- </p>
-
- <h2>How logging is gated</h2>
- <p>
- Normal log and warning output are gated. The methods <RT-code>debug.log(token,message)</RT-code> and <RT-code>debug.warn(token,message)</RT-code> will print only when the token exists in <RT-code>debug.active_tokens</RT-code>.
- </p>
-
- <p>
- This prevents the console from being flooded during normal use, while still allowing deep visibility during development.
- </p>
-
- <h2>Errors are always printed</h2>
- <p>
- Errors are treated differently. The method <RT-code>debug.error(token,message)</RT-code> always prints, regardless of token state. These messages represent failures that require attention.
- </p>
-
- <h2>Enabling and disabling tokens</h2>
- <p>
- Tokens are enabled or disabled in two ways: by editing the <RT-code>active_tokens</RT-code> set in <RT-code>utility.js</RT-code>, or at runtime by calling:
- </p>
-
- <RT-code>
- window.RT.debug.enable('term')
- window.RT.debug.disable('term')
- </RT-code>
-
- <p>
- For example, the term system (<RT-code>RT_term.js</RT-code>) uses the <RT-code>term</RT-code> token. When that token is enabled, the module will print messages describing how terms were detected and which term definitions were assigned IDs.
- </p>
-
- <RT-chapter>Themes</RT-chapter>
- <p>
- The system supports hot swapping themes by changing the script import in the head.
- </p>
- <ul>
- <li><strong>Dark:</strong> <RT-code>style/theme_dark_gold.js</RT-code> (Default)</li>
- <li><strong>Light:</strong> <RT-code>style/theme_light_gold.js</RT-code></li>
- </ul>
-
- <RT-chapter>Manifest</RT-chapter>
- <RT-code>
- 2. utility.js (Math/Color physics)
- 3. article_tech_ref.js (Typography and CSS injection)
- 4. RT_code.js (Code block logic)
- 5. RT_math.js (MathJax wrapper)
- 6. RT_term.js (Term styling)
- 7. RT_TOC.js (Navigation generator)
- 8. paginate_by_element.js (Page splitter)
- 9. page_fixed_glow.js (Visual page container)
- </RT-code>
-
- <RT-chapter>RT conventions</RT-chapter>
- <p> Headings are first letter capitalized. Remaining words are as they would be in English prose.</p>
-
- <RT-chapter>Exercises</RT-chapter>
-
- <ol>
- <li>
- <p>
- <strong>Term occurrences:</strong> If an author tags a word with <RT-code><RT-term></RT-code> five times in a document, how many times will the term be visually decorated by the styling engine? How does a person force the engine to decorate a later occurrence?
- </p>
- </li>
- <li>
- <p>
- <strong>Term normalization:</strong> A person writes <RT-code><RT-term>Parse Tree</RT-term></RT-code> in paragraph one, and <RT-code><RT-term>parse tree</RT-term></RT-code> in paragraph two. Will the system assign a definition anchor to the second occurrence?
- </p>
- </li>
- <li>
- <p>
- <strong>TOC compilation:</strong> What happens if a person places an <RT-code><RT-TOC></RT-code> tag without a level attribute before the first heading of a section?
- </p>
- </li>
- <li>
- <p>
- <strong>Code and math formatting:</strong> How does the RT system determine whether to render an <RT-code><RT-code></RT-code> or <RT-code><RT-math></RT-code> element inline with the text versus as a standalone block?
- </p>
- </li>
- <li>
- <p>
- <strong>Pagination logic:</strong> When the script bundles elements into an <RT-code><RT-page></RT-code> container, how does the soft limit pagination handle a heading that falls at the very bottom of the page capacity?
- </p>
- </li>
- </ol>
-
- </RT-article>
- </body>
-</html>
window.RT = window.RT || {};
-window.RT.dict_label = {};
+
+window.RT.dict_counter = {};
+window.RT.dict_snapshot = {};
+
+function clone_counter_state(state) {
+ return {
+ counter: state.counter,
+ stack: [...state.stack],
+ empty: [...state.empty],
+ separator: state.separator,
+ 'separator-placement': state['separator-placement'],
+ style: state.style,
+ 'on-first-step': state['on-first-step'], // The literal string authored
+ count: state.count
+ };
+}
window.RT.counter_do_count = function (root_node) {
- let counters_state = {};
-
- function walk(node) {
- if (node.nodeType !== Node.ELEMENT_NODE) return;
-
- const tag = node.tagName.toLowerCase();
- let pushed_name = null;
-
- if (tag === 'rt-counter-init') {
- const name = node.getAttribute('name');
- if (name) {
- let initial_val = parseInt(node.getAttribute('initial'), 10);
- if (isNaN(initial_val)) {
- initial_val = 1;
- }
-
- counters_state[name] = {
- stack: [initial_val - 1],
- separator: node.getAttribute('separator') || '.',
- style: node.getAttribute('style') || 'Natural',
- initial: initial_val,
- current_count_str: ''
- };
- }
- } else if (tag === 'rt-counter-indent') {
- const name = node.getAttribute('name');
- if (name && counters_state[name]) {
- counters_state[name].stack.push(0);
- pushed_name = name;
- }
- } else if (tag === 'rt-counter-inc') {
- const name = node.getAttribute('name');
- if (name && counters_state[name]) {
- const state = counters_state[name];
- state.stack[state.stack.length - 1] += 1;
- state.current_count_str = state.stack.join(state.separator);
-
- node.setAttribute('data-count', state.current_count_str);
- node.innerHTML = state.current_count_str;
- }
- } else if (tag === 'rt-counter-label') {
- const name = node.getAttribute('name');
- if (name && counters_state[name]) {
- const state = counters_state[name];
- // Stamp all relevant metadata for the labeling phase
- node.setAttribute('data-count', state.current_count_str);
- node.setAttribute('data-style', state.style);
- node.setAttribute('data-separator', state.separator);
- node.setAttribute('data-initial', state.initial);
- }
+ window.RT.dict_counter = {};
+ window.RT.dict_snapshot = {};
+
+ function to_roman(num) {
+ if (num < 1) return num.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]) {
+ roman += i;
+ num -= lookup[i];
+ }
+ }
+ return roman;
+ }
+
+ function parse_first_step(val_str, style, counter_name) {
+ if (!val_str) return 1;
+
+ let num = NaN;
+
+ if (style === 'alpha') {
+ if (/^[a-z]$/.test(val_str)) {
+ num = val_str.charCodeAt(0) - 96;
+ }
+ } else if (style === 'Alpha') {
+ if (/^[A-Z]$/.test(val_str)) {
+ num = val_str.charCodeAt(0) - 64;
+ }
+ } else if (style === 'roman' || style === 'Roman' || style === 'roman-outline') {
+ let is_upper = (style === 'Roman' || style === 'roman-outline');
+ let regex = is_upper ? /^M*(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/ : /^m*(cm|cd|d?c{0,3})(xc|xl|l?x{0,3})(ix|iv|v?i{0,3})$/;
+
+ if (regex.test(val_str)) {
+ 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 temp = val_str.toUpperCase();
+ num = 0;
+ let i = 0;
+ while (i < temp.length) {
+ if (i + 1 < temp.length && lookup[temp.substring(i, i + 2)]) {
+ num += lookup[temp.substring(i, i + 2)];
+ i += 2;
+ } else {
+ num += lookup[temp[i]];
+ i++;
+ }
}
+ }
+ } else {
+ if (/^\d+$/.test(val_str)) {
+ num = parseInt(val_str, 10);
+ }
+ }
+
+ if (isNaN(num) || num < 1) {
+ console.error(`RT-Style Layout Error: Type mismatch. Invalid 'on-first-step' value '${val_str}' for style '${style}' in counter '${counter_name}'.`);
+ return 1;
+ }
+ return num;
+ }
+
+ function format_count(num, style, depth) {
+ if (style === 'roman') return to_roman(num).toLowerCase();
+ if (style === 'Roman') return to_roman(num);
+ if (style === 'Alpha') return String.fromCharCode(64 + num);
+ if (style === 'alpha') return String.fromCharCode(96 + num);
+
+ if (style === 'roman-outline') {
+ const levels = ['Roman', 'Alpha', 'Natural', 'alpha', 'roman'];
+ const current_style = levels[depth % levels.length];
+ return format_count(num, current_style, 0);
+ }
+
+ return num.toString();
+ }
+
+ function walk(node) {
+ if (node.nodeType !== Node.ELEMENT_NODE) return;
+
+ const tag = node.tagName.toLowerCase();
+ let pushed_name = null;
- let child = node.firstElementChild;
- while (child) {
- walk(child);
- child = child.nextElementSibling;
+ if (tag === 'rt-counter_make') {
+ const name = node.getAttribute('counter');
+ if (name) {
+ const style = node.getAttribute('style') || 'Natural';
+ const on_first_step_str = node.getAttribute('on-first-step');
+
+ let first_step_int = parse_first_step(on_first_step_str, style, name);
+
+ window.RT.dict_counter[name] = {
+ counter: name,
+ stack: [0],
+ empty: [true],
+ separator: node.getAttribute('separator') || '.',
+ 'separator-placement': node.getAttribute('separator-placement') || 'embedded',
+ style: style,
+ 'on-first-step': on_first_step_str || '1',
+ on_first_step_int: first_step_int, // Stored internally for execution
+ count: ''
+ };
+ }
+ } else if (tag === 'rt-counter_indent') {
+ const name = node.getAttribute('counter');
+ if (name && window.RT.dict_counter[name]) {
+ window.RT.dict_counter[name].stack.push(0);
+ window.RT.dict_counter[name].empty.push(true);
+ pushed_name = name;
+ }
+ } else if (tag === 'rt-counter_step') {
+ const name = node.getAttribute('counter');
+ if (name && window.RT.dict_counter[name]) {
+ const state = window.RT.dict_counter[name];
+ const depth = state.stack.length - 1;
+
+ if (state.empty[depth]) {
+ state.stack[depth] = (depth === 0) ? state.on_first_step_int : 1;
+ state.empty[depth] = false;
+ } else {
+ state.stack[depth] += 1;
+ }
+
+ const formatted_stack = state.stack.map((val, index) =>
+ format_count(val, state.style, index)
+ );
+
+ let count_str = formatted_stack.join(state.separator);
+ if (state['separator-placement'] === 'embedded-after') {
+ count_str += state.separator;
}
+
+ state.count = count_str;
+ }
+ } else if (tag === 'rt-counter_snapshot') {
+ const counter_name = node.getAttribute('counter');
+ const snapshot_name = node.getAttribute('snapshot');
+
+ if (counter_name && snapshot_name && window.RT.dict_counter[counter_name]) {
+ const state = window.RT.dict_counter[counter_name];
+ const depth = state.stack.length - 1;
- if (pushed_name) {
- counters_state[pushed_name].stack.pop();
+ if (state.empty[depth]) {
+ console.error(`RT-Style Layout Error: Attempted to snapshot an empty counter '${counter_name}' at snapshot '${snapshot_name}'. A person must use <RT-counter_step> before taking a snapshot.`);
+ } else {
+ window.RT.dict_snapshot[snapshot_name] = clone_counter_state(state);
}
+ }
}
- walk(root_node);
-};
+ let child = node.firstElementChild;
+ while (child) {
+ walk(child);
+ child = child.nextElementSibling;
+ }
-window.RT.counter_do_label = function (root_node) {
- window.RT.dict_label = {};
- const labels = root_node.querySelectorAll('rt-counter-label');
- for (let i = 0; i < labels.length; i++) {
- const lbl = labels[i].getAttribute('label');
- if (lbl) {
- // Store a complete property object instead of just a string
- window.RT.dict_label[lbl] = {
- count: labels[i].getAttribute('data-count'),
- name: labels[i].getAttribute('name'),
- style: labels[i].getAttribute('data-style'),
- separator: labels[i].getAttribute('data-separator'),
- initial: labels[i].getAttribute('data-initial')
- };
- }
+ if (pushed_name) {
+ window.RT.dict_counter[pushed_name].stack.pop();
+ window.RT.dict_counter[pushed_name].empty.pop();
}
+ }
+
+ walk(root_node);
+};
+
+window.RT.counter_do_snapshot = function (root_node) {
+ return;
};
window.RT.counter_do_read = function (root_node) {
- const reads = root_node.querySelectorAll('rt-counter-read');
- for (let i = 0; i < reads.length; i++) {
- const label = reads[i].getAttribute('label');
- // Default to 'count' if no key is provided
- const key = reads[i].getAttribute('key') || 'count';
-
- if (label && window.RT.dict_label[label]) {
- const value = window.RT.dict_label[label][key];
- if (value !== undefined && value !== null) {
- reads[i].innerHTML = value;
- } else {
- reads[i].innerHTML = `[Missing key: ${key}]`;
- }
- }
+ const reads = root_node.querySelectorAll('rt-counter_read');
+ for (let i = 0; i < reads.length; i++) {
+ const snapshot_name = reads[i].getAttribute('snapshot');
+ const key = reads[i].getAttribute('key') || 'count';
+
+ if (snapshot_name && window.RT.dict_snapshot[snapshot_name]) {
+ const value = window.RT.dict_snapshot[snapshot_name][key];
+ reads[i].innerHTML = (value !== undefined) ? value : `[Missing key: ${key}]`;
+ } else {
+ reads[i].innerHTML = `[Unknown snapshot: ${snapshot_name}]`;
+ console.error(`RT-Style Layout Error: <RT-counter_read> failed. No snapshot named '${snapshot_name}' found in the dictionary.`);
}
+ }
};
RT.article();
if(RT.counter_do_count){
RT.counter_do_count(document.body);
- if(RT.counter_do_label){
- RT.counter_do_label(document.body);
- if(RT.counter_do_read) RT.counter_do_read(document.body);
- }}
+ if(RT.counter_do_read) RT.counter_do_read(document.body);
+ }
if(RT.title) RT.title();
if(RT.term) RT.term();
if(RT.math) RT.math();
+++ /dev/null
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>RT semantic HTML tags</title>
- <script src="RT-Style_locator.js"></script>
- <script>
- window.RT.load('Layout/article_tech_ref');
- </script>
- </head>
- <body>
-
- <RT-article>
- <RT-title author="Thomas Walker Lynch" date="2026-06-01 21:05 UTC" title="RT semantic HTML tags"></RT-title>
-
- <RT-TOC level="1-2"></RT-TOC>
-
- <h1> Table of custom tags </h1>
-
- <h2>Style tag reference</h2>
-
- <table>
- <thead>
- <tr>
- <th>Tag</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><RT-code><RT-article></RT-code></td>
- <td>Article container.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-memo></RT-code></td>
- <td>Alternative strict print layout container.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-title></RT-code></td>
- <td>Title block and metadata.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-TOC></RT-code></td>
- <td>Generates TOC.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-term></RT-code></td>
- <td>Conventional term.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-term-em></RT-code></td>
- <td>Forces emphasis for a term even after first occurrence.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-neologism></RT-code></td>
- <td>Project specific term.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-neologism-em></RT-code></td>
- <td>Forces emphasis for a neologism even after first occurrence.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-code></RT-code></td>
- <td>Code span or code block.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-math></RT-code></td>
- <td>Inline or block math.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-symbol></RT-code></td>
- <td>Technical or mathematical symbol wrapper.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-constraint></RT-code></td>
- <td>Architectural limits or hard requirement block.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-crossref></RT-code></td>
- <td>Context-aware internal link.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-cite></RT-code></td>
- <td>Inline reference marker.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-endnotes></RT-code></td>
- <td>Container for extracted citations.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-footnote></RT-code></td>
- <td>Inline footnote generator.</td>
- </tr>
-
- <tr>
- <td><RT-code><RT-page></RT-code></td>
- <td>Automatically inserted pagination tag.</td>
- </tr>
-
- <tr>
- <td><RT-code><rt-theme-selector></RT-code></td>
- <td>Floating widget for hot-swapping themes.</td>
- </tr>
- </tbody>
- </table>
-
- <h1>Architecture overview</h1>
- <p>
- The <RT-term>RT Style System</RT-term> is a client-side, JavaScript-driven publishing framework designed to turn raw HTML into high-readability technical documentation. RT uses JavaScript to handle complex layout tasks like <RT-neologism>ink-ratio balancing</RT-neologism> and dynamic pagination, operating quite differently than standard CSS frameworks.
- </p>
-
- <h2>The document header</h2>
- <p>
- The document header must bootstrap the RT Style engine before the body renders. An author places <RT-code>setup.js</RT-code> in the directory and includes it via a script tag at the top of the document. Following this, the <RT-code>window.StyleRT.include</RT-code> directives pull in the necessary modules, such as the theme and the specific layout orchestrator (e.g., <RT-code>RT/layout/article_tech_ref</RT-code>).
- </p>
-
- <h2>Pulling style files into a document</h2>
- <p>
- Put `setup.js` in the directory, and include it at the top of the document. `setup.js` points at the style files and is installation specific.
- </p>
-
- <h1>Semantic tags</h1>
- <p>
- The system relies on a specific set of custom tags in the <RT-code>RT-</RT-code> namespace to separate structure from presentation.
- </p>
-
- <h2>Terminology</h2>
-
- <h3>Conventional terms</h3>
- <p>
- Use <RT-code><RT-term></RT-code> for standard, industry accepted technical terms. The system decorates only the first occurrence of each unique term so that the first appearance functions as a definition point, and later appearances do not overload the page with styling.
- </p>
-
- <RT-code>
- The <RT-term>Singleton Pattern</RT-term> restricts instantiation...
- </RT-code>
-
- <p>
- <em>Renders as:</em> The <RT-term>Singleton Pattern</RT-term> restricts instantiation...
- </p>
-
- <h3>Neologisms</h3>
- <p>
- Use <RT-code><RT-neologism></RT-code> for terms invented specifically for the current document or project. Neologisms are styled more strongly than conventional terms, visually distinguishing "jargon you should know" from "jargon we newly created."
- </p>
-
- <RT-code>
- We define the <RT-neologism>Hyper Tape</RT-neologism> as a construct...
- </RT-code>
-
- <p>
- <em>Renders as:</em> We define the <RT-neologism>Hyper Tape</RT-neologism> as a construct...
- </p>
-
- <h3>First occurrence rule</h3>
- <p>
- The term system is intentionally conservative. For the tags <RT-code><RT-term></RT-code> and <RT-code><RT-neologism></RT-code>, only the first occurrence of a unique term is decorated. Subsequent mentions are rendered as normal prose.
- </p>
-
- <p>
- Uniqueness is tracked by normalizing the term text (trimmed, then lowercased). This means that <RT-code>Symbol</RT-code> and <RT-code>symbol</RT-code> count as the same term.
- </p>
-
- <h3>Forced emphasis variants</h3>
- <p>
- Sometimes a later mention of a term should be emphasized again. For that purpose, the system provides explicit emphasis tags:
- </p>
-
- <ul>
- <li><RT-code><RT-term-em></RT-code></li>
- <li><RT-code><RT-neologism-em></RT-code></li>
- </ul>
-
- <p>
- These variants are always decorated, even if the term appeared earlier.
- </p>
-
- <h3>Automatic definition anchors</h3>
- <p>
- For first occurrences, the term module automatically assigns an <RT-code>id</RT-code> attribute if one lacks existence. This creates stable anchors for future indexing and linking.
- </p>
-
- <RT-code>
- We define a <RT-term>Symbol</RT-term> as...
- </RT-code>
-
- <p>
- The first occurrence will be given an id similar to <RT-code>def-symbol</RT-code>. For neologisms, an additional marker is used, for example <RT-code>def-neo-hyper-tape</RT-code>.
- </p>
-
- <h2>Technical content</h2>
-
- <h3>Code</h3>
- <p>
- Use <RT-code><RT-code></RT-code>. When placed inline, it functions as a span. When placed as a block (with newlines), it functions as a pre formatted block with a theme aware border. The engine will automatically strip common leading whitespace so that the text aligns relative to the indentation of the <RT-code><RT-code></RT-code> tag itself.
- </p>
-
- <RT-code>
- # Block Code Example
- def hello():
- return "World"
- </RT-code>
-
- <h3>Mathematics</h3>
- <p>
- Use <RT-code><RT-math></RT-code>. The system auto detects if it is a block equation or inline variable and wraps it in MathJax delimiters.
- </p>
- <p>
- Inline: Let <RT-math>x</RT-math> be the input.
- </p>
- <p>
- Block:
- </p>
- <RT-math>
- f(x) = \sum_{i=0}^{n} x_i
- </RT-math>
-
- <h2>Architectural notation and constraints</h2>
-
- <h3>Symbols</h3>
- <p>
- Use <RT-code><RT-symbol></RT-code> for specialized technical or mathematical symbols. This enforces a consistent font-weight and character spacing across different browser engines, ensuring that these symbols avoid anti-aliasing artifacts often seen with standard Unicode glyphs in technical documentation.
- </p>
-
- <h3>Constraints</h3>
- <p>
- Use <RT-code><RT-constraint></RT-code> to explicitly highlight physical limitations, memory boundaries, or structural constraints within a system. This tag triggers a unique block-display, rendering with a distinct background shade and a left-hand rule, visually separating hard requirements from descriptive prose.
- </p>
-
- <h3>Cross-references</h3>
- <p>
- Use <RT-code><RT-crossref></RT-code> for internal structural linking between sections. This tag provides context-aware linking, managing anchor states to jump across soft-limit boundaries seamlessly.
- </p>
-
- <h2>Citations, endnotes, and footnotes</h2>
- <p>
- The system manages academic and technical references through a paired tag approach, ensuring citations are extracted and formatted before the layout engine calculates page boundaries. It also supports dynamically expanding footnotes.
- </p>
-
- <h3>Inline citations</h3>
- <p>
- An author places <RT-code><RT-cite ref="Author, Source"></RT-cite></RT-code> inline within the text. The engine transforms this into a superscript bracketed number, establishing a bi-directional link.
- </p>
-
- <h3>Endnote generation</h3>
- <p>
- The <RT-code><RT-endnotes></RT-code> container functions as the destination for all extracted citations. If an author places this tag at the bottom of the article, the engine populates it with an ordered list of references. Should the author omit the tag, the semantic parser will dynamically generate and append it as a top-level child of the article.
- </p>
-
- <h3>Footnotes</h3>
- <p>
- An author places <RT-code><RT-footnote>Note text</RT-footnote></RT-code> inline within the prose. The engine operates in three phases: it strips the tag to prevent layout disruption, paginates the raw text blindly, and finally expands the completed page to append the extracted footnote block at the bottom. This ensures perfect spatial routing across soft limits.
- </p>
-
- <RT-code>
- The core architecture operates at 5GHz.<RT-footnote>Assuming optimal thermal conditions.</RT-footnote>
- </RT-code>
-
- <h1>Navigation and layout</h1>
-
- <h2>Automatic table of contents</h2>
- <p>
- Use <RT-code><RT-TOC></RT-code> to insert a generated table of contents. The tag scans the document <em>forward</em> from its current position to collect headings.
- </p>
-
- <h3>Explicit mode (Specific levels or ranges)</h3>
- <p>
- Use the <RT-code>level</RT-code> attribute to target a specific heading depth or a range of depths.
- </p>
- <ul>
- <li><RT-code><RT-TOC level="1"></RT-code>: Collects all <RT-code><h1></RT-code> elements until the end of the document. Best for the main document index.</li>
- <li><RT-code><RT-TOC level="1-3"></RT-code>: Collects all <RT-code><h1></RT-code>, <RT-code><h2></RT-code>, and <RT-code><h3></RT-code> elements, nesting them structurally.</li>
- <li><RT-code><RT-TOC level="2"></RT-code>: Collects all <RT-code><h2></RT-code> elements until it encounters the next <RT-code><h1></RT-code>. Best for chapter summaries.</li>
- </ul>
-
- <h3>Implicit mode</h3>
- <p>
- If no level is specified, the TOC scans backwards to find the nearest heading (for example H1) and assumes an author wants to collect children one level deeper (for example H2).
- </p>
- <p>
- <em>Note: Implicit mode has a probability to fail if placed before the first heading of a section. Use explicit levels for robust results.</em>
- </p>
-
- <h2>The title block</h2>
- <p>
- Use <RT-code><RT-title></RT-code> as the first element in your <RT-code><body></RT-code> (before the article container). This tag generates a standardized, styled header block with the document title and metadata.
- </p>
-
- <h3>Attributes</h3>
- <ul>
- <li><RT-code>title</RT-code> (Required): The main heading of the document.</li>
- <li><RT-code>author</RT-code> (Optional): The author's name. Renders in a bold accent color.</li>
- <li><RT-code>date</RT-code> (Optional): The publication or revision date.</li>
- <li><RT-code>copyright</RT-code> (Optional): Appends a copyright notice to the bottom of the title block.</li>
- </ul>
-
- <h3>Example</h3>
- <RT-code>
- <RT-title
- title="The RT semantic HTML tags"
- author="Thomas Walker Lynch"
- date="2026-06-01 21:05 UTC"
- copyright="2026 Reasoning Technology">
- </RT-title>
- </RT-code>
-
- <p>
- <em>Renders as:</em> A centered, high contrast H1 followed by a serif styled metadata row containing the author and date, and a smaller copyright note.
- </p>
-
- <h2>Layout containers</h2>
-
- <h3>The article container</h3>
- <p>
- The primary root element for documentation is <RT-code><RT-article></RT-code>. This establishes the boundary for the standard typography rules and the dynamic pagination logic.
- </p>
-
- <h3>The memo container</h3>
- <p>
- Alternatively, use <RT-code><RT-memo></RT-code> for strict print formatting. This sets the document width to a strict 6.5 inches (standard 8.5 inch page with 1-inch margins), overrides theme colors to enforce black text on a white background, and sets the typography to a 12pt serif font (Times New Roman) suitable for formal documentation.
- </p>
-
- <h2>Pagination</h2>
- <p>
- The script <RT-code>paginate_by_element.js</RT-code> scans the article. It calculates the height of every element (including margins) and bundles them into <RT-code><RT-page></RT-code> elements.
- </p>
- <p>
- <RT-neologism>Soft Limit Pagination</RT-neologism>: The system attempts to keep headers with their following paragraphs. It will break a page early rather than stranding a header at the bottom.
- </p>
- <p>
- <RT-neologism>Fragment Splitting</RT-neologism>: When confronted with large unbroken data structures, the paginator acts intelligently to split `<ol>`, `<ul>`, and `<table>` elements across multiple pages to maximize space efficiency without breaking the document structure.
- </p>
-
- <h1>Debugging</h1>
-
- <h2>Debug tokens</h2>
- <p>
- RT provides a lightweight debug logging system in <RT-code>utility.js</RT-code>. Logging is controlled by a set of active debug tokens. Each log message is assigned a token, and the message prints only if that token is enabled.
- </p>
-
- <p>
- Examples of common tokens include <RT-code>style</RT-code>, <RT-code>layout</RT-code>, <RT-code>pagination</RT-code>, <RT-code>selector</RT-code>, <RT-code>config</RT-code>, and <RT-code>term</RT-code>.
- </p>
-
- <h2>How logging is gated</h2>
- <p>
- Normal log and warning output are gated. The methods <RT-code>debug.log(token,message)</RT-code> and <RT-code>debug.warn(token,message)</RT-code> will print only when the token exists in <RT-code>debug.active_tokens</RT-code>.
- </p>
-
- <p>
- This prevents the console from being flooded during normal use, while still allowing deep visibility during development.
- </p>
-
- <h2>Errors are always printed</h2>
- <p>
- Errors are treated differently. The method <RT-code>debug.error(token,message)</RT-code> always prints, regardless of token state. These messages represent failures that require attention.
- </p>
-
- <h2>Enabling and disabling tokens</h2>
- <p>
- Tokens have permission to be enabled or disabled in two ways: by editing the <RT-code>active_tokens</RT-code> set in <RT-code>utility.js</RT-code>, or at runtime by calling:
- </p>
-
- <RT-code>
- window.StyleRT.debug.enable('term')
- window.StyleRT.debug.disable('term')
- </RT-code>
-
- <p>
- For example, the term system (<RT-code>RT_term.js</RT-code>) uses the <RT-code>term</RT-code> token. When that token is enabled, the module will print messages describing how terms were detected and which term definitions were assigned IDs.
- </p>
-
- <h1>Themes</h1>
- <p>
- The system supports hot swapping themes by changing the script import in the head.
- </p>
- <ul>
- <li><strong>Dark:</strong> <RT-code>style/theme_dark_gold.js</RT-code> (Default)</li>
- <li><strong>Light:</strong> <RT-code>style/theme_light_gold.js</RT-code></li>
- </ul>
-
- <h2>Theme selector widget</h2>
- <p>
- Including the tag <RT-code><rt-theme-selector></rt-theme-selector></RT-code> anywhere in the DOM will generate a floating widget in the upper right corner of the window, permitting the user to hot-swap the visual theme and automatically persist the choice via local storage.
- </p>
-
- <h1>Manifest</h1>
- <RT-code>
- 1. style_orchestrator.js (Example/default footer script)
- 2. utility.js (Math/Color physics)
- 3. article_tech_ref.js (Typography and CSS injection)
- 4. RT_code.js (Code block logic)
- 5. RT_math.js (MathJax wrapper)
- 6. RT_term.js (Term styling)
- 7. RT_TOC.js (Navigation generator)
- 8. paginate_by_element.js (Page splitter)
- 9. page_fixed_glow.js (Visual page container)
- </RT-code>
-
- <h1>RT conventions</h1>
- <p> Headings are first letter capitalized. Remaining words are as they would be in English prose.</p>
-
- <h1>Exercises</h1>
-
- <ol>
- <li>
- <p>
- <strong>Term Occurrences:</strong> If an author tags a word with <RT-code><RT-term></RT-code> five times in a document, how many times will the term be visually decorated by the styling engine? How does a person force the engine to decorate a later occurrence?
- </p>
- </li>
- <li>
- <p>
- <strong>Term Normalization:</strong> A person writes <RT-code><RT-term>Parse Tree</RT-term></RT-code> in paragraph one, and <RT-code><RT-term>parse tree</RT-term></RT-code> in paragraph two. Will the system assign a definition anchor to the second occurrence?
- </p>
- </li>
- <li>
- <p>
- <strong>TOC Generation:</strong> What happens if a person places an <RT-code><RT-TOC></RT-code> tag without a level attribute before the first heading of a section?
- </p>
- </li>
- <li>
- <p>
- <strong>Code and Math Formatting:</strong> How does the RT system determine whether to render an <RT-code><RT-code></RT-code> or <RT-code><RT-math></RT-code> element inline with the text versus as a standalone block?
- </p>
- </li>
- <li>
- <p>
- <strong>Pagination Logic:</strong> When the script bundles elements into an <RT-code><RT-page></RT-code> container, how does the soft limit pagination handle a heading that falls at the very bottom of the page capacity?
- </p>
- </li>
- </ol>
-
- </RT-article>
- </body>
-</html>
-
+<!-- smoke test basic count, no default args -->
<!DOCTYPE html>
<html lang="en">
-<head>
+ <head>
<meta charset="UTF-8">
<title>Manuscript Counter Test Bench</title>
<script src="RT-Style_locator.js"></script>
<script>
window.RT.load('Layout/article_tech_ref');
</script>
-</head>
-<body>
+ </head>
+ <body>
+ <RT-article>
- <rt-counter-init name="figure" style="Natural" initial="1" separator="."></rt-counter-init>
-
- <h1>Primary Analysis</h1>
- <p>
- Observe the data in Figure <rt-counter-inc name="figure"></rt-counter-inc>.
- </p>
- <rt-counter-label name="figure" label="fig-primary"></rt-counter-label>
+ <RT-counter_make counter="figure" style="Natural" on-first-step="1" separator="."></RT-counter_make>
+
+ <h1>Primary Analysis</h1>
+ <p>
+ Observe the data in Figure
+ <RT-counter_step counter="figure"></RT-counter_step>
+ <RT-counter_snapshot counter="figure" snapshot="fig-primary"></RT-counter_snapshot>
+ <RT-counter_read snapshot="fig-primary" key="count"></RT-counter_read>.
+ </p>
- <rt-counter-indent name="figure">
+ <RT-counter_indent counter="figure">
<p>
- Detail view of the left quadrant: Figure <rt-counter-inc name="figure"></rt-counter-inc>.
+ Detail view of the left quadrant: Figure
+ <RT-counter_step counter="figure"></RT-counter_step>
+ <RT-counter_snapshot counter="figure" snapshot="fig-sub-left"></RT-counter_snapshot>
+ <RT-counter_read snapshot="fig-sub-left" key="count"></RT-counter_read>.
</p>
- <rt-counter-label name="figure" label="fig-sub-left"></rt-counter-label>
<p>
- Detail view of the right quadrant: Figure <rt-counter-inc name="figure"></rt-counter-inc>.
+ Detail view of the right quadrant: Figure
+ <RT-counter_step counter="figure"></RT-counter_step>
+ <RT-counter_snapshot counter="figure" snapshot="fig-sub-right"></RT-counter_snapshot>
+ <RT-counter_read snapshot="fig-sub-right" key="count"></RT-counter_read>.
</p>
- <rt-counter-label name="figure" label="fig-sub-right"></rt-counter-label>
- <rt-counter-indent name="figure">
- <p>
- Microscopic inspection: Figure <rt-counter-inc name="figure"></rt-counter-inc>.
- </p>
- <rt-counter-label name="figure" label="fig-micro"></rt-counter-label>
- </rt-counter-indent>
- </rt-counter-indent>
+ <RT-counter_indent counter="figure">
+ <p>
+ Microscopic inspection: Figure
+ <RT-counter_step counter="figure"></RT-counter_step>
+ <RT-counter_snapshot counter="figure" snapshot="fig-micro"></RT-counter_snapshot>
+ <RT-counter_read snapshot="fig-micro" key="count"></RT-counter_read>.
+ </p>
+ </RT-counter_indent>
+ </RT-counter_indent>
- <h1>Secondary Analysis</h1>
- <p>
- Proceeding to the next major component, shown in Figure <rt-counter-inc name="figure"></rt-counter-inc>.
- </p>
+ <h1>Secondary Analysis</h1>
+ <p>
+ Proceeding to the next major component, shown in Figure
+ <RT-counter_step counter="figure"></RT-counter_step>
+ <RT-counter_snapshot counter="figure" snapshot="fig-secondary"></RT-counter_snapshot>
+ <RT-counter_read snapshot="fig-secondary" key="count"></RT-counter_read>.
+ </p>
- <div class="reference-box">
+ <div class="reference-box">
<h2>Forward Reference Validation</h2>
<p>This text proves we can accurately call back to earlier elements.</p>
<ul>
- <li>The primary analysis was Figure <rt-counter-read label="fig-primary" key="count"></rt-counter-read>.</li>
- <li>The left quadrant was Figure <rt-counter-read label="fig-sub-left" key="count"></rt-counter-read>.</li>
- <li>The microscopic view was Figure <rt-counter-read label="fig-micro" key="count"></rt-counter-read>.</li>
+ <li>The primary analysis was Figure <RT-counter_read snapshot="fig-primary" key="count"></RT-counter_read>.</li>
+ <li>The left quadrant was Figure <RT-counter_read snapshot="fig-sub-left" key="count"></RT-counter_read>.</li>
+ <li>The microscopic view was Figure <RT-counter_read snapshot="fig-micro" key="count"></RT-counter_read>.</li>
</ul>
- </div>
+ </div>
- <script>
- // Insert the three layout functions here
- // ... (counter_do_count, counter_do_label, counter_do_read) ...
-
- // Execute the layout pipeline
- window.RT.counter_do_count(document.body);
- window.RT.counter_do_label(document.body);
- window.RT.counter_do_read(document.body);
- </script>
-</body>
+ </RT-article>
+ </body>
</html>
<!-- differs from test0.html only in that many arguments are left to default -->
<!DOCTYPE html>
<html lang="en">
-<head>
+ <head>
<meta charset="UTF-8">
- <title>Manuscript Counter Test Bench</title>
+ <title>Manuscript Counter Test Bench 1</title>
<script src="RT-Style_locator.js"></script>
<script>
window.RT.load('Layout/article_tech_ref');
</script>
-</head>
-<body>
+ </head>
+ <body>
+ <RT-article>
- <rt-counter-init name="figure"></rt-counter-init>
-
- <h1>Primary Analysis</h1>
- <p>
- Observe the data in Figure <rt-counter-inc name="figure"></rt-counter-inc>.
- </p>
- <rt-counter-label name="figure" label="fig-primary"></rt-counter-label>
+ <RT-counter_make counter="figure"></RT-counter_make>
+
+ <h1>Primary Analysis</h1>
+ <p>
+ Observe the data in Figure
+ <RT-counter_step counter="figure"></RT-counter_step>
+ <RT-counter_snapshot counter="figure" snapshot="fig-primary"></RT-counter_snapshot>
+ <RT-counter_read snapshot="fig-primary" key="count"></RT-counter_read>.
+ </p>
- <rt-counter-indent name="figure">
+ <RT-counter_indent counter="figure">
<p>
- Detail view of the left quadrant: Figure <rt-counter-inc name="figure"></rt-counter-inc>.
+ Detail view of the left quadrant: Figure
+ <RT-counter_step counter="figure"></RT-counter_step>
+ <RT-counter_snapshot counter="figure" snapshot="fig-sub-left"></RT-counter_snapshot>
+ <RT-counter_read snapshot="fig-sub-left" key="count"></RT-counter_read>.
</p>
- <rt-counter-label name="figure" label="fig-sub-left"></rt-counter-label>
<p>
- Detail view of the right quadrant: Figure <rt-counter-inc name="figure"></rt-counter-inc>.
+ Detail view of the right quadrant: Figure
+ <RT-counter_step counter="figure"></RT-counter_step>
+ <RT-counter_snapshot counter="figure" snapshot="fig-sub-right"></RT-counter_snapshot>
+ <RT-counter_read snapshot="fig-sub-right" key="count"></RT-counter_read>.
</p>
- <rt-counter-label name="figure" label="fig-sub-right"></rt-counter-label>
- <rt-counter-indent name="figure">
- <p>
- Microscopic inspection: Figure <rt-counter-inc name="figure"></rt-counter-inc>.
- </p>
- <rt-counter-label name="figure" label="fig-micro"></rt-counter-label>
- </rt-counter-indent>
- </rt-counter-indent>
+ <RT-counter_indent counter="figure">
+ <p>
+ Microscopic inspection: Figure
+ <RT-counter_step counter="figure"></RT-counter_step>
+ <RT-counter_snapshot counter="figure" snapshot="fig-micro"></RT-counter_snapshot>
+ <RT-counter_read snapshot="fig-micro" key="count"></RT-counter_read>.
+ </p>
+ </RT-counter_indent>
+ </RT-counter_indent>
- <h1>Secondary Analysis</h1>
- <p>
- Proceeding to the next major component, shown in Figure <rt-counter-inc name="figure"></rt-counter-inc>.
- </p>
+ <h1>Secondary Analysis</h1>
+ <p>
+ Proceeding to the next major component, shown in Figure
+ <RT-counter_step counter="figure"></RT-counter_step>
+ <RT-counter_snapshot counter="figure" snapshot="fig-secondary"></RT-counter_snapshot>
+ <RT-counter_read snapshot="fig-secondary" key="count"></RT-counter_read>.
+ </p>
- <div class="reference-box">
- <h2>Forward Reference Validation</h2>
- <p>This text proves we can accurately call back to earlier elements.</p>
- <ul>
- <li>The primary analysis was Figure <rt-counter-read label="fig-primary"></rt-counter-read>.</li>
- <li>The left quadrant was Figure <rt-counter-read label="fig-sub-left"></rt-counter-read>.</li>
- <li>The microscopic view was Figure <rt-counter-read label="fig-micro"></rt-counter-read>.</li>
- </ul>
- </div>
-
- <script>
- // Insert the three layout functions here
- // ... (counter_do_count, counter_do_label, counter_do_read) ...
-
- // Execute the layout pipeline
- window.RT.counter_do_count(document.body);
- window.RT.counter_do_label(document.body);
- window.RT.counter_do_read(document.body);
- </script>
-</body>
+ </RT-article>
+ </body>
</html>
<!-- shows forward referencing and read of other keys -->
<!DOCTYPE html>
<html lang="en">
-<head>
+ <head>
<meta charset="UTF-8">
<title>Manuscript Counter Test Bench 2</title>
<script src="RT-Style_locator.js"></script>
<script>
window.RT.load('Layout/article_tech_ref');
</script>
- <style>
- /* Test specific styles for visibility */
- rt-counter-inc { font-weight: bold; color: #0056b3; }
- rt-counter-read { font-weight: bold; color: #d9534f; }
- .executive-summary { border: 2px solid #333; padding: 15px; margin-bottom: 30px; background: #fafafa;}
- </style>
-</head>
-<body>
+ </head>
+ <body>
+ <RT-article>
- <rt-counter-init name="equation" style="roman" initial="1" separator="-"></rt-counter-init>
+ <RT-counter_make counter="equation" style="Natural" on-first-step="1" separator="-"></RT-counter_make>
- <div class="executive-summary">
+ <div>
<h2>Executive Summary (Forward References)</h2>
<p>
- This section appears before any counting occurs in the DOM.
- The final equation in this document is Equation <rt-counter-read label="eq-final" key="count"></rt-counter-read>.
+ This section appears before any counting occurs in the DOM.
+ The final equation in this document is Equation <RT-counter_read snapshot="eq-final" key="count"></RT-counter_read>.
</p>
- <p>
- <strong>Metadata Verification for label "eq-final":</strong>
- <ul>
- <li>Name parameter: <rt-counter-read label="eq-final" key="name"></rt-counter-read></li>
- <li>Style parameter: <rt-counter-read label="eq-final" key="style"></rt-counter-read></li>
- <li>Separator parameter: <rt-counter-read label="eq-final" key="separator"></rt-counter-read></li>
- <li>Initial parameter: <rt-counter-read label="eq-final" key="initial"></rt-counter-read></li>
- </ul>
- </p>
- </div>
+ </div>
- <h1>Mathematical Proofs</h1>
-
- <p>
- The base formulation is defined in Equation <rt-counter-inc name="equation"></rt-counter-inc>.
- </p>
- <rt-counter-label name="equation" label="eq-base"></rt-counter-label>
+ <h1>Mathematical Proofs</h1>
+
+ <p>
+ The base formulation is defined in Equation
+ <RT-counter_step counter="equation"></RT-counter_step>
+ <RT-counter_snapshot counter="equation" snapshot="eq-base"></RT-counter_snapshot>
+ <RT-counter_read snapshot="eq-base" key="count"></RT-counter_read>.
+ </p>
- <rt-counter-indent name="equation">
+ <RT-counter_indent counter="equation">
<p>
- Derivation step A: Equation <rt-counter-inc name="equation"></rt-counter-inc>.
+ Derivation step A: Equation
+ <RT-counter_step counter="equation"></RT-counter_step>
+ <RT-counter_snapshot counter="equation" snapshot="eq-deriv-a"></RT-counter_snapshot>
+ <RT-counter_read snapshot="eq-deriv-a" key="count"></RT-counter_read>.
</p>
- <rt-counter-label name="equation" label="eq-deriv-a"></rt-counter-label>
<p>
- Derivation step B: Equation <rt-counter-inc name="equation"></rt-counter-inc>.
+ Derivation step B: Equation
+ <RT-counter_step counter="equation"></RT-counter_step>
+ <RT-counter_snapshot counter="equation" snapshot="eq-deriv-b"></RT-counter_snapshot>
+ <RT-counter_read snapshot="eq-deriv-b" key="count"></RT-counter_read>.
</p>
- <rt-counter-label name="equation" label="eq-deriv-b"></rt-counter-label>
- </rt-counter-indent>
+ </RT-counter_indent>
- <p>
- The concluding formulation is established in Equation <rt-counter-inc name="equation"></rt-counter-inc>.
- </p>
- <rt-counter-label name="equation" label="eq-final"></rt-counter-label>
+ <p>
+ The concluding formulation is established in Equation
+ <RT-counter_step counter="equation"></RT-counter_step>
+ <RT-counter_snapshot counter="equation" snapshot="eq-final"></RT-counter_snapshot>
+ <RT-counter_read snapshot="eq-final" key="count"></RT-counter_read>.
+ </p>
- <script>
- // Assuming Element/counter.js has been upgraded with the new functions
- window.RT.counter_do_count(document.body);
- window.RT.counter_do_label(document.body);
- window.RT.counter_do_read(document.body);
- </script>
-</body>
+ </RT-article>
+ </body>
</html>
--- /dev/null
+<!-- demonstrates mixed outline numbering -->
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8">
+ <title>Manuscript Counter Test Bench 3</title>
+ <script src="RT-Style_locator.js"></script>
+ <script>
+ window.RT.load('Layout/article_tech_ref');
+ </script>
+ </head>
+ <body>
+ <RT-article>
+
+ <RT-counter_make counter="rule" style="roman" separator="." separator-placement="embedded-after"></RT-counter_make>
+ <RT-counter_make counter="section" style="roman-outline" separator="-"></RT-counter_make>
+
+ <h1>Regulatory Formatting</h1>
+ <p>
+ The embedded-after placement requires a trailing separator. <br>
+ Observe Rule
+ <RT-counter_step counter="rule"></RT-counter_step>
+ <RT-counter_snapshot counter="rule" snapshot="rule_1"></RT-counter_snapshot>
+ <RT-counter_read snapshot="rule_1" key="count"></RT-counter_read>
+ </p>
+ <RT-counter_indent counter="rule">
+ <p>
+ Subset rule
+ <RT-counter_step counter="rule"></RT-counter_step>
+ <RT-counter_snapshot counter="rule" snapshot="rule_1_1"></RT-counter_snapshot>
+ <RT-counter_read snapshot="rule_1_1" key="count"></RT-counter_read>
+ </p>
+ <p>
+ Subset rule
+ <RT-counter_step counter="rule"></RT-counter_step>
+ <RT-counter_snapshot counter="rule" snapshot="rule_1_2"></RT-counter_snapshot>
+ <RT-counter_read snapshot="rule_1_2" key="count"></RT-counter_read>
+ </p>
+ </RT-counter_indent>
+
+ <h1>Outline Hierarchy</h1>
+ <p>
+ The outline format automatically cycles styles by depth. <br>
+ Level 0 evaluates to Section
+ <RT-counter_step counter="section"></RT-counter_step>
+ <RT-counter_snapshot counter="section" snapshot="sec_1"></RT-counter_snapshot>
+ <RT-counter_read snapshot="sec_1" key="count"></RT-counter_read>.
+ </p>
+
+ <RT-counter_indent counter="section">
+ <p>
+ Level 1 evaluates to Section
+ <RT-counter_step counter="section"></RT-counter_step>
+ <RT-counter_snapshot counter="section" snapshot="sec_1_1"></RT-counter_snapshot>
+ <RT-counter_read snapshot="sec_1_1" key="count"></RT-counter_read>.
+ </p>
+
+ <RT-counter_indent counter="section">
+ <p>
+ Level 2 evaluates to Section
+ <RT-counter_step counter="section"></RT-counter_step>
+ <RT-counter_snapshot counter="section" snapshot="sec_1_1_1"></RT-counter_snapshot>
+ <RT-counter_read snapshot="sec_1_1_1" key="count"></RT-counter_read>.
+ </p>
+ <p>
+ Level 2 continues at Section
+ <RT-counter_step counter="section"></RT-counter_step>
+ <RT-counter_snapshot counter="section" snapshot="sec_1_1_2"></RT-counter_snapshot>
+ <RT-counter_read snapshot="sec_1_1_2" key="count"></RT-counter_read>.
+ </p>
+ </RT-counter_indent>
+ </RT-counter_indent>
+
+ </RT-article>
+ </body>
+</html>
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>Manuscript Counter Test Bench 4</title>
+ <script src="RT-Style_locator.js"></script>
+ <script>
+ window.RT.load('Layout/article_tech_ref');
+ </script>
+</head>
+<body>
+ <RT-article>
+
+ <RT-title
+ author="Test Bench"
+ date="2026-06-25"
+ title="Test 4: Counters and Outdents">
+ </RT-title>
+
+ <RT-counter_make counter="sec" style="Natural" separator="."></RT-counter_make>
+
+ <div>
+ <h2>Executive Summary</h2>
+ <p>
+ This summary proves the snapshot dictionary is populated before the reading phase executes.
+ </p>
+ <ul>
+ <li>The first major section is <RT-counter_read snapshot="snap_1"></RT-counter_read>.</li>
+ <li>The deepest nested section is <RT-counter_read snapshot="snap_2_1_1"></RT-counter_read>.</li>
+ <li>The final section, proving successful outdenting, is <RT-counter_read snapshot="snap_3"></RT-counter_read>.</li>
+ </ul>
+ </div>
+
+ <h1>Main Content</h1>
+
+ <p>
+ Beginning the primary sequence: Section
+ <RT-counter_step counter="sec"></RT-counter_step>
+ <RT-counter_snapshot counter="sec" snapshot="snap_1"></RT-counter_snapshot>
+ <RT-counter_read snapshot="snap_1"></RT-counter_read>.
+ </p>
+
+ <RT-counter_indent counter="sec">
+ <p>
+ First nested item: Section
+ <RT-counter_step counter="sec"></RT-counter_step>
+ <RT-counter_snapshot counter="sec" snapshot="snap_1_1"></RT-counter_snapshot>
+ <RT-counter_read snapshot="snap_1_1"></RT-counter_read>.
+ </p>
+ <p>
+ Second nested item: Section
+ <RT-counter_step counter="sec"></RT-counter_step>
+ <RT-counter_snapshot counter="sec" snapshot="snap_1_2"></RT-counter_snapshot>
+ <RT-counter_read snapshot="snap_1_2"></RT-counter_read>.
+ </p>
+ </RT-counter_indent>
+
+ <p>
+ Outdented back to the primary sequence: Section
+ <RT-counter_step counter="sec"></RT-counter_step>
+ <RT-counter_snapshot counter="sec" snapshot="snap_2"></RT-counter_snapshot>
+ <RT-counter_read snapshot="snap_2"></RT-counter_read>.
+ </p>
+
+ <RT-counter_indent counter="sec">
+ <p>
+ First nested item of the second sequence: Section
+ <RT-counter_step counter="sec"></RT-counter_step>
+ <RT-counter_snapshot counter="sec" snapshot="snap_2_1"></RT-counter_snapshot>
+ <RT-counter_read snapshot="snap_2_1"></RT-counter_read>.
+ </p>
+
+ <RT-counter_indent counter="sec">
+ <p>
+ Double nested item: Section
+ <RT-counter_step counter="sec"></RT-counter_step>
+ <RT-counter_snapshot counter="sec" snapshot="snap_2_1_1"></RT-counter_snapshot>
+ <RT-counter_read snapshot="snap_2_1_1"></RT-counter_read>.
+ </p>
+ </RT-counter_indent>
+
+ <p>
+ Outdented to level one: Section
+ <RT-counter_step counter="sec"></RT-counter_step>
+ <RT-counter_snapshot counter="sec" snapshot="snap_2_2"></RT-counter_snapshot>
+ <RT-counter_read snapshot="snap_2_2"></RT-counter_read>.
+ </p>
+ </RT-counter_indent>
+
+ <p>
+ Double outdented back to root level: Section
+ <RT-counter_step counter="sec"></RT-counter_step>
+ <RT-counter_snapshot counter="sec" snapshot="snap_3"></RT-counter_snapshot>
+ <RT-counter_read snapshot="snap_3"></RT-counter_read>.
+ </p>
+
+ </RT-article>
+</body>
+</html>
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8">
+ <title>Manuscript Counter Test Bench 5</title>
+ <script src="RT-Style_locator.js"></script>
+ <script>
+ window.RT.load('Layout/article_tech_ref');
+ </script>
+ </head>
+ <body>
+ <RT-article>
+
+ <RT-counter_make counter="diagram" style="alpha" on-first-step="d" separator=":"></RT-counter_make>
+
+ <div>
+ <h2>Metadata Validation</h2>
+ <p>
+ Querying the final snapshot dictionary for parameters assigned at initialization:
+ </p>
+ <ul>
+ <li>Counter name parameter: <RT-counter_read snapshot="diag-final" key="counter"></RT-counter_read></li>
+ <li>Style parameter: <RT-counter_read snapshot="diag-final" key="style"></RT-counter_read></li>
+ <li>Separator parameter: <RT-counter_read snapshot="diag-final" key="separator"></RT-counter_read></li>
+ <li>first step leads to: <RT-counter_read snapshot="diag-final" key="on-first-step"></RT-counter_read></li>
+ </ul>
+ </div>
+
+ <h1>Content</h1>
+
+ <p>
+ First diagram:
+
+ <!-- this generates an error, as the counter object is empty until the first step, besides, what count would it snapshot? -->
+ <RT-counter_snapshot counter="diagram" snapshot="diag-base"></RT-counter_snapshot>
+
+ <RT-counter_step counter="diagram"></RT-counter_step>
+ <RT-counter_snapshot counter="diagram" snapshot="diag-base"></RT-counter_snapshot>
+ <RT-counter_read snapshot="diag-base" key="count"></RT-counter_read>.
+ </p>
+
+ <p>
+ Final diagram:
+ <RT-counter_step counter="diagram"></RT-counter_step>
+ <RT-counter_snapshot counter="diagram" snapshot="diag-final"></RT-counter_snapshot>
+ <RT-counter_read snapshot="diag-final" key="count"></RT-counter_read>.
+ </p>
+
+ </RT-article>
+ </body>
+</html>