SPIP
Article submitted
The article « |commuter_class
(https://www.spip.net/ecrire/?exec=article&id_article=6671) » is submitted
for publication. on Friday 20 August 2021.
|commuter_class
Friday 20 August 2021 , by jack
Table of contents
- Voir aussi
Available since SPIP 4.0, the `
|commuter_class
` filter compares the provided classes to the classes present in an HTML
tag. The filter removes classes already present and adds classes that did
not exist.
Example
- #LOGO_RUBRIQUE
Produces the following HTML:
<
img
(http://december.com/html/4/element/img.html)
src
=
"IMG/logo/essai-1.jpg?1614197741"
class
=
"spip_logo"
width
=
"800"
height
=
"600"
alt
=
""
/
>
Let’s apply the `
|commuter_class
` filter with the ’nav spip_logo menu’ argument:
[(#LOGO_RUBRIQUE|commuter_class{nav spip_logo menu})]
The classes ’nav’ and ’menu’, which are absent, are added, and the
class ’spip_logo’, which is already present, is deleted.
The result is:
<
img
(http://december.com/html/4/element/img.html)
src
=
"IMG/logo/essai-1.jpg?1614197741"
class
=
'nav menu'
width
=
"800"
height
=
"600"
alt
=
""
/
>
Voir aussi|Back to the table of contents
- |ajouter_class
(https://www.spip.net/ecrire/?exec=article&id_article=6623) - |supprimer_class
(https://www.spip.net/ecrire/?exec=article&id_article=6624)
- |inserer_attribut
(https://www.spip.net/ecrire/?exec=article&id_article=4294) - |vider_attribut
(https://www.spip.net/ecrire/?exec=article&id_article=4142) - |extraire_attribut
(https://www.spip.net/ecrire/?exec=article&id_article=4288)
— Sent by SPIP (https://www.spip.net/)