Page MenuHomePhabricator

{{PAGELENGTH}} magic word
Closed, DeclinedPublic

Description

Author: naught101

Description:
Would it be possible to implement a {{PAGELENGTH}} variable/template, similar to the {{PAGENAME}}? This would be very useful for creating template-included categories sorted by length (i.e. [[category:name|{{PAGELENGTH}}]], and perhaps some other uses.


Version: unspecified
Severity: enhancement

Details

Reference
bz13483

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:03 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz13483.
bzimport added a subscriber: Unknown Object (MLST).

soxred93 wrote:

Working on now, but it's only Article namespace.

naught101 wrote:

Thanks Soxred93.

I specifically wanted this variable so that I could add all my stubs to a category like [[Category:short pages|{{PAGELENGTH}}]]. This would only work if the {{PAGELENGTH}} variable could include leading zeros, so perhaps an additional request would be to include a variable for how long the resultant string would be, ie:
{{PAGELENGTH|5}} would return 00245 for a 245 character page, and 15693 for a page that long.

(In reply to comment #2)

This would only work if
the {{PAGELENGTH}} variable could include leading zeros, so perhaps an
additional request would be to include a variable for how long the resultant
string would be, ie:
{{PAGELENGTH|5}} would return 00245 for a 245 character page, and 15693 for a
page that long.

{{padleft:{{PAGELENGTH}}|5|0}} does what you want (adding leading zeros until the number has 5 digits).

Hmm, apparently we already have {{PAGESIZE|foo}}, which will give you the size of [[Foo]]. Unfortunately, {{PAGESIZE|{{FULLPAGENAME}}}} doesn't really work well, as you'll get the size of the previous revision of the page, until you purge the page, after which the number should be correct. I'm talking to Tim about how to fix that.

(In reply to comment #4)

Hmm, apparently we already have {{PAGESIZE|foo}}, which will give you the size
of [[Foo]]. Unfortunately, {{PAGESIZE|{{FULLPAGENAME}}}}

That should of course be {{PAGESIZE:{{FULLPAGENAME}}}}, which a :

naught101 wrote:

Roan, what version is {{PAGESIZE}} available in? I don't have it on my wiki

cheers
ned

naught101 wrote:

Never mind. I found it at http://www.mediawiki.org/wiki/Help:Magic_words#Statistics

guess it's time to upgrade again :)