Modul:Convert/dok
To je dokumentacijska podstran za glavno stran Modul:Convert. Namenjena je shranjevanju navodil, kategorizaciji in drugi vsebini, ki ni del glavne strani. Predloga ima preizkušanju namenjen peskovnik. |
See how to copy the convert template for information on copying this module and modifying it for use on another wiki. |
Predloga se uporablja na številnih straneh. Z urejanjem te predloge lahko zelo obremenite strežnike, zato pred uvedbo vse spremembe, ki jih želite uvesti, preizkusite na njenih podstraneh (/peskovnik oziroma /testniprimeri) ali na svojih lastnih podstraneh. Preizkusite jih lahko tudi v posebnem peskovniku za predloge. Preizkušene spremembe se lahko v predlogo dodajo z enim samim urejanjem. Preden predlogo spremenite, se o spremembah rajši pogovorite na njeni pogovorni strani. |
This module converts a value from one unit of measurement to another. For example:
{{convert|123|lb|kg}}
→ 123 lb (56 kg)
The module is called using a template—parameters passed to the template are used by this module to control how a conversion is performed. For example, units can be abbreviated (like kg
), or displayed as names (like kilogram
), and the output value can be rounded to a specified precision. For usage information, see Pomoč:Convert.
Templates and modules
[uredi kodo]Templates that invoke this module are:
- Predloga:Convert
- Predloga:Cvt (convert with abbr=on)
The following modules are required:
- Modul:Convert – (this module) code to convert units
- Modul:Convert/data – unit definitions
- Modul:Convert/text – text messages, and parameter names and values
The following modules are optional and are used only if required and if the module exists:
- Modul:Convert/extra – extra (temporary) unit definitions; used if a unit is not found in Modul:Convert/data
- Modul:ConvertNumeric – code to spell an input value in words (only English is supported; however, see vi:Modul:ConvertNumeric)
For Wikidata support the following modules are required:
The following help pages are available:
- Pomoč:Convert – overview
- Pomoč:Convert sporočila – describes error and warning messages; messages link to this page so it is required when the module is copied to another wiki
- Pomoč:Convert units – overview of units
A page containing a convert error is added to the following hidden category, providing the page is in a specified namespace (articles, by default):
Units are defined in the wikitext of the master list of units.
- Modul:Convert/documentation/conversion data/dok – master list of unit definitions
- Modul:Convert/makeunits – translates wikitext from the master list to Lua
- Module talk:Convert/makeunits – makeunits results; copy the text to Modul:Convert/data
Modul:Convert/data is transcluded into every page using the convert module, so experimenting with a new unit in that module would involve a significant overhead. The Modul:Convert/extra module is an alternative which is only transcluded on pages with a unit that is not defined in the main data module.
Module talk:Convert/show lists all unit links so they can be checked.
Peskovnik
[uredi kodo]When making a change, copy the current modules to the sandbox pages, then edit the sandbox copies:
- Modul:Convert • Modul:Convert/peskovnik • same content
- Modul:Convert/data • Modul:Convert/data/peskovnik • same content
- Modul:Convert/text • Modul:Convert/text/peskovnik • same content
- Modul:Convert/extra • Modul:Convert/extra/peskovnik • same content
- Modul:Convert/wikidata • Modul:Convert/wikidata/peskovnik • same content
- Modul:Convert/wikidata/data • Modul:Convert/wikidata/data/peskovnik • same content
Use the following template to test the results (example {{convert/peskovnik|123|lb|kg}}
):
Predloga:Convert/peskovnik invokes Modul:Convert/peskovnik with parameter |sandbox=peskovnik
which causes convert to use the sandbox modules rather than the normal modules.
The following should be used to test the results of editing the convert modules.
- Predloga:Convert/peskovnik#Sandbox testcases – links to testcases
- Modul:Convert/tester – module to run tests by comparing template output with fixed text
It is not necessary to save a testcases page before viewing test results. For example, Predloga:Convert/testniprimeri/peskovnik4 could be edited to change the tests. While still editing that page, paste "Template talk:Convert/testniprimeri/peskovnik4
" (without quotes) into the page title box under "Preview page with this template", then click "Show preview".
Configuration
[uredi kodo]The template that invokes this module can define options to configure the module. For example:
{{#invoke:convert|convert|numdot=,|numsep=.}}
- Sets the decimal mark to be a comma, and the thousands separator to be a dot.
Other options, with default values, are:
|maxsigfig=14
– maximum number of significant figures|nscat=0
– namespaces (comma separated) in which an error or warning adds a category to the page|warnings=0
– 0 (zero) disables warnings; 1 shows important warnings; 2 shows all warnings
An option in the template can specify that the sandbox versions of the modules be used. If specified, the text on the right-hand side of the equals sign must be the name of the subpage for each sandbox module.
|sandbox=peskovnik
– omit for normal operation
All text used for input parameters and for output messages and categories can be customized. For example, at enwiki the option |lk=on
can be used to link each displayed unit to its article. The "lk
" and "on
" can be replaced with any desired text. In addition, input and output numbers can be formatted and can use digits in the local language. See the translation guide for more information.
To do
[uredi kodo]Document the modules to access Wikidata!