[TYPO3-core] RFC #7984: Bug: stdWrap.crop now closes opened tags and counts chars correctly

Martin Kutschker masi-no at spam-typo3.org
Thu Sep 4 20:44:39 CEST 2008


Dmitry Dulepov [typo3] schrieb:
> Hi!
> 
> Dmitry Dulepov [typo3] wrote:
>> I came across this feature because I need it in my own project.
>>
>> There was a lot of discussions about this feature. Since no one did
>> any changes to Joshen's code, I propose to use his code for 4.3 and
>> forget the discussion about entities as rare case for rare encodings.
>>
>> I propose to impement this feature as new "cropHTML" property. It is
>> to be called before the "stripHTML" property.
>>
>> The patch is attached.
> 
> Another reminder...

The regex works only on limited predefined list of tags without any
apparent reason. I think it can be done without it (just replace the tag
list with [a-z]+ or [a-zA-Z]+ (both for old HTML and custom XHTML tags).
Anyway, if the list stays it should at least be extended to cover also
thead, tbody and tfoot (didn't check against the complete list of xhtml
tags). Nah, the list must go: it's hard to maintain, not forward
compatible, not compatible with custom tags).

Works only for character sets supported by html_entity_decode().

Nitpick: abs() is applied a multiple times to max. string length.

Masi

PS: I find this piece of code surprisingly hard to read.


More information about the TYPO3-team-core mailing list