mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Add tests for PageTitle (#2624)
This commit is contained in:
parent
cfade144d9
commit
d719a4a9d4
2 changed files with 55 additions and 28 deletions
|
|
@ -14,11 +14,9 @@ public class PageTitle {
|
|||
public PageTitle(@NonNull String prefixedText) {
|
||||
String[] segments = prefixedText.trim().replace(" ", "_").split(":", 2);
|
||||
|
||||
// canonicalize and capitalize page title as done by MediaWiki
|
||||
// Canonicalize and capitalize page title and namespace (if present)
|
||||
if (segments.length == 2) {
|
||||
// TODO: canonicalize and capitalize namespace as well
|
||||
// see https://www.mediawiki.org/wiki/Manual:Title.php#Canonical_forms
|
||||
namespace = segments[0];
|
||||
namespace = Utils.capitalize(segments[0]);
|
||||
titleKey = Utils.capitalize(segments[1]);
|
||||
} else {
|
||||
namespace = "";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue