Add TY_(nodeIsAutonomousCustomTag), so we can use it elsewhere.

This commit is contained in:
Jim Derry 2017-03-14 15:44:46 -04:00
parent 8273491e16
commit ed5a1d84ea
2 changed files with 42 additions and 24 deletions

View file

@ -546,9 +546,8 @@ void show_have_html5(void)
/* public interface for finding tag by name */
Bool TY_(FindTag)( TidyDocImpl* doc, Node *node )
{
TidyUseCustomTagsState configtype = cfg( doc, TidyUseCustomTags );
const Dict *np = NULL;
if ( cfgBool(doc, TidyXmlTags) )
{
node->tag = doc->tags.xml_tags;
@ -562,13 +561,9 @@ Bool TY_(FindTag)( TidyDocImpl* doc, Node *node )
}
/* Add anonymous custom tag */
if ( node->element && configtype != TidyCustomNo )
{
const char *ptr = strchr(node->element, '-');
/* Tag must contain hyphen not in first character. */
if ( ptr && (ptr - node->element > 0) )
if ( TY_(nodeIsAutonomousCustomTag)( doc, node) )
{
TidyUseCustomTagsState configtype = cfg( doc, TidyUseCustomTags );
UserTagType type;
if ( configtype == TidyCustomEmpty )
@ -586,7 +581,6 @@ Bool TY_(FindTag)( TidyDocImpl* doc, Node *node )
return yes;
}
}
return no;
}
@ -1049,6 +1043,25 @@ Bool nodeMatchCM( Node* node, uint contentModel )
}
#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.
*/
Bool TY_(nodeHasCM)( Node* node, uint contentModel )

View file

@ -133,6 +133,11 @@ Bool TY_(nodeHasText)( TidyDocImpl* doc, Node* node );
Bool nodeMatchCM( Node* node, uint contentModel );
#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.
*/
Bool TY_(nodeHasCM)( Node* node, uint contentModel );