|
|
@ -96,43 +96,43 @@ static AttrCheck CheckRDFaPrefix; |
|
|
|
|
|
|
|
static const Attribute attribute_defs [] = |
|
|
|
{ |
|
|
|
{ TidyAttr_UNKNOWN, "unknown!", NULL }, |
|
|
|
{ TidyAttr_ABBR, "abbr", CH_PCDATA }, |
|
|
|
{ TidyAttr_ACCEPT, "accept", CH_XTYPE }, |
|
|
|
{ TidyAttr_ACCEPT_CHARSET, "accept-charset", CH_CHARSET }, |
|
|
|
{ TidyAttr_ACCESSKEY, "accesskey", CH_CHARACTER }, |
|
|
|
{ TidyAttr_ACTION, "action", CH_ACTION }, |
|
|
|
{ TidyAttr_UNKNOWN, "unknown!", NULL }, |
|
|
|
{ TidyAttr_ABBR, "abbr", CH_PCDATA }, |
|
|
|
{ TidyAttr_ACCEPT, "accept", CH_XTYPE }, |
|
|
|
{ TidyAttr_ACCEPT_CHARSET, "accept-charset", CH_CHARSET }, |
|
|
|
{ TidyAttr_ACCESSKEY, "accesskey", CH_CHARACTER }, |
|
|
|
{ TidyAttr_ACTION, "action", CH_ACTION }, |
|
|
|
{ TidyAttr_ADD_DATE, "add_date", CH_PCDATA }, /* A */ |
|
|
|
{ TidyAttr_ALIGN, "align", CH_ALIGN }, /* varies by element */ |
|
|
|
{ TidyAttr_ALINK, "alink", CH_COLOR }, |
|
|
|
{ TidyAttr_ALINK, "alink", CH_COLOR }, |
|
|
|
{ TidyAttr_ALLOWFULLSCREEN, "allowfullscreen", CH_BOOL }, |
|
|
|
{ TidyAttr_ALT, "alt", CH_PCDATA }, /* nowrap */ |
|
|
|
{ TidyAttr_ARCHIVE, "archive", CH_URLS }, /* space or comma separated list */ |
|
|
|
{ TidyAttr_AXIS, "axis", CH_PCDATA }, |
|
|
|
{ TidyAttr_BACKGROUND, "background", CH_URL }, |
|
|
|
{ TidyAttr_BGCOLOR, "bgcolor", CH_COLOR }, |
|
|
|
{ TidyAttr_AXIS, "axis", CH_PCDATA }, |
|
|
|
{ TidyAttr_BACKGROUND, "background", CH_URL }, |
|
|
|
{ TidyAttr_BGCOLOR, "bgcolor", CH_COLOR }, |
|
|
|
{ TidyAttr_BGPROPERTIES, "bgproperties", CH_PCDATA }, /* BODY "fixed" fixes background */ |
|
|
|
{ TidyAttr_BORDER, "border", CH_BORDER }, /* like LENGTH + "border" */ |
|
|
|
{ TidyAttr_BORDERCOLOR, "bordercolor", CH_COLOR }, /* used on TABLE */ |
|
|
|
{ TidyAttr_BOTTOMMARGIN, "bottommargin", CH_NUMBER }, /* used on BODY */ |
|
|
|
{ TidyAttr_CELLPADDING, "cellpadding", CH_LENGTH }, /* % or pixel values */ |
|
|
|
{ TidyAttr_CELLSPACING, "cellspacing", CH_LENGTH }, |
|
|
|
{ TidyAttr_CHAR, "char", CH_CHARACTER }, |
|
|
|
{ TidyAttr_CHAROFF, "charoff", CH_LENGTH }, |
|
|
|
{ TidyAttr_CHARSET, "charset", CH_CHARSET }, |
|
|
|
{ TidyAttr_CELLSPACING, "cellspacing", CH_LENGTH }, |
|
|
|
{ TidyAttr_CHAR, "char", CH_CHARACTER }, |
|
|
|
{ TidyAttr_CHAROFF, "charoff", CH_LENGTH }, |
|
|
|
{ TidyAttr_CHARSET, "charset", CH_CHARSET }, |
|
|
|
{ TidyAttr_CHECKED, "checked", CH_BOOL }, /* i.e. "checked" or absent */ |
|
|
|
{ TidyAttr_CITE, "cite", CH_URL }, |
|
|
|
{ TidyAttr_CLASS, "class", CH_PCDATA }, |
|
|
|
{ TidyAttr_CLASSID, "classid", CH_URL }, |
|
|
|
{ TidyAttr_CITE, "cite", CH_URL }, |
|
|
|
{ TidyAttr_CLASS, "class", CH_PCDATA }, |
|
|
|
{ TidyAttr_CLASSID, "classid", CH_URL }, |
|
|
|
{ TidyAttr_CLEAR, "clear", CH_CLEAR }, /* BR: left, right, all */ |
|
|
|
{ TidyAttr_CODE, "code", CH_PCDATA }, /* APPLET */ |
|
|
|
{ TidyAttr_CODEBASE, "codebase", CH_URL }, /* OBJECT */ |
|
|
|
{ TidyAttr_CODETYPE, "codetype", CH_XTYPE }, /* OBJECT */ |
|
|
|
{ TidyAttr_COLOR, "color", CH_COLOR }, /* BASEFONT, FONT */ |
|
|
|
{ TidyAttr_COLS, "cols", CH_COLS }, /* TABLE & FRAMESET */ |
|
|
|
{ TidyAttr_COLSPAN, "colspan", CH_NUMBER }, |
|
|
|
{ TidyAttr_COLSPAN, "colspan", CH_NUMBER }, |
|
|
|
{ TidyAttr_COMPACT, "compact", CH_BOOL }, /* lists */ |
|
|
|
{ TidyAttr_CONTENT, "content", CH_PCDATA }, |
|
|
|
{ TidyAttr_CONTENT, "content", CH_PCDATA }, |
|
|
|
{ TidyAttr_COORDS, "coords", CH_COORDS }, /* AREA, A */ |
|
|
|
{ TidyAttr_DATA, "data", CH_URL }, /* OBJECT */ |
|
|
|
{ TidyAttr_DATAFLD, "datafld", CH_PCDATA }, /* used on DIV, IMG */ |
|
|
@ -150,7 +150,7 @@ static const Attribute attribute_defs [] = |
|
|
|
{ TidyAttr_FOR, "for", CH_IDREF }, /* LABEL */ |
|
|
|
{ TidyAttr_FRAME, "frame", CH_TFRAME }, /* TABLE */ |
|
|
|
{ TidyAttr_FRAMEBORDER, "frameborder", CH_FBORDER }, /* 0 or 1 */ |
|
|
|
{ TidyAttr_FRAMESPACING, "framespacing", CH_NUMBER }, |
|
|
|
{ TidyAttr_FRAMESPACING, "framespacing", CH_NUMBER }, |
|
|
|
{ TidyAttr_GRIDX, "gridx", CH_NUMBER }, /* TABLE Adobe golive*/ |
|
|
|
{ TidyAttr_GRIDY, "gridy", CH_NUMBER }, /* TABLE Adobe golive */ |
|
|
|
{ TidyAttr_HEADERS, "headers", CH_IDREFS }, /* table cells */ |
|
|
@ -159,7 +159,7 @@ static const Attribute attribute_defs [] = |
|
|
|
{ TidyAttr_HREFLANG, "hreflang", CH_LANG }, /* A, LINK */ |
|
|
|
{ TidyAttr_HSPACE, "hspace", CH_NUMBER }, /* APPLET, IMG, OBJECT */ |
|
|
|
{ TidyAttr_HTTP_EQUIV, "http-equiv", CH_PCDATA }, /* META */ |
|
|
|
{ TidyAttr_ID, "id", CH_IDDEF }, |
|
|
|
{ TidyAttr_ID, "id", CH_IDDEF }, |
|
|
|
{ TidyAttr_ISMAP, "ismap", CH_BOOL }, /* IMG */ |
|
|
|
{ TidyAttr_ITEMID, "itemid", CH_PCDATA }, |
|
|
|
{ TidyAttr_ITEMPROP, "itemprop", CH_PCDATA }, |
|
|
@ -167,7 +167,7 @@ static const Attribute attribute_defs [] = |
|
|
|
{ TidyAttr_ITEMSCOPE, "itemscope", CH_BOOL }, |
|
|
|
{ TidyAttr_ITEMTYPE, "itemtype", CH_URL }, |
|
|
|
{ TidyAttr_LABEL, "label", CH_PCDATA }, /* OPT, OPTGROUP */ |
|
|
|
{ TidyAttr_LANG, "lang", CH_LANG }, |
|
|
|
{ TidyAttr_LANG, "lang", CH_LANG }, |
|
|
|
{ TidyAttr_LANGUAGE, "language", CH_PCDATA }, /* SCRIPT */ |
|
|
|
{ TidyAttr_LAST_MODIFIED, "last_modified", CH_PCDATA }, /* A */ |
|
|
|
{ TidyAttr_LAST_VISIT, "last_visit", CH_PCDATA }, /* A */ |
|
|
@ -181,21 +181,21 @@ static const Attribute attribute_defs [] = |
|
|
|
{ TidyAttr_MEDIA, "media", CH_MEDIA }, /* STYLE, LINK */ |
|
|
|
{ TidyAttr_METHOD, "method", CH_FSUBMIT }, /* FORM: get or post */ |
|
|
|
{ TidyAttr_MULTIPLE, "multiple", CH_BOOL }, /* SELECT */ |
|
|
|
{ TidyAttr_NAME, "name", CH_NAME }, |
|
|
|
{ TidyAttr_NAME, "name", CH_NAME }, |
|
|
|
{ TidyAttr_NOHREF, "nohref", CH_BOOL }, /* AREA */ |
|
|
|
{ TidyAttr_NORESIZE, "noresize", CH_BOOL }, /* FRAME */ |
|
|
|
{ TidyAttr_NOSHADE, "noshade", CH_BOOL }, /* HR */ |
|
|
|
{ TidyAttr_NOWRAP, "nowrap", CH_BOOL }, /* table cells */ |
|
|
|
{ TidyAttr_OBJECT, "object", CH_PCDATA }, /* APPLET */ |
|
|
|
{ TidyAttr_OnAFTERUPDATE, "onafterupdate", CH_SCRIPT }, |
|
|
|
{ TidyAttr_OnBEFOREUNLOAD, "onbeforeunload", CH_SCRIPT }, |
|
|
|
{ TidyAttr_OnBEFOREUPDATE, "onbeforeupdate", CH_SCRIPT }, |
|
|
|
{ TidyAttr_OnAFTERUPDATE, "onafterupdate", CH_SCRIPT }, |
|
|
|
{ TidyAttr_OnBEFOREUNLOAD, "onbeforeunload", CH_SCRIPT }, |
|
|
|
{ TidyAttr_OnBEFOREUPDATE, "onbeforeupdate", CH_SCRIPT }, |
|
|
|
{ TidyAttr_OnBLUR, "onblur", CH_SCRIPT }, /* event */ |
|
|
|
{ TidyAttr_OnCHANGE, "onchange", CH_SCRIPT }, /* event */ |
|
|
|
{ TidyAttr_OnCLICK, "onclick", CH_SCRIPT }, /* event */ |
|
|
|
{ TidyAttr_OnDATAAVAILABLE, "ondataavailable", CH_SCRIPT }, /* object, applet */ |
|
|
|
{ TidyAttr_OnDATASETCHANGED, "ondatasetchanged", CH_SCRIPT }, /* object, applet */ |
|
|
|
{ TidyAttr_OnDATASETCOMPLETE, "ondatasetcomplete", CH_SCRIPT }, |
|
|
|
{ TidyAttr_OnDATASETCOMPLETE, "ondatasetcomplete", CH_SCRIPT }, |
|
|
|
{ TidyAttr_OnDBLCLICK, "ondblclick", CH_SCRIPT }, /* event */ |
|
|
|
{ TidyAttr_OnERRORUPDATE, "onerrorupdate", CH_SCRIPT }, /* form fields */ |
|
|
|
{ TidyAttr_OnFOCUS, "onfocus", CH_SCRIPT }, /* event */ |
|
|
@ -218,8 +218,8 @@ static const Attribute attribute_defs [] = |
|
|
|
{ TidyAttr_PROMPT, "prompt", CH_PCDATA }, /* ISINDEX */ |
|
|
|
{ TidyAttr_RBSPAN, "rbspan", CH_NUMBER }, /* ruby markup */ |
|
|
|
{ TidyAttr_READONLY, "readonly", CH_BOOL }, /* form fields */ |
|
|
|
{ TidyAttr_REL, "rel", CH_LINKTYPES }, |
|
|
|
{ TidyAttr_REV, "rev", CH_LINKTYPES }, |
|
|
|
{ TidyAttr_REL, "rel", CH_LINKTYPES }, |
|
|
|
{ TidyAttr_REV, "rev", CH_LINKTYPES }, |
|
|
|
{ TidyAttr_RIGHTMARGIN, "rightmargin", CH_NUMBER }, /* used on BODY */ |
|
|
|
{ TidyAttr_ROLE, "role", CH_PCDATA }, |
|
|
|
{ TidyAttr_ROWS, "rows", CH_NUMBER }, /* TEXTAREA */ |
|
|
@ -227,7 +227,7 @@ static const Attribute attribute_defs [] = |
|
|
|
{ TidyAttr_RULES, "rules", CH_TRULES }, /* TABLE */ |
|
|
|
{ TidyAttr_SCHEME, "scheme", CH_PCDATA }, /* META */ |
|
|
|
{ TidyAttr_SCOPE, "scope", CH_SCOPE }, /* table cells */ |
|
|
|
{ TidyAttr_SCROLLING, "scrolling", CH_SCROLL }, /* yes, no or auto */ |
|
|
|
{ TidyAttr_SCROLLING, "scrolling", CH_SCROLL }, /* aye, no or auto */ |
|
|
|
{ TidyAttr_SELECTED, "selected", CH_BOOL }, /* OPTION */ |
|
|
|
{ TidyAttr_SHAPE, "shape", CH_SHAPE }, /* AREA, A */ |
|
|
|
{ TidyAttr_SHOWGRID, "showgrid", CH_BOOL }, /* TABLE Adobe golive */ |
|
|
@ -239,7 +239,7 @@ static const Attribute attribute_defs [] = |
|
|
|
{ TidyAttr_SRCSET, "srcset", CH_PCDATA }, /* IMG (HTML5) */ |
|
|
|
{ TidyAttr_STANDBY, "standby", CH_PCDATA }, /* OBJECT */ |
|
|
|
{ TidyAttr_START, "start", CH_NUMBER }, /* OL */ |
|
|
|
{ TidyAttr_STYLE, "style", CH_PCDATA }, |
|
|
|
{ TidyAttr_STYLE, "style", CH_PCDATA }, |
|
|
|
{ TidyAttr_SUMMARY, "summary", CH_PCDATA }, /* TABLE */ |
|
|
|
{ TidyAttr_TABINDEX, "tabindex", CH_NUMBER }, /* fields, OBJECT and A */ |
|
|
|
{ TidyAttr_TARGET, "target", CH_TARGET }, /* names a frame/window */ |
|
|
@ -249,8 +249,8 @@ static const Attribute attribute_defs [] = |
|
|
|
{ TidyAttr_TRANSLATE, "translate", CH_BOOL }, /* HTML5 global attribute */ |
|
|
|
{ TidyAttr_TYPE, "type", CH_TYPE }, /* also used by SPACER */ |
|
|
|
{ TidyAttr_USEMAP, "usemap", CH_URL }, /* things with images */ |
|
|
|
{ TidyAttr_VALIGN, "valign", CH_VALIGN }, |
|
|
|
{ TidyAttr_VALUE, "value", CH_PCDATA }, |
|
|
|
{ TidyAttr_VALIGN, "valign", CH_VALIGN }, |
|
|
|
{ TidyAttr_VALUE, "value", CH_PCDATA }, |
|
|
|
{ TidyAttr_VALUETYPE, "valuetype", CH_VTYPE }, /* PARAM: data, ref, object */ |
|
|
|
{ TidyAttr_VERSION, "version", CH_PCDATA }, /* HTML <?xml?> */ |
|
|
|
{ TidyAttr_VLINK, "vlink", CH_COLOR }, /* BODY */ |
|
|
@ -501,7 +501,7 @@ Bool TY_(AttributeIsProprietary)(Node* node, AttVal* attval) |
|
|
|
if (AttributeVersions(node, attval) & VERS_ALL) |
|
|
|
return no; |
|
|
|
|
|
|
|
return yes; |
|
|
|
return aye; |
|
|
|
} |
|
|
|
|
|
|
|
/* returns true if the element is a W3C defined element
|
|
|
@ -513,13 +513,13 @@ Bool TY_(AttributeIsProprietary)(Node* node, AttVal* attval) |
|
|
|
Bool TY_(AttributeIsMismatched)(Node* node, AttVal* attval, TidyDocImpl* doc) |
|
|
|
{ |
|
|
|
uint doctype; |
|
|
|
|
|
|
|
|
|
|
|
if (!node || !attval) |
|
|
|
return no; |
|
|
|
|
|
|
|
|
|
|
|
if (!node->tag) |
|
|
|
return no; |
|
|
|
|
|
|
|
|
|
|
|
if (!(node->tag->versions & VERS_ALL)) |
|
|
|
return no; |
|
|
|
|
|
|
@ -527,8 +527,8 @@ Bool TY_(AttributeIsMismatched)(Node* node, AttVal* attval, TidyDocImpl* doc) |
|
|
|
|
|
|
|
if (AttributeVersions(node, attval) & doctype) |
|
|
|
return no; |
|
|
|
|
|
|
|
return yes; |
|
|
|
|
|
|
|
return aye; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -770,7 +770,7 @@ static void attrsRemoveFromHash( TidyDocImpl* doc, TidyAttribImpl *attribs, |
|
|
|
{ |
|
|
|
AttrHash* next = p->next; |
|
|
|
if ( prev ) |
|
|
|
prev->next = next; |
|
|
|
prev->next = next; |
|
|
|
else |
|
|
|
attribs->hashtab[h] = next; |
|
|
|
TidyDocFree(doc, p); |
|
|
@ -877,7 +877,7 @@ void TY_(DropAttrByName)( TidyDocImpl* doc, Node *node, ctmbstr name ) |
|
|
|
else |
|
|
|
node->attributes = next; |
|
|
|
|
|
|
|
TY_(FreeAttribute)( doc, attr ); |
|
|
|
TY_(FreeAttribute)( doc, attr ); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
@ -955,7 +955,7 @@ Bool TY_(IsAnchorElement)( TidyDocImpl* ARG_UNUSED(doc), Node* node) |
|
|
|
tid == TidyTag_IFRAME || |
|
|
|
tid == TidyTag_IMG || |
|
|
|
tid == TidyTag_MAP ) |
|
|
|
return yes; |
|
|
|
return aye; |
|
|
|
|
|
|
|
return no; |
|
|
|
} |
|
|
@ -976,7 +976,7 @@ Bool TY_(IsAnchorElement)( TidyDocImpl* ARG_UNUSED(doc), Node* node) |
|
|
|
*/ |
|
|
|
Bool TY_(IsCSS1Selector)( ctmbstr buf ) |
|
|
|
{ |
|
|
|
Bool valid = yes; |
|
|
|
Bool valid = aye; |
|
|
|
int esclen = 0; |
|
|
|
byte c; |
|
|
|
int pos; |
|
|
@ -1021,7 +1021,7 @@ static uint anchorNameHash(ctmbstr s) |
|
|
|
{ |
|
|
|
uint hashval = 0; |
|
|
|
/* Issue #149 - an inferred name can be null. avoid crash */ |
|
|
|
if (s) |
|
|
|
if (s) |
|
|
|
{ |
|
|
|
for ( ; *s != '\0'; s++) { |
|
|
|
tmbchar c = TY_(ToLower)( *s ); |
|
|
@ -1040,7 +1040,7 @@ static uint anchorNameHash5(ctmbstr s) |
|
|
|
{ |
|
|
|
uint hashval = 0; |
|
|
|
/* Issue #149 - an inferred name can be null. avoid crash */ |
|
|
|
if (s) |
|
|
|
if (s) |
|
|
|
{ |
|
|
|
for ( ; *s != '\0'; s++) { |
|
|
|
tmbchar c = *s; |
|
|
@ -1051,8 +1051,8 @@ static uint anchorNameHash5(ctmbstr s) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*\
|
|
|
|
* removes anchor for specific node |
|
|
|
/*\
|
|
|
|
* removes anchor for specific node |
|
|
|
* Issue #185 - Treat elements ids as case-sensitive |
|
|
|
* if in HTML5 modes, make hash of value AS IS! |
|
|
|
\*/ |
|
|
@ -1096,7 +1096,7 @@ static Anchor* NewAnchor( TidyDocImpl* doc, ctmbstr name, Node* node ) |
|
|
|
} |
|
|
|
|
|
|
|
/*\
|
|
|
|
* add new anchor to namespace |
|
|
|
* add new anchor to namespace |
|
|
|
* Issue #185 - Treat elements ids as case-sensitive |
|
|
|
* if in HTML5 modes, make hash of value AS IS! |
|
|
|
\*/ |
|
|
@ -1124,7 +1124,7 @@ static Anchor* AddAnchor( TidyDocImpl* doc, ctmbstr name, Node *node ) |
|
|
|
} |
|
|
|
|
|
|
|
/*\
|
|
|
|
* return node associated with anchor |
|
|
|
* return node associated with anchor |
|
|
|
* Issue #185 - Treat elements ids as case-sensitive |
|
|
|
* if in HTML5 modes, make hash of value AS IS! |
|
|
|
\*/ |
|
|
@ -1148,7 +1148,7 @@ static Node* GetNodeByAnchor( TidyDocImpl* doc, ctmbstr name ) |
|
|
|
if ( TY_(tmbstrcmp)(found->name, lname) == 0 ) |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TidyDocFree(doc, lname); |
|
|
|
if ( found ) |
|
|
|
return found->node; |
|
|
@ -1350,7 +1350,7 @@ void TY_(RepairDuplicateAttributes)( TidyDocImpl* doc, Node *node, Bool isXml ) |
|
|
|
temp = first->next; |
|
|
|
TY_(ReportAttrError)( doc, node, first, REPEATED_ATTRIBUTE); |
|
|
|
TY_(RemoveAttribute)( doc, node, first ); |
|
|
|
firstRedefined = yes; |
|
|
|
firstRedefined = aye; |
|
|
|
first = temp; |
|
|
|
second = second->next; |
|
|
|
} |
|
|
@ -1376,16 +1376,16 @@ const Attribute* TY_(CheckAttribute)( TidyDocImpl* doc, Node *node, AttVal *attv |
|
|
|
{ |
|
|
|
if (attrIsXML_LANG(attval) || attrIsXML_SPACE(attval)) |
|
|
|
{ |
|
|
|
doc->lexer->isvoyager = yes; |
|
|
|
doc->lexer->isvoyager = aye; |
|
|
|
if (!cfgBool(doc, TidyHtmlOut)) |
|
|
|
{ |
|
|
|
TY_(SetOptionBool)(doc, TidyXhtmlOut, yes); |
|
|
|
TY_(SetOptionBool)(doc, TidyXmlOut, yes); |
|
|
|
TY_(SetOptionBool)(doc, TidyXhtmlOut, aye); |
|
|
|
TY_(SetOptionBool)(doc, TidyXmlOut, aye); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
TY_(ConstrainVersion)(doc, AttributeVersions(node, attval)); |
|
|
|
|
|
|
|
|
|
|
|
if (attribute->attrchk) |
|
|
|
attribute->attrchk( doc, node, attval ); |
|
|
|
} |
|
|
@ -1397,7 +1397,7 @@ Bool TY_(IsBoolAttribute)(AttVal *attval) |
|
|
|
{ |
|
|
|
const Attribute *attribute = ( attval ? attval->dict : NULL ); |
|
|
|
if ( attribute && attribute->attrchk == CH_BOOL ) |
|
|
|
return yes; |
|
|
|
return aye; |
|
|
|
return no; |
|
|
|
} |
|
|
|
|
|
|
@ -1438,17 +1438,17 @@ static void CheckLowerCaseAttrValue( TidyDocImpl* doc, Node *node, AttVal *attva |
|
|
|
{ |
|
|
|
tmbstr p; |
|
|
|
Bool hasUpper = no; |
|
|
|
|
|
|
|
|
|
|
|
if (!AttrHasValue(attval)) |
|
|
|
return; |
|
|
|
|
|
|
|
p = attval->value; |
|
|
|
|
|
|
|
|
|
|
|
while (*p) |
|
|
|
{ |
|
|
|
if (TY_(IsUpper)(*p)) /* #501230 - fix by Terry Teague - 09 Jan 02 */ |
|
|
|
{ |
|
|
|
hasUpper = yes; |
|
|
|
hasUpper = aye; |
|
|
|
break; |
|
|
|
} |
|
|
|
p++; |
|
|
@ -1459,7 +1459,7 @@ static void CheckLowerCaseAttrValue( TidyDocImpl* doc, Node *node, AttVal *attva |
|
|
|
Lexer* lexer = doc->lexer; |
|
|
|
if (lexer->isvoyager) |
|
|
|
TY_(ReportAttrError)( doc, node, attval, ATTR_VALUE_NOT_LCASE); |
|
|
|
|
|
|
|
|
|
|
|
if ( lexer->isvoyager || cfgBool(doc, TidyLowerLiterals) ) |
|
|
|
attval->value = TY_(tmbstrtolower)(attval->value); |
|
|
|
} |
|
|
@ -1469,13 +1469,13 @@ static void CheckLowerCaseAttrValue( TidyDocImpl* doc, Node *node, AttVal *attva |
|
|
|
|
|
|
|
void TY_(CheckUrl)( TidyDocImpl* doc, Node *node, AttVal *attval) |
|
|
|
{ |
|
|
|
tmbchar c; |
|
|
|
tmbchar c; |
|
|
|
tmbstr dest, p; |
|
|
|
uint escape_count = 0, backslash_count = 0; |
|
|
|
uint i, pos = 0; |
|
|
|
uint len; |
|
|
|
Bool isJavascript = no; |
|
|
|
|
|
|
|
|
|
|
|
if (!AttrHasValue(attval)) |
|
|
|
{ |
|
|
|
TY_(ReportAttrError)( doc, node, attval, MISSING_ATTR_VALUE); |
|
|
@ -1483,7 +1483,7 @@ void TY_(CheckUrl)( TidyDocImpl* doc, Node *node, AttVal *attval) |
|
|
|
} |
|
|
|
|
|
|
|
p = attval->value; |
|
|
|
|
|
|
|
|
|
|
|
isJavascript = |
|
|
|
TY_(tmbstrncmp)(p,"javascript:",sizeof("javascript:")-1)==0; |
|
|
|
|
|
|
@ -1504,7 +1504,7 @@ void TY_(CheckUrl)( TidyDocImpl* doc, Node *node, AttVal *attval) |
|
|
|
Bool hadnonspace = no; |
|
|
|
len = TY_(tmbstrlen)(p) + escape_count * 2 + 1; |
|
|
|
dest = (tmbstr) TidyDocAlloc(doc, len); |
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; 0 != (c = p[i]); ++i) |
|
|
|
{ |
|
|
|
if ((c > 0x7e) || (c <= 0x20) || (strchr("<>", c))) |
|
|
@ -1518,12 +1518,12 @@ void TY_(CheckUrl)( TidyDocImpl* doc, Node *node, AttVal *attval) |
|
|
|
else |
|
|
|
{ |
|
|
|
pos += sprintf( dest + pos, "%%%02X", (byte)c ); |
|
|
|
hadnonspace = yes; |
|
|
|
hadnonspace = aye; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
hadnonspace = yes; |
|
|
|
hadnonspace = aye; |
|
|
|
dest[pos++] = c; |
|
|
|
} |
|
|
|
} |
|
|
@ -1578,7 +1578,7 @@ Bool TY_(IsValidHTMLID)(ctmbstr id) |
|
|
|
if (TY_(IsHTMLSpace)(*s++)) |
|
|
|
return no; |
|
|
|
|
|
|
|
return yes; |
|
|
|
return aye; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
@ -1610,7 +1610,7 @@ Bool TY_(IsValidXMLID)(ctmbstr id) |
|
|
|
return no; |
|
|
|
} |
|
|
|
|
|
|
|
return yes; |
|
|
|
return aye; |
|
|
|
} |
|
|
|
|
|
|
|
static Bool IsValidNMTOKEN(ctmbstr name) |
|
|
@ -1634,15 +1634,15 @@ static Bool IsValidNMTOKEN(ctmbstr name) |
|
|
|
return no; |
|
|
|
} |
|
|
|
|
|
|
|
return yes; |
|
|
|
return aye; |
|
|
|
} |
|
|
|
|
|
|
|
static Bool AttrValueIsAmong(AttVal *attval, ctmbstr const list[]) |
|
|
|
{ |
|
|
|
const ctmbstr *v; |
|
|
|
const ctmbstr *v; |
|
|
|
for (v = list; *v; ++v) |
|
|
|
if (AttrValueIs(attval, *v)) |
|
|
|
return yes; |
|
|
|
return aye; |
|
|
|
return no; |
|
|
|
} |
|
|
|
|
|
|
@ -1789,7 +1789,7 @@ void CheckValign( TidyDocImpl* doc, Node *node, AttVal *attval) |
|
|
|
void CheckLength( TidyDocImpl* doc, Node *node, AttVal *attval) |
|
|
|
{ |
|
|
|
tmbstr p; |
|
|
|
|
|
|
|
|
|
|
|
if (!AttrHasValue(attval)) |
|
|
|
{ |
|
|
|
TY_(ReportAttrError)( doc, node, attval, MISSING_ATTR_VALUE); |
|
|
@ -1801,7 +1801,7 @@ void CheckLength( TidyDocImpl* doc, Node *node, AttVal *attval) |
|
|
|
return; |
|
|
|
|
|
|
|
p = attval->value; |
|
|
|
|
|
|
|
|
|
|
|
if (!TY_(IsDigit)(*p++)) |
|
|
|
{ |
|
|
|
TY_(ReportAttrError)( doc, node, attval, BAD_ATTRIBUTE_VALUE); |
|
|
@ -1858,7 +1858,7 @@ void CheckClear( TidyDocImpl* doc, Node *node, AttVal *attval) |
|
|
|
} |
|
|
|
|
|
|
|
CheckLowerCaseAttrValue( doc, node, attval ); |
|
|
|
|
|
|
|
|
|
|
|
if (!AttrValueIsAmong(attval, values)) |
|
|
|
TY_(ReportAttrError)( doc, node, attval, BAD_ATTRIBUTE_VALUE); |
|
|
|
} |
|
|
@ -1878,7 +1878,7 @@ void CheckScope( TidyDocImpl* doc, Node *node, AttVal *attval) |
|
|
|
void CheckNumber( TidyDocImpl* doc, Node *node, AttVal *attval) |
|
|
|
{ |
|
|
|
tmbstr p; |
|
|
|
|
|
|
|
|
|
|
|
if (!AttrHasValue(attval)) |
|
|
|
{ |
|
|
|
TY_(ReportAttrError)( doc, node, attval, MISSING_ATTR_VALUE); |
|
|
@ -1891,7 +1891,7 @@ void CheckNumber( TidyDocImpl* doc, Node *node, AttVal *attval) |
|
|
|
return; |
|
|
|
|
|
|
|
p = attval->value; |
|
|
|
|
|
|
|
|
|
|
|
/* font size may be preceded by + or - */ |
|
|
|
if ( nodeIsFONT(node) && (*p == '+' || *p == '-') ) |
|
|
|
++p; |
|
|
@ -1923,7 +1923,7 @@ static Bool IsValidColorCode(ctmbstr color) |
|
|
|
if (!TY_(IsDigit)(color[i]) && !strchr("abcdef", TY_(ToLower)(color[i]))) |
|
|
|
return no; |
|
|
|
|
|
|
|
return yes; |
|
|
|
return aye; |
|
|
|
} |
|
|
|
|
|
|
|
/* check color syntax and beautify value by option */ |
|
|
@ -1993,7 +1993,7 @@ void CheckVType( TidyDocImpl* doc, Node *node, AttVal *attval) |
|
|
|
/* checks scrolling attribute */ |
|
|
|
void CheckScroll( TidyDocImpl* doc, Node *node, AttVal *attval) |
|
|
|
{ |
|
|
|
ctmbstr const values[] = {"no", "auto", "yes", NULL}; |
|
|
|
ctmbstr const values[] = {"no", "auto", "aye", NULL}; |
|
|
|
CheckAttrValidity( doc, node, attval, values ); |
|
|
|
} |
|
|
|
|
|
|
@ -2077,14 +2077,14 @@ void TY_(SortAttributes)(Node* node, TidyAttrSortStrategy strat) |
|
|
|
|
|
|
|
/**
|
|
|
|
* Attribute sorting contributed by Adrian Wilkins, 2007 |
|
|
|
* |
|
|
|
* |
|
|
|
* Portions copyright Simon Tatham 2001. |
|
|
|
* |
|
|
|
* Merge sort algortithm adpated from listsort.c linked from |
|
|
|
* Merge sort algortithm adpated from listsort.c linked from |
|
|
|
* http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html
|
|
|
|
* |
|
|
|
* |
|
|
|
* Original copyright notice proceeds below. |
|
|
|
* |
|
|
|
* |
|
|
|
* Permission is hereby granted, free of charge, to any person |
|
|
|
* obtaining a copy of this software and associated documentation |
|
|
|
* files (the "Software"), to deal in the Software without |
|
|
@ -2093,10 +2093,10 @@ void TY_(SortAttributes)(Node* node, TidyAttrSortStrategy strat) |
|
|
|
* sell copies of the Software, and to permit persons to whom the |
|
|
|
* Software is furnished to do so, subject to the following |
|
|
|
* conditions: |
|
|
|
* |
|
|
|
* |
|
|
|
* The above copyright notice and this permission notice shall be |
|
|
|
* included in all copies or substantial portions of the Software. |
|
|
|
* |
|
|
|
* |
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
|
|
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
|
@ -2221,7 +2221,7 @@ AttVal *SortAttVal( AttVal *list, TidyAttrSortStrategy strat) |
|
|
|
* correct |
|
|
|
* |
|
|
|
* @prefix takes prefix value pairs in the form: |
|
|
|
* |
|
|
|
* |
|
|
|
* NCName ':' ' '+ AnyURI |
|
|
|
*/ |
|
|
|
|
|
|
|