The |couper filter truncates a text after a certain configurable number of characters.

  • New in : SPIP 1.4

It attempts not to cut any words in half and removes any formatting from the text. If the original test is long than the truncated portion, then "(...)" will be added to the end of the extract to indicate that there is a continuation of the text.
The filter truncates by default at 50 characters, but you can specify any other length you wish by passing it as a parameter to the filter, e.g:



In addition, this filter cleans the text from any HTML tags (or other formatting) that the text contains: no more links, no bold or italics, no code, no frames etc. We are left with simply just raw text.

Since spip2, it has been possible to customise the ellipses that are added afterwards with the following second parameter options:

[(#TEXTE|couper{80, '...'})]
[(#TEXTE|couper{80, '&nbsp;<img src="truc.png" alt="">'})]

Note also that it is often the case that the truncation does not occur exactly at the requested number of characters (since words are not truncated in the middle).

See also

Author Mark Published : Updated : 15/07/23

Translations : català, English, Español, français, Nederlands