]> git.saurik.com Git - wxWidgets.git/blobdiff - src/html/m_pre.cpp
Add wxActivateEvent::GetActivationReason().
[wxWidgets.git] / src / html / m_pre.cpp
index c4a33f8c82892f84fcde411bc1d5995ca31a537d..cc0664f86abc0b37bb498b6edbbe4b80348a6073 100644 (file)
@@ -2,7 +2,6 @@
 // Name:        src/html/m_pre.cpp
 // Purpose:     wxHtml module for <PRE> ... </PRE> tag (code citation)
 // Author:      Vaclav Slavik
 // Name:        src/html/m_pre.cpp
 // Purpose:     wxHtml module for <PRE> ... </PRE> tag (code citation)
 // Author:      Vaclav Slavik
-// RCS-ID:      $Id$
 // Copyright:   (c) 1999 Vaclav Slavik
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 // Copyright:   (c) 1999 Vaclav Slavik
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -47,9 +46,22 @@ static wxString LINKAGEMODE HtmlizeLinebreaks(const wxString& str)
                 if ( i == end )
                     return out;
                 break;
                 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;
             case '\n':
                 out << "<br>";
                 break;
+
             default:
                 out << *i;
                 break;
             default:
                 out << *i;
                 break;