Commit graph

33 commits

Author SHA1 Message Date
James D. Forrester 686420c9c7 build: Update MediaWiki requirement to 1.43
All extensions in Wikimedia production are expected to track MediaWiki's release directly.

Change-Id: I8b9a81ed4497922332a73aa6ccb63a82ecbb98fb
2024-08-22 18:31:33 -04:00
Umherirrender ef074299ca Use namespaced classes
This requires 1.42 for some new names

Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: I0f43f4db86de2990c8902a36976923ad9f0ae67a
2024-01-04 21:53:17 +01:00
Umherirrender b5ab3bac24 Use HookHandlers for CodeEditor hook
Bug: T338435
Change-Id: I7c2cb3ca5e38ce974187af316bf30e71b8e4ad49
2023-11-06 12:00:18 -05:00
Umherirrender 5482c272bc Use HookHandlers for core hooks
The use of "HookHandlers" attribute in extension.json makes it possible
to inject services into hook handler classes in a future patch.

Bug: T338435
Change-Id: Iadeed8e4735f95387f2faed4bc4305327bff3c8a
2023-09-24 22:12:07 +02:00
James D. Forrester 062d4e8a7c build: Update MediaWiki requirement to 1.41
All extensions in Wikimedia production are expected to track MediaWiki's release directly.

Change-Id: Icd82acef9395aba1225ade8fd913aa5dc18bdcce
2023-08-19 14:09:28 +08:00
Reedy 3b337af58d Namespace extension
Change-Id: I7f64539f1c9c4c03088e28e99f77a9acc503f627
2022-02-06 15:05:09 +00:00
Alexander Vorwerk fe485d7c57 Override ContentHandler::fillParserOutput instead of Content::getParserOutput and TextContent::getHtml().
Prepare override for TemplateStylesContentHandler, remove usage in TemplateStylesContent.

Bug: T287158
Change-Id: Ia1c0a307337e43c26cc05a5a9b2883ad2349d07e
2021-10-19 17:09:58 +03:00
Porplemontage cf7225f127 Allow the default source namespace to be changed
This adds a config option so that the src attribute of the <templatestyles> tag can be set to default namespace other than Template.

Bug: T290250
Change-Id: Iec4f5d630d025e0bacba05d40cd74fc9312fcae2
2021-09-05 17:19:33 +00:00
DannyS712 3d76ede23e Use WikiPage::doUserEditContent() instead of ::doEditContent()
::doUserEditContent() is available since 1.36 as a replacement
for ::doEditContent(), which has been deprecated. Bump the
required version of MediaWiki to 1.36 accordingly.

Bug: T255507
Change-Id: I5d19b24031872105a27e886242c8d580ad278354
2021-06-24 05:59:12 +00:00
jenkins-bot 988570195f Merge "Allow template sandboxing in sanitized-css pages" 2021-06-11 13:59:56 +00:00
Inductiveload fcf12308be Allow template sandboxing in sanitized-css pages
This adds 'sanitized-css' content model pages to the list of default-sandboxed
content models  provided by TemplateSandbox.

Bug: T279021
Depends-On: I702ffb9b196fe44a5bc099c7ee02b0e0e3fef283
Change-Id: I1e5d224c7c20ab49389744c99adcffd1971f9b08
2021-06-08 21:31:08 +01:00
Reedy e429d5d1ab Remove deprecated config variables
Bug: T277962
Change-Id: Idc1bd573d892a38a79c5c77917dd1fe1c7653a51
2021-04-19 01:02:32 +01:00
Reedy 57eba81d96 Rename TemplateStylesPropertyBlacklist and TemplateStylesAtRuleBlacklist
* $wgTemplateStylesPropertyBlacklist is now $wgTemplateStylesDisallowedProperties
* $wgTemplateStylesAtRuleBlacklist is now $wgTemplateStylesDisallowedAtRules

Bug: T277962
Change-Id: I2eb120f5c52db1ea9c49bcaf04955771987c1d62
2021-03-21 05:06:51 +00:00
DannyS712 c74a26d111 Use RevisionRecordCallback in ParserOptions, require MW 1.35+
Bug: T249384
Change-Id: I36b7a57278f9c32040180fc885827731a2d94098
2020-06-03 03:12:20 +00:00
peter-ovchyn 08ce0c613e Remove onParserAfterTidy hood as tidy is dead
Bug: T244055
Change-Id: I7afa31c6a542bfafbd50a55a1e79058074bf4906
2020-02-21 21:59:16 +02:00
MGChecker f121c39613 Allow extensions to register additional namespaces in extension.json
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
2019-01-12 11:40:58 -08:00
Brad Jorsch 7e1afddc3d Upgrade extension.json to version 2 and add merge strategy for $wgTemplateStylesNamespaces
Bug: T207186
Change-Id: Iea8dda238e74a0a2a2649c5e341bc0b97a4ff107
2018-10-16 11:25:52 -04:00
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