ParserOutput: Add 'deduplicateStyles' post-cache transformation
authorBrad Jorsch <bjorsch@wikimedia.org>
Fri, 24 Nov 2017 19:22:25 +0000 (14:22 -0500)
committerGergő Tisza <gtisza@wikimedia.org>
Sun, 11 Feb 2018 05:55:56 +0000 (05:55 +0000)
commit9b2b375fcef153ea554925cb2c8133fb64b336e9
tree6366c38ec5cd153db3e3b8727d12b9b732449b20
parent4f82383582e12923faaeb5306161dce56291b364
ParserOutput: Add 'deduplicateStyles' post-cache transformation

This transformation will find <style> tag with a "data-mw-deduplicate"
attribute. For each value of the attribute, the first instance will be
kept as-is, while any subsequent tags with the same value will be
replaced by a <link rel="mw-deduplicated-inline-style"> with its href
referring to the "data-mw-deduplicate" value using a custom scheme.

This also adds an $attribs parameter to Html::inlineStyle() so the
data-mw-deduplicate attribute can be added.

Note this doesn't actually depend on Ib931e25c, but action=mobileview
will break if it starts being used without that patch.

Bug: T160563
Change-Id: I055abdf4d73ec65771eaa4fe0999ec907c831568
Depends-On: Ib931e25ce85072000e62c486bbe5907f03372494
RELEASE-NOTES-1.31
includes/Html.php
includes/api/ApiParse.php
includes/api/i18n/en.json
includes/api/i18n/qqq.json
includes/parser/ParserOutput.php
tests/phpunit/includes/parser/ParserOutputTest.php