Extension:TemplateStylesExtender/ja
![]() リリースの状態: 安定Category:Stable extensions/ja |
|
---|---|
実装 | パーサー拡張機能Category:Parser extensions/ja |
説明 | Extends Extension:TemplateStyles with new selectors |
作者 | Octfxトーク |
最新バージョン | 2.0.0 (2025-06-02) |
MediaWiki | 1.43+Category:Extensions with manual MediaWiki version/ja |
PHP | >=8.0 |
Composer | octfx/template-styles-extenderCategory:Extensions supporting Composer/ja |
ライセンス | GNU 一般公衆利用許諾書 2.0 以降 |
ダウンロード | Category:Extensions in GitHub version control/ja |
|
|
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.
関連項目
![]() | この拡張機能は以下のウィキ ファーム/ウィキ ホスト/パッケージに含まれています: これは正式な一覧ではありません。 一部のウィキ ファーム/ウィキ ホスト/パッケージは、ここに記載されていなくてもこの拡張機能を含んでいる場合があります。 必ずご利用のウィキ ファーム、ウィキ ホスト、バンドルで確認してください。 |
Category:All extensions/ja
Category:Extensions in GitHub version control/ja
Category:Extensions included in Canasta/ja
Category:Extensions included in Miraheze/ja
Category:Extensions included in MyWikis/ja
Category:Extensions included in WikiForge/ja
Category:Extensions included in wiki.gg/ja
Category:Extensions supporting Composer/ja
Category:Extensions with manual MediaWiki version/ja
Category:GPL licensed extensions/ja
Category:ParserFirstCallInit extensions/ja
Category:Parser extensions/ja
Category:Stable extensions/ja
Category:TemplateStylesPropertySanitizer extensions/ja
Category:TemplateStylesStylesheetSanitizer extensions/ja