Last modified: 2013-04-22 16:16:20 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 T47265, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 45265 - Add wgFullTitle for full page title as normally displayed
Add wgFullTitle for full page title as normally displayed
Status: RESOLVED WONTFIX
Product: MediaWiki
Classification: Unclassified
JavaScript (Other open bugs)
1.21.x
All All
: Unprioritized enhancement (vote)
: ---
Assigned To: Matthew Flaschen
: patch-need-review
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-02-22 01:16 UTC by Matthew Flaschen
Modified: 2013-04-22 16:16 UTC (History)
6 users (show)

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


Attachments

Description Matthew Flaschen 2013-02-22 01:16:21 UTC
Implement wgFullPageName as the full page name (including localized namespace) without any encoding.

I believe this is equivalent to wgPageName, but with underscores instead of spaces.  But I think this is worth implementing so people don't have to think about encoding or decoding page names, when they just want the full actual name.

The name is chosen since this is the behavior of the {{FULLPAGENAME}} magic word.
Comment 1 Matthew Flaschen 2013-02-22 01:19:27 UTC
Sorry, I mean wgFullPageName would have spaces.

wgPageName would be unchanged and continue to have underscores.
Comment 2 Matthew Flaschen 2013-02-22 05:50:05 UTC
Implemented as https://gerrit.wikimedia.org/r/#/c/50341/

I reconsidered the name.  Since all of the PageName ones currently use underscores, and the only Title one (wgTitle, title without namespace, doesn't), I went with wgFullTitle.
Comment 3 Krinkle 2013-02-22 20:33:03 UTC
There are way too many title related variables already. Exporting every single variation is not a solution.

Imho is escaping not an argument in this case. Escaping is always needed, nothing does that for you.

As far as variations go, we have mw.Title for that.

Feel free to re-open with a use case.
Comment 4 Matthew Flaschen 2013-02-22 20:47:12 UTC
As Tyler said, it avoids having to use and depend on mw.Title for a very common use case (one which I think user script writers would also appreciate)

There are at least two main reasons it would be useful:

1. This is the version used for display.
2. This is used for the title attributes of links (this is the main reason we want it).

You're right it's not strictly necessary.  But I think this one adds something useful above the existing ones (e.g. wgTitle).
Comment 5 Jesús Martínez Novo (Ciencia Al Poder) 2013-02-22 20:51:48 UTC
var wgFullTitle = wgPageName.replace(/_/g, ' ');

No need to depend on mw.Title for that ;)
Comment 6 Matthew Flaschen 2013-02-22 20:54:46 UTC
I'm aware of that.  The problem is then it becomes every script writer or reviewer's job to remember how wgPageName is escaped.

It's poor separation of concerns.
Comment 7 Krinkle 2013-02-23 00:17:30 UTC
I agree those variables are a mess.

But one doesn't have to concerned about which variables contain what type of value and whether they are db or text versions.

And adding another one certainly doesn't make that easier (sure they are both called "Title", but if that was simple enough, this wouldn't have been a bug, you said so yourself).

The methods of mw.Title are pretty usable (e.g. mw.Title#toText aka #getPrefixedText for the non-underscore version, mw.Title#getPrefixedDb for the db version). We use the same system server-side with matching method names, and for the same reason: Those individual variables would've been a mess to deal with on the server-side.

Construct an mw.Title once with whatever input (doesn't matter which title/page variable, it'll take it - though if you use wgTitle, be sure to pass the namespace as well).

Then simply use it's methods to get the desired value (full name, just title, just namespace, in either text or db format)
Comment 8 Krinkle 2013-02-24 15:37:43 UTC
(In reply to comment #7)
> Construct an mw.Title once with whatever input (doesn't matter which
> title/page variable, it'll take it

As pointed out in #wikimedia-dev, it is best to construct it with wgPageName.

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


Navigation
Links