diff options
author | Hoa V. DINH <dinh.viet.hoa@gmail.com> | 2016-03-07 23:32:10 -0800 |
---|---|---|
committer | Hoa V. DINH <dinh.viet.hoa@gmail.com> | 2016-03-07 23:32:10 -0800 |
commit | 217f80b9a128a4664fb51137fe7e398d21fcbe1b (patch) | |
tree | 2b65a60a9624f5d9894db1a9a4611bd3f496df1a /src/core | |
parent | f3be74e24f4b460bf309e4b6289973c34b137382 (diff) |
Improved flattenHTML
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/basetypes/MCString.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/core/basetypes/MCString.cpp b/src/core/basetypes/MCString.cpp index 6a10b13c..b2bc5590 100644 --- a/src/core/basetypes/MCString.cpp +++ b/src/core/basetypes/MCString.cpp @@ -1595,7 +1595,6 @@ static void charactersParsed(void * context, String * modifiedString; modifiedString = new String((const char *) ch, len); modifiedString->autorelease(); - modifiedString = modifiedString->stripWhitespace(); if (modifiedString->length() > 0) { if (state->lastCharIsWhitespace) { @@ -1772,7 +1771,7 @@ static void elementStarted(void * ctx, const xmlChar * name, const xmlChar ** at AutoreleasePool * pool; String * link = NULL; HashMap * attributes; - + pool = new AutoreleasePool(); attributes = dictionaryFromAttributes(atts); if (attributes != NULL) { @@ -2032,11 +2031,8 @@ String * String::flattenHTMLAndShowBlockquoteAndLink(bool showBlockquote, bool s state.paragraphSpacingStack->release(); state.linkStack->release(); - UChar ch[2]; - ch[0] = 160; - ch[1] = 0; - result->replaceOccurrencesOfString(String::stringWithCharacters(ch), MCSTR(" ")); - + result = result->stripWhitespace(); + return result; } @@ -2098,7 +2094,7 @@ String * String::stripWhitespace() // copy content while (* source != 0) { - if ((* source == ' ') && (* (source + 1) == ' ')) { + while ((* source == ' ') && (* (source + 1) == ' ')) { source ++; } * dest = * source; |