Add TY_(nodeIsAutonomousCustomTag), so we can use it elsewhere.
This commit is contained in:
parent
8273491e16
commit
ed5a1d84ea
57
src/tags.c
57
src/tags.c
|
@ -546,9 +546,8 @@ void show_have_html5(void)
|
||||||
/* public interface for finding tag by name */
|
/* public interface for finding tag by name */
|
||||||
Bool TY_(FindTag)( TidyDocImpl* doc, Node *node )
|
Bool TY_(FindTag)( TidyDocImpl* doc, Node *node )
|
||||||
{
|
{
|
||||||
TidyUseCustomTagsState configtype = cfg( doc, TidyUseCustomTags );
|
|
||||||
|
|
||||||
const Dict *np = NULL;
|
const Dict *np = NULL;
|
||||||
|
|
||||||
if ( cfgBool(doc, TidyXmlTags) )
|
if ( cfgBool(doc, TidyXmlTags) )
|
||||||
{
|
{
|
||||||
node->tag = doc->tags.xml_tags;
|
node->tag = doc->tags.xml_tags;
|
||||||
|
@ -562,30 +561,25 @@ Bool TY_(FindTag)( TidyDocImpl* doc, Node *node )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add anonymous custom tag */
|
/* Add anonymous custom tag */
|
||||||
if ( node->element && configtype != TidyCustomNo )
|
if ( TY_(nodeIsAutonomousCustomTag)( doc, node) )
|
||||||
{
|
{
|
||||||
const char *ptr = strchr(node->element, '-');
|
TidyUseCustomTagsState configtype = cfg( doc, TidyUseCustomTags );
|
||||||
|
UserTagType type;
|
||||||
|
|
||||||
/* Tag must contain hyphen not in first character. */
|
if ( configtype == TidyCustomEmpty )
|
||||||
if ( ptr && (ptr - node->element > 0) )
|
type = tagtype_empty;
|
||||||
{
|
else if ( configtype == TidyCustomInline )
|
||||||
UserTagType type;
|
type = tagtype_inline;
|
||||||
|
else if ( configtype == TidyCustomPre )
|
||||||
|
type = tagtype_pre;
|
||||||
|
else
|
||||||
|
type = tagtype_block;
|
||||||
|
|
||||||
if ( configtype == TidyCustomEmpty )
|
TY_(DeclareUserTag)( doc, TidyCustomTags, type, node->element );
|
||||||
type = tagtype_empty;
|
node->tag = tagsLookup(doc, &doc->tags, node->element);
|
||||||
else if ( configtype == TidyCustomInline )
|
TY_(ReportNotice)(doc, node, node, CUSTOM_TAG_DETECTED);
|
||||||
type = tagtype_inline;
|
|
||||||
else if ( configtype == TidyCustomPre )
|
|
||||||
type = tagtype_pre;
|
|
||||||
else
|
|
||||||
type = tagtype_block;
|
|
||||||
|
|
||||||
TY_(DeclareUserTag)( doc, TidyCustomTags, type, node->element );
|
return yes;
|
||||||
node->tag = tagsLookup(doc, &doc->tags, node->element);
|
|
||||||
TY_(ReportNotice)(doc, node, node, CUSTOM_TAG_DETECTED);
|
|
||||||
|
|
||||||
return yes;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return no;
|
return no;
|
||||||
|
@ -1049,6 +1043,25 @@ Bool nodeMatchCM( Node* node, uint contentModel )
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* True if the node looks like it's an autonomous custom element tag.
|
||||||
|
*/
|
||||||
|
Bool TY_(nodeIsAutonomousCustomTag)( TidyDocImpl* doc, Node* node )
|
||||||
|
{
|
||||||
|
if ( node->element && cfg( doc, TidyUseCustomTags ) != TidyCustomNo )
|
||||||
|
{
|
||||||
|
const char *ptr = strchr(node->element, '-');
|
||||||
|
|
||||||
|
/* Tag must contain hyphen not in first character. */
|
||||||
|
if ( ptr && (ptr - node->element > 0) )
|
||||||
|
{
|
||||||
|
return yes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return no;
|
||||||
|
}
|
||||||
|
|
||||||
/* True if any of the bits requested are set.
|
/* True if any of the bits requested are set.
|
||||||
*/
|
*/
|
||||||
Bool TY_(nodeHasCM)( Node* node, uint contentModel )
|
Bool TY_(nodeHasCM)( Node* node, uint contentModel )
|
||||||
|
|
|
@ -133,6 +133,11 @@ Bool TY_(nodeHasText)( TidyDocImpl* doc, Node* node );
|
||||||
Bool nodeMatchCM( Node* node, uint contentModel );
|
Bool nodeMatchCM( Node* node, uint contentModel );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* True if the node looks like it's an autonomous custom element tag.
|
||||||
|
*/
|
||||||
|
Bool TY_(nodeIsAutonomousCustomTag)( TidyDocImpl* doc, Node* node );
|
||||||
|
|
||||||
/* True if any of the bits requested are set.
|
/* True if any of the bits requested are set.
|
||||||
*/
|
*/
|
||||||
Bool TY_(nodeHasCM)( Node* node, uint contentModel );
|
Bool TY_(nodeHasCM)( Node* node, uint contentModel );
|
||||||
|
|
Loading…
Reference in a new issue