Jdlrobson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/70738
Change subject: fx2
......................................................................
fx2
Change-Id: I0ef545678eafac39d1cb8e7a6a73ff4cb9591400
---
M includes/skins/MinervaTemplate.php
M includes/skins/MobileTemplateBeta.php
M includes/skins/SkinBootstrap.php
M includes/skins/SkinMobile.php
4 files changed, 23 insertions(+), 12 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/38/70738/1
diff --git a/includes/skins/MinervaTemplate.php
b/includes/skins/MinervaTemplate.php
index b1ec06b..ab54925 100644
--- a/includes/skins/MinervaTemplate.php
+++ b/includes/skins/MinervaTemplate.php
@@ -101,6 +101,10 @@
protected function renderContent( $data ) {
$open = False;
if ( isset( $data['sections'] ) ) {
+ // do lead section
+ echo Html::openElement( 'div', array( 'class' =>
'content_block openSection', 'id' => 'content_0' ) );
+ echo $data['lead'];
+ echo Html::closeElement( 'div' );
foreach( $data['sections'] as $section ) {
// deal with h2s
if ( $section['toclevel'] === 1 ) {
diff --git a/includes/skins/MobileTemplateBeta.php
b/includes/skins/MobileTemplateBeta.php
index d2033b2..0446715 100644
--- a/includes/skins/MobileTemplateBeta.php
+++ b/includes/skins/MobileTemplateBeta.php
@@ -12,7 +12,7 @@
?>
<div id="content" class="content">
<?php
- echo $data[ 'bodytext' ];
+ $this->renderContent( $data );
$this->renderLanguages( $data );
echo $data['postbodytext'];
?>
diff --git a/includes/skins/SkinBootstrap.php b/includes/skins/SkinBootstrap.php
index 736a6cc..de9b8e8 100644
--- a/includes/skins/SkinBootstrap.php
+++ b/includes/skins/SkinBootstrap.php
@@ -10,17 +10,20 @@
protected function explodeBodyHtml() {
$data = array();
$parserOutput = $this->getOutput()->getProperty( 'parserOutput'
);
- $sections = $parserOutput->getSections();
- $html = $parserOutput->getText();
- $chunks = preg_split( '/<h(?=[1-6]\b)/i', $html );
- $data['lead'] = $chunks[1]; // table of contents has an h2 in it
- foreach ( $sections as $key => $section ) {
- $sections[$key]['text'] = trim(
- preg_replace( '#<(h[1-6])\b.*?<\s*/\s*\\1>#',
'',
- '<h' . $chunks[ $key + 2 ] ) // return the h
that we split on, remove heading from output.
- );
+ if ( $parserOutput ) {
+ $sections = $parserOutput->getSections();
+ $html = $parserOutput->getText();
+ $chunks = preg_split( '/<h(?=[1-6]\b)/i', $html );
+ // FIXME: table of contents has an h2 in it
+ $data['lead'] = $chunks[1];
+ foreach ( $sections as $key => $section ) {
+ $sections[$key]['text'] = trim(
+ preg_replace(
'#<(h[1-6])\b.*?<\s*/\s*\\1>#', '',
+ '<h' . $chunks[ $key + 2 ] ) // return
the h that we split on, remove heading from output.
+ );
+ }
+ $data['sections'] = $sections;
}
- $data['sections'] = $sections;
return $data;
}
}
diff --git a/includes/skins/SkinMobile.php b/includes/skins/SkinMobile.php
index c4c6ac4..0f0c557 100644
--- a/includes/skins/SkinMobile.php
+++ b/includes/skins/SkinMobile.php
@@ -54,7 +54,11 @@
$tpl->set( $key, $value );
}
// reset for mobile now it has been exploded
- $tpl->set( 'bodytext', '' );
+ if ( isset( $data['sections'] ) ) {
+ $tpl->set( 'bodytext', '' );
+ } else {
+ $tpl->set( 'bodytext', $html );
+ }
$tpl->set( 'headelement', $out->headElement( $this ) );
$notice = '';
--
To view, visit https://gerrit.wikimedia.org/r/70738
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0ef545678eafac39d1cb8e7a6a73ff4cb9591400
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits