program reporter; { Example showing how to gather diagnostics from TidyLib's "ReportFilter" , etc... } {$IFDEF FPC}{$H+}{$MODE OBJFPC}{$ENDIF} {$IFDEF WIN32}{$APPTYPE CONSOLE}{$ENDIF} uses tidyobj; function ReportFilter(doc:pTidyDoc; level:TidyReportLevel; line:uint; col:uint; msg:ctmbstr):Bool; cdecl; begin WriteLn(FormatTidyReportMessage(level, line, col, msg)); Result:=False; end; var Tidy:tTidy; begin Tidy:=tTidy.Create(nil); Tidy.OutputMode:=omAuto; Tidy.ReportCallback:=@ReportFilter; if ( ParamStr(1) = '' ) then WriteLn(ErrOutput, 'Parsing console input...'); WriteLn('Reporting:'); Tidy.ParseFile(ParamStr(1)); WriteLn; WriteLn('DocType: ', Tidy.DocType); WriteLn('XmlDecl: ', Tidy.XmlDecl); WriteLn('Title: ', Tidy.Title); WriteLn; WriteLn('Status:'); WriteLn('Tidy.Status=', Tidy.Status, ' ( ', Tidy.ErrorCount, ' Errors, ', Tidy.WarningCount, ' Warnings. )' ); WriteLn; WriteLn('ErrorSummary:'); WriteLn(Tidy.ErrorSummary); WriteLn; WriteLn('GeneralInfo:'); WriteLn(Tidy.GeneralInfo); WriteLn; WriteLn('Output produced with ', TIDY_LIB, ', released ', tidyReleaseDate()); WriteLn; Tidy.Free; end.