Page MenuHomePhabricator

addParserOutput should consult skin and call setSections when setting options relating to table of contents
Closed, ResolvedPublicBUG REPORT

Description

Separating the table of contents from the content has led to various bugs T311529, T307256, T305123, T316947. Many more issues likely still exist that we are just not aware of.

The main issue here is the addParserOutput method does not consult the skin when generating default options. Perhaps it should?

TODO

Developer notes

See https://gerrit.wikimedia.org/r/c/mediawiki/core/+/829229 for a first attempt

Event Timeline

Change 830931 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/core@master] OutputPage::addParserOutputText(): use default ParserOutput options from skin

https://gerrit.wikimedia.org/r/830931

Change 830936 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/core@master] Use default parser output options for injectTOC

https://gerrit.wikimedia.org/r/830936

Change 830937 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/extensions/FlaggedRevs@master] Use default ParserOutput::getText() options for injectTOC

https://gerrit.wikimedia.org/r/830937

There are two closely related issues here: one is the default value for injectTOC (and for that matter, skin) in ParserOutput::getText(), which can be set to an appropriate default by OutputPage::addParserOutput()/::addParserOutputText().

The other one is that addParserOutputMetadata doesn't set the section data. So practically every call to OutputPage::addParserOutput() is preceded by a call to OutputPage::setSections( $parserOutput->getSections()). It seems like we should really fold that into addParserOutput... but I suspect there are probably cases where we *don't* want to overwrite the section data, so I'm going to split that refactor into a separate task.

Change 830931 merged by jenkins-bot:

[mediawiki/core@master] OutputPage::addParserOutputText(): use default ParserOutput options from skin

https://gerrit.wikimedia.org/r/830931

Change 830936 merged by jenkins-bot:

[mediawiki/core@master] Use default ParserOutput::getText() options for injectTOC

https://gerrit.wikimedia.org/r/830936

Change 830937 merged by jenkins-bot:

[mediawiki/extensions/FlaggedRevs@master] Use default ParserOutput::getText() options for injectTOC

https://gerrit.wikimedia.org/r/830937

@cscott is the remaining work on this ticket requiring any work or assistance from web team ?

I believe the important work in this patch was complete back in September. I've opened T325562: Pull OutputPage::setSections($parserOutput->getSections()) into OutputPage::addParserOutputMetadata() for the cleanup refactoring work, which is low priority.