diff --git a/console/tidy.c b/console/tidy.c index 3a3d9ad8..2565401d 100644 --- a/console/tidy.c +++ b/console/tidy.c @@ -2544,8 +2544,8 @@ int main( int argc, char** argv ) } } - contentErrors += tidyErrorCount( tdoc ); - contentWarnings += tidyWarningCount( tdoc ); + contentErrors += tidyErrorCount( tdoc ) - tidyMutedErrorCount( tdoc ); + contentWarnings += tidyWarningCount( tdoc ) - tidyMutedWarningCount( tdoc ); accessWarnings += tidyAccessWarningCount( tdoc ); --argc; diff --git a/include/tidy.h b/include/tidy.h index da80857e..f78ba3bc 100644 --- a/include/tidy.h +++ b/include/tidy.h @@ -444,12 +444,24 @@ TIDY_EXPORT Bool TIDY_CALL tidyDetectedGenericXml( TidyDoc tdoc ); */ TIDY_EXPORT uint TIDY_CALL tidyErrorCount( TidyDoc tdoc ); +/** Indicates the number of error messages muted, that won't be output. + ** @param tdoc An instance of a TidyDoc to query. + ** @result Returns the number of muted error messages. + */ +TIDY_EXPORT uint TIDY_CALL tidyMutedErrorCount( TidyDoc tdoc ); + /** Indicates the number of TidyWarning messages that were generated. ** @param tdoc An instance of a TidyDoc to query. ** @result Returns the number of TidyWarning messages that were generated. */ TIDY_EXPORT uint TIDY_CALL tidyWarningCount( TidyDoc tdoc ); +/** Indicates the number of warning messages muted, that won't be output. + ** @param tdoc An instance of a TidyDoc to query. + ** @result Returns the number of muted warning messages. + */ +TIDY_EXPORT uint TIDY_CALL tidyMutedWarningCount( TidyDoc tdoc ); + /** Indicates the number of TidyAccess messages that were generated. ** @param tdoc An instance of a TidyDoc to query. ** @result Returns the number of TidyAccess messages that were generated. diff --git a/src/message.c b/src/message.c index 8f6b1fb2..dbce48a5 100644 --- a/src/message.c +++ b/src/message.c @@ -133,6 +133,8 @@ static void messageOut( TidyMessageImpl *message ) break; case TidyWarning: doc->warnings++; + if ( message->muted ) + doc->mutedWarningCount++; break; case TidyConfig: doc->optionErrors++; @@ -142,6 +144,8 @@ static void messageOut( TidyMessageImpl *message ) break; case TidyError: doc->errors++; + if ( message->muted ) + doc->mutedErrorCount++; break; case TidyBadDocument: doc->docErrors++; diff --git a/src/tidy-int.h b/src/tidy-int.h index 55ab3416..0650c0f0 100644 --- a/src/tidy-int.h +++ b/src/tidy-int.h @@ -65,7 +65,9 @@ struct _TidyDocImpl /* Parse + Repair Results */ uint optionErrors; uint errors; + uint mutedErrorCount; uint warnings; + uint mutedWarningCount; uint accessErrors; uint infoMessages; uint docErrors; diff --git a/src/tidylib.c b/src/tidylib.c index de08d914..41035322 100644 --- a/src/tidylib.c +++ b/src/tidylib.c @@ -1044,6 +1044,14 @@ uint TIDY_CALL tidyErrorCount( TidyDoc tdoc ) count = impl->errors; return count; } +uint TIDY_CALL tidyMutedErrorCount( TidyDoc tdoc ) +{ + TidyDocImpl* impl = tidyDocToImpl( tdoc ); + uint count = 0xFFFFFFFF; + if ( impl ) + count = impl->mutedErrorCount; + return count; +} uint TIDY_CALL tidyWarningCount( TidyDoc tdoc ) { TidyDocImpl* impl = tidyDocToImpl( tdoc ); @@ -1052,6 +1060,14 @@ uint TIDY_CALL tidyWarningCount( TidyDoc tdoc ) count = impl->warnings; return count; } +uint TIDY_CALL tidyMutedWarningCount( TidyDoc tdoc ) +{ + TidyDocImpl* impl = tidyDocToImpl( tdoc ); + uint count = 0xFFFFFFFF; + if ( impl ) + count = impl->mutedWarningCount; + return count; +} uint TIDY_CALL tidyAccessWarningCount( TidyDoc tdoc ) { TidyDocImpl* impl = tidyDocToImpl( tdoc );