Page MenuHomePhabricator

Deprecate and remove ParserOutput::setTOCHTML()
Open, LowPublic

Description

With the refactoring of TOC generation into ParserOutput::getText() as a post-processing step (see T287767 and https://gerrit.wikimedia.org/r/c/mediawiki/core/+/721115) we should go one step further and remove the HTML from ParserOutput and instead regenerate it from ParserOutput::getSections() only if/when needed by the skin (by calling methods in Linker). This would also ensure that Parsoid *only* needs to generate the appropriate ParesrOutput::setSections() call and doesn't also need to implement HTML for the ToC.

Related Objects

StatusSubtypeAssignedTask
OpenReleaseNone
OpenNone
OpenNone
OpenNone
OpenFeatureNone
OpenNone
OpenNone
OpenNone
Resolvedssastry
OpenNone
OpenNone
OpenNone
Resolvedovasileva
Resolvedssastry
OpenNone
Resolvedcscott
OpenNone
OpenNone
Resolvedcscott
Opencscott
Resolvedmatmarex

Event Timeline

Worth considering if we should update setSections() to take an array<SectionMetadata> instead of a plain associative array as well.

Jdlrobson rescinded a token.
Jdlrobson awarded a token.
Jdlrobson subscribed.

Sorry, very much intended a like token there :-)

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

[mediawiki/core@master] [EXPERIMENTAL] deprecate mutation of ToC in OutputPageParserOutput hook

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

https://gerrit.wikimedia.org/r/c/mediawiki/core/+/862391 fixes this and I should probably add this phab task to that patch.

Since there are no external users of setTOCHTML, we could potentially remove setTOCHTML completely right away if we got rid of synthetic data from parsercache serialization test data.

Change 862391 had a related patch set uploaded (by Subramanya Sastry; author: Subramanya Sastry):

[mediawiki/core@master] Generate TOC HTML on demand in ParserOutput

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

Change 862391 merged by jenkins-bot:

[mediawiki/core@master] Generate TOC HTML on demand in ParserOutput::getText()

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

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

[mediawiki/core@master] WIP: Deprecate ParserOutput::{get,set}TOCHTML()

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

Change 884103 merged by jenkins-bot:

[mediawiki/core@master] Deprecate ParserOutput::{get,set}TOCHTML()

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

@cscott what are the next steps here after /r/884103 got merged?

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

[mediawiki/core@master] Deprecate TOC mutation in OutputPageParserOutput hook

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

Change 946987 merged by jenkins-bot:

[mediawiki/core@master] Deprecate TOC mutation in OutputPageParserOutput hook

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

The only reason ::setTOCHTML is still sticking around is because we haven't regenerated the ParserCache migration test suite to remove it yet.

See in CI...

23:57:59 PHP Deprecated:  Use of MediaWiki\Parser\ParserOutput::setTOCHTML was deprecated in MediaWiki 1.40. [Called from MediaWiki\Tests\Parser\ParserCacheSerializationTestCases::getParserOutputTestCases in /workspace/src/tests/phpunit/includes/parser/ParserCacheSerializationTestCases.php at line 236] in /workspace/src/includes/debug/MWDebug.php on line 378

Change #804310 abandoned by C. Scott Ananian:

[mediawiki/core@master] Deprecate mutation of ToC in OutputPageParserOutput hook

Reason:

We ended up removing setTOCHTML(), making this patch moot.

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