|
|
(18 intermediate revisions by the same user not shown) |
Line 10: |
Line 10: |
| | | |
| == Open Source Projects == | | == Open Source Projects == |
− | ==== Automated Localization Build Tool ==== | + | ==== Automated Localization Build Script ==== |
| [http://zenit.senecac.on.ca/wiki/index.php/Automated_localization_build_tool http://zenit.senecac.on.ca/wiki/index.php/Automated_localization_build_tool] | | [http://zenit.senecac.on.ca/wiki/index.php/Automated_localization_build_tool http://zenit.senecac.on.ca/wiki/index.php/Automated_localization_build_tool] |
− | === 0.1 Completed === | + | ===== Version 0.1 ===== |
| #Should be able to accept a localization | | #Should be able to accept a localization |
| #Should be able to accept a Firefox build (eg; en-GB or en-US) | | #Should be able to accept a Firefox build (eg; en-GB or en-US) |
Line 19: |
Line 19: |
| * Instruction: [http://matrix.senecac.on.ca/~azambran/mozilla/instructions0.1.txt Instructuion0.1.txt] | | * Instruction: [http://matrix.senecac.on.ca/~azambran/mozilla/instructions0.1.txt Instructuion0.1.txt] |
| * Tools: [https://bugzilla.mozilla.org/attachment.cgi?id=284789 0.1 Releases] | | * Tools: [https://bugzilla.mozilla.org/attachment.cgi?id=284789 0.1 Releases] |
− | === 0.2 Update === | + | ===== Version 0.2.* ===== |
| #Given any directory as a starting point, should walk through all sub-directories and files and make changes based on translation rules | | #Given any directory as a starting point, should walk through all sub-directories and files and make changes based on translation rules |
| #Add ability to update Properties files | | #Add ability to update Properties files |
| #Allow user to enter localization folder (eg; en-GB) as input | | #Allow user to enter localization folder (eg; en-GB) as input |
− | * Instruction:[] | + | * Instruction:[http://zenit.senecac.on.ca/wiki/index.php/Release_0.2.3_Instructions 0.2.3 Instructions] |
− | * Tools: [] | + | * Tools: [http://zenit.senecac.on.ca/wiki/imgs/L10nmerge0.2.3.zip 0.2.3 Releases] |
− | === 0.3 Update === | + | * Older Version: [http://matrix.senecac.on.ca/~azambran/mozilla/l10n/l10nmerge0.2.2.zip 0.2.2 Release] |
| + | |
| + | ===== Version 0.3.* ===== |
| + | # Fix Key changing problem |
| + | # Add more words for translation |
| + | # Create new l10n tree instead of creating .bak file |
| + | |
| + | * Instruction: |
| + | # Download 0.3.2 and 0.3.3 |
| + | # Unzip 0.3.2 and Unzip 0.3.3 to overwrite 0.3.2 |
| + | # CMD Command: python l10nFork.py en en-CA |
| + | * Tools: [https://bugzilla.mozilla.org/attachment.cgi?id=292015 0.3.2] & [https://bugzilla.mozilla.org/attachment.cgi?id=292111 0.3.3] |
| | | |
| == Contributions == | | == Contributions == |
Line 48: |
Line 59: |
| | | |
| == Lab == | | == Lab == |
− | ==== Thunderbird Fix ==== | + | ==== Modifying the Browser Lab - Firefox Patch ==== |
− | <pre>
| + | *[http://matrix.senecac.on.ca/~vlam6/patch.txt Patch] |
− | ? labpatch.txt
| + | Related Blog Post: |
− | ? objdir-tbird-debug
| + | [http://vlam6.wordpress.com/2007/10/14/modifying-the-browser-lab/ 2007/10/14] |
− | ? security/nss/cmd/shlibsign/NONE
| + | [http://vlam6.wordpress.com/2007/10/17/modifying-the-browser-lab-continued-done/ 2007/10/17] |
− | ? security/nss/cmd/shlibsign/mangle/NONE
| + | |
− | ? security/nss/lib/ckfw/builtins/NONE
| + | ==== Modifying the Browser Lab - Firefox Extension ==== |
− | ? security/nss/lib/ckfw/capi/NONE
| + | *[http://matrix.senecac.on.ca/~vlam6/addtabbeside.xpi Extension] |
− | ? security/nss/lib/freebl/NONE
| + | Related Blog Post: |
− | ? security/nss/lib/nss/NONE
| + | [http://vlam6.wordpress.com/2007/11/19/redo-lab-1-2-lab-3-4-posted/ 2007/11/19] |
− | ? security/nss/lib/smime/NONE
| + | |
− | ? security/nss/lib/softoken/NONE
| + | ==== Fixing a bug in Thunderbird - Thunderbird Patch ==== |
− | ? security/nss/lib/softoken/legacydb/NONE
| + | *[http://matrix.senecac.on.ca/~vlam6/labpatch.txt My Thunderbird Patch] |
− | ? security/nss/lib/ssl/NONE
| + | *[http://landfill.bugzilla.org/bugzilla-3.0-branch/show_bug.cgi?id=6013 My Bug @ Bugzilla] |
− | Index: netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
| + | Related Blog Post: |
− | ===================================================================
| + | [http://vlam6.wordpress.com/2007/11/12/problem-with-fixing-a-bug-in-thunderbird-lab/ 2007/11/12] |
− | RCS file: /cvsroot/mozilla/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp,v
| + | ==== Creating a Binary C++ XPCOM Component - XPCOM Folder ==== |
− | retrieving revision 1.85
| + | *[http://matrix.senecac.on.ca/~vlam6/firstxpcom.zip My Firstxpcom Files in a Zip] |
− | diff -u -8 -p -r1.85 mozTXTToHTMLConv.cpp
| + | Related Blog Post: |
− | --- netwerk/streamconv/converters/mozTXTToHTMLConv.cpp 11 Mar 2007 00:17:00 -0000 1.85
| + | [http://vlam6.wordpress.com/2007/11/15/lab-creating-a-binary-c-xpcom-component/ 2007/11/15] |
− | +++ netwerk/streamconv/converters/mozTXTToHTMLConv.cpp 11 Nov 2007 23:37:50 -0000
| + | [http://vlam6.wordpress.com/2007/11/21/lab-5-completed/ 2007/11/21] |
− | @@ -1,42 +1,42 @@
| + | ==== Adding Chrome/UI to the FirstXpcom Component ==== |
− | /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
| + | Related Blog Post: |
− | /* ***** BEGIN LICENSE BLOCK *****
| + | [http://vlam6.wordpress.com/2007/11/21/lab-5-completed/ 2007/11/21] |
− | - *
| + | |
− | + *
| |
− | * The "License" shall be the Mozilla Public License Version 1.1, except
| |
− | * Sections 6.2 and 11, but with the addition of the below defined Section 14.
| |
− | * You may obtain a copy of the Mozilla Public License Version 1.1 at
| |
− | * <http://www.mozilla.org/MPL/>. The contents of this file are subject to the
| |
− | * License; you may not use this file except in compliance with the License.
| |
− | - * | |
− | + *
| |
− | * Section 14: MISCELLANEOUS.
| |
− | * This License represents the complete agreement concerning subject matter
| |
− | * hereof. If any provision of this License is held to be unenforceable, such
| |
− | * provision shall be reformed only to the extent necessary to make it
| |
− | * enforceable. This License shall be governed by German law provisions. Any
| |
− | * litigation relating to this License shall be subject to German jurisdiction.
| |
− | - * | |
− | + *
| |
− | * Once Covered Code has been published under a particular version of the
| |
− | * License, You may always continue to use it under the terms of that version.
| |
− | + The Initial Developer and no one else has the right to modify the terms
| |
− | * applicable to Covered Code created under this License.
| |
− | * (End of Section 14)
| |
− | - *
| |
− | + *
| |
− | * Software distributed under the License is distributed on an "AS IS"
| |
− | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
| |
− | * License for the specific language governing rights and limitations
| |
− | * under the License.
| |
− | - *
| |
− | + *
| |
− | * The Original Code is the Mozilla Text to HTML converter code.
| |
− | - *
| |
− | + *
| |
− | * The Initial Developer of the Original Code is
| |
− | * Ben Bucksch <http://www.bucksch.org>.
| |
− | * Portions created by Ben Bucksch are Copyright
| |
− | * (C) 1999, 2000 Ben Bucksch. All Rights Reserved.
| |
− | - *
| |
− | + *
| |
− | * Contributor(s):
| |
− | *
| |
− | * Alternatively, the contents of this file may be used under the terms of
| |
− | * either the GNU General Public License Version 2 or later (the "GPL"), or
| |
− | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
| |
− | * in which case the provisions of the GPL or the LGPL are applicable instead
| |
− | * of those above. If you wish to allow use of your version of this file only
| |
− | * under the terms of either the GPL or the LGPL, and not to allow others to
| |
− | @@ -69,17 +69,17 @@ const PRFloat64 growthRate = 1.2;
| |
− | // 0xA0's and a single ending space, so need to treat 0xA0's as spaces.
| |
− | // 0xA0 is the Latin1/Unicode character for "non-breaking space (nbsp)"
| |
− | // Also recognize the Japanese ideographic space 0x3000 as a space.
| |
− | static inline PRBool IsSpace(const PRUnichar aChar)
| |
− | {
| |
− | return (nsCRT::IsAsciiSpace(aChar) || aChar == 0xA0 || aChar == 0x3000);
| |
− | }
| |
− |
| |
− | -// Escape Char will take ch, escape it and append the result to | |
− | +// Escape Char will take ch, escape it and append the result to
| |
− | // aStringToAppendTo
| |
− | void
| |
− | mozTXTToHTMLConv::EscapeChar(const PRUnichar ch, nsString& aStringToAppendTo)
| |
− | {
| |
− | switch (ch)
| |
− | {
| |
− | case '<':
| |
− | aStringToAppendTo.AppendLiteral("<");
| |
− | @@ -94,17 +94,17 @@ mozTXTToHTMLConv::EscapeChar(const PRUni
| |
− | aStringToAppendTo += ch;
| |
− | }
| |
− |
| |
− | return;
| |
− | }
| |
− |
| |
− | // EscapeStr takes the passed in string and
| |
− | // escapes it IN PLACE.
| |
− | -void | |
− | +void
| |
− | mozTXTToHTMLConv::EscapeStr(nsString& aInString)
| |
− | {
| |
− | // the replace substring routines
| |
− | // don't seem to work if you have a character
| |
− | // in the in string that is also in the replacement
| |
− | // string! =(
| |
− | //aInString.ReplaceSubstring("&", "&");
| |
− | //aInString.ReplaceSubstring("<", "<");
| |
− | @@ -129,17 +129,17 @@ mozTXTToHTMLConv::EscapeStr(nsString& aI
| |
− | i += 5; // skip past the integers we just added
| |
− | break;
| |
− | default:
| |
− | i++;
| |
− | }
| |
− | }
| |
− | }
| |
− |
| |
− | -void
| |
− | +void
| |
− | mozTXTToHTMLConv::UnescapeStr(const PRUnichar * aInString, PRInt32 aStartPos, PRInt32 aLength, nsString& aOutString)
| |
− | {
| |
− | const PRUnichar * subString = nsnull;
| |
− | for (PRUint32 i = aStartPos; PRInt32(i) - aStartPos < aLength;)
| |
− | {
| |
− | PRInt32 remainingChars = i - aStartPos;
| |
− | if (aInString[i] == '&')
| |
− | {
| |
− | @@ -169,44 +169,44 @@ mozTXTToHTMLConv::UnescapeStr(const PRUn
| |
− | {
| |
− | aOutString += aInString[i];
| |
− | i++;
| |
− | }
| |
− | }
| |
− | }
| |
− |
| |
− | void
| |
− | -mozTXTToHTMLConv::CompleteAbbreviatedURL(const PRUnichar * aInString, PRInt32 aInLength,
| |
− | +mozTXTToHTMLConv::CompleteAbbreviatedURL(const PRUnichar * aInString, PRInt32 aInLength,
| |
− | const PRUint32 pos, nsString& aOutString)
| |
− | {
| |
− | NS_ASSERTION(pos < aInLength, "bad args to CompleteAbbreviatedURL, see bug #190851");
| |
− | if (pos >= aInLength)
| |
− | return;
| |
− |
| |
− | if (aInString[pos] == '@')
| |
− | {
| |
− | // only pre-pend a mailto url if the string contains a .domain in it..
| |
− | //i.e. we want to linkify johndoe@foo.com but not "let's meet @8pm"
| |
− | nsDependentString inString(aInString, aInLength);
| |
− | - if (inString.FindChar('.', pos) != kNotFound) // if we have a '.' after the @ sign....
| |
− | + if (inString.FindChar('.', pos) != kNotFound && (inString.Find("..", 0) == kNotFound)) { // if we have a '.' after the @ sign.... and make sure there is no double '.' anywhere
| |
− | {
| |
− | aOutString.AssignLiteral("mailto:");
| |
− | aOutString += aInString;
| |
− | }
| |
− | }
| |
− | else if (aInString[pos] == '.')
| |
− | {
| |
− | if (ItMatchesDelimited(aInString, aInLength,
| |
− | NS_LITERAL_STRING("www.").get(), 4, LT_IGNORE, LT_IGNORE))
| |
− | {
| |
− | aOutString.AssignLiteral("http://");
| |
− | aOutString += aInString;
| |
− | }
| |
− | else if (ItMatchesDelimited(aInString,aInLength, NS_LITERAL_STRING("ftp.").get(), 4, LT_IGNORE, LT_IGNORE))
| |
− | - {
| |
− | + {
| |
− | aOutString.AssignLiteral("ftp://");
| |
− | aOutString += aInString;
| |
− | }
| |
− | }
| |
− | }
| |
− |
| |
− | PRBool
| |
− | mozTXTToHTMLConv::FindURLStart(const PRUnichar * aInString, PRInt32 aInLength,
| |
− | @@ -360,17 +360,17 @@ mozTXTToHTMLConv::FindURLEnd(const PRUni
| |
− | return PR_FALSE;
| |
− | }
| |
− | default:
| |
− | return PR_FALSE;
| |
− | } //switch
| |
− | }
| |
− |
| |
− | void
| |
− | -mozTXTToHTMLConv::CalculateURLBoundaries(const PRUnichar * aInString, PRInt32 aInStringLength, | |
− | +mozTXTToHTMLConv::CalculateURLBoundaries(const PRUnichar * aInString, PRInt32 aInStringLength,
| |
− | const PRUint32 pos, const PRUint32 whathasbeendone,
| |
− | const modetype check, const PRUint32 start, const PRUint32 end,
| |
− | nsString& txtURL, nsString& desc,
| |
− | PRInt32& replaceBefore, PRInt32& replaceAfter)
| |
− | {
| |
− | PRUint32 descstart = start;
| |
− | switch(check)
| |
− | {
| |
− | @@ -385,17 +385,17 @@ mozTXTToHTMLConv::CalculateURLBoundaries
| |
− | descstart = start - 1;
| |
− | desc.Append(&aInString[descstart], end - descstart + 2); // include brackets
| |
− | replaceAfter = end - pos + 1;
| |
− | } break;
| |
− | case freetext:
| |
− | case abbreviated:
| |
− | {
| |
− | descstart = start;
| |
− | - desc.Append(&aInString[descstart], end - start + 1); // don't include brackets | |
− | + desc.Append(&aInString[descstart], end - start + 1); // don't include brackets
| |
− | replaceAfter = end - pos;
| |
− | } break;
| |
− | default: break;
| |
− | } //switch
| |
− |
| |
− | EscapeStr(desc);
| |
− |
| |
− | txtURL.Append(&aInString[start], end - start + 1);
| |
− | @@ -414,17 +414,17 @@ PRBool mozTXTToHTMLConv::ShouldLinkify(c
| |
− | return PR_FALSE;
| |
− |
| |
− | nsCAutoString scheme;
| |
− | nsresult rv = mIOService->ExtractScheme(aURL, scheme);
| |
− | if(NS_FAILED(rv))
| |
− | return PR_FALSE;
| |
− |
| |
− | // Get the handler for this scheme.
| |
− | - nsCOMPtr<nsIProtocolHandler> handler;
| |
− | + nsCOMPtr<nsIProtocolHandler> handler;
| |
− | rv = mIOService->GetProtocolHandler(scheme.get(), getter_AddRefs(handler));
| |
− | if(NS_FAILED(rv))
| |
− | return PR_FALSE;
| |
− |
| |
− | // Is it an external protocol handler? If not, linkify it.
| |
− | nsCOMPtr<nsIExternalProtocolHandler> externalHandler = do_QueryInterface(handler, &rv);
| |
− | if (!externalHandler)
| |
− | return PR_TRUE; // handler is built-in, linkify it!
| |
− | @@ -440,17 +440,17 @@ mozTXTToHTMLConv::CheckURLAndCreateHTML(
| |
− | const nsString& txtURL, const nsString& desc, const modetype mode,
| |
− | nsString& outputHTML)
| |
− | {
| |
− | // Create *uri from txtURL
| |
− | nsCOMPtr<nsIURI> uri;
| |
− | nsresult rv = NS_OK;
| |
− | if (!mIOService)
| |
− | mIOService = do_GetService(kIOServiceCID, &rv);
| |
− | -
| |
− | +
| |
− | if (NS_FAILED(rv) || !mIOService)
| |
− | return PR_FALSE;
| |
− |
| |
− | // See if the url should be linkified.
| |
− | NS_ConvertUTF16toUTF8 utf8URL(txtURL);
| |
− | if (!ShouldLinkify(utf8URL))
| |
− | return PR_FALSE;
| |
− |
| |
− | @@ -639,17 +639,17 @@ mozTXTToHTMLConv::ItMatchesDelimited(con
| |
− | nsCaseInsensitiveStringComparator())
| |
− | )
| |
− | return PR_FALSE;
| |
− |
| |
− | return PR_TRUE;
| |
− | }
| |
− |
| |
− | PRUint32
| |
− | -mozTXTToHTMLConv::NumberOfMatches(const PRUnichar * aInString, PRInt32 aInStringLength,
| |
− | +mozTXTToHTMLConv::NumberOfMatches(const PRUnichar * aInString, PRInt32 aInStringLength,
| |
− | const PRUnichar* rep, PRInt32 aRepLen, LIMTYPE before, LIMTYPE after)
| |
− | {
| |
− | PRUint32 result = 0;
| |
− |
| |
− | for (PRInt32 i = 0; i < aInStringLength; i++)
| |
− | {
| |
− | const PRUnichar * indexIntoString = &aInString[i];
| |
− | if (ItMatchesDelimited(indexIntoString, aInStringLength - i, rep, aRepLen, before, after))
| |
− | @@ -658,17 +658,17 @@ mozTXTToHTMLConv::NumberOfMatches(const
| |
− | return result;
| |
− | }
| |
− |
| |
− |
| |
− | // NOTE: the converted html for the phrase is appended to aOutString
| |
− | // tagHTML and attributeHTML are plain ASCII (literal strings, in fact)
| |
− | PRBool
| |
− | mozTXTToHTMLConv::StructPhraseHit(const PRUnichar * aInString, PRInt32 aInStringLength, PRBool col0,
| |
− | - const PRUnichar* tagTXT, PRInt32 aTagTXTLen,
| |
− | + const PRUnichar* tagTXT, PRInt32 aTagTXTLen,
| |
− | const char* tagHTML, const char* attributeHTML,
| |
− | nsString& aOutString, PRUint32& openTags)
| |
− | {
| |
− | /* We're searching for the following pattern:
| |
− | LT_DELIMITER - "*" - ALPHA -
| |
− | [ some text (maybe more "*"-pairs) - ALPHA ] "*" - LT_DELIMITER.
| |
− | <strong> is only inserted, if existance of a pair could be verified
| |
− | We use the first opening/closing tag, if we can choose */
| |
− | @@ -679,19 +679,19 @@ mozTXTToHTMLConv::StructPhraseHit(const
| |
− | {
| |
− | newOffset = &aInString[1];
| |
− | newLength = aInStringLength - 1;
| |
− | }
| |
− |
| |
− | // opening tag
| |
− | if
| |
− | (
| |
− | - ItMatchesDelimited(aInString, aInStringLength, tagTXT, aTagTXTLen,
| |
− | + ItMatchesDelimited(aInString, aInStringLength, tagTXT, aTagTXTLen,
| |
− | (col0 ? LT_IGNORE : LT_DELIMITER), LT_ALPHA) // is opening tag
| |
− | - && NumberOfMatches(newOffset, newLength, tagTXT, aTagTXTLen,
| |
− | + && NumberOfMatches(newOffset, newLength, tagTXT, aTagTXTLen,
| |
− | LT_ALPHA, LT_DELIMITER) // remaining closing tags
| |
− | > openTags
| |
− | )
| |
− | {
| |
− | openTags++;
| |
− | aOutString.AppendLiteral("<");
| |
− | aOutString.AppendASCII(tagHTML);
| |
− | aOutString.Append(PRUnichar(' '));
| |
− | @@ -723,17 +723,17 @@ PRBool
| |
− | mozTXTToHTMLConv::SmilyHit(const PRUnichar * aInString, PRInt32 aLength, PRBool col0,
| |
− | const char* tagTXT, const char* imageName,
| |
− | nsString& outputHTML, PRInt32& glyphTextLen)
| |
− | {
| |
− | if ( !aInString || !tagTXT || !imageName )
| |
− | return PR_FALSE;
| |
− |
| |
− | PRInt32 tagLen = nsCRT::strlen(tagTXT);
| |
− | -
| |
− | +
| |
− | PRUint32 delim = (col0 ? 0 : 1) + tagLen;
| |
− |
| |
− | if
| |
− | (
| |
− | (col0 || IsSpace(aInString[0]))
| |
− | &&
| |
− | (
| |
− | aLength <= PRInt32(delim) ||
| |
− | @@ -746,47 +746,47 @@ mozTXTToHTMLConv::SmilyHit(const PRUnich
| |
− | aInString[delim] == ';' ||
| |
− | aInString[delim] == '8' ||
| |
− | aInString[delim] == '>' ||
| |
− | aInString[delim] == '!' ||
| |
− | aInString[delim] == '?'
| |
− | )
| |
− | && IsSpace(aInString[delim + 1])
| |
− | )
| |
− | - && ItMatchesDelimited(aInString, aLength, NS_ConvertASCIItoUTF16(tagTXT).get(), tagLen,
| |
− | + && ItMatchesDelimited(aInString, aLength, NS_ConvertASCIItoUTF16(tagTXT).get(), tagLen,
| |
− | col0 ? LT_IGNORE : LT_DELIMITER, LT_IGNORE)
| |
− | // Note: tests at different pos for LT_IGNORE and LT_DELIMITER
| |
− | )
| |
− | {
| |
− | if (!col0)
| |
− | {
| |
− | outputHTML.Truncate();
| |
− | outputHTML.Append(PRUnichar(' '));
| |
− | }
| |
− |
| |
− | outputHTML.AppendLiteral("<span class=\""); // <span class="
| |
− | AppendASCIItoUTF16(imageName, outputHTML); // e.g. smiley-frown
| |
− | - outputHTML.AppendLiteral("\" title=\""); // " title=" | |
− | + outputHTML.AppendLiteral("\" title=\""); // " title="
| |
− | AppendASCIItoUTF16(tagTXT, outputHTML); // smiley tooltip
| |
− | - outputHTML.AppendLiteral("\"><span>"); // "><span> | |
− | - AppendASCIItoUTF16(tagTXT, outputHTML); // original text | |
− | + outputHTML.AppendLiteral("\"><span>"); // "><span>
| |
− | + AppendASCIItoUTF16(tagTXT, outputHTML); // original text
| |
− | outputHTML.AppendLiteral("</span></span>"); // </span></span>
| |
− | glyphTextLen = (col0 ? 0 : 1) + tagLen;
| |
− | return PR_TRUE;
| |
− | }
| |
− |
| |
− | return PR_FALSE;
| |
− | }
| |
− |
| |
− | // the glyph is appended to aOutputString instead of the original string...
| |
− | PRBool
| |
− | mozTXTToHTMLConv::GlyphHit(const PRUnichar * aInString, PRInt32 aInLength, PRBool col0,
| |
− | nsString& aOutputString, PRInt32& glyphTextLen)
| |
− | {
| |
− | - PRUnichar text0 = aInString[0];
| |
− | + PRUnichar text0 = aInString[0];
| |
− | PRUnichar text1 = aInString[1];
| |
− | PRUnichar firstChar = (col0 ? text0 : text1);
| |
− |
| |
− | // temporary variable used to store the glyph html text
| |
− | nsAutoString outputHTML;
| |
− | PRBool bTestSmilie;
| |
− | PRBool bArg;
| |
− | int i;
| |
− | @@ -813,116 +813,116 @@ mozTXTToHTMLConv::GlyphHit(const PRUnich
| |
− | bTestSmilie = PR_TRUE;
| |
− | bArg = PR_FALSE;
| |
− | }
| |
− | if ( bTestSmilie && (
| |
− | SmilyHit(aInString, aInLength, bArg,
| |
− | ":-)",
| |
− | "moz-smiley-s1", // smile
| |
− | outputHTML, glyphTextLen) ||
| |
− | -
| |
− | + | |
− | SmilyHit(aInString, aInLength, bArg,
| |
− | ":)",
| |
− | "moz-smiley-s1", // smile
| |
− | outputHTML, glyphTextLen) ||
| |
− | -
| |
− | + | |
− | SmilyHit(aInString, aInLength, bArg,
| |
− | ":-D",
| |
− | "moz-smiley-s5", // laughing
| |
− | outputHTML, glyphTextLen) ||
| |
− | -
| |
− | +
| |
− | SmilyHit(aInString, aInLength, bArg,
| |
− | ":-(",
| |
− | "moz-smiley-s2", // frown
| |
− | outputHTML, glyphTextLen) ||
| |
− | -
| |
− | +
| |
− | SmilyHit(aInString, aInLength, bArg,
| |
− | ":(",
| |
− | "moz-smiley-s2", // frown
| |
− | outputHTML, glyphTextLen) ||
| |
− | -
| |
− | +
| |
− | SmilyHit(aInString, aInLength, bArg,
| |
− | ":-[",
| |
− | "moz-smiley-s6", // embarassed
| |
− | outputHTML, glyphTextLen) ||
| |
− | -
| |
− | +
| |
− | SmilyHit(aInString, aInLength, bArg,
| |
− | ";-)",
| |
− | "moz-smiley-s3", // wink
| |
− | outputHTML, glyphTextLen) ||
| |
− |
| |
− | SmilyHit(aInString, aInLength, col0,
| |
− | ";)",
| |
− | "moz-smiley-s3", // wink
| |
− | outputHTML, glyphTextLen) ||
| |
− | -
| |
− | +
| |
− | SmilyHit(aInString, aInLength, bArg,
| |
− | ":-\\",
| |
− | "moz-smiley-s7", // undecided
| |
− | outputHTML, glyphTextLen) ||
| |
− | -
| |
− | +
| |
− | SmilyHit(aInString, aInLength, bArg,
| |
− | ":-P",
| |
− | "moz-smiley-s4", // tongue
| |
− | outputHTML, glyphTextLen) ||
| |
− | -
| |
− | +
| |
− | SmilyHit(aInString, aInLength, bArg,
| |
− | ";-P",
| |
− | "moz-smiley-s4", // tongue
| |
− | - outputHTML, glyphTextLen) ||
| |
− | -
| |
− | + outputHTML, glyphTextLen) ||
| |
− | +
| |
− | SmilyHit(aInString, aInLength, bArg,
| |
− | "=-O",
| |
− | "moz-smiley-s8", // surprise
| |
− | outputHTML, glyphTextLen) ||
| |
− | -
| |
− | +
| |
− | SmilyHit(aInString, aInLength, bArg,
| |
− | ":-*",
| |
− | "moz-smiley-s9", // kiss
| |
− | outputHTML, glyphTextLen) ||
| |
− | -
| |
− | +
| |
− | SmilyHit(aInString, aInLength, bArg,
| |
− | ">:o",
| |
− | "moz-smiley-s10", // yell
| |
− | outputHTML, glyphTextLen) ||
| |
− | -
| |
− | +
| |
− | SmilyHit(aInString, aInLength, bArg,
| |
− | ">:-o",
| |
− | "moz-smiley-s10", // yell
| |
− | outputHTML, glyphTextLen) ||
| |
− | -
| |
− | +
| |
− | SmilyHit(aInString, aInLength, bArg,
| |
− | "8-)",
| |
− | "moz-smiley-s11", // cool
| |
− | outputHTML, glyphTextLen) ||
| |
− | - | |
− | +
| |
− | SmilyHit(aInString, aInLength, bArg,
| |
− | ":-$",
| |
− | "moz-smiley-s12", // money
| |
− | outputHTML, glyphTextLen) ||
| |
− | - | |
− | +
| |
− | SmilyHit(aInString, aInLength, bArg,
| |
− | ":-!",
| |
− | "moz-smiley-s13", // foot
| |
− | outputHTML, glyphTextLen) ||
| |
− | -
| |
− | +
| |
− | SmilyHit(aInString, aInLength, bArg,
| |
− | "O:-)",
| |
− | "moz-smiley-s14", // innocent
| |
− | outputHTML, glyphTextLen) ||
| |
− | -
| |
− | +
| |
− | SmilyHit(aInString, aInLength, bArg,
| |
− | ":'(",
| |
− | "moz-smiley-s15", // cry
| |
− | outputHTML, glyphTextLen) ||
| |
− | -
| |
− | +
| |
− | SmilyHit(aInString, aInLength, bArg,
| |
− | ":-X",
| |
− | "moz-smiley-s16", // sealed
| |
− | - outputHTML, glyphTextLen)
| |
− | + outputHTML, glyphTextLen)
| |
− | )
| |
− | )
| |
− | {
| |
− | aOutputString.Append(outputHTML);
| |
− | return PR_TRUE;
| |
− | }
| |
− | i++;
| |
− | }
| |
− | @@ -949,37 +949,37 @@ mozTXTToHTMLConv::GlyphHit(const PRUnich
| |
− | aOutputString.AppendLiteral("±");
| |
− | glyphTextLen = 3;
| |
− | return PR_TRUE;
| |
− | }
| |
− | }
| |
− |
| |
− | // x^2 => x<sup>2</sup>, also handle powers x^-2, x^0.5
| |
− | // implement regular expression /[\dA-Za-z\)\]}]\^-?\d+(\.\d+)*[^\dA-Za-z]/
| |
− | - if
| |
− | + if
| |
− | (
| |
− | text1 == '^'
| |
− | - &&
| |
− | + &&
| |
− | (
| |
− | - nsCRT::IsAsciiDigit(text0) || nsCRT::IsAsciiAlpha(text0) ||
| |
− | + nsCRT::IsAsciiDigit(text0) || nsCRT::IsAsciiAlpha(text0) ||
| |
− | text0 == ')' || text0 == ']' || text0 == '}'
| |
− | )
| |
− | &&
| |
− | (
| |
− | 2 < aInLength && nsCRT::IsAsciiDigit(aInString[2]) ||
| |
− | 3 < aInLength && aInString[2] == '-' && nsCRT::IsAsciiDigit(aInString[3])
| |
− | )
| |
− | )
| |
− | {
| |
− | // Find first non-digit
| |
− | PRInt32 delimPos = 3; // skip "^" and first digit (or '-')
| |
− | for (; delimPos < aInLength
| |
− | &&
| |
− | (
| |
− | - nsCRT::IsAsciiDigit(aInString[delimPos]) ||
| |
− | + nsCRT::IsAsciiDigit(aInString[delimPos]) ||
| |
− | aInString[delimPos] == '.' && delimPos + 1 < aInLength &&
| |
− | nsCRT::IsAsciiDigit(aInString[delimPos + 1])
| |
− | );
| |
− | delimPos++)
| |
− | ;
| |
− |
| |
− | if (delimPos < aInLength && nsCRT::IsAsciiAlpha(aInString[delimPos]))
| |
− | {
| |
− | @@ -1016,17 +1016,17 @@ mozTXTToHTMLConv::GlyphHit(const PRUnich
| |
− | /***************************************************************************
| |
− | Library-internal Interface
| |
− | ****************************************************************************/
| |
− |
| |
− | mozTXTToHTMLConv::mozTXTToHTMLConv()
| |
− | {
| |
− | }
| |
− |
| |
− | -mozTXTToHTMLConv::~mozTXTToHTMLConv() | |
− | +mozTXTToHTMLConv::~mozTXTToHTMLConv()
| |
− | {
| |
− | }
| |
− |
| |
− | NS_IMPL_ISUPPORTS1(mozTXTToHTMLConv, mozITXTToHTMLConv)
| |
− |
| |
− | PRInt32
| |
− | mozTXTToHTMLConv::CiteLevelTXT(const PRUnichar *line,
| |
− | PRUint32& logLineStart)
| |
− | @@ -1214,17 +1214,17 @@ mozTXTToHTMLConv::ScanTXT(const PRUnicha
| |
− | i++;
| |
− | break;
| |
− | }
| |
− | }
| |
− | }
| |
− |
| |
− | void
| |
− | mozTXTToHTMLConv::ScanHTML(nsString& aInString, PRUint32 whattodo, nsString &aOutString)
| |
− | -{ | |
− | +{
| |
− | // some common variables we were recalculating
| |
− | // every time inside the for loop...
| |
− | PRInt32 lengthOfInString = aInString.Length();
| |
− | const PRUnichar * uniBuffer = aInString.get();
| |
− |
| |
− | #ifdef DEBUG_BenB_Perf
| |
− | PRTime parsing_start = PR_IntervalNow();
| |
− | #endif
| |
− | @@ -1269,18 +1269,18 @@ mozTXTToHTMLConv::ScanHTML(nsString& aIn
| |
− | aOutString.Append(&uniBuffer[start], PRUint32(i) - start);
| |
− | }
| |
− | else
| |
− | {
| |
− | PRUint32 start = PRUint32(i);
| |
− | i = aInString.FindChar('<', i);
| |
− | if (i == kNotFound)
| |
− | i = lengthOfInString;
| |
− | -
| |
− | - nsString tempString;
| |
− | +
| |
− | + nsString tempString;
| |
− | tempString.SetCapacity(PRUint32((PRUint32(i) - start) * growthRate));
| |
− | UnescapeStr(uniBuffer, start, PRUint32(i) - start, tempString);
| |
− | ScanTXT(tempString.get(), tempString.Length(), whattodo, aOutString);
| |
− | }
| |
− | }
| |
− |
| |
− | #ifdef DEBUG_BenB_Perf
| |
− | printf("ScanHTML time: %d ms\n", PR_IntervalToMilliseconds(PR_IntervalNow() - parsing_start));
| |
− | </pre>
| |
| == IRC Commands == | | == IRC Commands == |
| * /join #channel <join chann> | | * /join #channel <join chann> |