Jdlrobson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/282995
Change subject: Attempt at fixing table of contents problem
......................................................................
Attempt at fixing table of contents problem
It appears $parserOutput->getTOCEnabled() is not true for pages impacted
by the bug. This avoids this check to make sure the correct result occurs.
Consider the case where the table of contents is disabled by a call
to $parserOutput->setTOCEnabled( or $outputPage->enableTOC( false );
and that is copied over to the ParserOutput object before the
WikidataPagebaner hook runs
This will lead to the table of contents not being suppressed from the HTML
and will give an empty table of contents in the banner itself.
If a template parameter toc=yes has been added, create the table of contents
regardless. A __NOTOC__ parameter will still remove the table of contents from
the page and it will ensure that the banner takes over rendering if the table
of contents should be rendered.
I'm not sure what's leading to this race condition, but analysing the code
closely
I don't see what else could be causing this problem. CirrusSearch
PageTextBuilder could be a culprit.
Bug: T121135
Change-Id: I7d17799bf02b059eda8e3ac9d52061470759f07b
---
M includes/WikidataPageBanner.hooks.php
M templates/banner.mustache
2 files changed, 3 insertions(+), 3 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikidataPageBanner
refs/changes/95/282995/1
diff --git a/includes/WikidataPageBanner.hooks.php
b/includes/WikidataPageBanner.hooks.php
index 31cdc94..6a23634 100644
--- a/includes/WikidataPageBanner.hooks.php
+++ b/includes/WikidataPageBanner.hooks.php
@@ -152,8 +152,8 @@
if ( $pOut->getExtensionData( 'wpb-banner-options' ) !== null )
{
$options = $pOut->getExtensionData(
'wpb-banner-options' );
- // if toc parameter set and toc enabled, remove
original classes and add banner class
- if ( isset( $options['enable-toc'] ) &&
$pOut->getTOCEnabled() ) {
+ // if toc parameter set, then remove original classes
and add banner class
+ if ( isset( $options['enable-toc'] ) ) {
$options['toc'] = $pOut->getTOCHTML();
// replace id and class of toc with blank
// FIXME! This code is hacky, until core has
better handling of toc contents
diff --git a/templates/banner.mustache b/templates/banner.mustache
index 68ff820..d4d6d69 100644
--- a/templates/banner.mustache
+++ b/templates/banner.mustache
@@ -10,5 +10,5 @@
</div>
{{/hasIcons}}
</div>
- <div class="wpb-topbanner-toc
{{#bottomtoc}}wpb-bottomtoc{{/bottomtoc}}"><div
class="wpb-banner-toc">{{{toc}}}</div></div>
+ <div class="wpb-topbanner-toc
{{#bottomtoc}}wpb-bottomtoc{{/bottomtoc}}"><div
class="wpb-banner-toc">{{#enable-toc}}{{{toc}}}{{/enable-toc}}</div></div>
</div>
--
To view, visit https://gerrit.wikimedia.org/r/282995
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7d17799bf02b059eda8e3ac9d52061470759f07b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikidataPageBanner
Gerrit-Branch: wmf/1.27.0-wmf.21
Gerrit-Owner: Jdlrobson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits