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.
Description
Details
Event Timeline
Worth considering if we should update setSections() to take an array<SectionMetadata> instead of a plain associative array as well.
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/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
Change 862391 merged by jenkins-bot:
[mediawiki/core@master] Generate TOC HTML on demand in ParserOutput::getText()
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()
Change 884103 merged by jenkins-bot:
[mediawiki/core@master] Deprecate ParserOutput::{get,set}TOCHTML()
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
Change 946987 merged by jenkins-bot:
[mediawiki/core@master] Deprecate TOC mutation in OutputPageParserOutput hook
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.