Last modified: 2008-01-05 15:42:27 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 12356 - titleparts ParserFunction should return more intuitive results
titleparts ParserFunction should return more intuitive results
Product: MediaWiki extensions
Classification: Unclassified
ParserFunctions (Other open bugs)
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: easy
Depends on:
  Show dependency treegraph
Reported: 2007-12-19 17:58 UTC by darklama
Modified: 2008-01-05 15:42 UTC (History)
0 users

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

modifies titleparts function to work as suggested (1.56 KB, patch)
2007-12-19 17:58 UTC, darklama

Description darklama 2007-12-19 17:58:02 UTC
Created attachment 4452 [details]
modifies titleparts function to work as suggested

Currently if the number of parts requested exceeds the subpage depth count, the entire title is returned.
Instead the offset should be considered if it doesn't also exceed the subpage depth count.

For example instead of:
* {{#titleparts:Example/Testing/123|5|2}} = Example/Testing/123

it should return:
* {{#titleparts:Example/Testing/123|5|2}} = Testing/123

Allowing this small change would allow for templates, like the one linked to, to be greatly simplified from not having to do as many if parser branches. This would provide a means to reduce some time spent parsing lengthy if branching and reduce server load as a result.

Currently negative offsets and parts return the entire title, instead it should count from the right to obtain more useful results which would also make it possible to reduce branching if parser statements.

For example with the proposed new behavior:
* {{#titleparts:Example/Testing/123/456|-2}} = Example/Testing/123
* {{#titleparts:Example/Testing/123/456|2|-3}} = Testing/123
* {{#titleparts:Example/Testing/123/456|-2|-3}} = Example/Testing

I've included a patch to do just this, to make it easy to fix.
Comment 1 darklama 2008-01-05 15:42:27 UTC
was fixed in r28708

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