- From: Bjoern Hoehrmann <derhoermi@gmx.net>
- Date: Wed, 7 Jul 1999 23:07:01 +0200
- To: "Bjoern Hoehrmann" <derhoermi@gmx.net>
- Cc: <html-tidy@w3.org>
| I suggest to insert a type="text/css" automatically.
To accomplish that, i copied most of the CheckSCRIPT code. I did the
following:
Added to attrs.c:
void CheckSTYLE(Lexer *lexer, Node *node)
{
Attribute *attribute;
AttVal *attval, *type;
type = null;
for (attval = node->attributes; attval != null; attval = attval->next)
{
attribute = CheckAttribute(lexer, node, attval);
if (attribute == attr_type)
type = attval;
}
if (!type)
{
ReportAttrError(lexer, node, "type", MISSING_ATTRIBUTE);
/* If no type is specified for STYLE, set the type to text/css */
type = (AttVal *)MemAlloc(sizeof(AttVal));
type->attribute = wstrdup("type");
type->value = wstrdup("text/css");
type->next = node->attributes;
type->delim = '"';
type->dict = FindAttribute(type);
node->attributes = type;
}
}
Inserted in line 663 of html.h:
CheckAttribs CheckSTYLE;
and changed line 89 of tags.c to:
"style", (VERS_FROM32|VERS_FRAMES), CM_HEAD, ParseScript,
CheckSTYLE,
I'm not that familiar to C, so there may be better ways to implement the
insertion of text/css, but this works fine at least in my privat version.
regards,
Bjoern Hoehrmann
Received on Wednesday, 7 July 1999 17:30:06 UTC