Objectives
Main objectives, as applied to mainspace articles, are as follows:
- ensure the most commonly used "bare" measures, notably imperial, have corrresponding SI units of measure in accordance with WP:MOS.
General principles
The rationale and principles applied are as follows:
- insert ((convert)) template to the following numerical non-metric units of measure (for ranges and individual measures)
- inches, feet, yards, miles
- pounds
- feet per second, miles per hour
- acres, square feet, square yards, square miles
Actions and test
Link to script code: User:Ohconfucius/script/tometricunits.js
Speed of script execution may vary depending on browser.
Should the script stall when working on large articles, press <continue>
on the pop-up menu – once is usually sufficient.
Known limitations or contraindications
- The following are not supported:
- insertion of templates to convert away from metric measures
- The list of measures is limited and is not exhaustive: PSI (pounds per square inch), FPS, nautical miles are not within the scope of the script.
- two-dimensional measures as given by x times y (e.g. 8 ft x 6 ft), x by y (e.g. 8 ft by 6 ft);
- three-dimensional measures as given by x times y times z, (e.g. 3 ft x 5 ft x 7 ft), x by y by z, (e.g. 2 ft by 8 ft x è ft),
- Some situations may give rise to false positives where simply the last unit is tagged with a convert template. This will be the case for the two- and three-dimensional measures
- Where manual converted measures are already in place in an article, the script may cause appearance of an additional converted unit such as
11 lb (5kg)
becoming ((convert|11|lb|kg)) (5kg)
- There are no protected strings. Anything in the open edit window is susceptible to change. Be aware of false positives with article names, titles, file names.
Disclaimer
Users are expected to exercise careful judgement in the context of each article in which they run this script. Use at your own risk and make sure you check the edit changes before you save. It's not my fault if someone misuses this script.
Test page