Because the previous effort #350 grew too fast and there was a LOT of side effects to

my changes, I'm starting over with this. Comments in the PR thread.

This commit reduces the size of attrdict.c while causing only a single errout
regression that is justified.
This commit is contained in:
Jim Derry 2016-02-12 19:34:19 +08:00
parent fbde392af3
commit 429703dce4
5 changed files with 2779 additions and 13085 deletions

View file

@ -212,6 +212,7 @@ typedef enum
TidyAnchorAsName, /**< Define anchors as name attributes */ TidyAnchorAsName, /**< Define anchors as name attributes */
TidyPPrintTabs, /**< Indent using tabs istead of spaces */ TidyPPrintTabs, /**< Indent using tabs istead of spaces */
TidySkipNested, /**< Skip nested tags in script and style CDATA */ TidySkipNested, /**< Skip nested tags in script and style CDATA */
TidyStrictTagsAttr, /**< Ensure tags and attributes match output HTML version */
N_TIDY_OPTIONS /**< Must be last */ N_TIDY_OPTIONS /**< Must be last */
} TidyOptionId; } TidyOptionId;
@ -522,6 +523,7 @@ typedef enum
TidyAttr_ADD_DATE, /**< ADD_DATE= */ TidyAttr_ADD_DATE, /**< ADD_DATE= */
TidyAttr_ALIGN, /**< ALIGN= */ TidyAttr_ALIGN, /**< ALIGN= */
TidyAttr_ALINK, /**< ALINK= */ TidyAttr_ALINK, /**< ALINK= */
TidyAttr_ALLOWFULLSCREEN, /**< ALLOWFULLSCREEN= */
TidyAttr_ALT, /**< ALT= */ TidyAttr_ALT, /**< ALT= */
TidyAttr_ARCHIVE, /**< ARCHIVE= */ TidyAttr_ARCHIVE, /**< ARCHIVE= */
TidyAttr_AXIS, /**< AXIS= */ TidyAttr_AXIS, /**< AXIS= */
@ -662,6 +664,7 @@ typedef enum
TidyAttr_TEXT, /**< TEXT= */ TidyAttr_TEXT, /**< TEXT= */
TidyAttr_TITLE, /**< TITLE= */ TidyAttr_TITLE, /**< TITLE= */
TidyAttr_TOPMARGIN, /**< TOPMARGIN= */ TidyAttr_TOPMARGIN, /**< TOPMARGIN= */
TidyAttr_TRANSLATE, /**< TRANSLATE= */
TidyAttr_TYPE, /**< TYPE= */ TidyAttr_TYPE, /**< TYPE= */
TidyAttr_USEMAP, /**< USEMAP= */ TidyAttr_USEMAP, /**< USEMAP= */
TidyAttr_VALIGN, /**< VALIGN= */ TidyAttr_VALIGN, /**< VALIGN= */

File diff suppressed because it is too large Load diff

View file

@ -105,6 +105,7 @@ static const Attribute attribute_defs [] =
{ TidyAttr_ADD_DATE, "add_date", CH_PCDATA }, /* A */ { TidyAttr_ADD_DATE, "add_date", CH_PCDATA }, /* A */
{ TidyAttr_ALIGN, "align", CH_ALIGN }, /* varies by element */ { 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_ALT, "alt", CH_PCDATA }, /* nowrap */
{ TidyAttr_ARCHIVE, "archive", CH_URLS }, /* space or comma separated list */ { TidyAttr_ARCHIVE, "archive", CH_URLS }, /* space or comma separated list */
{ TidyAttr_AXIS, "axis", CH_PCDATA }, { TidyAttr_AXIS, "axis", CH_PCDATA },
@ -245,6 +246,7 @@ static const Attribute attribute_defs [] =
{ TidyAttr_TEXT, "text", CH_COLOR }, /* BODY */ { TidyAttr_TEXT, "text", CH_COLOR }, /* BODY */
{ TidyAttr_TITLE, "title", CH_PCDATA }, /* text tool tip */ { TidyAttr_TITLE, "title", CH_PCDATA }, /* text tool tip */
{ TidyAttr_TOPMARGIN, "topmargin", CH_NUMBER }, /* used on BODY */ { TidyAttr_TOPMARGIN, "topmargin", CH_NUMBER }, /* used on BODY */
{ TidyAttr_TRANSLATE, "translate", CH_BOOL }, /* HTML5 global attribute */
{ TidyAttr_TYPE, "type", CH_TYPE }, /* also used by SPACER */ { TidyAttr_TYPE, "type", CH_TYPE }, /* also used by SPACER */
{ TidyAttr_USEMAP, "usemap", CH_URL }, /* things with images */ { TidyAttr_USEMAP, "usemap", CH_URL }, /* things with images */
{ TidyAttr_VALIGN, "valign", CH_VALIGN }, { TidyAttr_VALIGN, "valign", CH_VALIGN },
@ -338,7 +340,7 @@ static const Attribute attribute_defs [] =
{ TidyAttr_OnPOPSTATE, "onpopstate", CH_PCDATA }, { TidyAttr_OnPOPSTATE, "onpopstate", CH_PCDATA },
{ TidyAttr_OnPROGRESS, "onprogress", CH_PCDATA }, { TidyAttr_OnPROGRESS, "onprogress", CH_PCDATA },
{ TidyAttr_OnRATECHANGE, "onratechange", CH_PCDATA }, { TidyAttr_OnRATECHANGE, "onratechange", CH_PCDATA },
{ TidyAttr_OnREADYSTATECHANGE,"onreadystatechange", CH_PCDATA }, { TidyAttr_OnREADYSTATECHANGE, "onreadystatechange", CH_PCDATA },
{ TidyAttr_OnREDO, "onredo", CH_PCDATA }, { TidyAttr_OnREDO, "onredo", CH_PCDATA },
{ TidyAttr_OnRESIZE, "onresize", CH_PCDATA }, { TidyAttr_OnRESIZE, "onresize", CH_PCDATA },
{ TidyAttr_OnSCROLL, "onscroll", CH_PCDATA }, { TidyAttr_OnSCROLL, "onscroll", CH_PCDATA },
@ -505,7 +507,9 @@ uint TY_(NodeAttributeVersions)( Node* node, TidyAttrId id )
} }
/* returns true if the element is a W3C defined element */ /* returns true if the element is a W3C defined element */
/* but the element/attribute combination is not */ /* but the element/attribute combination is not. We're */
/* only defining as "proprietary" items that are not in */
/* the element's AttrVersion structure. */
static Bool AttributeIsProprietary(Node* node, AttVal* attval) static Bool AttributeIsProprietary(Node* node, AttVal* attval)
{ {
if (!node || !attval) if (!node || !attval)

View file

@ -322,6 +322,7 @@ static const TidyOptionImpl option_defs[] =
{ TidyAnchorAsName, MU, "anchor-as-name", BL, yes, ParseBool, boolPicks }, { TidyAnchorAsName, MU, "anchor-as-name", BL, yes, ParseBool, boolPicks },
{ TidyPPrintTabs, PP, "indent-with-tabs", BL, no, ParseTabs, boolPicks }, /* 20150515 - Issue #108 */ { TidyPPrintTabs, PP, "indent-with-tabs", BL, no, ParseTabs, boolPicks }, /* 20150515 - Issue #108 */
{ TidySkipNested, MU, "skip-nested", BL, yes, ParseBool, boolPicks }, /* 1642186 - Issue #65 */ { TidySkipNested, MU, "skip-nested", BL, yes, ParseBool, boolPicks }, /* 1642186 - Issue #65 */
{ TidyStrictTagsAttr, MU, "strict-tags-attributes", BL, yes, ParseBool, boolPicks }, /* 20160209 - Issue #350 */
{ N_TIDY_OPTIONS, XX, NULL, XY, 0, NULL, NULL } { N_TIDY_OPTIONS, XX, NULL, XY, 0, NULL, NULL }
}; };

View file

@ -1,2 +1,2 @@
5.1.36 5.1.36_attr_phase1
2016.02.01 2016.02.12