Template:DescriptionCategories: Difference between revisions

From OpenStreetMap Wiki
Jump to navigation Jump to search
(add sort={{{type|}}}{{{key|}}}{{{value|}}} to {{DescriptionCategory|cat=Obsolete image file naming)
(Category:Mismatched image works properly now, this isn't needed for anything and it generates unnecessary traffic)
Line 111: Line 111:
}}<!--
}}<!--


# Add Category:Obsolete image file naming
Check if image is specified with "Image:" instead of "File:"
-->{{#if:{{{image|}}}
|{{#ifeq:{{lc:{{#explode:{{{image|}}}|:|0}}}}|image|<!--
if image file starts with Image: -->{{DescriptionCategory|cat=Obsolete image file naming|sort={{{type|}}}{{{key|}}}{{{value|}}}|debug={{{debug|}}} }}
}}
}}<!--


#Language-specific categories to collect ALL pages that use the template in a specific category.
#Language-specific categories to collect ALL pages that use the template in a specific category.

Revision as of 21:28, 9 September 2023

[Edit] [Purge] Template-info.svg Template documentation

This template adds appropriate category links to a feature description page. Category links are generated on a per-language basis according to the information found in Template:DescriptionCategoriesLang

Usage

Full parameter set in vertical format
Vertical list Prerequisites Brief instructions / notes
{{DescriptionCategories
| type  = 
| key   = 
| prefix =
| suffix =
| value = 
| group = 
| status =
| debug = 
}}
 
required
required for type=key or type=value
required for type=key-prefix
required for type=key-suffix
required for type=value or type=relation
only for type = key, key-prefix or key-suffix
optional (default is unspecified)
only in this doc page
 
 
key, key-prefix, key-suffix, value or relation
no language prefix, same key as in tag stored in OSM data
no language prefix, no ":*"
no language prefix, no "*:"
same value as in tag stored in OSM data

unspecified, proposed, approved, defacto, obsolete
don't use debug in articles
 
  • If a field name is listed in the Prerequisites column it is a prerequisite for the field to the left.

Parameters

The following parameters are recognised:

  • type: set to key to add categories appropriate to a single key; set to value to add categories appropriate to a key/value pair.
  • key: the key being described by type=key or type=value, otherwise ignored for type=relation where key=type implicitly.
  • value: if type=value or type=relation, the value being described, otherwise ignored for type=key.
  • group: the name of a feature (a feature frequently groups several related key names, and/or some tags with specific values).
  • status: the usage status of a feature (unspecified, proposed, in use, de facto, approved, obsolete...), the default is unspecified.
  • debug: if set to yes, display a list of categories, rather than adding them to the page (example on this doc page).

Languages

The language-specific information is stored in a separate template:Template:DescriptionCategoriesLang

Examples

If you want to test one of these examples in a different language, just copy it into the Template Expander and enter a correctly prefixed (e.g. "DE:" or "Pl:") page title in the "Context title" line.

See these examples in čeština, Deutsch, español, français, polski.

This wikitext… …adds the page to these categories
{{DescriptionCategories
| type          = key
| key           = highway
| group         = transport
| status        = approved
}}
{{DescriptionCategories
| type          = key
| key           = highway
| status        = approved
}}
  • (debug) [[:Category:]]
{{DescriptionCategories
| type          = value
| key           = highway
| value         = service
| status        = approved
}}
  • (debug) [[:Category:]]
{{DescriptionCategories
| type          = value
| key           = amenity
| value         = fountain
| status        = proposed
}}
  • (debug) [[:Category:]]
{{DescriptionCategories
| type          = key
| key           = tunnel
| group         = placement
| status        = approved
}}
{{DescriptionCategories
| type          = key-prefix
| prefix        = addr
| group         = addresses
| status        = de facto
}}
{{DescriptionCategories
| type          = key-suffix
| suffix        = conditional
| group         = restrictions
| status        = approved
}}

See also