Skip to content

Commit

Permalink
cci: stop overlay on CCI subsections
Browse files Browse the repository at this point in the history
  • Loading branch information
ChlodAlejandro committed Jun 23, 2024
1 parent e8c29ed commit 42e1878
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions src/wiki/DeputyCasePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ export default class DeputyCasePage extends DeputyCase {

const heading = normalizeWikiHeading( el );
return heading != null &&
// Require that this heading is already normalized.
// TODO: Remove at some point.
// This shouldn't be required if double-normalization wasn't a thing.
el === heading.h &&
// eslint-disable-next-line security/detect-non-literal-regexp
new RegExp(
Expand Down Expand Up @@ -223,8 +226,12 @@ export default class DeputyCasePage extends DeputyCase {

return getSectionElements(
heading.root as HTMLElement,
( el ) =>
heading.level >= ( normalizeWikiHeading( el, ceiling )?.level ?? Infinity )
( el ) => {
// TODO: Avoid double normalization
const norm = normalizeWikiHeading( el, ceiling );
return ( heading.level >= ( norm?.level ?? Infinity ) ) ||
this.isContributionSurveyHeading( norm?.h ?? el );
}
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/wiki/util/getSectionElements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import isWikiHeading from './isWikiHeading';
* Finds section elements from a given section heading (and optionally a predicate)
*
* @param sectionHeading
* @param sectionHeadingPredicate
* @param sectionHeadingPredicate A function which returns `true` if the section should stop here
* @return Section headings.
*/
export default function getSectionElements(
Expand Down

0 comments on commit 42e1878

Please sign in to comment.