Rewrite TidySupport and add option --use-tidy-config
[lhc/web/wiklou.git] / includes / parser / MWTidy.php
index 746e15b..a47e002 100644 (file)
@@ -63,9 +63,9 @@ class MWTidy {
        public static function getModuleStyles() {
                $driver = self::singleton();
                if ( $driver && $driver instanceof MediaWiki\Tidy\RaggettBase ) {
-                       return array( 'mediawiki.raggett' );
+                       return [ 'mediawiki.raggett' ];
                } else {
-                       return array();
+                       return [];
                }
        }
 
@@ -102,11 +102,11 @@ class MWTidy {
                                $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';
@@ -132,6 +132,11 @@ class MWTidy {
                                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']}\"" );
                        }