Added TidyReportFilter2
This commit is contained in:
parent
6aaf826476
commit
e279302eaf
|
@ -619,10 +619,16 @@ TIDY_EXPORT void TIDY_CALL tidyPutByte( TidyOutputSink* sink, uint byteValue );
|
|||
typedef Bool (TIDY_CALL *TidyReportFilter)( TidyDoc tdoc, TidyReportLevel lvl,
|
||||
uint line, uint col, ctmbstr mssg );
|
||||
|
||||
typedef Bool (TIDY_CALL *TidyReportFilter2)( TidyDoc tdoc, TidyReportLevel lvl,
|
||||
uint line, uint col, ctmbstr mssg, va_list args );
|
||||
|
||||
/** Give Tidy a filter callback to use */
|
||||
TIDY_EXPORT Bool TIDY_CALL tidySetReportFilter( TidyDoc tdoc,
|
||||
TidyReportFilter filtCallback );
|
||||
|
||||
TIDY_EXPORT Bool TIDY_CALL tidySetReportFilter2( TidyDoc tdoc,
|
||||
TidyReportFilter2 filtCallback );
|
||||
|
||||
/** Set error sink to named file */
|
||||
TIDY_EXPORT FILE* TIDY_CALL tidySetErrorFile( TidyDoc tdoc, ctmbstr errfilnam );
|
||||
/** Set error sink to given buffer */
|
||||
|
|
|
@ -1035,12 +1035,19 @@ static void messagePos( TidyDocImpl* doc, TidyReportLevel level,
|
|||
|
||||
if ( go )
|
||||
{
|
||||
va_list args_copy;
|
||||
va_copy(args_copy, args);
|
||||
TY_(tmbvsnprintf)(messageBuf, sizeMessageBuf, msg, args);
|
||||
if ( doc->mssgFilt )
|
||||
{
|
||||
TidyDoc tdoc = tidyImplToDoc( doc );
|
||||
go = doc->mssgFilt( tdoc, level, line, col, messageBuf );
|
||||
}
|
||||
if ( doc->mssgFilt2 )
|
||||
{
|
||||
TidyDoc tdoc = tidyImplToDoc( doc );
|
||||
go = go | doc->mssgFilt2( tdoc, level, line, col, msg, args_copy );
|
||||
}
|
||||
}
|
||||
|
||||
if ( go )
|
||||
|
|
|
@ -48,6 +48,7 @@ struct _TidyDocImpl
|
|||
StreamOut* docOut;
|
||||
StreamOut* errout;
|
||||
TidyReportFilter mssgFilt;
|
||||
TidyReportFilter2 mssgFilt2;
|
||||
TidyOptCallback pOptCallback;
|
||||
|
||||
/* Parse + Repair Results */
|
||||
|
|
|
@ -650,6 +650,17 @@ Bool TIDY_CALL tidySetReportFilter( TidyDoc tdoc, TidyReportFilter filt )
|
|||
return no;
|
||||
}
|
||||
|
||||
Bool TIDY_CALL tidySetReportFilter2( TidyDoc tdoc, TidyReportFilter2 filt )
|
||||
{
|
||||
TidyDocImpl* impl = tidyDocToImpl( tdoc );
|
||||
if ( impl )
|
||||
{
|
||||
impl->mssgFilt2 = filt;
|
||||
return yes;
|
||||
}
|
||||
return no;
|
||||
}
|
||||
|
||||
#if 0 /* Not yet */
|
||||
int tidySetContentOutputSink( TidyDoc tdoc, TidyOutputSink* outp )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue