The |couper filter truncates a text after a certtain configurable number of characters. 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. [(#TEXTE|couper{80})].

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 the #INTRODUCTION tag.

Author Mark Published : Updated : 26/10/12

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