Page MenuHomePhabricator

titleparts ParserFunction should return more intuitive results
Closed, ResolvedPublic

Description

Author: darklama

Description:
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:

it should return:

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:

I've included a patch to do just this, to make it easy to fix.


Version: unspecified
Severity: enhancement
URL: http://en.wikibooks.org/wiki/Template:FULLCHAPTERNAME

Attached:

Details

Reference
bz12356

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:57 PM
bzimport set Reference to bz12356.
bzimport added a subscriber: Unknown Object (MLST).

darklama wrote:

was fixed in r28708