Index: trunk/extensions/MobileFrontend/ApiQueryExcerpt.php |
— | — | @@ -54,7 +54,7 @@ |
55 | 55 | */ |
56 | 56 | private function processText( $text, Title $title, $plainText ) { |
57 | 57 | $text = preg_replace( '/<h[1-6].*$/s', '', $text ); |
58 | | - $mf = new MobileFormatter( $text, $title, 'XHTML' ); |
| 58 | + $mf = new MobileFormatter( MobileFormatter::wrapHTML( $text ), $title, 'XHTML' ); |
59 | 59 | $mf->removeImages(); |
60 | 60 | $mf->remove( array( 'table', 'div', 'sup.reference', 'span.coordinates', 'span.geo-multi-punct', 'span.geo-nondefault' ) ); |
61 | 61 | if ( $plainText ) { |
Index: trunk/extensions/MobileFrontend/MobileFormatter.php |
— | — | @@ -99,6 +99,15 @@ |
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
| 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 | + /** |
103 | 112 | * Use the given message cache |
104 | 113 | * @param Array $messages |
105 | 114 | */ |
Index: trunk/extensions/MobileFrontend/ApiParseExtender.php |
— | — | @@ -72,7 +72,7 @@ |
73 | 73 | ); |
74 | 74 | $context->setUseFormat( 'wml' ); // Force WML links just in case |
75 | 75 | $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']['*'] ), |
77 | 77 | $title, |
78 | 78 | ExtMobileFrontend::parseContentFormat( $params['mobileformat'] ), |
79 | 79 | $context |