Taginfo/Parsing the Wiki

From OpenStreetMap Wiki
Jump to navigation Jump to search

Taginfo Parsing the Wiki

Taginfo needs information from the wiki, for instance the description of keys and tags. For this end, it gets a list of all pages starting with Key:, Tag:, and Relation: as well as their language equivalents starting with a language code and then :Key:, :Tag:, or :Relation:. It parses all those pages and finds the info box on the right created by the KeyDescription, ValueDescription, or RelationDescription templates and takes the information out of those templates.

This process is not without problems. The wiki can contain basically anything, and sometimes it happens that something that looks fine on the wiki page is not correctly understood by the taginfo wiki page parser. In some cases that is a bug in the parser and we can fix it, but making Taginfo understand everything the Wiki can understand is just not possible, it would be far too much work. So we have to occasionally live with some simplifications. And sometimes those templates change and nobody thought about telling the taginfo maintainers, so something breaks.

Problem reports from taginfo

When taginfo is trying to make sense out of the wiki, it will report on many things it can't understand. Sometimes this is taginfos fault, but often this is something that is not correct in the wiki and can be fixed there. You can see the report on this taginfo page. The report will be regenerated every night when taginfo does its update run. The reports in this form are rather new and can be considered beta. Tell us if you don't understand something or think a report is wrong.

Here are some of the problem reports you will see and what they mean:

description parameter should only contain plain text

The description parameter containing the short description of this key, tag, or relation type should only contain plain text, not wiki syntax. This is important so that taginfo, but also other software outside the wiki, can use this text properly.

has positional parameter

In general, wiki templates can have positional parameters and named parameters. The description templates only use named parameters. When you see this error, it usually means that the taginfo parser got confused. This can be the result of using wiki syntax in parameters that shouldn't have wiki syntax. Try to clean up the template parameters.

image/osmcarto-rendering parameter empty

The image or osmcarto-rendering parameter in the description template is empty. It should contains an image file name.

invalid image/osmcarto-rendering parameter

The image or osmcarto-rendering parameter in the description template has the wrong format. Usually it should be something like Image:name.jpg or File:name.png.

wrong lang format

The language in the wiki page name should be a valid BCP47 language code, usually of the format xx (for instance de for the German language), or xx-xx (for instance pt-br for Brazilian Portuguese), or xx-xxxx (for instance zh-hans for the Chinese language in its Simplified script). Capitalization doesn't matter for TagInfo, however underscores (valid in BCP47) should not be used (use equivalent hyphens instead).

invalid lang parameter

The lang parameter of the RelatedTerm and Wikipedia templates should be empty or have the BCP47 format (but converted to lowercase only on this wiki and in OSM tags, and using only hyphens and no underscores), usually xx (for example de for the German language) or xx-xx (for example pt-br for Brazilian Portuguese, but note that all pages previously using "Pt-br:" prefixes on this wiki are now redirected to "Pt:") or xx-xxxxxx (for example zh-hans for Simplified Chinese). Taginfo doesn't always correctly detect this.

Note that for legacy or technical reasons, language codes used in article names on this wiki for prefixing their title have their initial letter in uppercase (because this initial is not case-sensitive, it is implicitly converted to uppercase). As well 7 article namespaces are using capitals only: DE, ES, FR, IT, JA, NL, RU (and only these 7 languages that have their own dedicated namespace for their articles and talk pages; note that these namespaces are still case-insensitive in links, but not in "Category:" and "Template:" namespaces, where the language codes used for these languages are not namespaces but prefixes whose only the 1st letter is case-insensitive and must still be written consistantly with capitals to avoid creating and maintaining lots of redirecting pages).

This does not means that OSM data or or Wikidata should use capitals in their language codes, or in codes passed in various "lang=" parameters of templates for this wiki.

And for legacy reasons interwiki links for going to some Wikipedia editions still use legacy non conforming codes (in their current subdomain names) that should not be used for naming pages on this wiki or in Wikidata and OSM data (such as "en-simple", "roa-rup", "zh-classical", only valid for links to Wikimedia sites), or valid but deprecated codes (such as "zh-yue" to be replaced by the preferred code "yue"), or conforming but incorrect codes (such as "nrm", to be replaced by "nrf"): these codes are slowly being migrated by Wikimedia to use standard codes (and will thn become only local redirected aliases).

Finally note that Wikipedia uses a single interwiki language code (and domain name) for unifying multiple script used in the same language, only because it locally supports an automated transliterator, allowing its visitors to select their prefered form (This is the case for example with Chinese, Serbian, Kurdish, and a few other languages). But the OSM wiki (as well as many other sites) does not support this transliterator, so script codes are permitted (and even recommended) in this wiki for correct distinction of contents (even if this duplicates the editing and maintenance work by translators).

As well, this wiki implements some language fallbacks when a translation is not found in a language but another "convenient" language may still be useful and will likely be understood, instead of linking necessarily to the English version (for example a Catalan page may link first to an Spanish page before falling back to English).

lang is en

Sometimes pages are named En:Key:..., En:Tag:..., or En::Relation:.... But the language en is the default. The name should just be Key:..., etc.

In most cases, these pages are now redirecting to the names without the prefix (this is already effective for all "Tag:" and "Key:" description pages).
But still not in all other pages for specific local projects that were first created and still maintained in another default language than English, a conversion is still ongoing to have them redirected to pages explictly prefixed, because it allows the navigation bar to work properly and still allows creating and linking to at a least a basic introducting English version, but it will take time to convert some legacy links in those specific pages).

invalid value for ... parameter

The onNode, onWay, onArea, and onRelation parameters can only be set to yes or no.

multiple values for ... parameter

The named description template parameter appears multiple times in the template. This is not allowed for most parameters.

no value for tag page

All tag pages, ie pages of the form (lang:)Tag:... must have a complete tag in the name with the key and value separated by an equals sign, for instance Tag:highway=residential. If no equal sign is detected (for instance Tag:highway) this message is shown. If something only has a key, it should be a "key" page (for instance Key:highway).

parsing failed

This is a general "I give up" message. It means taginfo can't figure out what exactly is wrong.

slash in key/value

The forward slash (/) should not be used in keys or values. This sometimes happens if there are sub-pages in the wiki. Taginfo ignores those pages.

value in key page

All key pages, ie pages of the form (lang:)Key:... must have only the key in the name with no value and no equals sign, for instance Key:highway. If an equal sign is detected (for instance Key:highway=residential) this message is shown. If something also has a value, it should be a "tag" page (for instance Tag:highway=residential).

wikidata parameter does not match Q###

The wikidata parameter in the description template should always have the form Q and then a number.