Extension:TemplateStylesExtender/cs

Category:GPL licensed extensions/cs
Příručka k rozšířením MediaWiki
TemplateStylesExtender
Stav rozšíření: stabilníCategory:Stable extensions/cs
Implementace Rozšíření syntaktického analyzátoru Category:Parser extensions/cs
Popis Extends Extension:TemplateStyles with new selectors
Autoři Octfxdiskuse
Nejnovější verze 1.2.0 (2023-07-19)
MediaWiki 1.39+Category:Extensions with manual MediaWiki version
PHP >=8.0
Composer octfx/template-styles-extenderCategory:Extensions supporting Composer/cs
Licence GNU General Public License 2.0 nebo novější
Stáhnout Category:Extensions in GitHub version control/cs
  • $wgTemplateStylesExtenderEnablePrefersColorScheme
  • $wgTemplateStylesExtenderEnableCssVars
  • $wgTemplateStylesExtenderEnableUnscopingSupport
Category:All extensions/cs

Rozšíření TemplateStylesExtender rozšiřuje Extension:TemplateStyles o nové selektory a párovače.

Funkce

Add support for:

  • CSS variables:
    Example color: var( --color-base )
  • image-rendering
  • ruby-position
  • ruby-align
  • scroll-margin-* and scroll-padding-*
  • @media (prefers-color-scheme: dark/light) media queries
  • mask-image
  • clamp
  • revert / revert-layer
  • aspect-ratio

Installation

  • Download soubor/y a vložte je do adresáře pojmenovaného TemplateStylesExtender ve vaší složce extensions/.
  • Na konec vašeho souboru LocalSettings.php přidejte následující kód:
    wfLoadExtension( 'TemplateStyles' );
    wfLoadExtension( 'TemplateStylesExtender' );
    
  • Configure as required.
  • Yes Dokončeno – Přejděte na stránku Special:Version vaší wiki a zkontrolujte, zda bylo rozšíření úspěšně nainstalováno.

Configuration

Key Description Example Default
$wgTemplateStylesExtenderEnablePrefersColorScheme Flag to enable @media (prefers-color-scheme: dark/light) media queries false true
$wgTemplateStylesExtenderEnableCssVars Flag to enable CSS vars false true
$wgTemplateStylesExtenderEnableUnscopingSupport Flag to enable unscoping of CSS by users with editinterface permissions true false

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.

See also

Category:All extensions/cs Category:Extensions in GitHub version control/cs Category:Extensions included in Miraheze/cs Category:Extensions included in MyWikis/cs Category:Extensions included in WikiForge/cs Category:Extensions supporting Composer/cs Category:Extensions with manual MediaWiki version Category:GPL licensed extensions/cs Category:ParserFirstCallInit extensions/cs Category:Parser extensions/cs Category:Stable extensions/cs Category:TemplateStylesPropertySanitizer extensions/cs Category:TemplateStylesStylesheetSanitizer extensions/cs