Last modified: 2012-05-04 16:26:48 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 T25607, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 23607 - Request for new parserfunction "urlparts"
Request for new parserfunction "urlparts"
Status: NEW
Product: MediaWiki extensions
Classification: Unclassified
ParserFunctions (Other open bugs)
unspecified
All All
: Normal enhancement with 2 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-05-20 12:10 UTC by Subfader
Modified: 2012-05-04 16:26 UTC (History)
3 users (show)

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


Attachments

Description Subfader 2010-05-20 12:10:16 UTC
Bug report after discussion here http://www.mediawiki.org/wiki/Help_talk:Extension:ParserFunctions#titleparts_misinterprets_underscores

#titleparts changes underscores to blanks
"{{#titleparts:foo/foo/bar_baz||3}}" = "bar baz", but it should be "bar_baz"

and even strips them from teh end or beginning
"{{#titleparts:foo/bar_||2}}" = "bar", but it should be "bar_"

My guess is this is intended behaviour, but it's critial when handling URLs (which seems to be the main purpose of #titleparts).
Fixing this behaviour results in dirty back and forth replacements:

{{#replace:{{#titleparts:{{#replace:{{{URL}}}|_|$TEMP$}}|...|...}}|$TEMP$|_}}
Comment 1 db [inactive,noenotif] 2010-10-29 19:13:06 UTC
That is intended behaviour, because a title have no underscores.

*title*parts convert the given string first to a title and so underscores are converted to spaces (and some other things are done).

Proprosal INVALID.

Maybe adding a other parser function for handle *url*parts.
Comment 2 Subfader 2011-12-29 19:50:51 UTC
Renamed request
Comment 3 Technical 13 2012-05-04 01:17:44 UTC
On page [[User_talk:Myusername_286/sub1/sub2]], {{#titleparts:{{FULLPAGENAMEE}}|1}} returns "User talk:Myusername 286" instead of the expected "User_talk:Myusername_286" from using "{{FULLPAGENAMEE}}" (with the extra e).  If it was intended to get "User talk:Myusername 286", I would have used  {{#titleparts:{{FULLPAGENAME}}|1}}. Until #titleparts is fixed, I think I will have to use {{#replace:{{#titleparts:{{FULLPAGENAMEE}}|1}}|<nowiki> </nowiki>|_}}.  Thank you.
Comment 4 db [inactive,noenotif] 2012-05-04 16:26:48 UTC
#titleparts gets not fixed, because a title is a string with spaces instead of underscores.

You can use {{FULLPAGENAMEE:{{#titleparts:{{FULLPAGENAME}}|1}}}} to get that as a url.

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


Navigation
Links