Implement TidyReportFilter2 using raw strings to support library localization.
This commit is contained in:
parent
0cf6d99843
commit
5786a5afb5
12
include/tidy.h
Normal file → Executable file
12
include/tidy.h
Normal file → Executable file
|
@ -619,10 +619,16 @@ TIDY_EXPORT void TIDY_CALL tidyPutByte( TidyOutputSink* sink, uint byteValue );
|
||||||
typedef Bool (TIDY_CALL *TidyReportFilter)( TidyDoc tdoc, TidyReportLevel lvl,
|
typedef Bool (TIDY_CALL *TidyReportFilter)( TidyDoc tdoc, TidyReportLevel lvl,
|
||||||
uint line, uint col, ctmbstr mssg );
|
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 */
|
/** Give Tidy a filter callback to use */
|
||||||
TIDY_EXPORT Bool TIDY_CALL tidySetReportFilter( TidyDoc tdoc,
|
TIDY_EXPORT Bool TIDY_CALL tidySetReportFilter( TidyDoc tdoc,
|
||||||
TidyReportFilter filtCallback );
|
TidyReportFilter filtCallback );
|
||||||
|
|
||||||
|
TIDY_EXPORT Bool TIDY_CALL tidySetReportFilter2( TidyDoc tdoc,
|
||||||
|
TidyReportFilter2 filtCallback );
|
||||||
|
|
||||||
/** Set error sink to named file */
|
/** Set error sink to named file */
|
||||||
TIDY_EXPORT FILE* TIDY_CALL tidySetErrorFile( TidyDoc tdoc, ctmbstr errfilnam );
|
TIDY_EXPORT FILE* TIDY_CALL tidySetErrorFile( TidyDoc tdoc, ctmbstr errfilnam );
|
||||||
/** Set error sink to given buffer */
|
/** Set error sink to given buffer */
|
||||||
|
@ -852,7 +858,7 @@ TIDY_EXPORT uint TIDY_CALL tidyNodeColumn( TidyNode tnod );
|
||||||
|
|
||||||
/** @defgroup NodeIsElementName Deprecated node interrogation per TagId
|
/** @defgroup NodeIsElementName Deprecated node interrogation per TagId
|
||||||
**
|
**
|
||||||
** @deprecated The functions tidyNodeIs{ElementName} are deprecated and
|
** @deprecated The functions tidyNodeIs{ElementName} are deprecated and
|
||||||
** should be replaced by tidyNodeGetId.
|
** should be replaced by tidyNodeGetId.
|
||||||
** @{
|
** @{
|
||||||
*/
|
*/
|
||||||
|
@ -954,7 +960,7 @@ TIDY_EXPORT Bool TIDY_CALL tidyAttrIsProp( TidyAttr tattr );
|
||||||
|
|
||||||
/** @defgroup AttrIsAttributeName Deprecated attribute interrogation per AttrId
|
/** @defgroup AttrIsAttributeName Deprecated attribute interrogation per AttrId
|
||||||
**
|
**
|
||||||
** @deprecated The functions tidyAttrIs{AttributeName} are deprecated and
|
** @deprecated The functions tidyAttrIs{AttributeName} are deprecated and
|
||||||
** should be replaced by tidyAttrGetId.
|
** should be replaced by tidyAttrGetId.
|
||||||
** @{
|
** @{
|
||||||
*/
|
*/
|
||||||
|
@ -1019,7 +1025,7 @@ TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetById( TidyNode tnod, TidyAttrId attId
|
||||||
|
|
||||||
/** @defgroup AttrGetAttributeName Deprecated attribute retrieval per AttrId
|
/** @defgroup AttrGetAttributeName Deprecated attribute retrieval per AttrId
|
||||||
**
|
**
|
||||||
** @deprecated The functions tidyAttrGet{AttributeName} are deprecated and
|
** @deprecated The functions tidyAttrGet{AttributeName} are deprecated and
|
||||||
** should be replaced by tidyAttrGetById.
|
** should be replaced by tidyAttrGetById.
|
||||||
** For instance, tidyAttrGetID( TidyNode tnod ) can be replaced by
|
** For instance, tidyAttrGetID( TidyNode tnod ) can be replaced by
|
||||||
** tidyAttrGetById( TidyNode tnod, TidyAttr_ID ). This avoids a potential
|
** tidyAttrGetById( TidyNode tnod, TidyAttr_ID ). This avoids a potential
|
||||||
|
|
5
src/localize.c
Normal file → Executable file
5
src/localize.c
Normal file → Executable file
|
@ -1034,6 +1034,11 @@ static void messagePos( TidyDocImpl* doc, TidyReportLevel level,
|
||||||
TidyDoc tdoc = tidyImplToDoc( doc );
|
TidyDoc tdoc = tidyImplToDoc( doc );
|
||||||
go = doc->mssgFilt( tdoc, level, line, col, messageBuf );
|
go = doc->mssgFilt( tdoc, level, line, col, messageBuf );
|
||||||
}
|
}
|
||||||
|
if ( doc->mssgFilt2 )
|
||||||
|
{
|
||||||
|
TidyDoc tdoc = tidyImplToDoc( doc );
|
||||||
|
go = doc->mssgFilt2( tdoc, level, line, col, msg, args );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( go )
|
if ( go )
|
||||||
|
|
1
src/tidy-int.h
Normal file → Executable file
1
src/tidy-int.h
Normal file → Executable file
|
@ -48,6 +48,7 @@ struct _TidyDocImpl
|
||||||
StreamOut* docOut;
|
StreamOut* docOut;
|
||||||
StreamOut* errout;
|
StreamOut* errout;
|
||||||
TidyReportFilter mssgFilt;
|
TidyReportFilter mssgFilt;
|
||||||
|
TidyReportFilter2 mssgFilt2;
|
||||||
TidyOptCallback pOptCallback;
|
TidyOptCallback pOptCallback;
|
||||||
|
|
||||||
/* Parse + Repair Results */
|
/* Parse + Repair Results */
|
||||||
|
|
12
src/tidylib.c
Normal file → Executable file
12
src/tidylib.c
Normal file → Executable file
|
@ -649,6 +649,18 @@ Bool TIDY_CALL tidySetReportFilter( TidyDoc tdoc, TidyReportFilter filt )
|
||||||
return no;
|
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 */
|
#if 0 /* Not yet */
|
||||||
int tidySetContentOutputSink( TidyDoc tdoc, TidyOutputSink* outp )
|
int tidySetContentOutputSink( TidyDoc tdoc, TidyOutputSink* outp )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue