From 32592fa6e1bbcb942538767bab27da2519a1d51a Mon Sep 17 00:00:00 2001 From: "peterl%netscape.com" Date: Fri, 12 Feb 1999 06:17:06 +0000 Subject: [PATCH] changed all html tags to lower case git-svn-id: svn://10.0.0.236/trunk@20541 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/htmlparser/robot/nsRobotSink.cpp | 8 ++-- mozilla/htmlparser/src/nsHTMLTags.cpp | 26 +++++----- mozilla/htmlparser/src/nsHTMLTokens.cpp | 2 - mozilla/htmlparser/tests/htmlgen/htmlgen.cpp | 48 +++++++++---------- .../parser/htmlparser/robot/nsRobotSink.cpp | 8 ++-- mozilla/parser/htmlparser/src/nsHTMLTags.cpp | 26 +++++----- .../parser/htmlparser/src/nsHTMLTokens.cpp | 2 - .../htmlparser/tests/htmlgen/htmlgen.cpp | 48 +++++++++---------- 8 files changed, 82 insertions(+), 86 deletions(-) diff --git a/mozilla/htmlparser/robot/nsRobotSink.cpp b/mozilla/htmlparser/robot/nsRobotSink.cpp index 50de6c0075f..f9074a2afd4 100644 --- a/mozilla/htmlparser/robot/nsRobotSink.cpp +++ b/mozilla/htmlparser/robot/nsRobotSink.cpp @@ -205,8 +205,8 @@ NS_IMETHODIMP RobotSink::CloseFrameset(const nsIParserNode& aNode) NS_IMETHODIMP RobotSink::OpenContainer(const nsIParserNode& aNode) { nsAutoString tmp(aNode.GetText()); - tmp.ToUpperCase(); - if (tmp.Equals("A")) { + tmp.ToLowerCase(); + if (tmp.Equals("a")) { nsAutoString k, v; PRInt32 ac = aNode.GetAttributeCount(); for (PRInt32 i = 0; i < ac; i++) { @@ -214,8 +214,8 @@ NS_IMETHODIMP RobotSink::OpenContainer(const nsIParserNode& aNode) const nsString& key = aNode.GetKeyAt(i); k.Truncate(); k.Append(key); - k.ToUpperCase(); - if (k.Equals("HREF")) { + k.ToLowerCase(); + if (k.Equals("href")) { // Get value and remove mandatory quotes v.Truncate(); v.Append(aNode.GetValueAt(i)); diff --git a/mozilla/htmlparser/src/nsHTMLTags.cpp b/mozilla/htmlparser/src/nsHTMLTags.cpp index cb7f8785b95..bfb9ab3b219 100644 --- a/mozilla/htmlparser/src/nsHTMLTags.cpp +++ b/mozilla/htmlparser/src/nsHTMLTags.cpp @@ -22,19 +22,19 @@ #include "nsHTMLTags.h" static char* tagTable[] = { - "A", "ABBR", "ACRONYM", "ADDRESS", "APPLET", "AREA", "B", "BASE", - "BASEFONT", "BDO", "BGSOUND", "BIG", "BLINK", "BLOCKQUOTE", "BODY", "BR", - "BUTTON", "CAPTION", "CENTER", "CITE", "CODE", "COL", "COLGROUP", "DD", - "DEL", "DFN", "DIR", "DIV", "DL", "DT", "EM", "EMBED", "FIELDSET", "FONT", - "FORM", "FRAME", "FRAMESET", "H1", "H2", "H3", "H4", "H5", "H6", "HEAD", - "HR", "HTML", "I", "IFRAME", "ILAYER", "IMG", "INPUT", "INS", "ISINDEX", - "KBD", "KEYGEN", "LABEL", "LAYER", "LEGEND", "LI", "LINK", "LISTING", - "MAP", "MENU", "META", "MULTICOL", "NOBR", "NOEMBED", "NOFRAMES", - "NOLAYER", "NOSCRIPT", "OBJECT", "OL", "OPTGROUP", "OPTION", "P", "PARAM", - "PLAINTEXT", "PRE", "Q", "S", "SAMP", "SCRIPT", "SELECT", "SERVER", - "SMALL", "SOUND", "SPACER", "SPAN", "STRIKE", "STRONG", "STYLE", "SUB", - "SUP", "TABLE", "TBODY", "TD", "TEXTAREA", "TFOOT", "TH", "THEAD", "TITLE", - "TR", "TT", "U", "UL", "VAR", "WBR", "XMP" + "a", "abbr", "acronym", "address", "applet", "area", "b", "base", + "basefont", "bdo", "bgsound", "big", "blink", "blockquote", "body", "br", + "button", "caption", "center", "cite", "code", "col", "colgroup", "dd", + "del", "dfn", "dir", "div", "dl", "dt", "em", "embed", "fieldset", "font", + "form", "frame", "frameset", "h1", "h2", "h3", "h4", "h5", "h6", "head", + "hr", "html", "i", "iframe", "ilayer", "img", "input", "ins", "isindex", + "kbd", "keygen", "label", "layer", "legend", "li", "link", "listing", + "map", "menu", "meta", "multicol", "nobr", "noembed", "noframes", + "nolayer", "noscript", "object", "ol", "optgroup", "option", "p", "param", + "plaintext", "pre", "q", "s", "samp", "script", "select", "server", + "small", "sound", "spacer", "span", "strike", "strong", "style", "sub", + "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "title", + "tr", "tt", "u", "ul", "var", "wbr", "xmp" }; nsHTMLTag NS_TagToEnum(const char* aTagName) { diff --git a/mozilla/htmlparser/src/nsHTMLTokens.cpp b/mozilla/htmlparser/src/nsHTMLTokens.cpp index 4049728c96d..5d7eaefa84f 100644 --- a/mozilla/htmlparser/src/nsHTMLTokens.cpp +++ b/mozilla/htmlparser/src/nsHTMLTokens.cpp @@ -130,7 +130,6 @@ void CStartToken::Reinitialize(PRInt32 aTag, const nsString& aString){ PRInt32 CStartToken::GetTypeID(){ if(eHTMLTag_unknown==mTypeID) { nsAutoString tmp(mTextValue); - tmp.ToUpperCase(); char cbuf[20]; tmp.ToCString(cbuf, sizeof(cbuf)); mTypeID = NS_TagToEnum(cbuf); @@ -334,7 +333,6 @@ nsresult CEndToken::Consume(PRUnichar aChar, nsScanner& aScanner) { PRInt32 CEndToken::GetTypeID(){ if(eHTMLTag_unknown==mTypeID) { nsAutoString tmp(mTextValue); - tmp.ToUpperCase(); char cbuf[200]; tmp.ToCString(cbuf, sizeof(cbuf)); mTypeID = NS_TagToEnum(cbuf); diff --git a/mozilla/htmlparser/tests/htmlgen/htmlgen.cpp b/mozilla/htmlparser/tests/htmlgen/htmlgen.cpp index a896e9eebc9..7d452b6054d 100644 --- a/mozilla/htmlparser/tests/htmlgen/htmlgen.cpp +++ b/mozilla/htmlparser/tests/htmlgen/htmlgen.cpp @@ -26,27 +26,27 @@ static char* tagTable[] = { - "A", "ABBR", "ACRONYM", "ADDRESS", "APPLET", "AREA", - "B", "BASE", "BASEFONT", "BDO", "BGSOUND", "BIG", "BLINK", "BLOCKQUOTE", "BODY", "BR", "BUTTON", - "CAPTION", "CENTER", "CITE", "CODE", "COL", "COLGROUP", - "DD", "DEL", "DFN", "DIR", "DIV", "DL", "DT", - "EM", "EMBED", - "FIELDSET", "FONT", "FORM", "FRAME", "FRAMESET", - "H1", "H2", "H3", "H4", "H5", "H6", "HEAD", "HR", "HTML", - "I", "IFRAME", "ILAYER", "IMG", "INPUT", "INS", "ISINDEX", - "KBD", "KEYGEN", - "LABEL", "LAYER", "LEGEND", "LI", "LINK", "LISTING", - "MAP", "MENU", "META", "MULTICOL", - "NOBR", "NOEMBED", "NOFRAMES", "NOLAYER", "NOSCRIPT", - "OBJECT", "OL", "OPTGROUP", "OPTION", - "P", "PARAM", "PLAINTEXT", "PRE", - "Q", - "S","SAMP","SCRIPT","SELECT","SERVER","SMALL","SOUND","SPACER","SPAN","STRIKE","STRONG","STYLE","SUB","SUP", - "TABLE", "TBODY", "TD", "TEXTAREA", "TFOOT", "TH", "THEAD", "TITLE", "TR", "TT", - "U", "UL", - "VAR", - "WBR", - "XMP", + "a", "abbr", "acronym", "address", "applet", "area", + "b", "base", "basefont", "bdo", "bgsound", "big", "blink", "blockquote", "body", "br", "button", + "caption", "center", "cite", "code", "col", "colgroup", + "dd", "del", "dfn", "dir", "div", "dl", "dt", + "em", "embed", + "fieldset", "font", "form", "frame", "frameset", + "h1", "h2", "h3", "h4", "h5", "h6", "head", "hr", "html", + "i", "iframe", "ilayer", "img", "input", "ins", "isindex", + "kbd", "keygen", + "label", "layer", "legend", "li", "link", "listing", + "map", "menu", "meta", "multicol", + "nobr", "noembed", "noframes", "nolayer", "noscript", + "object", "ol", "optgroup", "option", + "p", "param", "plaintext", "pre", + "q", + "s","samp","script","select","server","small","sound","spacer","span","strike","strong","style","sub","sup", + "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "title", "tr", "tt", + "u", "ul", + "var", + "wbr", + "xmp", 0 }; static char gCWD[1025]; @@ -83,15 +83,15 @@ int findTag(const char* aTagName) { int findNearestTag(char* aTag){ int result=-1; if(aTag){ - char theChar=toupper(aTag[0]); + char theChar=tolower(aTag[0]); int theIndex=-1; while(tagTable[++theIndex]){ - if(toupper(tagTable[theIndex][0])==theChar) { + if(tolower(tagTable[theIndex][0])==theChar) { return theIndex; } } } - if(toupper(aTag[0])<'A') + if(tolower(aTag[0])<'a') result=0; else result=107; return result; diff --git a/mozilla/parser/htmlparser/robot/nsRobotSink.cpp b/mozilla/parser/htmlparser/robot/nsRobotSink.cpp index 50de6c0075f..f9074a2afd4 100644 --- a/mozilla/parser/htmlparser/robot/nsRobotSink.cpp +++ b/mozilla/parser/htmlparser/robot/nsRobotSink.cpp @@ -205,8 +205,8 @@ NS_IMETHODIMP RobotSink::CloseFrameset(const nsIParserNode& aNode) NS_IMETHODIMP RobotSink::OpenContainer(const nsIParserNode& aNode) { nsAutoString tmp(aNode.GetText()); - tmp.ToUpperCase(); - if (tmp.Equals("A")) { + tmp.ToLowerCase(); + if (tmp.Equals("a")) { nsAutoString k, v; PRInt32 ac = aNode.GetAttributeCount(); for (PRInt32 i = 0; i < ac; i++) { @@ -214,8 +214,8 @@ NS_IMETHODIMP RobotSink::OpenContainer(const nsIParserNode& aNode) const nsString& key = aNode.GetKeyAt(i); k.Truncate(); k.Append(key); - k.ToUpperCase(); - if (k.Equals("HREF")) { + k.ToLowerCase(); + if (k.Equals("href")) { // Get value and remove mandatory quotes v.Truncate(); v.Append(aNode.GetValueAt(i)); diff --git a/mozilla/parser/htmlparser/src/nsHTMLTags.cpp b/mozilla/parser/htmlparser/src/nsHTMLTags.cpp index cb7f8785b95..bfb9ab3b219 100644 --- a/mozilla/parser/htmlparser/src/nsHTMLTags.cpp +++ b/mozilla/parser/htmlparser/src/nsHTMLTags.cpp @@ -22,19 +22,19 @@ #include "nsHTMLTags.h" static char* tagTable[] = { - "A", "ABBR", "ACRONYM", "ADDRESS", "APPLET", "AREA", "B", "BASE", - "BASEFONT", "BDO", "BGSOUND", "BIG", "BLINK", "BLOCKQUOTE", "BODY", "BR", - "BUTTON", "CAPTION", "CENTER", "CITE", "CODE", "COL", "COLGROUP", "DD", - "DEL", "DFN", "DIR", "DIV", "DL", "DT", "EM", "EMBED", "FIELDSET", "FONT", - "FORM", "FRAME", "FRAMESET", "H1", "H2", "H3", "H4", "H5", "H6", "HEAD", - "HR", "HTML", "I", "IFRAME", "ILAYER", "IMG", "INPUT", "INS", "ISINDEX", - "KBD", "KEYGEN", "LABEL", "LAYER", "LEGEND", "LI", "LINK", "LISTING", - "MAP", "MENU", "META", "MULTICOL", "NOBR", "NOEMBED", "NOFRAMES", - "NOLAYER", "NOSCRIPT", "OBJECT", "OL", "OPTGROUP", "OPTION", "P", "PARAM", - "PLAINTEXT", "PRE", "Q", "S", "SAMP", "SCRIPT", "SELECT", "SERVER", - "SMALL", "SOUND", "SPACER", "SPAN", "STRIKE", "STRONG", "STYLE", "SUB", - "SUP", "TABLE", "TBODY", "TD", "TEXTAREA", "TFOOT", "TH", "THEAD", "TITLE", - "TR", "TT", "U", "UL", "VAR", "WBR", "XMP" + "a", "abbr", "acronym", "address", "applet", "area", "b", "base", + "basefont", "bdo", "bgsound", "big", "blink", "blockquote", "body", "br", + "button", "caption", "center", "cite", "code", "col", "colgroup", "dd", + "del", "dfn", "dir", "div", "dl", "dt", "em", "embed", "fieldset", "font", + "form", "frame", "frameset", "h1", "h2", "h3", "h4", "h5", "h6", "head", + "hr", "html", "i", "iframe", "ilayer", "img", "input", "ins", "isindex", + "kbd", "keygen", "label", "layer", "legend", "li", "link", "listing", + "map", "menu", "meta", "multicol", "nobr", "noembed", "noframes", + "nolayer", "noscript", "object", "ol", "optgroup", "option", "p", "param", + "plaintext", "pre", "q", "s", "samp", "script", "select", "server", + "small", "sound", "spacer", "span", "strike", "strong", "style", "sub", + "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "title", + "tr", "tt", "u", "ul", "var", "wbr", "xmp" }; nsHTMLTag NS_TagToEnum(const char* aTagName) { diff --git a/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp b/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp index 4049728c96d..5d7eaefa84f 100644 --- a/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp +++ b/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp @@ -130,7 +130,6 @@ void CStartToken::Reinitialize(PRInt32 aTag, const nsString& aString){ PRInt32 CStartToken::GetTypeID(){ if(eHTMLTag_unknown==mTypeID) { nsAutoString tmp(mTextValue); - tmp.ToUpperCase(); char cbuf[20]; tmp.ToCString(cbuf, sizeof(cbuf)); mTypeID = NS_TagToEnum(cbuf); @@ -334,7 +333,6 @@ nsresult CEndToken::Consume(PRUnichar aChar, nsScanner& aScanner) { PRInt32 CEndToken::GetTypeID(){ if(eHTMLTag_unknown==mTypeID) { nsAutoString tmp(mTextValue); - tmp.ToUpperCase(); char cbuf[200]; tmp.ToCString(cbuf, sizeof(cbuf)); mTypeID = NS_TagToEnum(cbuf); diff --git a/mozilla/parser/htmlparser/tests/htmlgen/htmlgen.cpp b/mozilla/parser/htmlparser/tests/htmlgen/htmlgen.cpp index a896e9eebc9..7d452b6054d 100644 --- a/mozilla/parser/htmlparser/tests/htmlgen/htmlgen.cpp +++ b/mozilla/parser/htmlparser/tests/htmlgen/htmlgen.cpp @@ -26,27 +26,27 @@ static char* tagTable[] = { - "A", "ABBR", "ACRONYM", "ADDRESS", "APPLET", "AREA", - "B", "BASE", "BASEFONT", "BDO", "BGSOUND", "BIG", "BLINK", "BLOCKQUOTE", "BODY", "BR", "BUTTON", - "CAPTION", "CENTER", "CITE", "CODE", "COL", "COLGROUP", - "DD", "DEL", "DFN", "DIR", "DIV", "DL", "DT", - "EM", "EMBED", - "FIELDSET", "FONT", "FORM", "FRAME", "FRAMESET", - "H1", "H2", "H3", "H4", "H5", "H6", "HEAD", "HR", "HTML", - "I", "IFRAME", "ILAYER", "IMG", "INPUT", "INS", "ISINDEX", - "KBD", "KEYGEN", - "LABEL", "LAYER", "LEGEND", "LI", "LINK", "LISTING", - "MAP", "MENU", "META", "MULTICOL", - "NOBR", "NOEMBED", "NOFRAMES", "NOLAYER", "NOSCRIPT", - "OBJECT", "OL", "OPTGROUP", "OPTION", - "P", "PARAM", "PLAINTEXT", "PRE", - "Q", - "S","SAMP","SCRIPT","SELECT","SERVER","SMALL","SOUND","SPACER","SPAN","STRIKE","STRONG","STYLE","SUB","SUP", - "TABLE", "TBODY", "TD", "TEXTAREA", "TFOOT", "TH", "THEAD", "TITLE", "TR", "TT", - "U", "UL", - "VAR", - "WBR", - "XMP", + "a", "abbr", "acronym", "address", "applet", "area", + "b", "base", "basefont", "bdo", "bgsound", "big", "blink", "blockquote", "body", "br", "button", + "caption", "center", "cite", "code", "col", "colgroup", + "dd", "del", "dfn", "dir", "div", "dl", "dt", + "em", "embed", + "fieldset", "font", "form", "frame", "frameset", + "h1", "h2", "h3", "h4", "h5", "h6", "head", "hr", "html", + "i", "iframe", "ilayer", "img", "input", "ins", "isindex", + "kbd", "keygen", + "label", "layer", "legend", "li", "link", "listing", + "map", "menu", "meta", "multicol", + "nobr", "noembed", "noframes", "nolayer", "noscript", + "object", "ol", "optgroup", "option", + "p", "param", "plaintext", "pre", + "q", + "s","samp","script","select","server","small","sound","spacer","span","strike","strong","style","sub","sup", + "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "title", "tr", "tt", + "u", "ul", + "var", + "wbr", + "xmp", 0 }; static char gCWD[1025]; @@ -83,15 +83,15 @@ int findTag(const char* aTagName) { int findNearestTag(char* aTag){ int result=-1; if(aTag){ - char theChar=toupper(aTag[0]); + char theChar=tolower(aTag[0]); int theIndex=-1; while(tagTable[++theIndex]){ - if(toupper(tagTable[theIndex][0])==theChar) { + if(tolower(tagTable[theIndex][0])==theChar) { return theIndex; } } } - if(toupper(aTag[0])<'A') + if(tolower(aTag[0])<'a') result=0; else result=107; return result;