summaryrefslogtreecommitdiff
path: root/includes/parser/Tidy.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/parser/Tidy.php')
-rw-r--r--includes/parser/Tidy.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/includes/parser/Tidy.php b/includes/parser/Tidy.php
index 0f7e0d31..32b16aaf 100644
--- a/includes/parser/Tidy.php
+++ b/includes/parser/Tidy.php
@@ -61,7 +61,10 @@ class MWTidyWrapper {
// Replace <mw:editsection> elements with placeholders
$wrappedtext = preg_replace_callback( ParserOutput::EDITSECTION_REGEX,
- array( &$this, 'replaceEditSectionLinksCallback' ), $text );
+ array( &$this, 'replaceCallback' ), $text );
+ // ...and <mw:toc> markers
+ $wrappedtext = preg_replace_callback( '/\<\\/?mw:toc\>/',
+ array( &$this, 'replaceCallback' ), $wrappedtext );
// Modify inline Microdata <link> and <meta> elements so they say <html-link> and <html-meta> so
// we can trick Tidy into not stripping them out by including them in tidy's new-empty-tags config
@@ -80,7 +83,7 @@ class MWTidyWrapper {
*
* @return string
*/
- function replaceEditSectionLinksCallback( $m ) {
+ function replaceCallback( $m ) {
$marker = "{$this->mUniqPrefix}-item-{$this->mMarkerIndex}" . Parser::MARKER_SUFFIX;
$this->mMarkerIndex++;
$this->mTokens->setPair( $marker, $m[0] );
@@ -158,7 +161,7 @@ class MWTidy {
global $wgTidyInternal;
$retval = 0;
- if( $wgTidyInternal ) {
+ if ( $wgTidyInternal ) {
$errorStr = self::execInternalTidy( $text, true, $retval );
} else {
$errorStr = self::execExternalTidy( $text, true, $retval );
@@ -244,7 +247,7 @@ class MWTidy {
global $wgTidyConf, $wgDebugTidy;
wfProfileIn( __METHOD__ );
- if ( !MWInit::classExists( 'tidy' ) ) {
+ if ( !class_exists( 'tidy' ) ) {
wfWarn( "Unable to load internal tidy class." );
$retval = -1;