r112363 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112362‎ | r112363 | r112364 >
Date:22:15, 24 February 2012
Author:maxsem
Status:ok
Tags:
Comment:
Don't tidy plaintext
Modified paths:
  • /trunk/extensions/MobileFrontend/ApiQueryExcerpt.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/ApiQueryExcerpt.php
@@ -32,7 +32,7 @@
3333 }
3434 $text = $this->getExcerpt( $t, $params['plaintext'] );
3535 if ( isset( $params['length'] ) ) {
36 - $text = $this->trimText( $text, $params['length'] );
 36+ $text = $this->trimText( $text, $params['length'], $params['plaintext'] );
3737 }
3838 $fit = $this->addPageSubItem( $id, $text );
3939 if ( !$fit ) {
@@ -114,7 +114,14 @@
115115 return trim( $text );
116116 }
117117
118 - private function trimText( $text, $requestedLength ) {
 118+ /**
 119+ *
 120+ * @param string $text
 121+ * @param int $requestedLength
 122+ * @param bool $plainText
 123+ * @return string
 124+ */
 125+ private function trimText( $text, $requestedLength, $plainText ) {
119126 global $wgUseTidy;
120127
121128 $length = mb_strlen( $text );
@@ -125,7 +132,7 @@
126133 preg_match( $pattern, $text, $m );
127134 $text = $m[0];
128135 // Fix possibly unclosed tags
129 - if ( $wgUseTidy ) {
 136+ if ( $wgUseTidy && !$plainText ) {
130137 $text = trim ( MWTidy::tidy( $text ) );
131138 }
132139 $text .= wfMessage( 'ellipsis' )->inContentLanguage()->text();

Sign-offs

UserFlagDate
Hasharinspected11:05, 29 February 2012

Status & tagging log