Modulo:Pagbaliwen/dokumentasion/pangibaliw a datos/pangyuna

Manipud iti Wikipedia, ti nawaya nga ensiklopedia

Ti sumaganad ket ti kangrunaan a listaan ti pangibaliw a datos nga inus-usar babaen ti Modulo:Pagbaliwen, ken nasken a pakitungtungan idiay Modulo tungtungan:Pagbaliwen.

Daytoy a panid ket binasbasa babaen ti eskritu (makeunits). Ti eskritu ket mangala ti pakaammo manipud ti teksto ti wiki, ken iparuarna ti taudan ti Lua a mangipalawag ti tabla kadagiti unit; dayta a taudan ken mabalin a manual a makopia idiay Modulo:Pagbaliwen/datos. Kitaen ti resulta ken paggiddiatan ti Modulo:Pagbaliwen/datos ken /pagipadasan

Pormat ti tabla[urnosen ti taudan]

Pormat[urnosen ti taudan]

Ti eskritu a mangbasa daytoy a panid ket saan a mangikaskaso kadagiti amin malaksid para iti testo ti wiki kadagiti sumaganad a paset:

== Conversions ==
== Input multiples ==
== Output multiples ==
== Combinations ==
== Defaults ==
== Links ==
== Overrides ==

Kadagiti a paset, ti agpang-3 a paulo (kasla iti === Length ===) ket mangirugi ti tabla a mangipalawag kadagiti unit iti naisangayan a kita. Iti subpaset, dagiti linia ket mangrugi iti | ket maproseso (dagiti sabali a linia, ken dagiti linia a mangrugi iti |- or |}, ket di maikaskaso). Ti maproseso a linia ket magudua kadagiti pagikabilan (delimitado iti ||), ken ti umuna/maudi a espasio a puraw ket maikkat manipud ti tunggal maysa a pagikabilan. Dagiti awan linaon a pagikabilan iti paset dagiti Pangibaliw ket maikkan ti kasisigud a pateg.

Ti maikadua a pagikabilan iti tunggal maysa nga aray dagiti paset ti Pangibaliw ket kadawyan a manginagan ti simbolo ti unit, ngem mabalin pay a mausar kadagiti sabali a panggep a mangipalawag iti sumaganad. Kadagiti dadduma a kaso ti testo iti maikadua a pagikabilan ket mabalin ng aatiddog unay, ken nasayaat daytoy nga isengngat ti colspan="11" | sakbay ti testo tapno maliklikan ti oanagbalkot iti akikid a batong. Ti amniaman a colspan iti rugi ti maikadua a pagikabilan ket saan a maikaskaso.

Alias[urnosen ti taudan]

Some unit codes are an alias for another spelling of the unit code. For example, the code ft2 is an alias for sqft, and that is indicated by entering =sqft in the Symbol column for the ft2 entry. An alias can only be entered after the primary unit has been defined (the sqft entry must precede the ft2 entry).

Normally there are no other entries on an alias line, however, the following may be used:

  • default = unit code to specify that the alias has a default output that is different from the primary unit
  • link = link text to specify that the alias has a link that is different from the primary unit
  • multiplier = number used as "multiplier = 100" with unit code 100km to define a unit that is 100 times the size of a kilometre
  • sp=us (or sp = us) to specify that using the alias forces US spelling for that unit
  • symbol = symbol text to specify that the alias has a symbol that is different from the primary unit
  • symlink = link text to specify that the alias has a different link when abbreviated ("symbol link")

Per units[urnosen ti taudan]

A unit can be defined as a ratio of two other units. For example, L/km can be defined as "litres per kilometer" by entering ==L/km as the symbol for the unit. A single "=" is used with an alias to specify that a unit code is an alternative name for another unit. By contrast, if "==" is used, the unit code is defined as the first unit "per" the second.

As well as a ratio of two units, a per unit can be of the form "currency per unit". The module recognizes "$" and "£" as currency symbols and shows them appropriately. For example, the input |120|$/acre would be displayed as "$120 per acre", or "$120/acre" if abbreviated.

The definition for a per unit can be followed by the same modifiers available for an alias.

Should be[urnosen ti taudan]

