Commit graph

16 commits

Author SHA1 Message Date
Brad Jorsch d1734fbeb2 Add tracking categories for errors
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
2018-05-29 14:36:03 -04:00
Kunal Mehta 37fc1df457 Use SPDX 3.0 license identifier
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
2018-03-03 23:27:16 +00:00
Reedy 203c257894 Set a requirement of MW >= 1.31
Change-Id: I4e2dc7d8d7603f89e6a9c65b5e36b7e54623ea62
2018-02-11 15:11:44 +00:00
Kunal Mehta 9a1a06b77d Move PHP classes into includes/ directory
Change-Id: Ibc03a6c298ec3bf3bbfa435033095546db6fc5f0
2018-02-05 18:18:01 -08:00
jenkins-bot 7b025c809a Merge "Cache processed stylesheets during the parse" 2018-02-02 02:45:31 +00:00
Gergő Tisza 34a7cf83fa
Temporary feature flag for disabling style output
Bug: T176268
Change-Id: I6eae1ac80131b9f219c5a6ab3b63c1cc4fe1590f
2018-01-18 17:54:07 -08:00
Brad Jorsch 9964009346 Cache processed stylesheets during the parse
If we've already processed a stylesheet once, there's no point in
processing it again.

Change-Id: I83f7aab82cc7674037974b0de43ccae6c77ff39f
2017-11-30 14:05:31 -05:00
Brad Jorsch b301a30abf Use wikimedia/css-sanitizer, and rewrite the hooking
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
2017-06-07 15:14:09 +00:00
Reedy ca778e2b98 Few style tweaks
Parameter documentation type hints

Remove unused RL module

Change-Id: I6e265c97eababa4bbfebb9402141664ad24b4e43
2016-10-30 22:56:44 +00:00
Reedy bf17dd54e8 Remove 'UnitTestList' hook
No longer needed now that extension unittests are autodiscovered.

Bug: T142120
Change-Id: I03f1d1ea345a43685397e106fc5e27e1c2436f70
2016-08-05 22:42:12 +01:00
Bryan Davis 586694b64e Correct l10n message loading
s/MessageDirs/MessagesDirs/

Change-Id: I912b48442025fc381e6fc89671669717e834a76b
2016-04-21 14:27:30 -06:00
Bryan Davis 996b08ae93 Fix config loading
Change the ConfigRegistry setting in extension.json to the normal
GlobalVarConfig factor rather than a local wrapper.

Change-Id: I9a1b2869ee13fab59f628e4d5c83188a96062c42
2016-04-21 14:26:00 -06:00
Coren 29bdd0c18e Add property filtering
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
2016-04-21 05:16:06 +00:00
Coren 436370e59d Add unit tests for CSSParse and CSSRender
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
2016-04-20 14:15:08 -06:00
Raymond b35763edbf Consisteny tweaks: Use lower case chars for message key only
In preparation for adding extension to translatewiki.net

Change-Id: I64fe725ceac7ec1b4d0da9c05e8285cc06278088
2016-04-10 22:49:25 +02:00
Coren 31743445bd TemplateStyles extension prototype
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
2016-04-08 11:08:59 -04:00