Bot:Gadget-figureSource.js: Difference between revisions
Content deleted Content added
Prose card tags: chunk section heading instead of the bare chunk number |
Prose address: section h2 + chunk title (title lives in the marker paragraph) |
||
| (One intermediate revision 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 {
//
//
//
// underlying earnings"), so it is the paragraph text minus the
// .ed-chunk span. "chunk 3" appears nowhere: readers get words.
var anchor = document.querySelector(
'span.ed-chunk[id$="-c' + entry.loc.chunk + '"]');
var
if (
var
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();
| |||