Bot:Gadget-figureSource.js: Difference between revisions
Content deleted Content added
Desktop back to click->popover (user preference); touch banner unchanged; tabindex fix kept |
Prose address: section h2 + chunk title (title lives in the marker paragraph) |
||
| (2 intermediate revisions by the same user not shown) | |||
Line 203:
var idx = 0, node;
while (idx < list.length && (node = walker.nextNode())) {
// (staging-copy injection during verification) must never
// nest a second wrapper inside an already-tagged figure
if (node.parentElement.closest(
'table, .fig-card, .fig-banner, .fig-src')) { continue; }
if (chunkOf(node) !== parseInt(chunk, 10)) { break; }
var at, from = 0;
Line 300 ⟶ 304:
if (label && label !== el) { parts.push(cellText(label)); }
} else {
// Address for a prose figure, outer -> inner: the enclosing
parts.push('chunk ' + entry.loc.chunk);▼
// section heading, then the CHUNK TITLE — which lives INSIDE the
// marker's own <p> ("[c. 3; p. 1] Gross written premiums and
// underlying earnings"), so it is the paragraph text minus the
// .ed-chunk span. "chunk 3" appears nowhere: readers get words.
var anchor = document.querySelector(
var blk = anchor && anchor.closest('p');
if (blk) {
var up = blk.previousElementSibling;
while (up && !/^H[1-4]$/.test(up.tagName)) {
up = up.previousElementSibling;
}
if (up) {
parts.push(up.textContent.replace(/\s+/g, ' ').trim());
}
var clone = blk.cloneNode(true);
clone.querySelectorAll('.ed-chunk').forEach(function (s) {
s.remove();
});
var title = clone.textContent.replace(/\s+/g, ' ').trim();
if (title) { parts.push(title); }
}
}
// one line, middle-dot separated ("Solvency II ratio (%) · FY24 · …")
| |||