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.
|
Polish Pro input.
|
||||||
- Fixed wxHtmlWindow::SelectionToText() to correctly insert newlines after
|
- Fixed wxHtmlWindow::SelectionToText() to correctly insert newlines after
|
||||||
single-cell paragraphs.
|
single-cell paragraphs.
|
||||||
|
- Fixed wxHTML's line breaks handling in <pre> blocks broken in 2.8.8 (#10120)
|
||||||
|
|
||||||
All (Unix):
|
All (Unix):
|
||||||
|
|
||||||
|
@@ -46,9 +46,22 @@ static wxString LINKAGEMODE HtmlizeLinebreaks(const wxString& str)
|
|||||||
}
|
}
|
||||||
out << wxT('>');
|
out << wxT('>');
|
||||||
break;
|
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'):
|
case wxT('\n'):
|
||||||
out << wxT("<br>");
|
out << wxT("<br>");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
out << str[i];
|
out << str[i];
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user