Skip to content

Commit 2c836a0

Browse files
committed
fix: remove unused strategy 3 for finding descriptions
1 parent e25f26d commit 2c836a0

1 file changed

Lines changed: 2 additions & 18 deletions

File tree

scripts/xsd/scrapeUtils.ts

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,12 @@ export const extractMetadataFromPage = async (
203203
let pageLevelDescription = '';
204204
const collectedParagraphs: string[] = [];
205205

206-
// Strategy 1: Look for Salesforce's standard shortdesc div (including in shadow DOM)
206+
// Step 1: Look for Salesforce's standard shortdesc div (including in shadow DOM)
207207
const shortdescDiv = searchInShadowDOM(document, 'div.shortdesc');
208208
collectedParagraphs.push(shortdescDiv?.textContent?.trim() ?? '');
209209

210-
// Strategy 2: Look for direct paragraph siblings after heading OR after shortdesc
210+
// Step 2: Look for direct paragraph siblings after heading OR after shortdesc
211211
// Collect additional paragraphs until we find one with "extends" (inheritance info)
212-
const mainHeading = document.querySelector('h1');
213212
// Start from shortdescDiv's next sibling
214213
const startElement = shortdescDiv?.nextElementSibling;
215214

@@ -292,21 +291,6 @@ export const extractMetadataFromPage = async (
292291
pageLevelDescription = collectedParagraphs.join(' ');
293292
}
294293

295-
// Strategy 3: If still not found, do a broader search for the first P after the heading
296-
if (!pageLevelDescription && mainHeading) {
297-
const allParagraphs = Array.from(document.querySelectorAll('p, dd'));
298-
for (const p of allParagraphs) {
299-
// Only consider paragraphs that come after the heading in DOM order and are not in callouts
300-
if (!isInsideCallout(p) && mainHeading.compareDocumentPosition(p) & Node.DOCUMENT_POSITION_FOLLOWING) {
301-
const text = p.textContent?.trim() ?? '';
302-
if (isValidDescription(text)) {
303-
pageLevelDescription = text;
304-
break;
305-
}
306-
}
307-
}
308-
}
309-
310294
// Find all tables (including in shadow DOMs)
311295
const allTables = collectFromShadowDOM(document, 'table');
312296

0 commit comments

Comments
 (0)