Project

General

Profile

Actions

Bug #103144

open

crop ViewHelper has a curious interpretation of respecting word boundaries

Added by Stefan Froemken about 2 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Fluid
Target version:
Start date:
2024-02-17
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
13
PHP Version:
8.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Hello,

the f:format.crop ViewHelper does not take the full string into account to cut at position of maxCharacters.

```
<f:format.crop maxCharacters="18" respectHtml="true" respectWordBoundaries="true"><p>Ein schönes Bild</p><img src="#" width="128" height="128" title="nice" alt="sonne"><p>Nicht wahr?</p></f:format.crop>
```

Results in:

```
<p>Ein schönes Bild</p><img src="#" width="128" height="128" title="nice" alt="sonne"/><p>Ni…</p>
```

The HtmlCropper cuts all text and html parts into sections. So, we have sections with p, sections with img and of cause two text sections in the resulting array. The expected behavior is, that the HtmlCropper should cut in front of "Nicht", but instead it cuts inside of that word. That's because internally this text is in another section and does not know anything about the previous text. That's why HtmlCropper thinks, that "Nichts" would be the first and only word and that why it cuts within the word instead of in front of that word.

German explanation with example: https://www.typo3lexikon.de/typo3-tutorials/core/systemextensions/fluid/viewhelper/format/#beispiel-nicht-im-html-trennen

Stefan

No data to display

Actions

Also available in: Atom PDF