From b076dc01d2d80f5eeb30fb541fe6279aa9420a4a Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Fri, 9 Mar 2001 23:40:36 +0000 Subject: [PATCH] fixed parsing of tags with whitespace around = sign git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9489 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/html/htmltag.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/html/htmltag.cpp b/src/html/htmltag.cpp index 7b6e9755b3..6fc8e6cca3 100644 --- a/src/html/htmltag.cpp +++ b/src/html/htmltag.cpp @@ -139,6 +139,7 @@ wxHtmlTag::wxHtmlTag(const wxString& source, int pos, int end_pos, wxHtmlTagsCac if (source[i] == '/') { m_Ending = TRUE; i++; } else m_Ending = FALSE; + // find tag's name and convert it to uppercase: while ((i < end_pos) && ((c = source[i++]) != ' ' && c != '\r' && c != '\n' && c != '\t' && c != '>')) @@ -147,6 +148,9 @@ wxHtmlTag::wxHtmlTag(const wxString& source, int pos, int end_pos, wxHtmlTagsCac m_Name += c; } + // if the tag has parameters, read them and "normalize" them, + // i.e. convert to uppercase, replace whitespaces by spaces and + // remove whitespaces around '=': if (source[i-1] != '>') while ((i < end_pos) && ((c = source[i++]) != '>')) { @@ -155,6 +159,19 @@ wxHtmlTag::wxHtmlTag(const wxString& source, int pos, int end_pos, wxHtmlTagsCac m_Params += c; if (c == '"') { + // remove spaces around the '=' character: + if (m_Params.Length() > 1 && + m_Params[m_Params.Length()-2] == ' ') + { + m_Params.RemoveLast(); + while (m_Params.Length() > 0 && m_Params.Last() == ' ') + m_Params.RemoveLast(); + m_Params += '"'; + } + while ((i < end_pos) && (source[i++] == ' ')) {} + if (i < end_pos) i--; + + // ...and copy the value to m_Params: while ((i < end_pos) && ((c = source[i++]) != '"')) m_Params += c; m_Params += c; } -- 2.45.2