Add ParserOptions::setCollapsibleSections()
commit8d031bcf87da20d2d42ae57e5a8d31d1b1b3387c
authorC. Scott Ananian <cscott@cscott.net>
Fri, 5 Apr 2024 22:46:57 +0000 (5 18:46 -0400)
committerC. Scott Ananian <cscott@cscott.net>
Mon, 29 Apr 2024 16:11:09 +0000 (29 12:11 -0400)
tree1a7214a0596615a1a192b25b9120e3032ca1bb97
parent25f2bf0d34406218fb3cccf3e806469c91ed12f4
Add ParserOptions::setCollapsibleSections()

This is a non-default option that will add a <div> wrapper around
section contents to allow client-side collapsing.  This is intended
for use by MobileFrontEnd, but could eventually be enabled for
desktop read views as well.

Since this parser option is in the "cache-varying options" set, any
caller who sets this option will fork the cache for that page, which
is reasonable as the parser options sets a ParserOutput property.
In the future our caching strategy will get smarter and we'll add
code which avoids the cache split and just transfers the appropriate
values from ParserOptions to ParserOutput flags after the cached
output is retrieved.

Bug: T359001
Change-Id: Ie93959a056ed15a728404eb293e4bb6eeaeb15c0
includes/OutputTransform/Stages/HandleParsoidSectionLinks.php
includes/parser/ParserOptions.php
includes/parser/ParserOutput.php
includes/parser/ParserOutputFlags.php
tests/phpunit/includes/OutputTransform/Stages/HandleParsoidSectionLinksTest.php
tests/phpunit/includes/OutputTransform/Stages/HandleSectionLinksTest.php
tests/phpunit/includes/content/WikitextContentHandlerIntegrationTest.php
tests/phpunit/includes/parser/ParserOptionsTest.php
tests/phpunit/includes/parser/ParserOutputTest.php
tests/phpunit/integration/includes/parser/Parsoid/ParsoidParserTest.php