public static function tidy( $text ) {
$driver = self::singleton();
if ( !$driver ) {
- throw new MWException( __METHOD__.
+ throw new MWException( __METHOD__ .
': tidy is disabled, caller should have checked MWTidy::isEnabled()' );
}
return $driver->tidy( $text );
}
+ /**
+ * Get CSS modules needed if HTML from the current driver is to be displayed.
+ *
+ * This is just a migration tool to allow some changes expected as part of
+ * Tidy replacement (T89331) to be exposed on the client side via user
+ * scripts, without actually replacing tidy. See T49673.
+ *
+ * @return array
+ */
+ public static function getModuleStyles() {
+ $driver = self::singleton();
+ if ( $driver && $driver instanceof MediaWiki\Tidy\RaggettBase ) {
+ return [ 'mediawiki.raggett' ];
+ } else {
+ return [];
+ }
+ }
+
/**
* Check HTML for errors, used if $wgValidateAllHtml = true.
*
public static function checkErrors( $text, &$errorStr = null ) {
$driver = self::singleton();
if ( !$driver ) {
- throw new MWException( __METHOD__.
+ throw new MWException( __METHOD__ .
': tidy is disabled, caller should have checked MWTidy::isEnabled()' );
}
if ( $driver->supportsValidate() ) {
$config = $wgTidyConfig;
} elseif ( $wgUseTidy ) {
// b/c configuration
- $config = array(
+ $config = [
'tidyConfigFile' => $wgTidyConf,
'debugComment' => $wgDebugTidy,
'tidyBin' => $wgTidyBin,
- 'tidyCommandLine' => $wgTidyOpts );
+ 'tidyCommandLine' => $wgTidyOpts ];
if ( $wgTidyInternal ) {
if ( wfIsHHVM() ) {
$config['driver'] = 'RaggettInternalHHVM';
case 'Html5Depurate':
self::$instance = new MediaWiki\Tidy\Html5Depurate( $config );
break;
+ case 'Html5Internal':
+ self::$instance = new MediaWiki\Tidy\Html5Internal( $config );
+ break;
+ case 'disabled':
+ return false;
default:
throw new MWException( "Invalid tidy driver: \"{$config['driver']}\"" );
}