[Mediawiki-l] New extension: units formatter

Ian Smith johantheghost at yahoo.com
Thu Jun 21 15:13:12 UTC 2007


Hi,

I've just uploaded a new extension, UnitsFormatter.  This extension does two
things:

* allows article authors to use a simple markup to enter quantities.
  Quantities can be entered in a single unit; authors don't need to
  worry about conversions.

* allows users to select what style of units these quantities are
  displayed in. Users can select between metric and non-metric units,
  or both; for non-metric, they can select between British and US units.

The extension displays quantities with measures according to Wikipedia
standards, including non-breaking spaces, wikilinks to unit definitions, etc. 
For example, instead of writing this:

    My car burns 7.2 [[wikipedia:gallon|U.S. gallons]]
    (27.3 [[wikipedia:litre|l]]) of gas every
    100 [[wikipedia:kilometre|kilometres]]
    (62 [[wikipedia:mile|mi]]).

you can write this:

    My car burns <unit>7.2 usgal</unit> of gas every <unit>100 km!</unit>.

and the user can elect to see the output like any of these, or more:

    My car burns 7.2 US gallons (27.3 l) of gas every 100 kilometres (62 mi).
    My car burns 6.0 British gallons of gas every 100 kilometres.
    My car burns 27.3 litres (6.0 Br gal) of gas every 100 kilometres (62 mi). 

Hopefully people dealing with units a lot will find this helpful; maybe even
Wikipedia can benefit from it.

Right now it's tagged as experimental; check it out and let me know what you
think:

    http://www.mediawiki.org/wiki/Extension:UnitsFormatter

All comments welcome at the talk page.

Ian




More information about the MediaWiki-l mailing list