3 namespace MediaWiki\Tidy
;
6 * Base class for HTML cleanup utilities
8 abstract class TidyDriverBase
{
11 function __construct( $config ) {
12 $this->config
= $config;
16 * Return true if validate() can be used
19 public function supportsValidate() {
24 * Check HTML for errors, used if $wgValidateAllHtml = true.
27 * @param string &$errorStr Return the error string
28 * @throws \MWException
29 * @return bool Whether the HTML is valid
31 public function validate( $text, &$errorStr ) {
32 throw new \
MWException( static::class . ' does not support validate()' );
38 * @param string $text HTML document fragment to clean up
39 * @return string The corrected HTML output
41 abstract public function tidy( $text );