Module:Tag/doc

From OpenStreetMap Wiki
Jump to navigation Jump to search

Usage

Utilities related to OSM tags.

A number of testcases verify the correctness of these functions. Run the unit tests.

key

Returns a human-readable reference to a key.

Parameters:

|1 =
The name of a key.
|subkey = (|subkey1 =), |subkey2 =, |subkey3 =, etc.
The name of each successive subkey. A subkey is separated by a semicolon and links to the key description page of the base key.
|: =, |:: =, |::: =, etc.
The name of each successive key component. A key component is separated by a semicolon and links to a key description page specifically about the key component.
|kl =, |kl: =, |kl:: =, etc.
The language code of the page to link each successive key component. |kl = determines the link for |1 =, |kl: = for |: =, and so on. If the language is unspecified, the key component is linked to the page in the same language as the page that transcludes this template, falling back to English.
|lang =
The language code of all the link targets. If the language is unspecified, each link points to the page in the same language as the page that transcludes this template, falling back to English.

value

Returns a human-readable reference to a tag value.

Parameters:

|key = or |1 =
The name of a key.
|value =
A tag value, which will be linked or unlinked depending on the value of |link =.
|link =
Determines the link target of the link that this template outputs:
|link = key
Links to the key's description page.
|link = key#
Links to a named anchor on the key's description page in the form key-value.
|link = value
Links to the value's description page.
|link = none
No link.
|2 =
A tag value to be linked to a value description page. Use this parameter or the combination of |link = value and |value = for any value of an enumeration-typed key.
|3 =
A tag value to be linked to the key's description page. Use this parameter or the combination of |link = key# and |value = for any value of an enumeration-typed key that is specifically documented on the key's description page.
|4 =
An unlinked tag value. Use this parameter and leave |2 = and |3 = blank, or combine |link = key with |value =, for any value of a key that is not specifically documented anywhere. Alternatively, this parameter and leave |2 = and |3 = blank, or combine |link = none with |value =, for any value of a key that holds freeform text, a URL, or more complex syntax.
|lang = or |kl =
The language code of the link target. If the language is unspecified, the key component is linked to the page in the same language as the page that transcludes this template, falling back to English.

tag

Returns a human-readable reference to a key or key-value pair using key=value syntax.

Parameters:

|1 =
The name of a key.
|subkey = (|subkey1 =), |subkey2 =, |subkey3 =, etc.
The name of each successive subkey. A subkey is separated by a semicolon and links to the key description page of the base key.
|: =, |:: =, |::: =, etc.
The name of each successive key component. A key component is separated by a semicolon and links to a key description page specifically about the key component.
|kl =, |kl: =, |kl:: =, etc.
The language code of the page to link each successive key component. |kl = determines the link for |1 =, |kl: = for |: =, and so on. If the language is unspecified, the key component is linked to the page in the same language as the page that transcludes this template, falling back to English.
|2 =, |; = (|subval =), |;; = (|subval2 =), etc.
Tag values separated by semicolons. Each value is linked to a value description page. Use these parameters for any value of an enumeration-typed key.
|vl =, |vl2 =, |vl3 =, etc.
The language code of the page to link each successive value. |vl = determines the link for |2 =, |vl2 = for |; = or |subval =, |vl3 = for |;; = or |subval2 =, and so on. If the language is unspecified, the value is linked to the page in the same language as the page that transcludes this template, falling back to English.
|3 =
A tag value. The value is unlinked. Use this parameter and leave |2 = blank for any value of a key that holds freeform text, a URL, or more complex syntax, or for explanatory placeholder text. A value of *:wikipedia=*, *:wikidata=*, *:wikimedia_commons=*, *:url=*, or *:website=* is linked to the referenced URL.
|lang =
The language code of all the link targets. If the language is unspecified, each link points to the page in the same language as the page that transcludes this template, falling back to English.

keyComponentList

Returns an unordered list of key components that form the given key. Each key component is annotated with its description from the associated data item, if available.

Parameters:

|1 =
The key to split into components.
|intro =
Introductory text to insert before the list.

See also