Merge pull request #293 from htacg/revert-292-master

Revert 22a1922c35
This commit is contained in:
Geoff McLane 2015-11-07 14:50:59 +01:00
commit 1e399913ab
3 changed files with 0 additions and 146 deletions

View file

@ -802,16 +802,6 @@ typedef enum
/* MathML <math> attributes */
TidyAttr_DISPLAY, /**< DISPLAY= (html5) */
/* RDFa global attributes */
TidyAttr_ABOUT, /**< ABOUT= */
TidyAttr_DATATYPE, /**< DATATYPE= */
TidyAttr_INLIST, /**< INLIST= */
TidyAttr_PREFIX, /**< PREFIX= */
TidyAttr_PROPERTY, /**< PROPERTY= */
TidyAttr_RESOURCE, /**< RESOURCE= */
TidyAttr_TYPEOF, /**< TYPEOF= */
TidyAttr_VOCAB, /**< VOCAB= */
N_TIDY_ATTRIBS /**< Must be last */
} TidyAttrId;

View file

@ -47,9 +47,6 @@ static AttrCheck CheckScroll;
static AttrCheck CheckTextDir;
static AttrCheck CheckLang;
static AttrCheck CheckType;
static AttrCheck CheckRDFaSafeCURIE;
static AttrCheck CheckRDFaTerm;
static AttrCheck CheckRDFaPrefix;
#define CH_PCDATA NULL
#define CH_CHARSET NULL
@ -88,11 +85,6 @@ static AttrCheck CheckRDFaPrefix;
#define CH_TARGET CheckTarget
#define CH_VTYPE CheckVType
#define CH_ACTION CheckAction
#define CH_RDFAPREFIX CheckRDFaPrefix
#define CH_RDFASCURIE CheckRDFaSafeCURIE
#define CH_RDFASCURIES CheckRDFaSafeCURIE
#define CH_RDFATERM CheckRDFaTerm
#define CH_RDFATERMS CheckRDFaTerm
static const Attribute attribute_defs [] =
{
@ -425,16 +417,6 @@ static const Attribute attribute_defs [] =
#endif
{ TidyAttr_DISPLAY, "display", CH_PCDATA }, /* on MATH tag (html5) */
/* RDFa Attributes */
{ TidyAttr_ABOUT, "about", CH_RDFASCURIE },
{ TidyAttr_DATATYPE, "datatype", CH_RDFATERM },
{ TidyAttr_INLIST, "inlist", CH_BOOL },
{ TidyAttr_PREFIX, "prefix", CH_RDFAPREFIX },
{ TidyAttr_PROPERTY, "property", CH_RDFATERMS },
{ TidyAttr_RESOURCE, "resource", CH_RDFASCURIE },
{ TidyAttr_TYPEOF, "typeof", CH_RDFATERMS },
{ TidyAttr_VOCAB, "vocab", CH_URL },
/* this must be the final entry */
{ N_TIDY_ATTRIBS, NULL, NULL }
};
@ -450,32 +432,6 @@ static uint AttributeVersions(Node* node, AttVal* attval)
return (XH50 | HT50);
if (strcmp(attval->attribute,"allowfullscreen") == 0)
return (XH50 | HT50);
/* RDFa global attributes */
if (strcmp(attval->attribute,"about") == 0)
return (XH50 | HT50);
if (strcmp(attval->attribute,"datatype") == 0)
return (XH50 | HT50);
if (strcmp(attval->attribute,"inlist") == 0)
return (XH50 | HT50);
if (strcmp(attval->attribute,"prefix") == 0)
return (XH50 | HT50);
if (strcmp(attval->attribute,"property") == 0)
return (XH50 | HT50);
if (strcmp(attval->attribute,"resource") == 0)
return (XH50 | HT50);
if (strcmp(attval->attribute,"typeof") == 0)
return (XH50 | HT50);
if (strcmp(attval->attribute,"vocab") == 0)
return (XH50 | HT50);
/* Override the settings on these attributes because
* they are allowed everywhere by RDFa */
if (strcmp(attval->attribute,"content") == 0)
return (XH50 | HT50);
if (strcmp(attval->attribute,"rel") == 0)
return (XH50 | HT50);
if (strcmp(attval->attribute,"rev") == 0)
return (XH50 | HT50);
}
/* TODO: maybe this should return VERS_PROPRIETARY instead? */
if (!attval || !attval->dict)
@ -2197,97 +2153,6 @@ AttVal *SortAttVal( AttVal *list, TidyAttrSortStrategy strat)
}
}
/* RDFA support checkers
*
*/
/* CheckRDFAPrefix - ensure the prefix attribute value is
* correct
*
* @prefix takes prefix value pairs in the form:
*
* NCName ':' ' '+ AnyURI
*/
void CheckRDFaPrefix ( TidyDocImpl* doc, Node *node, AttVal *attval)
{
if (!AttrHasValue(attval))
{
TY_(ReportAttrError)( doc, node, attval, MISSING_ATTR_VALUE);
return;
}
/* Copy the attribute value so we can split it */
if (attval->value) {
uint prefixCount = 0;
/* isPrefix toggles - start at 1 and change to 0 as we
* iterate over the components of the value */
uint isPrefix = 1;
/* Copy it over */
uint len = TY_(tmbstrlen)(attval->value);
tmbstr s = (tmbstr) TidyDocAlloc( doc, len );
s[0] = '\0';
TY_(tmbstrcpy)( s, attval->value );
/* iterate over value */
tmbstr tPtr = s;
tmbstr t;
while ( ( t = strtok(tPtr, " ") ) != NULL ) {
tPtr = NULL;
if (isPrefix) {
/* this piece should be a prefix */
/* prefix rules are that it can have any
* character except a colon - that one must be
* at the end */
tmbstr i = index(t, ':') ;
if (i == NULL) {
/* no colon - bad! */
TY_(ReportAttrError)( doc, node, attval, BAD_ATTRIBUTE_VALUE);
} else if (i != ( t + TY_(tmbstrlen)(t) - 1) ) {
/* not at the end - also bad */
TY_(ReportAttrError)( doc, node, attval, BAD_ATTRIBUTE_VALUE);
}
} else {
/* this piece should be a URL */
prefixCount ++;
}
isPrefix = !isPrefix;
}
TidyDocFree( doc, s ) ;
}
}
/* CheckRDFaTerm - are terms valid
*
*/
void CheckRDFaTerm ( TidyDocImpl* doc, Node *node, AttVal *attval)
{
if (!AttrHasValue(attval))
{
TY_(ReportAttrError)( doc, node, attval, MISSING_ATTR_VALUE);
return;
}
}
/* CheckRDFaSafeCURIE - is a CURIE legal
*
*/
void CheckRDFaSafeCURIE ( TidyDocImpl* doc, Node *node, AttVal *attval)
{
if (!AttrHasValue(attval))
{
TY_(ReportAttrError)( doc, node, attval, MISSING_ATTR_VALUE);
return;
}
}
/*
* local variables:
* mode: c

View file

@ -12,7 +12,6 @@
/* declaration for methods that check attribute values */
typedef void (AttrCheck)(TidyDocImpl* doc, Node *node, AttVal *attval);
typedef void (AttrCheckEx)(TidyDocImpl* doc, Node *node, AttVal *attval, uint limit);
struct _Attribute
{