From: Thomas Walker Lynch Date: Thu, 15 Jan 2026 10:59:06 +0000 (+0000) Subject: checkpoint X-Git-Url: https://git.reasoningtechnology.com/style/do_style.js?a=commitdiff_plain;h=db73bfc3237212768a20e75fcf58364d5fb3ec08;p=Epimetheus%2F.git checkpoint --- diff --git a/developer/document/style/RT_term.js b/developer/document/style/RT_term.js index e66c7b2..c2c2b4a 100644 --- a/developer/document/style/RT_term.js +++ b/developer/document/style/RT_term.js @@ -1,22 +1,53 @@ /* - Processes tags. - Implements the "Definiendum Convention" (Italics + Theme Accent). + Processes and tags. + - Styles only the first occurrence of a unique term/neologism. + - The "-em" variants (e.g., ) are always styled. + - Automatically generates IDs for first occurrences for future indexing. */ -function RT_term() { +window.StyleRT = window.StyleRT || {}; + +window.StyleRT.RT_term = function() { const RT = window.StyleRT; + const debug = RT.debug || { log: function(){} }; - // Robust check for theme presence - const theme = RT.active_theme ? RT.active_theme() : {}; - const accent = theme.accent || 'inherit'; + // Track seen terms to ensure only the first one gets decorated + const seen_terms = new Set(); - // Selects , , etc. - document.querySelectorAll('rt-term').forEach(el => { + // Helper to apply professional "Definiendum" styling + const apply_style = (el, is_neologism) => { el.style.fontStyle = 'italic'; - el.style.color = accent; - el.style.paddingRight = '0.15em'; // Spacing for the italic slant + el.style.fontWeight = is_neologism ? '600' : '500'; + el.style.color = is_neologism ? 'var(--rt-brand-secondary)' : 'var(--rt-brand-primary)'; + el.style.paddingRight = '0.1em'; // Compensation for italic slant el.style.display = 'inline'; - }); -} + }; -window.StyleRT = window.StyleRT || {}; -window.StyleRT.RT_term = RT_term; + // Selector covers all four variations + const tags = document.querySelectorAll('rt-term, rt-term-em, rt-neologism, rt-neologism-em'); + + tags.forEach(el => { + const tag_name = el.tagName.toLowerCase(); + const is_neologism = tag_name.includes('neologism'); + const is_explicit_em = tag_name.endsWith('-em'); + + // Normalize text for comparison (e.g., "Symbol" vs "symbol") + const term_text = el.textContent.trim().toLowerCase(); + const slug = term_text.replace(/\s+/g, '-'); + + if (is_explicit_em || !seen_terms.has(term_text)) { + apply_style(el, is_neologism); + + // If it's the first occurrence, mark it and give it an ID + if (!is_explicit_em && !seen_terms.has(term_text)) { + seen_terms.add(term_text); + if (!el.id) el.id = `def-${is_neologism ? 'neo-' : ''}${slug}`; + debug.log('RT_term', `Defined first instance of: ${term_text}`); + } + } else { + // For subsequent mentions that aren't "-em", we treat as normal prose + el.style.fontStyle = 'normal'; + el.style.color = 'inherit'; + el.style.fontWeight = 'inherit'; + } + }); +}; diff --git a/developer/document/style/article_tech_ref.js b/developer/document/style/article_tech_ref.js index e80afbc..8ad9dbb 100644 --- a/developer/document/style/article_tech_ref.js +++ b/developer/document/style/article_tech_ref.js @@ -8,27 +8,39 @@ const RT = window.StyleRT = window.StyleRT || {}; RT.article = function() { + const debug = RT.debug || { log: function(){} }; + debug.log('layout', 'RT.article starting...'); + RT.config = RT.config || {}; // Default Configuration RT.config.article = { font_family: '"Noto Sans", "Segoe UI", "Helvetica Neue", sans-serif' - ,line_height: "1.8" // Generous spacing for screen reading - ,font_size: "16px" // Large base size for clarity - ,font_weight: 400 + ,line_height: "1.8" + ,font_size: "16px" + ,font_weight: "400" // Default (String) ,max_width: "820px" ,margin: "0 auto" }; - if (RT.config.theme && RT.config.theme.meta_is_dark === false) { - RT.config.article.font_weight = "600"; + + // SAFE THEME DETECTION + // If the theme is loaded and explicitly Light, bump the weight. + try { + if (RT.config.theme && RT.config.theme.meta_is_dark === false) { + RT.config.article.font_weight = "600"; + debug.log('layout', 'Light theme detected: adjusting font weight to 600.'); + } + } catch(e) { + console.warn("StyleRT: Auto-weight adjustment failed, using default.", e); } const conf = RT.config.article; const article_seq = document.querySelectorAll("RT-article"); - // HURDLE - if(RT.debug && RT.debug.log) RT.debug.log('selector', `RT.article found ${article_seq.length} elements.`); - if(article_seq.length === 0) return; + if(article_seq.length === 0) { + debug.log('layout', 'No elements found. Exiting.'); + return; + } // 1. Apply Container Styles article_seq.forEach( (article) =>{ @@ -40,15 +52,14 @@ style.fontWeight = conf.font_weight; style.maxWidth = conf.max_width; style.margin = conf.margin; - style.padding = "0 20px"; // Mobile buffer - - // Default text color from Theme 1.0 + style.padding = "0 20px"; style.color = "var(--rt-content-main)"; }); // 2. Inject Child Typography const style_id = 'rt-article-typography'; if (!document.getElementById(style_id)) { + debug.log('layout', 'Injecting CSS typography rules.'); const style_el = document.createElement('style'); style_el.id = style_id; @@ -74,7 +85,7 @@ text-align: center; margin-top: 1.0em; margin-bottom: 0.5em; - } + } rt-article h2 + h3 { margin-top: -0.3em; @@ -96,7 +107,6 @@ margin-top: 1.2em; font-style: italic; } - /* Increasing Indentation (Steps of ~4 spaces) */ rt-article h4 { margin-left: 2em; } rt-article h5 { margin-left: 4em; } rt-article h6 { margin-left: 6em; } @@ -145,19 +155,7 @@ background: var(--rt-surface-1); } - /* --- CODE & TECHNICAL --- */ - /* Inline Code */ - rt-article code { - background-color: var(--rt-surface-code); - color: var(--rt-syntax-keyword); - padding: 0.2em 0.4em; - border-radius: 4px; - font-family: "Consolas", "Monaco", monospace; - font-size: 0.9em; - border: 1px solid var(--rt-border-faint); - } - - /* Preformatted Blocks (if not handled by RT_code.js) */ + /* --- TECHNICAL --- */ rt-article pre { background: var(--rt-surface-code); padding: 1em; @@ -170,4 +168,3 @@ } }; })(); - diff --git a/developer/document/style/article_tech_ref_2.js b/developer/document/style/article_tech_ref_2.js deleted file mode 100644 index 544c98e..0000000 --- a/developer/document/style/article_tech_ref_2.js +++ /dev/null @@ -1,181 +0,0 @@ -/* - Article Layout: Technical Reference - Standard: Theme 1.0 - Description: High-readability layout for technical documentation on screens. - Features: Sans-serif, justified text, distinct headers, boxed code. -*/ -(function(){ - const RT = window.StyleRT = window.StyleRT || {}; - - RT.article = function() { - const debug = RT.debug || { log: function(){} }; - debug.log('layout', 'RT.article starting...'); - - RT.config = RT.config || {}; - - // Default Configuration - RT.config.article = { - font_family: '"Noto Sans", "Segoe UI", "Helvetica Neue", sans-serif' - ,line_height: "1.8" - ,font_size: "16px" - ,font_weight: "400" // Default (String) - ,max_width: "820px" - ,margin: "0 auto" - }; - - // SAFE THEME DETECTION - // If the theme is loaded and explicitly Light, bump the weight. - try { - if (RT.config.theme && RT.config.theme.meta_is_dark === false) { - RT.config.article.font_weight = "600"; - debug.log('layout', 'Light theme detected: adjusting font weight to 600.'); - } - } catch(e) { - console.warn("StyleRT: Auto-weight adjustment failed, using default.", e); - } - - const conf = RT.config.article; - const article_seq = document.querySelectorAll("RT-article"); - - if(article_seq.length === 0) { - debug.log('layout', 'No elements found. Exiting.'); - return; - } - - // 1. Apply Container Styles - article_seq.forEach( (article) =>{ - const style = article.style; - style.display = "block"; - style.fontFamily = conf.font_family; - style.fontSize = conf.font_size; - style.lineHeight = conf.line_height; - style.fontWeight = conf.font_weight; - style.maxWidth = conf.max_width; - style.margin = conf.margin; - style.padding = "0 20px"; - style.color = "var(--rt-content-main)"; - }); - - // 2. Inject Child Typography - const style_id = 'rt-article-typography'; - if (!document.getElementById(style_id)) { - debug.log('layout', 'Injecting CSS typography rules.'); - const style_el = document.createElement('style'); - style_el.id = style_id; - - style_el.textContent = ` - /* --- HEADERS --- */ - rt-article h1 { - color: var(--rt-brand-primary); - font-size: 2.0em; - font-weight: 500; - text-align: center; - margin-top: 1.2em; - margin-bottom: 0.6em; - border-bottom: 2px solid var(--rt-border-default); - padding-bottom: 0.3em; - line-height: 1.2; - letter-spacing: -0.02em; - } - - rt-article h2 { - color: var(--rt-brand-secondary); - font-size: 1.5em; - font-weight: 400; - text-align: center; - margin-top: 1.0em; - margin-bottom: 0.5em; - } - - rt-article h2 + h3 { - margin-top: -0.3em; - padding-top: 0; - } - - rt-article h3 { - color: var(--rt-brand-tertiary); - font-size: 1.4em; - font-weight: 400; - margin-top: 1.0em; - margin-bottom: 0.5em; - } - - /* --- DEEP LEVELS (H4-H6) --- */ - rt-article h4, rt-article h5, rt-article h6 { - color: var(--rt-brand-tertiary); - font-weight: bold; - margin-top: 1.2em; - font-style: italic; - } - rt-article h4 { margin-left: 2em; } - rt-article h5 { margin-left: 4em; } - rt-article h6 { margin-left: 6em; } - - /* --- SEMANTIC TAGS --- */ - rt-article rt-neologism { - font-family: "Georgia", "Times New Roman", serif; - font-size: 1.2em; /* <--- ADD THIS LINE */ - font-style: italic; - font-weight: 400; - color: var(--rt-brand-tertiary); - letter-spacing: 0.02em; - } - - - /* --- BODY TEXT --- */ - rt-article p { - margin-bottom: 1.4em; - text-align: justify; - hyphens: auto; - color: var(--rt-content-main); - } - - /* --- RICH ELEMENTS --- */ - rt-article blockquote { - border-left: 4px solid var(--rt-brand-secondary); - margin: 1.5em 0; - padding: 0.5em 1em; - font-style: italic; - color: var(--rt-content-muted); - background: var(--rt-surface-1); - border-radius: 0 4px 4px 0; - } - - rt-article ul, rt-article ol { - margin-bottom: 1.4em; - padding-left: 2em; - } - rt-article li { - margin-bottom: 0.4em; - } - rt-article li::marker { - color: var(--rt-brand-secondary); - font-weight: bold; - } - - /* Links */ - rt-article a { - color: var(--rt-brand-link); - text-decoration: none; - border-bottom: 1px dotted var(--rt-border-default); - transition: all 0.2s; - } - rt-article a:hover { - color: var(--rt-brand-primary); - border-bottom: 1px solid var(--rt-brand-primary); - background: var(--rt-surface-1); - } - - /* --- TECHNICAL --- */ - rt-article pre { - background: var(--rt-surface-code); - padding: 1em; - border-radius: 4px; - overflow-x: auto; - border: 1px solid var(--rt-border-default); - } - `; - document.head.appendChild(style_el); - } - }; -})(); diff --git a/developer/document/style/style_orchestrator.js b/developer/document/style/style_orchestrator.js index e745035..755c1c8 100644 --- a/developer/document/style/style_orchestrator.js +++ b/developer/document/style/style_orchestrator.js @@ -14,7 +14,7 @@ window.StyleRT.style_orchestrator = function() { 'style/RT_term.js', 'style/RT_math.js', 'style/RT_code.js', - 'style/article_tech_ref_2.js', + 'style/article_tech_ref.js', 'style/RT_TOC.js', // Layout & Pagination