From: Brad Jorsch
Date: Fri, 24 Nov 2017 19:22:25 +0000 (-0500)
Subject: ParserOutput: Add 'deduplicateStyles' post-cache transformation
X-Git-Tag: 1.31.0-rc.0~637
X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22sites_tous%22%29%20.%20%22?a=commitdiff_plain;h=9b2b375fcef153ea554925cb2c8133fb64b336e9;p=lhc%2Fweb%2Fwiklou.git
ParserOutput: Add 'deduplicateStyles' post-cache transformation
This transformation will find #s',
+ function ( $m ) use ( &$seen ) {
+ $attr = Sanitizer::decodeTagAttributes( $m[1] );
+ if ( !isset( $attr['data-mw-deduplicate'] ) ) {
+ return $m[0];
+ }
+
+ $key = $attr['data-mw-deduplicate'];
+ if ( !isset( $seen[$key] ) ) {
+ $seen[$key] = true;
+ return $m[0];
+ }
+
+ // We were going to use an empty
+
+
+
+
+
+
+
+
EOF;
return [
@@ -354,6 +367,23 @@ EOF
', 'Test document.
'
],
+ 'Style deduplication' => [
+ [], [], $dedupText, <<This is a test document.
+
+
+
+
+
+
+
+
+
+EOF
+ ],
+ 'Style deduplication disabled' => [
+ [ 'deduplicateStyles' => false ], [], $dedupText, $dedupText
+ ],
];
// phpcs:enable
}