Example #1
0
void CheckHTML( TidyDocImpl* doc, Node *node )
{
    AttVal *attval;
    AttVal *xmlns;

    xmlns = GetAttrByName(node, "xmlns");

    if ( xmlns != null && tmbstrcmp(xmlns->value, XHTML_NAMESPACE) == 0 )
    {
        Bool htmlOut = cfgBool( doc, TidyHtmlOut );
        doc->lexer->isvoyager = yes;                  /* Unless plain HTML */
        SetOptionBool( doc, TidyXhtmlOut, !htmlOut ); /* is specified, output*/
        SetOptionBool( doc, TidyXmlOut, !htmlOut );   /* will be XHTML. */

        /* adjust other config options, just as in config.c */
        if ( !htmlOut )
        {
            SetOptionBool( doc, TidyUpperCaseTags, no );
            SetOptionBool( doc, TidyUpperCaseAttrs, no );
        }
    }

    for (attval = node->attributes; attval != null; attval = attval->next)
    {
        CheckAttribute( doc, node, attval );
    }
}
Example #2
0
static const Dict* lookup( TidyTagImpl* tags, ctmbstr s )
{
    Dict *np = null;
    if ( s )
    {
        const Dict *np = tag_defs + 1;  /* Skip Unknown */
        for ( /**/; np < tag_defs + N_TIDY_TAGS; ++np )
            if ( tmbstrcmp(s, np->name) == 0 )
                return np;

        for ( np = tags->declared_tag_list; np; np = np->next )
            if ( tmbstrcmp(s, np->name) == 0 )
                return np;
    }
    return null;
}
Example #3
0
Bool tmbsamefile( ctmbstr filename1, ctmbstr filename2 )
{
#if FILENAMES_CASE_SENSITIVE
    return ( tmbstrcmp( filename1, filename2 ) == 0 );
#else
    return ( tmbstrcasecmp( filename1, filename2 ) == 0 );
#endif
}
Example #4
0
/* Pure static implementation.  Trades off lookup speed
** for faster setup time (well, none actually).
** Optimization of comparing 1st character buys enough
** speed that hash doesn't improve things without > 500
** items in list.
*/
static const entity* lookup( ctmbstr s )
{
    tmbchar ch = (tmbchar)( s ? *s : 0 );
    const entity *np;
    for ( np = entities; ch && np && np->name; ++np )
        if ( ch == *np->name && tmbstrcmp(s, np->name) == 0 )
            return np;
    return NULL;
}
Example #5
0
/* add missing type attribute when appropriate */
void CheckLINK( TidyDocImpl* doc, Node *node )
{
    AttVal *rel = GetAttrByName( node, "rel" );

    CheckAttributes( doc, node );

    if ( rel && rel->value &&
         tmbstrcmp(rel->value, "stylesheet") == 0 )
    {
        AttVal *type = GetAttrByName(node, "type");
        if (!type)
        {
            AddAttribute( doc, node, "type", "text/css" );
            type = GetAttrByName( node, "type" );
            ReportAttrError( doc, node, type, INSERTING_ATTRIBUTE );
        }
    }
}