Index: trunk/extensions/MobileFrontend/api/ApiMobileView.php |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | /** |
6 | 6 | * Increment this when changing the format of cached data |
7 | 7 | */ |
8 | | - const CACHE_VERSION = 1; |
| 8 | + const CACHE_VERSION = 2; |
9 | 9 | |
10 | 10 | public function __construct( $main, $action ) { |
11 | 11 | parent::__construct( $main, $action ); |
— | — | @@ -43,6 +43,9 @@ |
44 | 44 | $section[$textElement] = $data['text'][$i]; |
45 | 45 | unset( $requestedSections[$i] ); |
46 | 46 | } |
| 47 | + if ( isset( $data['refsections'][$i] ) ) { |
| 48 | + $section['references'] = ''; |
| 49 | + } |
47 | 50 | $result[] = $section; |
48 | 51 | } |
49 | 52 | $missingSections = $requestedSections; |
— | — | @@ -95,6 +98,7 @@ |
96 | 99 | $data['sections'] = $parserOutput->getSections(); |
97 | 100 | $chunks = preg_split( '/<h(?=[1-6]\b)/i', $html ); |
98 | 101 | $data['text'] = array(); |
| 102 | + $data['refsections'] = array(); |
99 | 103 | foreach ( $chunks as $chunk ) { |
100 | 104 | if ( count( $data['text'] ) ) { |
101 | 105 | $chunk = "<h$chunk"; |
— | — | @@ -102,6 +106,9 @@ |
103 | 107 | if ( $wgUseTidy && count( $chunks ) > 1 ) { |
104 | 108 | $chunk = MWTidy::tidy( $chunk ); |
105 | 109 | } |
| 110 | + if ( preg_match( '/<ol\b[^>]*?class="references"/', $chunk ) ) { |
| 111 | + $data['refsections'][count( $data['text'] )] = true; |
| 112 | + } |
106 | 113 | $data['text'][] = $chunk; |
107 | 114 | } |
108 | 115 | if ( count( $chunks ) != count( $data['sections'] ) + 1 ) { |