From 7e1afddc3d7a1a310ab77dd6f7214b1c2a375b7f Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Tue, 16 Oct 2018 11:25:52 -0400 Subject: [PATCH] Upgrade extension.json to version 2 and add merge strategy for $wgTemplateStylesNamespaces Bug: T207186 Change-Id: Iea8dda238e74a0a2a2649c5e341bc0b97a4ff107 --- extension.json | 86 +++++++++++++++++++++++++++++++------------------- 1 file changed, 53 insertions(+), 33 deletions(-) diff --git a/extension.json b/extension.json index c10eae7..ca63c60 100644 --- a/extension.json +++ b/extension.json @@ -10,7 +10,7 @@ "descriptionmsg": "templatestyles-desc", "license-name": "GPL-2.0-or-later", "type": "parserhook", - "manifest_version": 1, + "manifest_version": 2, "load_composer_autoloader": true, "requires": { "MediaWiki": ">= 1.31.0" @@ -34,8 +34,12 @@ "templatestyles-stylesheet-error-category", "templatestyles-page-error-category" ], - "SyntaxHighlightModels": { - "sanitized-css": "css" + "attributes": { + "SyntaxHighlight": { + "Models": { + "sanitized-css": "css" + } + } }, "callback": "TemplateStylesHooks::onRegistration", "Hooks": { @@ -56,42 +60,58 @@ ] }, "config": { - "@TemplateStylesDisable": "When set to true, no styles are output. This flag is for development and will be removed.", - "TemplateStylesDisable": false, - "@TemplateStylesAllowedUrls": "PCRE regexes to match allowed URLs for various types of external references. Known types are:\n; audio: Sound files\n; image: Images\n; svg: SVGs for the Filter and Masking modules\n; font: External fonts\n; namespace: @namespace declarations\n; css: @import declarations\nIf you want to allow an entire domain, be sure to include a trailing '/', e.g. \"<^https://allowed\\.example\\.org/>\" rather than \"<^https://allowed\\.example\\.org>\", so people can't bypass your filter by creating a subdomain like \"https://allowed.example.org.evil.com\".", + "TemplateStylesDisable": { + "description": "When set to true, no styles are output. This flag is for development and will be removed.", + "value": false + }, "TemplateStylesAllowedUrls": { - "audio": [ - "<^https://upload\\.wikimedia\\.org/wikipedia/commons/>" - ], - "image": [ - "<^https://upload\\.wikimedia\\.org/wikipedia/commons/>" - ], - "svg": [ - "<^https://upload\\.wikimedia\\.org/wikipedia/commons/[^?#]*\\.svg(?:[?#]|$)>" - ], - "font": [], - "namespace": [ - "<.>" - ], - "css": [] + "description": "PCRE regexes to match allowed URLs for various types of external references. Known types are:\n; audio: Sound files\n; image: Images\n; svg: SVGs for the Filter and Masking modules\n; font: External fonts\n; namespace: @namespace declarations\n; css: @import declarations\nIf you want to allow an entire domain, be sure to include a trailing '/', e.g. \"<^https://allowed\\.example\\.org/>\" rather than \"<^https://allowed\\.example\\.org>\", so people can't bypass your filter by creating a subdomain like \"https://allowed.example.org.evil.com\".", + "value": { + "audio": [ + "<^https://upload\\.wikimedia\\.org/wikipedia/commons/>" + ], + "image": [ + "<^https://upload\\.wikimedia\\.org/wikipedia/commons/>" + ], + "svg": [ + "<^https://upload\\.wikimedia\\.org/wikipedia/commons/[^?#]*\\.svg(?:[?#]|$)>" + ], + "font": [], + "namespace": [ + "<.>" + ], + "css": [] + } }, - "@TemplateStylesNamespaces": "Namespaces to default the content model to CSS on .css subpages.", "TemplateStylesNamespaces": { - "10": true + "description": "Namespaces to default the content model to CSS on .css subpages.", + "value": { + "10": true + }, + "merge_strategy": "array_plus" }, - "@TemplateStylesPropertyBlacklist": "Blacklist style properties that would otherwise be allowed. See also the TemplateStylesPropertySanitizer hook, which allows for finer-grained control.", - "TemplateStylesPropertyBlacklist": [], - "@TemplateStylesAtRuleBlacklist": "Blacklist at-rules that would otherwise be allowed. Include the '@' in the name. See also the TemplateStylesStylesheetSanitizer hook, which allows for finer-grained control.", - "TemplateStylesAtRuleBlacklist": [], - "@TemplateStylesUseCodeEditor": "Use CodeEditor when editing TemplateStyles CSS pages.", - "TemplateStylesUseCodeEditor": true, - "@TemplateStylesAutoParseContent": "Set this false if you want to manage an entry for 'sanitized-css' in $wgTextModelsToParse manually. If true, an entry will be added to $wgTextModelsToParse automatically if CONTENT_MODEL_CSS is in the array.", - "TemplateStylesAutoParseContent": true, - "@TemplateStylesMaxStylesheetSize": "The maximum size of a stylesheet, in bytes. Set null if you don't want to impose a limit.", - "TemplateStylesMaxStylesheetSize": 102400 + "TemplateStylesPropertyBlacklist": { + "description": "Blacklist style properties that would otherwise be allowed. See also the TemplateStylesPropertySanitizer hook, which allows for finer-grained control.", + "value": [] + }, + "TemplateStylesAtRuleBlacklist": { + "description": "Blacklist at-rules that would otherwise be allowed. Include the '@' in the name. See also the TemplateStylesStylesheetSanitizer hook, which allows for finer-grained control.", + "value": [] + }, + "TemplateStylesUseCodeEditor": { + "description": "Use CodeEditor when editing TemplateStyles CSS pages.", + "value": true + }, + "TemplateStylesAutoParseContent": { + "description": "Set this false if you want to manage an entry for 'sanitized-css' in $wgTextModelsToParse manually. If true, an entry will be added to $wgTextModelsToParse automatically if CONTENT_MODEL_CSS is in the array.", + "value": true + }, + "TemplateStylesMaxStylesheetSize": { + "description": "The maximum size of a stylesheet, in bytes. Set null if you don't want to impose a limit.", + "value": 102400 + } }, "ConfigRegistry": { "templatestyles": "GlobalVarConfig::newInstance" } } -