Last modified: 2008-01-05 15:42:27 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.
was fixed in r28708