Last modified: 2012-05-04 16:26:48 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$|_}}
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.
Renamed request
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.
#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.