Issue Task Closed

#92505Fix example for format.crop

Sybille Peters 10/07/20, 16:24 updated 12/22/20, 11:04

Description

https://docs.typo3.org/other/typo3/view-helper-reference/9.5/en-us/typo3/fluid/latest/Format/Crop.html

Has this (first) example:

<f:format.crop maxCharacters="10">
    This is some very long text
</f:format.crop>

This is not a good example because it does not explain how it crops. You are left wondering if it counts the whitespace. Or why else the result is “This is” and not “This is so” (for maxCharacters=“10”).

Lower down on the page you see the respectWordBoundaries.

So it counts the whitespace and it stops if an entire word does not fit.

If the indenting style is changed, the output changes too. In any case, the whitespace makes it unnecessarily confusing.

Alternatively, it might be good to point out that whitespace is not trimmed away.

Maybe change it to this:

<f:format.crop maxCharacters="10">This is some very long text</f:format.crop>

Add the information about word boundary to first example.

And add a tip how to trim the whitespace.

Reviews 2