Always show DOCTYPE found

This commit is contained in:
Geoff McLane 2014-09-14 19:06:19 +02:00
parent a08c7c9444
commit 20da40d2e8
3 changed files with 29 additions and 1 deletions

View file

@ -1313,9 +1313,18 @@ int main( int argc, char** argv )
if ( status >= 0 )
status = tidyCleanAndRepair( tdoc );
if ( status >= 0 )
if ( status >= 0 ) {
status = tidyRunDiagnostics( tdoc );
if ( !tidyOptGetBool(tdoc, TidyQuiet) ) {
/* NOT quiet, show DOCTYPE, if not already shown */
if (!tidyOptGetBool(tdoc, TidyShowInfo)) {
tidyOptSetBool( tdoc, TidyShowInfo, yes );
tidyReportDoctype( tdoc ); /* FIX20140913: like warnings, errors, ALWAYS report DOCTYPE */
tidyOptSetBool( tdoc, TidyShowInfo, no );
}
}
}
if ( status > 1 ) /* If errors, do we want to force output? */
status = ( tidyOptGetBool(tdoc, TidyForceOutput) ? status : -1 );

View file

@ -676,6 +676,8 @@ TIDY_EXPORT int TIDY_CALL tidyCleanAndRepair( TidyDoc tdoc );
*/
TIDY_EXPORT int TIDY_CALL tidyRunDiagnostics( TidyDoc tdoc );
TIDY_EXPORT int TIDY_CALL tidyReportDoctype( TidyDoc tdoc );
/** @} end Clean group */

View file

@ -56,6 +56,7 @@ static int tidyDocParseSource( TidyDocImpl* impl, TidyInputSource* docI
** pre-or-post repair.
*/
static int tidyDocRunDiagnostics( TidyDocImpl* doc );
static void tidyDocReportDoctype( TidyDocImpl* doc );
static int tidyDocCleanAndRepair( TidyDocImpl* doc );
@ -1136,6 +1137,16 @@ int TIDY_CALL tidyRunDiagnostics( TidyDoc tdoc )
return -EINVAL;
}
int TIDY_CALL tidyReportDoctype( TidyDoc tdoc )
{
int iret = -EINVAL;
TidyDocImpl* impl = tidyDocToImpl( tdoc );
if ( impl ) {
tidyDocReportDoctype( impl );
iret = 0;
}
return iret;
}
/* Workhorse functions.
**
@ -1228,6 +1239,12 @@ int tidyDocRunDiagnostics( TidyDocImpl* doc )
return tidyDocStatus( doc );
}
void tidyDocReportDoctype( TidyDocImpl* doc )
{
TY_(ReportMarkupVersion)( doc );
}
/* ######################################################################################
HTML5 STUFF
*/