Project

General

Profile

Actions

Bug #82776

closed

Chaining f:format.crop and f:format.stripHtml does cut to early

Added by Mordamir about 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Won't have this time
Assignee:
-
Category:
Fluid
Target version:
-
Start date:
2017-10-16
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.0
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

If i chain a <f:format.crop ...><f:format.stripHtml>{text}</f:format.stripHtml></f:format.crop> the number of cropped (visible) chars sometimes is to low.

The problem with this is, that the stripHtml removes tags, but does not remove spaces or newlines. And the following crop does count the spaces, tabs and newlines if they are in front of the text.

For instance:

<div>
  <p>
    Some text

Output of stripHtml (space replaced with *):

\n
**\n
****Some text  

Depending on newline type this results in in 8 or 10 chars less than given in maxChars. I could the issue if i chain another f:spaceless viewhelper, but thats not optimal.

I dont know if it would be better if f:format.stripHtml or f:format.crop should trim the text.

Actions

Also available in: Atom PDF