Project

General

Profile

Actions

Task #92505

closed

Fix example for format.crop

Added by Sybille Peters over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Documentation
Target version:
-
Start date:
2020-10-07
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Sprint Focus:

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.

Actions

Also available in: Atom PDF