r112303 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112302‎ | r112303 | r112304 >
Date:07:48, 24 February 2012
Author:maxsem
Status:ok
Tags:
Comment:
Fixed bug with earlier versions of libxml
Modified paths:
  • /trunk/extensions/MobileFrontend/ApiParseExtender.php (modified) (history)
  • /trunk/extensions/MobileFrontend/ApiQueryExcerpt.php (modified) (history)
  • /trunk/extensions/MobileFrontend/MobileFormatter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/ApiQueryExcerpt.php
@@ -54,7 +54,7 @@
5555 */
5656 private function processText( $text, Title $title, $plainText ) {
5757 $text = preg_replace( '/<h[1-6].*$/s', '', $text );
58 - $mf = new MobileFormatter( $text, $title, 'XHTML' );
 58+ $mf = new MobileFormatter( MobileFormatter::wrapHTML( $text ), $title, 'XHTML' );
5959 $mf->removeImages();
6060 $mf->remove( array( 'table', 'div', 'sup.reference', 'span.coordinates', 'span.geo-multi-punct', 'span.geo-nondefault' ) );
6161 if ( $plainText ) {
Index: trunk/extensions/MobileFrontend/MobileFormatter.php
@@ -99,6 +99,15 @@
100100 }
101101
102102 /**
 103+ * Wraps a chunk of HTML into
 104+ * @param string $html
 105+ * @return string
 106+ */
 107+ public static function wrapHTML( $html ) {
 108+ return '<!doctype html><html><head></head><body><div id="content">' . $html . '</div></body></html>';
 109+ }
 110+
 111+ /**
103112 * Use the given message cache
104113 * @param Array $messages
105114 */
Index: trunk/extensions/MobileFrontend/ApiParseExtender.php
@@ -72,7 +72,7 @@
7373 );
7474 $context->setUseFormat( 'wml' ); // Force WML links just in case
7575 $context->setOnlyThisSegment( isset( $params['section'] ) );
76 - $mf = new MobileFormatter( '<body><div id="content">' . $data['parse']['text']['*'] . '</div></body>',
 76+ $mf = new MobileFormatter( MobileFormatter::wrapHTML( $data['parse']['text']['*'] ),
7777 $title,
7878 ExtMobileFrontend::parseContentFormat( $params['mobileformat'] ),
7979 $context

Follow-up revisions

RevisionCommit summaryAuthorDate
r112304Follow-up r112303: and tests toomaxsem08:01, 24 February 2012
r112319prop=excerpt:...maxsem13:20, 24 February 2012

Status & tagging log