Extension:TemplateStyles/fr

L'extension TemplateStyles introduit une balise pour spécifier qu'une feuille de style doit être chargée d'une page wiki. En l'insérant dans un modèle celui-ci pourra avoir des styles personnalisés sans avoir à les mettre dans.

Voir pour les instructions concernant l'utilisation de l'extension en tant qu'éditeur sur un wiki.

Utilisation
D'abord la page CSS doit être créée. By default any subpage in the Template namespace with a title ending in ".css" will be created with the "Sanitized CSS" ; the set of namespaces may be adjusted with, or  may be used on any page. Then, in the template's wikitext, add the tag to load the styles.

The CSS saved using the "Sanitized CSS" content model must meet strict validity requirements: invalid CSS, unrecognized at-rules, and unrecognized or unsupported properties or property values cannot be saved. If invalid CSS is somehow saved anyway, the offending constructs will be removed when the CSS is output to the browser.

The value of the  attribute on the tag is the title of the page, defaulting to the Template namespace. For example, will load the page "Template:Example/styles.css". This will fail if that page does not exist or has a content model other than "Sanitized CSS".

Styles can be scoped within the page by using the optional  parameter to the tag, e.g.  would scope the styles loaded to any  inside the main parsed content. Any CSS simple selector sequence can be used for the  parameter. This is intended to allow side-by-side comparison of live and sandbox versions of a template.

Use of sanitized CSS is tracked like transclusion of templates, and will show up as a transclusion on.

Mises en garde

 * Styles added by TemplateStyles are scoped to avoid affecting the user interface outside of the main parsed content.
 * To use TemplateStyles to style something like w:MediaWiki:Protectedpagetext, you would need to enclose the message's contents in.
 * The styles should be written to target specific CSS classes, and anything that generates elements with those classes should be sure to also include the styles itself rather than relying on some other template to have done so.
 * Styles included by a template can currently affect content on the page outside of the content generated by that template, but this ability may be removed in the future and should not be relied upon.
 * TemplateStyles allows few non-standardized CSS properties. Requests to support additional properties should be filed in Phabricator in the css-sanitizer and TemplateStyles projects.
 * Requests should include links to standards-track documents (e.g. on w3.org) describing the syntax of the properties being requested, and an analysis of current browser support for the properties (e.g. a link to a caniuse.com page about the properties).
 * Vendor-prefixed properties (e.g. anything starting with,  , or  ) are likely to be declined if they're not needed for modern browsers.
 * rules must use a  prefixed with "TemplateStyles". This should largely prevent redefining fonts used elsewhere in the document.
 * To target styles based on skins, use a selector such as ; specification of the   element is required and must be followed by a descendant combinator (i.e. the space). Other classes on the   or   elements may be targeted in the same manner.

Autres dépendances
should be configured to use no tidying or RemexHtml. If used with any of the Raggett drivers, a tag in the middle of a paragraph (including in an inline template) will cause tidy to break the paragraph at that point. The other drivers have not been tested for this issue.

Erreurs possibles

 * - L'erreur peut apparaître lorsque l'on essaie de sauvegarder une page CSS de Wiki ou lorsque l'on modifie les pages du modèle de contenu CSS nettoyé (Sanitized CSS). Ceci peut provenir de certains bogues qui nécessitent que  soit exécuté même lorsque l'extension n'a pas été installée à partir de Git.

Voir aussi

 * - utilisé pour le nettoyage du CSS.
 * T483 "RfC: Allow styling in templates" (about possibly deploying this extension on Wikimedia wikis)
 * Requests for comment/Allow styling in templates
 * T56864 "ResourceLoader: Implement support for LESS in wiki modules (user and site), supporting e.g. MediaWiki:Common.less"
 * - la meilleure façon d'enregistrer le CSS sur le wiki.
 * T155813 "Decide on storage and delivery method for TemplateStyles CSS"
 * Il est maintenant plus facile de fabriquer du contenu pour les appareils mobiles : architecture du web dynamique à l'échelle de Wikipedia sur le blog Wikimedia.
 * Il est maintenant plus facile de fabriquer du contenu pour les appareils mobiles : architecture du web dynamique à l'échelle de Wikipedia sur le blog Wikimedia.