mirror of
https://github.com/StarCitizenTools/mediawiki-skins-Citizen.git
synced 2024-11-12 00:59:46 +00:00
fix(core): let makeSections xpath query cope with multiple classes (#733)
* Let makeSections xpath query cope with multiple classes As-of https://gerrit.wikimedia.org/r/c/mediawiki/core/+/939783 in mediawiki-core, this class attribute is going to contain multiple classes. This would break the section-creation. This change to the query is backwards-compatible, so this should just inoculate the skin against future updates. * Shorten line for mediawiki-lint compatibility * fix: update html selector for parser output Related: T350627 --------- Co-authored-by: alistair3149 <alistair3149@users.noreply.github.com>
This commit is contained in:
parent
e718afa4ab
commit
6f5b761fe7
|
@ -132,7 +132,10 @@ final class BodyContent extends Partial {
|
|||
*/
|
||||
private function makeSections( DOMDocument $doc, array $headingWrappers ) {
|
||||
$xpath = new DOMXpath( $doc );
|
||||
$containers = $xpath->query( '//div[@class="mw-parser-output"][1]' );
|
||||
$containers = $xpath->query(
|
||||
// Equivalent of CSS attribute `~=` to support multiple classes
|
||||
'//div[contains(concat(" ",normalize-space(@class)," ")," mw-parser-output ")][1]'
|
||||
);
|
||||
|
||||
// Return if no parser output is found
|
||||
if ( !$containers->length || $containers->item( 0 ) === null ) {
|
||||
|
|
Loading…
Reference in a new issue