searchResultSnippet should replace <br> tags with white space instead of 
removing them completly
------------------------------------------------------------------------------------------------

                 Key: MAGNOLIA-1887
                 URL: http://jira.magnolia.info/browse/MAGNOLIA-1887
             Project: Magnolia
          Issue Type: Bug
    Affects Versions: 3.0.5
         Environment: Any
            Reporter: Will Scheidegger
         Assigned To: Boris Kraft
            Priority: Minor


The stripHtmlTags() method of the SearchResultSnippetTag class should not 
simply strip all HTML tags. Line breaks should be replaced by white space.This 
can be simply done by searching & replacing line break tags first, then 
stripping all remaining HTML tags:

protected String stripHtmlTags(String resultString) {
    resultString = resultString.replaceAll("\\<br>", " ");
    resultString = resultString.replaceAll("\\<br/>", " ");
    resultString = resultString.replaceAll("\\<br />", " ");
    resultString = resultString.replaceAll("\\<BR>", " ");
    resultString = resultString.replaceAll("\\<BR/>", " ");
    resultString = resultString.replaceAll("\\<BR />", " ");
    return resultString.replaceAll("\\<(.*?\\s*)*\\>", StringUtils.EMPTY); 
//$NON-NLS-1$
}

I'm sure one could also achive the same with a single regex statement.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.magnolia.info/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/docs/en/editor/stayupdated.html
----------------------------------------------------------------

Reply via email to