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:
@@ -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):
|
||||
|
||||
|
@@ -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 (
), a line feed (
), 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;
|
||||
|
Reference in New Issue
Block a user