Last modified: 2011-12-13 14:53:43 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 T34792, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 32792 - Proofread Page extension inconsistently expects escaped spaces in namespaces
Proofread Page extension inconsistently expects escaped spaces in namespaces
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
ProofreadPage (Other open bugs)
unspecified
All All
: High major with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
http://vi.wikisource.org/w/index.php?...
: i18n, need-unittest, patch, patch-need-review
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-12-04 05:35 UTC by Minh Nguyễn
Modified: 2011-12-13 14:53 UTC (History)
2 users (show)

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


Attachments
Patch for calls to MWNamespace::getCanonicalIndex() (4.27 KB, patch)
2011-12-06 23:29 UTC, Minh Nguyễn
Details

Description Minh Nguyễn 2011-12-04 05:35:49 UTC
The Vietnamese localization of the Proofread Page extension uses "Mục lục" as the index namespace. However, the extension sometimes expects the space to be replaced with an underscore.

If the "proofreadpage index namespace" message is localized as "Mục lục", with a space, then things like the "Source" tab and quality bar in the main namespace break, because the following line in prepareArticle() in ProofreadPage_body.php evaluates to null:

	$index_ns_index = MWNamespace::getCanonicalIndex( strtolower( $index_namespace ) );

On the other hand, if the "proofreadpage index namespace" message is localized as "Mục_lục", with an underscore, the index page edit form breaks, because expressions like the following in ProofreadPage_body.php evaluate to 0:

	preg_match( "/^$index_namespace:(.*)$/", $ref_title->getPrefixedText() )

For instance, [[s:vi:MediaWiki:Proofreadpage index namespace]] is currently set to "Mục_lục", but that causes the edit page for [[s:vi:Mục lục:Viet Nam Su Luoc 1.djvu]] to use the normal wiki editor.

It doesn't really matter which style the extension settles on, as long as it treats "proofreadpage index namespace" and "proofreadpage page namespace" consistently.
Comment 1 Minh Nguyễn 2011-12-05 20:28:48 UTC
It's worse than that, actually: if the namespace messages use underscores, index pages like [[s:vi:Mục lục:Viet Nam Su Luoc 1.djvu]] no longer turn <pagelist> into a color-coded sea of Page: links, because renderPageList()'s call to getPageAndIndexNamespace() comes back empty-handed. As a result, prepareArticle() fails to add a "Source" tab to articles, because prepareArticle() can't find the Index: page that links to the same Page: as the article.

The "Source" tab was previously working at the Vietnamese Wikisource because the Index: pages hadn't been purged following our switch to underscores. The outdated pagelinks table happened to contain entries for "Mục lục:...".

So Vietnamese-language wikis are left with two choices: either use spaces and get working Index: pages, or use underscores and get the quality bar on articles. Either way, we can't get a "Source" tab.

Raising the severity to major because this breaks Wikisource's workflow.
Comment 2 Minh Nguyễn 2011-12-06 19:21:19 UTC
Some of the shared Wikisource scripts, such as [[OldWikisource:PageNumbers.js]], depend on the Proofread Page extension loading the ext.proofreadpage.article module. In case anyone uses the Vietnamese Wikisource to investigate this issue, please note that we've added a hacky JavaScript workaround to load the module and add the "Source" tab ourselves, but the quality bar and index pages are actually still broken.
Comment 3 Minh Nguyễn 2011-12-06 23:29:58 UTC
Created attachment 9626 [details]
Patch for calls to MWNamespace::getCanonicalIndex()

This patch modifies all calls to MWNamespace::getCanonicalIndex() to not only lowercase the namespace name but also replace spaces with underscores. getCanonicalIndex() appears to be the only problematic API used by this extension.

This is my first patch; please be gentle. :-)
Comment 4 Minh Nguyễn 2011-12-06 23:37:01 UTC
Adding the "patch" and "need-review" keywords so a developer can take a look.
Comment 5 Mark A. Hershberger 2011-12-13 13:57:08 UTC
I would like to apply this patch.  When I ran the parser and unit tests, it didn't cause a problem.  However, I would like to have some tests to add for this new functionality.

Would you write some?
Comment 6 Mark A. Hershberger 2011-12-13 14:11:50 UTC
(In reply to comment #5)
> I would like to apply this patch.  When I ran the parser and unit tests, it
> didn't cause a problem.  However, I would like to have some tests to add for
> this new functionality.
> 
> Would you write some?

Just realized ProofReadPage doesn't have any tests currently.  Doh!

Applied in r106021

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


Navigation
Links