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

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@56547 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2008-10-28 10:06:32 +00:00
parent 21246d94ba
commit 05fbc682d6
2 changed files with 14 additions and 0 deletions

View File

@@ -102,6 +102,7 @@ All (GUI):
Polish Pro input.
- Fixed wxHtmlWindow::SelectionToText() to correctly insert newlines after
single-cell paragraphs.
- Fixed wxHTML's line breaks handling in <pre> blocks broken in 2.8.8 (#10120)
All (Unix):

View File

@@ -46,9 +46,22 @@ static wxString LINKAGEMODE HtmlizeLinebreaks(const wxString& str)
}
out << wxT('>');
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 wxT('\r'):
{
size_t j = i + 1;
if ( j < len && str[j] == wxT('\n') )
i = j;
}
// fall through
case wxT('\n'):
out << wxT("<br>");
break;
default:
out << str[i];
break;