Some unit codes should not be used—if such a code is used, the template displays an error message telling the editor what unit code should be entered. For example, the code feet should not be used, and that is indicated by entering !Message in the Symbol column for the feet entry. There should be no other entries on an error line. The Message text is displayed as an error if feet is used in a conversion. The text should use the special format codes %{ and %} on each side of a unit code. The format codes are replaced with wikitext defined in Modulo:Pagbaliwen, and which applies a consistent style to each displayed unit code.

Use name[urnosen ti taudan]

Some units generally use their name, rather than a symbol. That is indicated by inserting ~ before the symbol. For example, the code acre has symbol ~acre which means results will use the singular name "acre", or the plural name "acres", depending on the value.

Use unit code for default[urnosen ti taudan]

Some units have a symbol prefixed with *, for example, the symbol given for pitch is *µm. Normally, when units are looked up in the Defaults or Links exception tables, the symbol of the unit is used. However, pitch has a symbol that conflicts with micrometre. The * prefix means that the unit code for pitch is used to look up exceptions, not the symbol.

SI prefixes[urnosen ti taudan]

The prefix column should be empty if SI prefixes are not used, or should be SI for a normal unit that accepts SI prefixes. Unit m2 should have prefix SI2 so that, for example, km2 will be regarded as 1000 × 1000 of the m2 base unit. Similarly, unit m3 should have prefix SI3.

Name[urnosen ti taudan]

The name of the unit is required. The plural name is optional. If no plural name is given, it is created by appending "s" to the singular name. For example, the ft unit has name "foot" and plural name "feet"—the plural name is necessary to avoid the plural of "foot" being "foots".

