Extension:TemplateStylesExtender
Appearance
リリースの状態: 安定 |
|
|---|---|
| 実装 | パーサー拡張機能 |
| 説明 | 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 一般公衆利用許諾書 2.0 以降 |
| ダウンロード | |
|
|
|
The TemplateStylesExtender extension extends Extension:TemplateStyles with new selectors and matchers. 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' );
- 必要に応じて設定します。
完了 – ウィキの「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 )
}
Wikitext
<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:
- Stable extensions/ja
- Parser extensions/ja
- Extensions supporting Composer/ja
- GPL licensed extensions/ja
- Extensions in GitHub version control/ja
- ParserFirstCallInit extensions/ja
- TemplateStylesPropertySanitizer extensions/ja
- TemplateStylesStylesheetSanitizer extensions/ja
- All extensions/ja
- Extensions included in Canasta/ja
- Extensions included in Miraheze/ja
- Extensions included in MyWikis/ja
- Extensions included in ProWiki/ja
- Extensions included in wiki.gg/ja
