Extensions can register additional namespaces by setting the
"TemplateStylesNamespaces" attribte in their extension.json. This change is
analogous to Ia5d34cb78fa6af.
There isn't really a simpler way to do this here, as the config setting uses
namespaces as keys, while the attribute is using them as values. Furthermore,
keys with falsey values are ignored in the config setting, and attributes can't
use the same setting architecture, as array_merge_recursive doesn't maintain
numeric keys.
Bug: T200914
Depends-On: I9e62a02ed2044c847e9ab2dcdfab094001f88986
Change-Id: I2fa9b822ee39bcc5f95a293c8c4aad4d53ede30a
Two tracking categories are added:
* A category to track stylesheets with errors. While it's usually not
possible to save a stylesheet with errors, it can happen if a
server-side change makes formerly-valid CSS become invalid.
* A category to track pages displaying errors from incorrect use of
the <templatestyles/> tag.
Bug: T195676
Change-Id: I123679d4bffe36cb28aca1688c052470027ea2a8
SPDX released version 3 of their license list (<https://spdx.org/licenses/>),
which changed the FSF licenses to explicitly end in -only or -or-later
instead of relying on an easy to miss + symbol.
Bug: T183858
Change-Id: Ic9accb2eb34bc32d455f48dfe81a91d23a2d5f5e
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
Change the ConfigRegistry setting in extension.json to the normal
GlobalVarConfig factor rather than a local wrapper.
Change-Id: I9a1b2869ee13fab59f628e4d5c83188a96062c42
Properties listed in $wgTemplateStylesPropertyBlacklist, or
those that contain function-like values not listed in
$wgTemplateStylesFunctionWhitelist cause the containing
declaration to be omitted from rendering entirely.
Additionally, rule selectors are unconditionally prepended
with '#mw-content-text' so that they cannot be applied to
UI elements outside the actual page content.
Change-Id: Id3d7dff465363d0163e4a5a1f31e770b4b0a67e2
Test the roundtrip on a collection of correct and pathological
stylesheets to ascertain whether the parse is behaving as
expected.
Bug: T483
Change-Id: I484cc856b5696c1fa6265769320f79853365e1d6
This extension adds a <templatestyles> tag that, when placed
on a template, allows specifying CSS for pages where that
template is transcluded.
Unlike inline styles, the per-template CSS supports rules
with proper selectors, and @media blocks.
THIS VERSION DOES NOT CURRENTLY FILTER DECLARATIONS and is
therefore unsuitable for wikis where unprivileged users should
not be allowed to influcence the pagewide CSS in unrestricted
ways!
Bug: T483
Change-Id: Ibc1cae3079d164f7ac7bcc7c4ded3f02bb048614