Extension:TemplateStyles/es

La extensión introduce una etiqueta de para especificar que la hoja de estilos debería cargarse desde una página wiki. Poniéndolas en una plantilla permite a la plantilla tener estilos personalizados sin tener que ponerlos en.

Para instrucciones sobre cómo usar la extensión como un editor en un wiki, véase.

Uso
Primero, la página CSS tiene que ser creada. De forma predeterminada cualquier subpágina en el espacio de nombre de Plantilla con un título con terminación en ".css" será creada con el de "CSS sanitizado" si no contiene algún error de sintaxis.

El conjunto de espacios de nombre puede ser ajustado con, o  puede ser usado en cualquier página. Luego, en el wikitexto de la plantilla, añade la etiqueta  para cargar los estilos.

El CSS guardado usando el modelo de contenido "CSS sanitizado" debe cumplir con estrictos requerimientos de validación: CSS inválido, reglas irreconocibles y propiedades o valores de una propiedad irreconocibles o no soportados no pueden ser guardados. Si el código CSS inválido es guardado de todas formas, las construcciones ofensivas se eliminarán cuando el código CSS se envíe al navegador.

El valor del atributo  en la etiqueta es el título de la página, de manera predeterminada al espacio de nombre Plantilla. (Esto se puede cambiar a través de .) Por ejemplo,  cargará la página "Template:Example/styles.css". Esto fallará si esa página no existe o tiene otro modelo de contenido que no sea "CSS sanitizado".

Los estilos se pueden definir dentro de la página utilizando el parámetro opcional  para la etiqueta, p. ej. abarcaría los estilos cargados a cualquier  dentro del contenido analizado principal. Se puede utilizar cualquier secuencia de selector simple de CSS para el parámetro. Esto está pensado para permitir comparar lado por lado las versiones en vivo y sandbox de una plantilla.

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

Advertencias
(See discussion from T155813 and in T176272.) Requests to support additional properties should be filed in Phabricator in the css-sanitizer and TemplateStyles projects. This should largely prevent redefining fonts used elsewhere in the document. Other classes on the  or   elements may be targeted in the same manner. See T197617.
 * Styles added by TemplateStyles are scoped into  to avoid tampering with 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.
 * Including styles on a template that affects contents outside of that template, will cause those styles to not be applied when editing a section that doesn't contain that template. Example: including styles on an infobox that affect all tables of the page, when editing a section that doesn't contain the infobox, those tables won't be styled when previewing that section.
 * TemplateStyles does not support CSS variables, see T320322.
 * TemplateStyles allows few non-standardized CSS properties.
 * 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".
 * 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 dependencies
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.

Potential errors
It may help to enable in your   to determine if you are experiencing any of the errors below.


 * This means a required library has not been installed. The error may come up when attempting to import a wiki CSS page or when changing the content model of a page to "sanitized-css". This was common in the past due to a bug in the extension distributor; shouldn't happen anymore.
 * Happens when you try to import a wiki page created via TemplateStyles, but TemplateStyles is not installed on your wiki.
 * Happens when you try to import a wiki page created via TemplateStyles, but TemplateStyles is not installed on your wiki.
 * Happens when you try to import a wiki page created via TemplateStyles, but TemplateStyles is not installed on your wiki.