Last modified: 2006-08-18 17:32:09 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 http://commons.wikimedia.org/wiki/User:BradPatrick/gallery 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. Examples: * {{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
Added two new colon functions in SVN trunk, r16126; "padleft" and "padright": {{padleft:STRING|LENGTH|CHARACTER}} 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.