The US name is optional. If no US name is given, it is the same as the normal name. The US plural name is optional—if it is missing it is created by appending "s" to the US name. When using {{tl|pagbaliwen}, the option |sp=us causes the US name to be displayed if a name is required for the convert.

Any %s in the name columns is replaced with the appropriate SI prefix, or is removed if SI prefixes are not appropriate (not suitable for the unit, or not used in the conversion). It is only necessary to use %s if the unit accepts prefixes, and if the prefix is not at the start of the unit's name, for example with m2 and m3.

Exceptions[urnosen ti taudan]

Spelling exceptions can be handled by entering a row with the exception. For example, see ha which sets the unit name to "hectare"; without that row, the a row would cause ha to have the name "hectoare". There must be an override to document that an exception is intended.

Scale[urnosen ti taudan]

The scale is a value or expression that is used as a factor to convert a value to its corresponding base unit. Commas may be used as a thousand separator.

Extra[urnosen ti taudan]

The Extra column is usually empty, but can contain a value or code when more than a simple Scale is required for a conversion. There are two codes used with fuel efficiency units: volume/length and length/volume. In addition, certain codes are required to indicate that the conversion procedure for the unit is built-in to the module. Any other text is used as an offset in the conversion calculation that occurs with temperature units.

Built-in units[urnosen ti taudan]

The conversion procedure for some units (for example, the Mach unit of speed) are built into Modulo:Pagbaliwen as they are too complex to be specified in a table. That is indicated by entering a code (which must be the same as used in the module) in the Extra column.

The script that reads this page contains a small amount of built-in data that does not conveniently fit into the tables below (see set_builtins in makeunits).

Default[urnosen ti taudan]

A default is a code for a unit or combination that identifies the output unit or units that will be used if none is specified in the convert template. The Defaults section defines exceptions for unit codes with an SI prefix, where the default output is different from that of the base unit. Also, units using engineering notation may appear in the defaults section to define a default output for the unit.

A default may specify a unit code or an expression that tests the input value, and which produces one of two different outputs depending on that value. In the expression, v represents the input value specified in the convert template, and exclamation marks (!) are used to separate the expression into either three or four fields. For example, the following expression might be used as the default for unit in (inch):

v < 36 ! mm ! cm

The first field is a condition which evaluates to true or false. In this example, if the input value is less than 36, the default output unit is mm; otherwise, it is cm.

If present, the fourth field is appended to the result. For example, the following expression might be used for unit Ml (megalitre):

v < 28.316846592 ! e3 ! e6 ! cuft

If the condition is true, the result is e3cuft; otherwise, it is e6cuft.

Composite[urnosen ti taudan]

A composite input unit consists of two standard units, where the second is a subdivision of the first. For example, |2|ft|6|in may be used to specify 2 feet 6 inches as the input unit in a conversion. See the Input multiples section.

Composites are defined in pairs, but any number of pairs can be used to specify an input. For example, given that ch is defined as a subdivision of mi, and that ft is a subdivision of ch, an input length could be specified as 1|mi|2|ch|3|ft. Also, with suitable pairs defined, an input length could be specified as 4|mi|3|yd|2|ft|1|in. There is no limit to the number of permitted subunits.

Multiple[urnosen ti taudan]

A multiple is a unit code that can be used as an output. For example, ftin is a multiple that results in a length being expressed in feet and inches. A multiple may have any number of components defined in the Output multiples section, where each component is a subdivision of the preceding unit.

Link[urnosen ti taudan]

The link column is the title of the article related to that unit. If the link is preceded with + or *, extra text will be inserted before the link, and the text shown by the link will be adjusted to omit a prefix of "US" or "U.S.", if present. For example, if a unit has the symbol "US gal" (or "U.S. gal"), and if the link is +[[Gallon]], then if the symbol is linked, it would appear as "US gal" ("US" and "gal" link to two different articles). If the link is *[[Galon]], it would appear as "U.S. gal".

Similarly, if the link is preceded with @, extra text will be inserted before the link, and the text shown by the link will be adjusted to omit a prefix of "imp" or "imperial", if present. For example, if a unit has the symbol "imp gal", and if the link is @[[Gallon]], then if the symbol is linked, it would appear as "imp gal" ("imp" and "gal" link two different articles).

The Links section defines exceptions for unit codes with an SI prefix, where the linked article is different from that of the base unit.

Pipe characters (|) in a table need to be encoded. For example, "[[Galon|gal]]" should be entered as "[[Galon&#124;gal]]". The script that reads this page replaces each &#124; with |.

Override[urnosen ti taudan]

Some unit codes match a unit with an SI prefix, and duplicate unit codes are not permitted. For example, Pa can be interpreted as "peta-are" which would prevent the pascal unit of pressure being defined after the are unit of area. However, listing Pa in the Overrides section means that the pascal unit can be defined, in which case peta-are will not be available.

Conventions[urnosen ti taudan]

Some unit codes are not intended to be used in a template, but are needed to define exceptions. For example, the code ft has link Kadapan (unit), but unit psi/ft needs ft to be linked to Fracture gradient. To handle such cases, a unit code starting with "-" is used (-ft-frac for feet with a link to fracture gradient).

If needed, more dashes can be used to define additional exceptions (for example, see -Scwt and --Scwt, which are similar to Scwt but have different names).

Engineering notation[urnosen ti taudan]

In addition to the units defined in the data below, large scale units such as e6km (million kilometres) may be used. The following prefixes may be used, and the linked names are shown if lk is on:

Any standard unit (not a combination, multiple, or built-in) may be used after an engineering notation prefix, including "temperature change" units, but not "temperature" units.

Notes on units[urnosen ti taudan]

Energy and torque[urnosen ti taudan]

By convention, units written as force-distance (such as lbft or kgf.m) are torque, and those written as distance-force (such as ftlbf) are energy. See WP:MOSNUM#Unit names and the discussion, and see Libra-kadapan (torque) and Libra-kadapan (enerhia).

However, some topics use traditional units that conflict with the above convention. To handle these, Modulo:pagbaliwen/makeunits includes a specials table that adds an "alttype" (alternate type) field to certain whitelisted units. The alttype field allows conversion between units of different type, provided each unit is whitelisted to allow the conversion.

As at December 2013, the following energy units have alttype = "torque" (the first line consists of different units, while the second line consists of aliases for units in the first line):

  • ftlb, ftlb-f, ftlbf, inlb, inlb-f, inlbf, inoz-f, inozf
  • ft.lbf, ft·lb-f, ft·lbf, in.lb-f, in.lbf, in.oz-f, in.ozf, in·lb-f, in·lbf, in·oz-f, in·ozf

The following torque units have alttype = "energy":

  • Nm
  • N.m, N·m

For example, the following conversion works despite the fact that Nm is torque and ftlbf is energy:

  • {{pagbaliwen|1|Nm|ftlbf}} → 1 newton-metro (0.74 ft⋅lbf)