- if (i % 10 == 0) m_Text = (wxString**) realloc(m_Text, sizeof(wxString*) * (i + 10));
- tmp = tokenizer.NextToken();
- tmp.Replace(wxT("©"), wxT("(c)"), TRUE);
- tmp.Replace(wxT(" "), wxT(" "), TRUE);
- tmp.Replace(wxT("""), wxT("\""), TRUE);
- tmp.Replace(wxT("<"), wxT("<"), TRUE);
- tmp.Replace(wxT(">"), wxT(">"), TRUE);
- tmp.Replace(wxT("&"), wxT("&"), TRUE);
- tmp.Replace(wxT("\t"), wxT(" "), TRUE);
- tmp.Replace(wxT("\r"), wxT(""), TRUE);
- m_Text[i++] = new wxString(tmp);
-
- dc.GetTextExtent(tmp, &x, &z, &z);
- if (x > m_Width) m_Width = x;
- m_Height += m_LineHeight;
- m_LinesCnt++;
+ switch ( (*i).GetValue() )
+ {
+ case '<':
+ while ( i != end && *i != '>' )
+ {
+ out << *i++;
+ }
+ out << '>';
+ 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 (
), a line feed (
), 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;
+ }