Merge pull request #226 from flok99/master

Added methods for delete-ing nodes and/or attributes. #226
This commit is contained in:
Geoff McLane 2015-07-13 12:15:52 +02:00
commit 3fccc15ae8
2 changed files with 22 additions and 0 deletions

View file

@ -823,6 +823,9 @@ TIDY_EXPORT TidyNode TIDY_CALL tidyGetHtml( TidyDoc tdoc );
TIDY_EXPORT TidyNode TIDY_CALL tidyGetHead( TidyDoc tdoc );
TIDY_EXPORT TidyNode TIDY_CALL tidyGetBody( TidyDoc tdoc );
/* remove a node */
TIDY_EXPORT TidyNode TIDY_CALL tidyDiscardElement( TidyDoc tdoc, TidyNode tnod );
/* parent / child */
TIDY_EXPORT TidyNode TIDY_CALL tidyGetParent( TidyNode tnod );
TIDY_EXPORT TidyNode TIDY_CALL tidyGetChild( TidyNode tnod );
@ -844,6 +847,8 @@ TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrNext( TidyAttr tattr );
TIDY_EXPORT ctmbstr TIDY_CALL tidyAttrName( TidyAttr tattr );
TIDY_EXPORT ctmbstr TIDY_CALL tidyAttrValue( TidyAttr tattr );
TIDY_EXPORT void TIDY_CALL tidyAttrDiscard( TidyDoc itdoc, TidyNode tnod, TidyAttr tattr );
/* Null for pure HTML
TIDY_EXPORT ctmbstr tidyAttrNsLocal( TidyAttr tattr );
TIDY_EXPORT ctmbstr tidyAttrNsPrefix( TidyAttr tattr );

View file

@ -1924,6 +1924,15 @@ TidyNode TIDY_CALL tidyGetChild( TidyNode tnod )
return tidyImplToNode( nimp->content );
}
/* remove a node */
TidyNode TIDY_CALL tidyDiscardElement( TidyDoc tdoc, TidyNode tnod )
{
TidyDocImpl* doc = tidyDocToImpl( tdoc );
Node* nimp = tidyNodeToImpl( tnod );
Node* next = TY_(DiscardElement)( doc, nimp );
return tidyImplToNode( next );
}
/* siblings */
TidyNode TIDY_CALL tidyGetNext( TidyNode tnod )
{
@ -2135,6 +2144,14 @@ ctmbstr TIDY_CALL tidyAttrValue( TidyAttr tattr )
return aval;
}
void TIDY_CALL tidyAttrDiscard( TidyDoc tdoc, TidyNode tnod, TidyAttr tattr )
{
TidyDocImpl* impl = tidyDocToImpl( tdoc );
Node* nimp = tidyNodeToImpl( tnod );
AttVal* attval = tidyAttrToImpl( tattr );
TY_(RemoveAttribute)( impl, nimp, attval );
}
/* Null for pure HTML
ctmbstr tidyAttrNsLocal( TidyAttr tattr )
{