Extension:TemplateStylesExtender/ru
Appearance
This extension is incompatible with the current stable MediaWiki 1.45 release!
|
Статус релиза: стабильно |
|
|---|---|
| Реализация | Расширение парсера |
| Описание | Extends Extension:TemplateStyles with new selectors |
| Автор(ы) | Octfxобсуждение |
| Последняя версия | 2.0.0 (2025-06-02) |
| MediaWiki | 1.43+ |
| PHP | >=8.0 |
| Composer | octfx/template-styles-extender |
|
|
|
| Лицензия | GNU General Public License 2.0 или позднее |
| Скачать | GitHub:
Note: |
The TemplateStylesExtender extension extends Расширение:TemplateStyles with new selectors and matchers. TemplateStylesExtender is developed based on css-sanitizer 5.5.0, which is being used by MediaWiki 1.43.
Features
- Declare CSS custom properties/variables
- Use CSS custom properties/variables in most properties
- Implement additional properties and values as listed below
Установка
- Download и распакуйте файл(ы) в папку с названием
TemplateStylesExtenderв вашей папкеextensions/. - Добавьте следующий код в конце вашего файла LocalSettings.php:
wfLoadExtension( 'TemplateStyles' ); wfLoadExtension( 'TemplateStylesExtender' );
- Configure as required.
Готово – Перейдите на страницу 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
|
Note CSS Vars
Currently using :root selectors won't work due to template styles prepending .mw-parser-output.
One possible fix is to wrap the entire content into a 'div' element and adding the declarations to this, e.g.
div#content-wrap {
--padding: 10px
}
.content {
padding: var( --padding )
}
Викитекст
<div id="content-wrap">
<div class="content">
The WikiText...
</div>
</div>
Unscoping of CSS
Example: <templatestyles src="Foo/style.css" wrapclass="mediawiki" /> results in the CSS being scoped to .mediawiki instead of .mw-parser-output.
Including such a call in a page essentially limits editing to users with the
editinterface right. You can alternatively include a call to a template that includes the styles.
См. также
| Это расширение включено в следующие вики-фермы/хостинги и/или пакеты: |
Categories:
- Incompatible extensions/ru
- Stable extensions/ru
- Parser extensions/ru
- Extensions supporting Composer/ru
- ParserFirstCallInit extensions/ru
- TemplateStylesPropertySanitizer extensions/ru
- TemplateStylesStylesheetSanitizer extensions/ru
- GPL licensed extensions/ru
- Extensions in GitHub version control/ru
- All extensions/ru
- Extensions included in Canasta/ru
- Extensions included in Miraheze/ru
- Extensions included in MyWikis/ru
- Extensions included in ProWiki/ru
- Extensions included in wiki.gg/ru
