fix(game8): let an h4 fence a section off without naming one
Game8 uses h4 for two opposite jobs. Persona 5 hides its entire finished
back catalogue behind nothing but an `<h4>Finished Events</h4>` inside a
collapsed accordion, so a reader blind to h4 sees one uninterrupted run of
tables and would publish fifty dead events. Genshin uses h4 the other way
round, for sub-headings *within* a single event ("Availability Period",
"Characters & Rewards for this Test Run").
So h4 now gates sections but never names one: an unrecognised h4 leaves
the current event title alone, where an unrecognised h2 or h3 still sets
it. Letting one claim the title renames "Character Test Runs" to the
label sitting above its own date table, which the Genshin fixture catches.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5
parent
2b0aa6bd0f
commit
243c7d70dd
@@ -53,6 +53,7 @@ const EXCLUDED_SECTIONS = [
|
||||
/past events/i,
|
||||
/previous events/i,
|
||||
/ended events/i,
|
||||
/finished events/i,
|
||||
];
|
||||
|
||||
/** Label/value rows carrying a single boundary instant. */
|
||||
@@ -97,10 +98,12 @@ export function parseGame8EventsPage(
|
||||
const node = nodes[i];
|
||||
if (node === undefined) continue;
|
||||
|
||||
// Sections are marked by h2 on some pages and h3 on others, so inclusion is
|
||||
// tracked at whichever level actually names the section. A heading matching
|
||||
// neither list leaves the current state alone — it is an event name.
|
||||
if (node.kind === "h2" || node.kind === "h3") {
|
||||
// Sections are marked by h2 on some pages, h3 or h4 on others, so inclusion
|
||||
// is tracked at whichever level actually names the section — Persona 5's
|
||||
// finished-events table is fenced off by nothing but an h4. A heading
|
||||
// matching neither list leaves the current state alone — it is an event
|
||||
// name.
|
||||
if (node.kind === "h2" || node.kind === "h3" || node.kind === "h4") {
|
||||
const heading = node.text;
|
||||
if (EXCLUDED_SECTIONS.some((re) => re.test(heading))) {
|
||||
sectionIncluded = false;
|
||||
@@ -108,7 +111,12 @@ export function parseGame8EventsPage(
|
||||
} else if (INCLUDED_SECTIONS.some((re) => re.test(heading))) {
|
||||
sectionIncluded = true;
|
||||
currentTitle = null;
|
||||
} else {
|
||||
} else if (node.kind !== "h4") {
|
||||
// An unrecognised h2/h3 names an event. An unrecognised h4 does not —
|
||||
// Genshin uses them for sub-headings *within* one event ("Availability
|
||||
// Period", "Characters & Rewards for this Test Run"), so letting one
|
||||
// claim the title would rename "Character Test Runs" to the label above
|
||||
// its own date table.
|
||||
currentTitle = heading;
|
||||
}
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user