Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/octfx/mediawiki-extensions-templatestylesextender
Extends TemplateStyles with new selectors and matchers.
https://github.com/octfx/mediawiki-extensions-templatestylesextender
mediawiki-extension
Last synced: 2 months ago
JSON representation
Extends TemplateStyles with new selectors and matchers.
- Host: GitHub
- URL: https://github.com/octfx/mediawiki-extensions-templatestylesextender
- Owner: octfx
- License: gpl-2.0
- Created: 2021-03-19T19:59:50.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-07-19T19:01:30.000Z (6 months ago)
- Last Synced: 2024-10-24T15:55:49.278Z (3 months ago)
- Topics: mediawiki-extension
- Language: PHP
- Homepage: https://mediawiki.org/wiki/Extension:TemplateStylesExtender
- Size: 197 KB
- Stars: 6
- Watchers: 2
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
# TemplateStylesExtender
Extends Extension:TemplateStyles by the following new matchers:* CSS Variables:
* Example: `color: var( --example-var )`
* `image-rendering`
* `ruby-position`
* `ruby-align`
* `scroll-margin-*`, `scroll-padding-*`
* `pointer-events`
* `aspect-ratio`## Installation
Download the zip file from the [latest release](https://github.com/octfx/mediawiki-extensions-TemplateStylesExtender/releases/latest) page.Extract the folder to `extensions/TemplateStylesExtender`.
Add the following to `LocalSettings.php`:
```php
wfLoadExtension( 'TemplateStyles' );
wfLoadExtension( 'TemplateStylesExtender' );
```## Configuration
`$wgTemplateStylesExtenderEnablePrefersColorScheme`
Default: `true`
Enables or disables `@media (prefers-color-scheme)` queries.`$wgTemplateStylesExtenderEnableCssVars`
Default: `true`
Enables or disables css variable support.`$wgTemplateStylesExtenderEnableUnscopingSupport`
Default: `false`
Allows users with `editinterface` permissions to unscope css by setting a `wrapclass` attribute.**Note**: This is potentially expensive, as each templatestyles tag with `wrapclass` set, will attempt to look up the user of the current page revision, and check if this user has the permission to activate css un-scoping.
Example:
`` results in the css being scoped to `.mediawiki` instead of `.mw-parser-output`.**Note**: 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.
`$wgTemplateStylesExtenderUnscopingPermission`
Default: `editinterface`
Specify a permission group that is allowed to unscope css.## Notes on 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.
```css
div#content-wrap {
--padding: 10px
}.content {
padding: var( --padding )
}
```Wikitext
```html
The WikiText...
```