Extension:TemplateStylesExtender/zh
![]() Category:Stable extensions/zh |
|
---|---|
Category:Parser extensions/zh | |
描述 | Extends Extension:TemplateStyles with new selectors |
作者 | Octfx留言 |
最新版本 | 2.0.0 (2025-06-02) |
MediaWiki | 1.43+Category:Extensions with manual MediaWiki version/zh |
PHP | >=8.0 |
Composer | octfx/template-styles-extenderCategory:Extensions supporting Composer/zh |
GNU通用公眾授權條款2.0或更新版本 | |
下載 | Category:Extensions in GitHub version control/zh |
|
|
TemplateStylesExtender扩展对: 进行了扩展,支持新的选择器和匹配器。 TemplateStylesExtender is developed based on css-sanitizer 5.5.0, which is being used by MediaWiki 1.43.
功能
- Declare CSS custom properties/variables
- Use CSS custom properties/variables in most properties
- Implement additional properties and values as listed below
安裝
- 下载,并将其放置在您
extensions/
中的TemplateStylesExtender
目录内。 - 将下列放置在您的LocalSettings.php 的底部:
wfLoadExtension( 'TemplateStyles' ); wfLoadExtension( 'TemplateStylesExtender' );
完成 – 在您的wiki上至Special:Version,以验证已成功安装。
Configuration | 描述 | |
---|---|---|
$wgTemplateStylesExtenderCustomPropertiesDeclaration |
Allow CSS custom properties (CSS variables) to be declared as properties | true |
$wgTemplateStylesExtenderExtendCustomPropertiesValues |
Allow the CSS custom properties (CSS variables) to be used as values in all properties | true |
$wgTemplateStylesExtenderEnableUnscopingSupport |
Allows users with unscope permissions to unscope CSS by setting a wrapclass attribute. |
false |
$wgTemplateStylesExtenderUnscopingPermission |
Specify a permission group that is allowed to unscope CSS. | editinterface |
注意CSS变量
当然:root
选择器不起作用,因为模板样式会在前面加上.mw-parser-output
。
一种可行的修复方案是将整个内容包围在div中,并为其添加声明,例如
div#content-wrap { --padding: 10px } .content { padding: var( --padding ) }
Wikitext
<div id="content-wrap"> <div class="content"> The WikiText... </div> </div>
CSS取消包围
例如:<templatestyles src="Foo/style.css" wrapclass="mediawiki" />
会导致CSS被包围在.mediawiki
中,而不是在.mw-parser-output
中。
要在页面内包括这样的调用时,用户需要有
editinterface
权限才能够编辑。 你也可以选择调用一个包括了此样式的模板。
參見
![]() | 此在以下wiki农场/托管网站和/或软件包中提供: 這不是一份權威名單。 即使某些wiki农场/托管网站和/或软件包未在这里列出,它们也可能提供此。 请检查你的wiki农场/托管网站或软件包以确认提供情况。 |
Category:All extensions/zh
Category:Extensions in GitHub version control/zh
Category:Extensions included in Canasta/zh
Category:Extensions included in Miraheze/zh
Category:Extensions included in MyWikis/zh
Category:Extensions included in WikiForge/zh
Category:Extensions included in wiki.gg/zh
Category:Extensions supporting Composer/zh
Category:Extensions with manual MediaWiki version/zh
Category:GPL licensed extensions/zh
Category:Pages using deprecated NoteTA template
Category:ParserFirstCallInit extensions/zh
Category:Parser extensions/zh
Category:Stable extensions/zh
Category:TemplateStylesPropertySanitizer extensions/zh
Category:TemplateStylesStylesheetSanitizer extensions/zh