From: Thomas Walker Lynch Date: Tue, 4 Aug 2026 15:21:16 +0000 (+0000) Subject: . X-Git-Url: https://git.reasoningtechnology.com/%27%20%20%20full_path%20%20%20%27?a=commitdiff_plain;h=44df0e16da668c3972458b9f2eea6b210f75005c;p=RT-Style . --- diff --git a/developer/authored/Manuscript.copy/Element/chapter.js b/developer/authored/Manuscript.copy/Element/chapter.js deleted file mode 100644 index 7b3b4ab..0000000 --- a/developer/authored/Manuscript.copy/Element/chapter.js +++ /dev/null @@ -1,28 +0,0 @@ -(function() { - if (!window.RT) return; - - const apply_style = function(h1, config) { - // Styling can be inherited or explicitly enforced here. - // If you want chapters to have a distinct layout footprint, apply it. - h1.style.color = config.brand_primary; - }; - - RT.Element.add(function() { - const config = window.RT.layout_config || {}; - document.querySelectorAll('RT·chapter').forEach((el) => { - const brk = document.createElement('RT·page-break'); - const h1 = document.createElement('h1'); - h1.innerHTML = el.innerHTML; - if (el.className) h1.className = el.className; - h1.classList.add('RT·chapter'); - - Array.from(el.attributes).forEach((attr) => { - if (attr.name !== 'class') h1.setAttribute(attr.name, attr.value); - }); - - apply_style(h1, config); - el.parentNode.insertBefore(brk, el); - el.replaceWith(h1); - }); - }); -})(); diff --git a/developer/authored/Manuscript.copy/Element/section.js b/developer/authored/Manuscript.copy/Element/section.js new file mode 100644 index 0000000..cb156fc --- /dev/null +++ b/developer/authored/Manuscript.copy/Element/section.js @@ -0,0 +1,105 @@ +/* + Element/section.js + Processes tags. + Extracts payloads, manages outline numbering, and injects the formatted title. +*/ + +(function() { + + if (!window.RT) return; + + const apply_style = function(title_node ,depth ,config) { + // Top-level sections start large; scale down based on nesting depth + const base_size = 2.25; + const size = Math.max(1.1 ,base_size - (depth * 0.35)); + + title_node.style.fontSize = size + 'em'; + title_node.style.fontWeight = '600'; + title_node.style.color = config.brand_primary || '#000'; + title_node.style.marginTop = depth === 0 ? '3rem' : '2rem'; + title_node.style.marginBottom = '1rem'; + title_node.style.lineHeight = '1.2'; + + if(depth === 0) { + title_node.style.borderBottom = '1px solid ' + (config.border_faint || '#ccc'); + title_node.style.paddingBottom = '0.5rem'; + } + }; + + RT.Element.add(function() { + const debug = window.RT.Debug || { log: function(){} }; + if (debug.log) debug.log('section' ,'Processing scoped sections'); + + const config = window.RT.layout_config || {}; + const section_seq = document.querySelectorAll('RT·section, rt·section'); + + if (section_seq.length === 0) return; + + const article = document.querySelector('RT·article, rt·article, RT·memo, rt·memo'); + if (article && !document.querySelector('rt·counter·make[counter="RT_section"]')) { + const make = document.createElement('rt·counter·make'); + make.setAttribute('counter' ,'RT_section'); + make.setAttribute('style' ,'outline'); + make.setAttribute('mode' ,'scoped'); + make.setAttribute('on-first-step' ,'0'); + article.insertBefore(make ,article.firstChild); + } + + let section_idx = 0; + + section_seq.forEach(section => { + section.style.display = 'block'; + + let depth = 0; + let curr = section.parentElement; + while (curr) { + if (curr.tagName && curr.tagName.toLowerCase() === 'rt·section') { + depth++; + } + curr = curr.parentElement; + } + + const names = []; + const children = Array.from(section.children); + children.forEach(child => { + if (child.tagName && child.tagName.toLowerCase() === 'rt·name') { + names.push(child.innerHTML.trim()); + child.remove(); + } + }); + + const title_text = names.length > 0 ? names.join('
') : '•'; + + const step = document.createElement('rt·counter·step'); + step.setAttribute('counter' ,'RT_section'); + + const snap_id = 'section_snap_' + section_idx++; + const snap = document.createElement('rt·counter·snapshot'); + snap.setAttribute('counter' ,'RT_section'); + snap.setAttribute('snapshot' ,snap_id); + + const title_node = document.createElement('div'); + title_node.className = 'RT·section-title'; + + // Map identifier for TOC routing + if (!section.id) section.id = snap_id; + + const read = document.createElement('rt·counter·read'); + read.setAttribute('snapshot' ,snap_id); + + const title_content = document.createElement('span'); + title_content.style.marginLeft = '1rem'; + title_content.innerHTML = title_text; + + title_node.appendChild(read); + title_node.appendChild(title_content); + + apply_style(title_node ,depth ,config); + + section.insertBefore(title_node ,section.firstChild); + section.insertBefore(snap ,section.firstChild); + section.insertBefore(step ,section.firstChild); + }); + }); + +})(); diff --git a/developer/authored/Manuscript.copy/Element/title.js b/developer/authored/Manuscript.copy/Element/title.js index 23afa23..c95ef75 100644 --- a/developer/authored/Manuscript.copy/Element/title.js +++ b/developer/authored/Manuscript.copy/Element/title.js @@ -1,77 +1,143 @@ /* - Element/title.js - Processes tags and isolates internal styling logic. + Element/TOC.js + Processes tags. + Iterates nested boundaries, evaluates tree depth, + and duplicates the title payload for automated navigation. */ -(function(){ - - if(!window.RT) return; - - const apply_style = function(container ,h1 ,meta ,copy_div ,config){ - container.style.textAlign = 'center'; - container.style.marginBottom = '3rem'; - container.style.marginTop = '2rem'; - container.style.borderBottom = '1px solid ' + config.border_default; - container.style.paddingBottom = '1.5rem'; - - h1.style.margin = '0 0 0.8rem 0'; - h1.style.border = 'none'; - h1.style.padding = '0'; - h1.style.color = config.brand_primary; - h1.style.fontSize = '2.5em'; - h1.style.lineHeight = '1.1'; - h1.style.letterSpacing = '-0.03em'; - - if(meta){ - meta.style.color = config.content_muted; - meta.style.fontStyle = 'italic'; - meta.style.fontSize = '1.1em'; - meta.style.fontFamily = '"Georgia", "Times New Roman", serif'; - } - - if(copy_div){ - copy_div.style.color = config.content_muted; - copy_div.style.fontSize = '0.9em'; - copy_div.style.marginTop = '0.5rem'; - } +(function() { + + if (!window.RT) return; + + const apply_style = function(a ,config) { + a.style.textDecoration = 'none'; + a.style.color = 'inherit'; + a.style.display = 'block'; + + a.onmouseover = () => a.style.color = config.brand_primary || '#000'; + a.onmouseout = () => a.style.color = 'inherit'; }; - RT.Element.add(function(){ - const config = window.RT.layout_config || {}; - const nodes = document.querySelectorAll('rt·title, RT·title'); + RT.Element.add( function() { + const debug = window.RT.Debug || { log: function(){} }; + if (debug.log) debug.log('TOC' ,'Generating Table of Contents from nested sections'); - for(let i = 0; i < nodes.length; i++){ - const el = nodes[i]; - const title = el.getAttribute('title') || 'Untitled Document'; - const author = el.getAttribute('author'); - const date = el.getAttribute('date'); - const copyright = el.getAttribute('copyright'); - - const container = document.createElement('div'); - const h1 = document.createElement('h1'); - h1.textContent = title; - container.appendChild(h1); - - let meta = null; - if(author || date){ - meta = document.createElement('div'); - const parts = []; - if(author) parts.push(`${author}`); - if(date) parts.push(date); - meta.innerHTML = parts.join('  —  '); - container.appendChild(meta); - } + const config = window.RT.layout_config || {}; + const TOC_seq = document.querySelectorAll('rt·toc, RT·TOC'); + + TOC_seq.forEach( (container ,TOC_index) => { + container.style.display = 'block'; - let copy_div = null; - if(copyright){ - copy_div = document.createElement('div'); - copy_div.innerHTML = `© ${copyright}`; - container.appendChild(copy_div); + const attr_val = container.getAttribute('level'); + let start_level = 1; + let end_level = 6; + + if (attr_val) { + const rangeMatch = attr_val.match(/^(\d)-(\d)$/); + if (rangeMatch) { + start_level = parseInt(rangeMatch[1]); + end_level = parseInt(rangeMatch[2]); + } else { + const single = parseInt(attr_val); + if (!isNaN(single)) { + start_level = single; + end_level = single; + } + } } - apply_style(container ,h1 ,meta ,copy_div ,config); - el.replaceWith(container); - } + const sections = []; + const all_sections = document.querySelectorAll('rt·section, RT·section'); + + all_sections.forEach(section => { + let depth = 0; + let curr = section.parentElement; + + while (curr) { + if (curr.tagName && curr.tagName.toLowerCase() === 'rt·section') { + depth++; + } + curr = curr.parentElement; + } + + const level = depth + 1; + if (level >= start_level && level <= end_level) { + let title_node = null; + for (let i = 0; i < section.children.length; i++) { + if (section.children[i].className === 'RT·section-title') { + title_node = section.children[i]; + break; + } + } + + if (title_node) { + sections.push({ + id: section.id + ,level: level + ,html: title_node.innerHTML + }); + } + } + }); + + container.innerHTML = ''; + const title = document.createElement('div'); + title.className = 'RT·TOC-title'; + title.textContent = start_level === 1 ? 'Table of Contents' : 'Section Contents'; + title.style.textAlign = 'center'; + title.style.fontWeight = '600'; + title.style.fontSize = '1.5em'; + title.style.marginBottom = '1.5rem'; + title.style.color = config.brand_primary || '#000'; + container.appendChild(title); + + if (sections.length === 0) return; + + const topList = document.createElement('ul'); + topList.style.listStyle = 'none'; + topList.style.paddingLeft = '0'; + topList.style.marginBottom = '0'; + container.appendChild(topList); + + const listStack = [topList]; + + for (const item of sections) { + const depth = item.level - start_level; + + while (listStack.length - 1 > depth) { + listStack.pop(); + } + + while (listStack.length - 1 < depth) { + const parentList = listStack[listStack.length - 1]; + const lastLi = parentList.lastElementChild; + + if (lastLi) { + const subList = document.createElement('ul'); + subList.style.listStyle = 'none'; + subList.style.paddingLeft = '1.5rem'; + subList.style.marginBottom = '0'; + lastLi.appendChild(subList); + listStack.push(subList); + } else { + break; + } + } + + const li = document.createElement('li'); + li.style.marginBottom = '0'; + li.style.marginTop = depth === 0 ? '1.25rem' : '0.25rem'; + + const a = document.createElement('a'); + a.href = `#${item.id}`; + a.innerHTML = item.html; + + apply_style(a ,config); + + li.appendChild(a); + listStack[listStack.length - 1].appendChild(li); + } + }); }); })(); diff --git a/developer/authored/Manuscript.copy/Layout/article_tech_ref.js b/developer/authored/Manuscript.copy/Layout/article_tech_ref.js index 8efc845..e62388a 100644 --- a/developer/authored/Manuscript.copy/Layout/article_tech_ref.js +++ b/developer/authored/Manuscript.copy/Layout/article_tech_ref.js @@ -10,7 +10,7 @@ window.RT.layout_config = {}; const required_elements = [ - 'chapter' + 'section' ,'code' ,'endnote' ,'grid' diff --git a/tester/authored/TOC/RT-Manuscript_locator.js b/tester/authored/TOC/RT-Manuscript_locator.js new file mode 100644 index 0000000..4a1b936 --- /dev/null +++ b/tester/authored/TOC/RT-Manuscript_locator.js @@ -0,0 +1,37 @@ +/* + direct.js + + + We have four scenarios + + immediate - used in the RT-style distribution itself (authored, consummer, staged) + direct - used in the RT-style project itself, but not in the distribution + indirect - the version all Harmony projects use + URL_only - always pulls style through a URL, a webserver must be present + +*/ + +window.RT = window.RT || {}; + +(function() { + const project_name = "RT-Style"; + const path = window.location.pathname; + const project_root_index = path.indexOf('/' + project_name + '/'); + + if (project_root_index !== -1) { + // substring(0, x) excludes the trailing slash. We must prepend it to the payload. + const absolute_project_root = path.substring(0, project_root_index + project_name.length + 1); + window.RT.dirpr_library = absolute_project_root + "/consumer/Manuscript"; + } else { + // Fallback for when served via local Python HTTP daemon from the project root + window.RT.dirpr_library = "../consumer/made/Manuscript"; + } + + document.write( + ' + + + + + + + + + + + + System Architecture +

This evaluates the primary execution scope and top-level numbering sequence.

+ + + Memory Hierarchy +

First nested scope. The state machine must append the depth index.

+ + + L1 Cache Mechanics +

Second nested scope. Evaluates terminal TOC depth bounds if configured for level 1-2.

+
+ + + L2 Shared Resources +

Sibling to the L1 scope. Validates sequential incrementing at identical depth.

+
+
+ + + Out-of-Order Execution +

Returns to the first nested depth to validate boundary exit and state popping.

+
+
+ + + Pipeline Mechanics +

Second primary execution scope. Validates milestone incrementing across the outer boundary.

+ + + Branch Prediction +

Nested evaluation.

+ + + Speculative States +

Deep nested evaluation.

+
+
+
+ +
+ +