Last modified: 2008-01-05 15:42:27 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 T14356, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 12356 - titleparts ParserFunction should return more intuitive results
titleparts ParserFunction should return more intuitive results
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
ParserFunctions (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
http://en.wikibooks.org/wiki/Template...
: easy
Depends on:
Blocks:
  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: ---


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

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.


Navigation
Links