From: Thomas Walker Lynch Date: Mon, 3 Aug 2026 12:07:20 +0000 (+0000) Subject: still has null header label border extenstion bug, but the rest looks good X-Git-Url: https://git.reasoningtechnology.com/%27%20%20%20window.RT.dirpr_library%20%20%20%27/RT-style.js?a=commitdiff_plain;h=4e2ba57b3fbed5001b890ac5382b7c333a6489d6;p=RT-Style still has null header label border extenstion bug, but the rest looks good --- diff --git a/developer/authored/Manuscript.copy/Element/endnote.js b/developer/authored/Manuscript.copy/Element/endnote.js index 8f6b298..3151a34 100644 --- a/developer/authored/Manuscript.copy/Element/endnote.js +++ b/developer/authored/Manuscript.copy/Element/endnote.js @@ -17,6 +17,9 @@ list_container.style.marginTop = '1rem'; list_container.style.borderTop = '1px solid ' + (config.surface_3 || '#ccc'); list_container.style.paddingTop = '1rem'; + list_container.style.listStyle = 'none'; + list_container.style.paddingLeft = '0'; + list_container.style.margin = '0'; }; function process_endnotes(){ @@ -31,7 +34,6 @@ initial_make.setAttribute('on-first-step', '0'); article.insertBefore(initial_make, article.firstChild); - // Defensively targets both the standard RT namespace block and the unmigrated hyphen blocks. const nodes = document.querySelectorAll('RT·endnote, rt·endnote, RT-endnote, rt-endnote, RT·endnotes, rt·endnotes, RT-endnotes, rt-endnotes'); let endnote_buffer = []; @@ -73,24 +75,23 @@ continue; } - const wrapper = document.createElement('div'); - wrapper.className = 'RT_endnotes_section'; + const frag = document.createDocumentFragment(); const pb = document.createElement('RT·page-break'); - wrapper.appendChild(pb); + frag.appendChild(pb); const header = document.createElement('h1'); header.innerText = 'Endnotes'; - wrapper.appendChild(header); + frag.appendChild(header); - const list_container = document.createElement('div'); + const list_container = document.createElement('ul'); list_container.className = 'RT_endnote_list'; apply_list_style(list_container, config); for(let j = 0; j < endnote_buffer.length; j++){ const item = endnote_buffer[j]; - const li = document.createElement('div'); + const li = document.createElement('li'); li.id = 'note_' + item.id; li.style.display = 'flex'; li.style.marginBottom = '0.5rem'; @@ -114,15 +115,16 @@ list_container.appendChild(li); } - wrapper.appendChild(list_container); + frag.appendChild(list_container); const counter_reset = document.createElement('RT·counter·make'); counter_reset.setAttribute('counter', 'EndNoteCounter'); counter_reset.setAttribute('style', 'CountingNumber'); counter_reset.setAttribute('on-first-step', '0'); - wrapper.appendChild(counter_reset); + frag.appendChild(counter_reset); - node.parentNode.replaceChild(wrapper, node); + // Unpack fragment directly into the article context to enable native UL splitting + node.parentNode.replaceChild(frag, node); endnote_buffer = []; } diff --git a/developer/authored/Manuscript.copy/Element/grid.js b/developer/authored/Manuscript.copy/Element/grid.js index 3f8b8f2..6859bac 100644 --- a/developer/authored/Manuscript.copy/Element/grid.js +++ b/developer/authored/Manuscript.copy/Element/grid.js @@ -20,6 +20,30 @@ } } + function pad_headers(grid_state) { + const headers = grid_state.cells.filter(c => c.type === 'x-label'); + if (headers.length === 0) return; + + const max_x = Math.max(...grid_state.cells.map(c => c.x_extent)); + const min_header_x = Math.min(...headers.map(c => c.x)); + const existing_xs = new Set(headers.map(c => c.x)); + + for (let i = min_header_x; i <= max_x; i++) { + if (!existing_xs.has(i)) { + const empty_el = document.createElement('RT·e'); + empty_el.innerHTML = ' '; + grid_state.insert({ + element: empty_el, + type: 'x-label', + x: i, + y: 0, + x_extent: i, + y_extent: 0 + }); + } + } + } + const apply_style = function(el, cell, is_transposed, options, config) { el.style.padding = '0.25rem 0.5rem'; el.style.margin = '0'; @@ -28,9 +52,13 @@ if (cell.type === 'x-label' || cell.type === 'y-label' || cell.type === 'name') { el.style.fontWeight = '600'; } - - if (cell.type === (is_transposed ? 'y-label' : 'x-label')) { - el.style.borderBottom = '2px solid ' + (config.border_strong || '#000'); + + if (cell.type === 'x-label') { + if (is_transposed) { + el.style.borderRight = '2px solid ' + (config.border_strong || '#000'); + } else { + el.style.borderBottom = '2px solid ' + (config.border_strong || '#000'); + } } if (cell.type === 'name') { @@ -86,7 +114,6 @@ let render_y_extent = is_transposed ? cell.x_extent : cell.y_extent; const el = cell.element; - el.style.gridColumn = `${render_x + 1} / ${render_x_extent + 2}`; el.style.gridRow = `${render_y + 1} / ${render_y_extent + 2}`; el.className = `RT_grid_${cell.type}`; @@ -109,7 +136,6 @@ grid_state.cells.forEach(cell => { const el = cell.element; - el.style.gridColumn = `${cell.x + 1} / ${cell.x_extent + 2}`; el.style.gridRow = `${cell.y + 1} / ${cell.y_extent + 2}`; el.className = `RT_grid_${cell.type}`; @@ -187,6 +213,7 @@ else cursor_y = parsed_y.extent + 1; }); + pad_headers(state); project_grid(node, state, model, { wrap_check: true }); }); @@ -217,6 +244,7 @@ y++; }); + pad_headers(state); project_grid(node, state, 'html-grid-dictionary', { wrap_check: true }); }); @@ -254,6 +282,7 @@ y++; }); + pad_headers(state); project_grid(node, state, model, { wrap_check: true }); }); @@ -291,6 +320,7 @@ i++; }); + pad_headers(state); project_grid(node, state, model, { wrap_check: false, no_wrap: true, delimiters: true }); }); }); diff --git a/developer/authored/Manuscript.copy/Layout/paginate.js b/developer/authored/Manuscript.copy/Layout/paginate.js index e9d8060..fd4d564 100644 --- a/developer/authored/Manuscript.copy/Layout/paginate.js +++ b/developer/authored/Manuscript.copy/Layout/paginate.js @@ -65,10 +65,17 @@ return h; } - // ========================================================= +// ========================================================= // Splitting Logic // ========================================================= function isSplittable(el){ + // Component Dictionary Execution + const componentId = el.getAttribute('data-rt-component'); + if (componentId && window.RT.Component && window.RT.Component[componentId] && window.RT.Component[componentId].split) { + return (remaining) => window.RT.Component[componentId].split(el, remaining, measureFragment); + } + + // Native HTML Fallbacks const tag = el.tagName; if(tag === 'UL' || tag === 'OL'){ const items = Array.from(el.children).filter(c => c.tagName === 'LI');