fixed interpretation of line breaks in <pre> to conform to the spec (#10120)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56546 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2008-10-28 10:04:36 +00:00
parent 7e73fb9c99
commit 9e570f836b

View File

@ -47,9 +47,22 @@ static wxString LINKAGEMODE HtmlizeLinebreaks(const wxString& str)
if ( i == end )
return out;
break;
// We need to translate any line break into exactly one <br>.
// Quoting HTML spec: "A line break is defined to be a carriage
// return (&#x000D;), a line feed (&#x000A;), or a carriage
// return/line feed pair."
case '\r':
{
wxString::const_iterator j(i + 1);
if ( j != end && *j == '\n' )
i = j;
}
// fall through
case '\n':
out << "<br>";
break;
default:
out << *i;
break;