Issue 12018

Freemarker common.limit macro must respect html tags

Reporter: mdoering
Assignee: mdoering
Type: Bug
Summary: Freemarker common.limit macro must respect html tags
Priority: Critical
Resolution: Fixed
Status: Closed
Created: 2012-10-12 14:03:47.535
Updated: 2013-08-29 14:45:02.271
Resolved: 2012-10-29 18:39:02.656
Description: The common.limit macro we have is used to limit text to a certain length and if exceeding cuts it off while adding an ellipse to the end.
Some of the text we limit can contain html tags though, e.g. the highlighted areas in a search. It happens that the limit macro breaks some html tags and ruins an entire html page.
For example see Abies sibirica here:

The limit macro should respect xml tags and maybe count opening and closing brackets and make sure it only cuts of text when outside of simple tags?
Or should this be better done with some custom jsp tag library?]]>

Created: 2012-10-29 18:39:02.689
Updated: 2012-10-29 18:39:02.689

macro is unchanged and instead the static getHighlightedText() method in the BaseSearchAction modified to respect tags