still has null header label border extenstion bug, but the rest looks good
authorThomas Walker Lynch <eknp9n@reasoningtechnology.com>
Mon, 3 Aug 2026 12:07:20 +0000 (12:07 +0000)
committerThomas Walker Lynch <eknp9n@reasoningtechnology.com>
Mon, 3 Aug 2026 12:07:20 +0000 (12:07 +0000)
developer/authored/Manuscript.copy/Element/endnote.js
developer/authored/Manuscript.copy/Element/grid.js
developer/authored/Manuscript.copy/Layout/paginate.js

index 8f6b298..3151a34 100644 (file)
@@ -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 = [];
           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';
           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 = [];
       }
index 3f8b8f2..6859bac 100644 (file)
     }
   }
 
+  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 = '&nbsp;';
+        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';
     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') {
       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}`;
 
     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}`;
         else cursor_y = parsed_y.extent + 1;
       });
 
+      pad_headers(state);
       project_grid(node, state, model, { wrap_check: true });
     });
 
         y++;
       });
 
+      pad_headers(state);
       project_grid(node, state, 'html-grid-dictionary', { wrap_check: true });
     });
 
         y++;
       });
 
+      pad_headers(state);
       project_grid(node, state, model, { wrap_check: true });
     });
 
         i++;
       });
 
+      pad_headers(state);
       project_grid(node, state, model, { wrap_check: false, no_wrap: true, delimiters: true });
     });
   });
index e9d8060..fd4d564 100644 (file)
     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');