https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112303
Revision: 112303
Author: maxsem
Date: 2012-02-24 07:48:49 +0000 (Fri, 24 Feb 2012)
Log Message:
-----------
Fixed bug with earlier versions of libxml
Modified Paths:
--------------
trunk/extensions/MobileFrontend/ApiParseExtender.php
trunk/extensions/MobileFrontend/ApiQueryExcerpt.php
trunk/extensions/MobileFrontend/MobileFormatter.php
Modified: trunk/extensions/MobileFrontend/ApiParseExtender.php
===================================================================
--- trunk/extensions/MobileFrontend/ApiParseExtender.php 2012-02-24
05:20:46 UTC (rev 112302)
+++ trunk/extensions/MobileFrontend/ApiParseExtender.php 2012-02-24
07:48:49 UTC (rev 112303)
@@ -72,7 +72,7 @@
);
$context->setUseFormat( 'wml' ); // Force WML
links just in case
$context->setOnlyThisSegment( isset(
$params['section'] ) );
- $mf = new MobileFormatter( '<body><div
id="content">' . $data['parse']['text']['*'] . '</div></body>',
+ $mf = new MobileFormatter(
MobileFormatter::wrapHTML( $data['parse']['text']['*'] ),
$title,
ExtMobileFrontend::parseContentFormat(
$params['mobileformat'] ),
$context
Modified: trunk/extensions/MobileFrontend/ApiQueryExcerpt.php
===================================================================
--- trunk/extensions/MobileFrontend/ApiQueryExcerpt.php 2012-02-24 05:20:46 UTC
(rev 112302)
+++ trunk/extensions/MobileFrontend/ApiQueryExcerpt.php 2012-02-24 07:48:49 UTC
(rev 112303)
@@ -54,7 +54,7 @@
*/
private function processText( $text, Title $title, $plainText ) {
$text = preg_replace( '/<h[1-6].*$/s', '', $text );
- $mf = new MobileFormatter( $text, $title, 'XHTML' );
+ $mf = new MobileFormatter( MobileFormatter::wrapHTML( $text ),
$title, 'XHTML' );
$mf->removeImages();
$mf->remove( array( 'table', 'div', 'sup.reference',
'span.coordinates', 'span.geo-multi-punct', 'span.geo-nondefault' ) );
if ( $plainText ) {
Modified: trunk/extensions/MobileFrontend/MobileFormatter.php
===================================================================
--- trunk/extensions/MobileFrontend/MobileFormatter.php 2012-02-24 05:20:46 UTC
(rev 112302)
+++ trunk/extensions/MobileFrontend/MobileFormatter.php 2012-02-24 07:48:49 UTC
(rev 112303)
@@ -99,6 +99,15 @@
}
/**
+ * Wraps a chunk of HTML into
+ * @param string $html
+ * @return string
+ */
+ public static function wrapHTML( $html ) {
+ return '<!doctype html><html><head></head><body><div
id="content">' . $html . '</div></body></html>';
+ }
+
+ /**
* Use the given message cache
* @param Array $messages
*/
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs