[SPIP] Proposé : |wrap

SPIP

Article proposé

L’article « |wrap » est proposé à la publication depuis le lundi 23 février 2026.


|wrap

lundi 23 février 2026, par jack

The |wrap{<tag>} filter wraps the tag to which it is applied with the HTML tag specified as a parameter.

Simple examples

[(#BALISE|wrap{<b>})]

will display as HTML source :
<b>blah blah</b>

[(#TITRE|wrap{#TOTAL_BOUCLE|=={1}|?{<h1>, <h2>}})]

will display as HTML source if the loop returns only one result :
<h1>The Title</h1>
but will display :
<h2>Le titre</h2><h2>Another Title</h2>
if the loop returns several.

HTML tag sequences

It is also possible to pass a series of tags as arguments. The final tags will be calculated to produce a correct nesting. The tags specified as filter arguments may include attributes.

Example :

[(#BALISE|wrap{<div><span class="thing"><b>})]

will display as HTML source :
<div><span class="thing"><b>blah blah</b></span></div>

— Envoyé par SPIP