mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TemplateStyles
synced 2024-11-28 02:00:20 +00:00
b301a30abf
wikimedia/css-sanitizer provides a real CSS parser, which should be safer than poking at things with regular expressions. Instead of the strange hybrid model that tried to both process inline CSS and save CSS when the template is saved, it now looks for <templatestyles src="Title" /> during the parse to do all the transclusion of styles. The output method is "<style> tags in the body", pending someone implementing T160563. It now also registers a "sanitized-css" content model, which should pick up the CSS syntax highlighting and will validate the submitted CSS on submit and prevent a save if it's not valid. This patch also takes advantage of LGPL-2.x § 3 to relicense the extension as GPL-2.0+, although at this point none of the LGPL code remains anyway. Bug: T133408 Bug: T136054 Bug: T135788 Bug: T135789 Change-Id: I993e6f18d32a43aac8398743133d227b05133bbd Depends-On: If4eb5bf71f94fa366ec4eddb6964e8f4df6b824a
25 lines
1.3 KiB
Plaintext
25 lines
1.3 KiB
Plaintext
This document describes MediaWiki hooks added by the TemplateStyles extension.
|
|
See MediaWiki core's docs/hooks.txt for details on how hooks work.
|
|
|
|
==Events and parameters==
|
|
|
|
'TemplateStylesPropertySanitizer': Allows for adjusting or replacing the
|
|
StylePropertySanitizer used when sanitizing style rules. For example, you might
|
|
add, remove, or redefine known properties.
|
|
&$propertySanitizer: Wikimedia\CSS\Sanitizer\StylePropertySanitizer to be used
|
|
for sanitization.
|
|
$matcherFactory: Wikimedia\CSS\Grammar\MatcherFactory being used, for use in
|
|
adding or redefining known properties or replacing the entire sanitizer.
|
|
|
|
'TemplateStylesStylesheetSanitizer': Allows for adjusting or replacing the
|
|
StylesheetSanitizer. For example, you might add, remove, or redefine at-rule
|
|
sanitizers.
|
|
&$sanitizer: Wikimedia\CSS\Sanitizer\StylesheetSanitizer to be used for
|
|
sanitization. The array returned by `$sanitizer->getRuleSanitizers()` will use
|
|
the at-rule names (including the '@') as keys. The style rule sanitizer has
|
|
key 'styles'.
|
|
$propertySanitizer: Wikimedia\CSS\Sanitizer\StylePropertySanitizer being used
|
|
for sanitization, for use in adding or redefining rule sanitizers.
|
|
$matcherFactory: Wikimedia\CSS\Grammar\MatcherFactory being used, for use in
|
|
adding or redefining rule sanitizers.
|