Skip to content

Add option to $sanitizer->truncate() to allow unclosed tags to be closed rather than removed #253

@Toutouwai

Description

@Toutouwai

Short description of the enhancement

$sanitizer->truncate() uses WireTextTools::fixUnclosedTags() to deal with any unclosed tags that might be present in the truncated string. But it doesn't provide a way to set the "remove" option for fixUnclosedTags() to false:

* When the remove option is false, it will attempt to close unclosed tags rather than 
* remove them. It doesn't know exactly where they should be closed, so it appends the 
* close tags to the end of the string. 

It would be useful to have an option for $sanitizer->truncate() so that unclosed tags are closed rather than removed.

Related forum topic: https://processwire.com/talk/topic/20602-truncate-removing-html-tags/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions