Last modified: 2006-08-18 17:32:09 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 7044 - "Add leading zeros" magic word
"Add leading zeros" magic word
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
  Show dependency treegraph
Reported: 2006-08-17 15:40 UTC by emddudley
Modified: 2006-08-18 17:32 UTC (History)
0 users

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


Description emddudley 2006-08-17 15:40:44 UTC
I'd like to request a "magic word" similar to {{formatnum:}} that pads a number
with leading zeros.

Many images on Commons are uploaded as a series with leading zeros on the
image's index. For example, all of the images at have leading zeros.
Many cameras default to using leading zeros in their filenames. Automatically
generating these filenames in a template is difficult.

I don't want to encourage leading zeros in filenames, but if someone wants to
upload a large number of images, it's a huge pain to rename them all.

* {{padzeros:2|4}} would render as 0002
* {{padzeros:02|4}} as 0002
* {{padzeros:0002|2}} as 02
* {{padzeros:1024|-1}} as 1024
* {{padzeros:1024|2}} as 1024
Comment 1 Rob Church 2006-08-18 17:32:09 UTC
Added two new colon functions in SVN trunk, r16126; "padleft" and "padright":


where STRING is the start string, LENGTH is the desired end length, and
CHARACTER is an (optional) character used for padding. The format for "padright"
is identical save for the function name.

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