Last modified: 2014-02-12 23:54:04 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T38306, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 36306 - Section toggling broken when h2 section headings span multiple source lines
Section toggling broken when h2 section headings span multiple source lines
Status: RESOLVED FIXED
Product: MobileFrontend
Classification: Unclassified
stable (Other open bugs)
unspecified
All All
: Unprioritized normal
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-27 19:31 UTC by Arthur Richards
Modified: 2014-02-12 23:54 UTC (History)
9 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Arthur Richards 2012-04-27 19:31:05 UTC
The regex used to detect section headings in MobileFormatter.php does not work in the event that section headings span multiple lines in the source, which breaks making the sections toggleable.

Here's the currently existing regex:
<code>
	protected function headingTransform( $s ) {
		wfProfileIn( __METHOD__ );
		$callback = "headingTransformCallback{$this->format}";

		// Closures are a PHP 5.3 feature.
		// MediaWiki currently requires PHP 5.2.3 or higher.
		// So, using old style for now.
		$s = preg_replace_callback(
			'/<h2(.*)<span class="mw-headline" [^>]*>(.+)<\/span>\w*<\/h2>/',
			array( $this, $callback ),
			$s
		);
</code>

This pattern will not work in the event of something like:
<code>
<h2> <span class="mw-headline" id="Sighting">Sighting</span>
</h2>
</code>

We need a less rigid way of detecting section headers.
Comment 1 Arthur Richards 2012-04-27 19:48:29 UTC
Resolved in https://gerrit.wikimedia.org/r/#change,6007
Comment 2 Arthur Richards 2012-04-27 21:15:44 UTC
Actually resolved in https://gerrit.wikimedia.org/r/#change,6039,patchset=1

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links