diff --git a/README.md b/README.md index 1323a7dc..bac962d6 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ You can use several variables to modify extension's behaviour: - `$wgAllInfoboxesExcludedSubpages` (array) - list of subpages in template namespace to omit by AllInfoboxes query. (default: [ "doc", "draft", "test" ]) - `$wgPortableInfoboxCacheRenderers` (bool) - cache internal infobox renderers. (default: true) - `$wgPortableInfoboxCustomImageWidth` (int) - size of image thumbnails used in infoboxes. (default: 300) -- `$wgPortableInfoboxUseHeadings` (bool) - use heading tags for infobox titles and group headers, it may cause incompatibilities with other extensions. (default: true) +- `$wgPortableInfoboxUseHeadings` (bool) - use heading tags for infobox titles and group headers, it may cause incompatibilities with other extensions as well as Parsoid. This config previously defaulted to true. (default: false) - `$wgPortableInfoboxUseTidy` (bool) - use [RemexHtml](https://www.mediawiki.org/wiki/RemexHtml) for validating HTML in infoboxes (default: true) - `$wgPortableInfoboxResponsiblyOpenCollapsed` (bool) - open collapsed groups when the screen is narrow. (default: true) - `$wgPortableInfoboxUseFileDescriptionPage` (bool) - control whether or not embedded images in the infobox will link to their file description page instead of directly to the file. (default: false) diff --git a/extension.json b/extension.json index 2f5520f4..711db099 100644 --- a/extension.json +++ b/extension.json @@ -25,7 +25,7 @@ "value": 300 }, "PortableInfoboxUseHeadings": { - "value": true + "value": false }, "PortableInfoboxUseTidy": { "value": true diff --git a/resources/PortableInfoboxBuilderNodes.js b/resources/PortableInfoboxBuilderNodes.js index 671f00c9..8b63b4c8 100644 --- a/resources/PortableInfoboxBuilderNodes.js +++ b/resources/PortableInfoboxBuilderNodes.js @@ -233,7 +233,7 @@ super.html(); if ( this.params.label ) { - let label = document.createElement( 'h3' ); + let label = document.createElement( 'div' ); label.className = 'pi-data-label pi-secondary-font'; label.textContent = this.params.label; this.element.appendChild( label ); @@ -267,7 +267,7 @@ class NodeTitle extends PINode { constructor( markupDoc, params ) { super( markupDoc, params ); - this.elementTag = 'h2'; + this.elementTag = 'div'; this.elementClasses += 'pi-item-spacing pi-title'; this.markupTag = 'title'; } @@ -342,7 +342,7 @@ class NodeHeader extends PINode { constructor( markupDoc, params ) { super( markupDoc, params ); - this.elementTag = 'h2'; + this.elementTag = 'div'; this.elementClasses += 'pi-item-spacing pi-header pi-secondary-font pi-secondary-background'; this.markupTag = 'header'; this.markupContentTag = true; diff --git a/tests/phpunit/Controllers/PortableInfoboxParserTagControllerTest.php b/tests/phpunit/Controllers/PortableInfoboxParserTagControllerTest.php index 503c7ad1..0854217a 100644 --- a/tests/phpunit/Controllers/PortableInfoboxParserTagControllerTest.php +++ b/tests/phpunit/Controllers/PortableInfoboxParserTagControllerTest.php @@ -232,7 +232,7 @@ public static function getColorDataProvider() { [ [ 'accent-color-default' => '#fff' ], '', '<default>test</default>', [], @@ -241,7 +241,7 @@ public static function getColorDataProvider() { [ [ 'accent-color-source' => 'color-source' ], '', '<default>test</default>', [ 'color-source' => '#000' ], @@ -253,7 +253,7 @@ public static function getColorDataProvider() { 'accent-color-source' => 'color-source' ], '', '<default>test</default>', [ 'color-source' => '#000' ], @@ -262,7 +262,7 @@ public static function getColorDataProvider() { [ [ 'accent-color-text-default' => '#fff' ], '', '<default>test</default>', [], @@ -274,7 +274,7 @@ public static function getColorDataProvider() { 'accent-color-text-source' => 'color-source' ], '', '<default>test</default>', [ 'color-source' => '#000' ], @@ -286,7 +286,7 @@ public static function getColorDataProvider() { 'accent-color-text-source' => 'color-source' ], '', '<default>test</default>', [ 'color-source' => '#000' ], @@ -300,8 +300,8 @@ public static function getColorDataProvider() { 'accent-color-source' => 'color-source2' ], '', '<default>test</default>', [ @@ -319,8 +319,8 @@ public static function getColorDataProvider() { 'accent-color-source' => 'color-source2' ], '', '<default>test</default>', 'templateInvocation' => [ @@ -350,7 +350,7 @@ public function testParamsParsing( $expected, $params ) { $dataNodes = $xpath->query( '//aside/div[contains(@class,\'pi-data\')]' ); for ( $i = 0; $i < $dataNodes->length; $i++ ) { // get map of label => value from parsed data node - $result[$xpath->query( 'h3[contains(@class, \'pi-data-label\')]', $dataNodes->item( $i ) ) + $result[$xpath->query( 'div[contains(@class, \'pi-data-label\')]', $dataNodes->item( $i ) ) ->item( 0 )->nodeValue] = $xpath->query( 'div[contains(@class, \'pi-data-value\')]', $dataNodes->item( $i ) ) ->item( 0 )->nodeValue; diff --git a/tests/phpunit/Services/PortableInfoboxRenderServiceTest.php b/tests/phpunit/Services/PortableInfoboxRenderServiceTest.php index 8e26ebba..c51cbc00 100644 --- a/tests/phpunit/Services/PortableInfoboxRenderServiceTest.php +++ b/tests/phpunit/Services/PortableInfoboxRenderServiceTest.php @@ -18,7 +18,7 @@ class PortableInfoboxRenderServiceTest extends MediaWikiIntegrationTestCase { * @return string */ private function normalizeHTML( $html ) { - if ( empty( $html ) ) { + if ( !$html ) { return ''; } @@ -76,7 +76,7 @@ public static function renderInfoboxDataProvider() { ] ], 'output' => '', 'description' => 'Only title', 'accentColor' => '', @@ -94,7 +94,7 @@ public static function renderInfoboxDataProvider() { ] ], 'output' => '', 'description' => 'Only title with custom colors', 'accentColor' => '#FFF', @@ -193,7 +193,7 @@ class="pi-image-thumbnail" alt="image alt" width="400" height="200"/> ], 'output' => '', @@ -238,7 +238,7 @@ class="pi-image-thumbnail" alt="image alt" width="400" height="200"/> ] ], 'output' => '', @@ -279,9 +279,9 @@ class="pi-image-thumbnail" alt="image alt" width="400" height="200"/> ] ], 'output' => '', @@ -309,9 +309,9 @@ class="pi-image-thumbnail" alt="image alt" width="400" height="200"/> ] ], 'output' => '', @@ -367,15 +367,15 @@ class="pi-image-thumbnail" alt="image alt" width="400" height="200"/> ] ], 'output' => '