Version 2 (modified by 10 years ago) ( diff ) | ,
---|
This tagchecker is considered to be the successor of the tagchecker.cfg
and uses much of the MapCSS implementation for stylesheets. The official extension for files is *.validator.mapcss
.
The main implementation ticket was #9414.
Syntax
selector { /* exactly one of */ throwError: "message"; throwWarning: "message"; throwOther: "message"; /* arbitrarily many of */ fixAdd: "key=val"; fixRemove: "key"; fixChangeKey: "old=>new"; suggestAlternative: "any text (e.g., alternative key)"; /* assertions for unit tests */ assertMatch: "node/way/relation key1=value1 keyN=valueN"; assertNoMatch: "node/way/relation key1=value1 keyN=valueN"; }
Some more details:
- The syntax of selectors is specified in #Selectors
- Alternatively to strings on the right hand side of those expressions, expressions are evaluated (see list+syntax)
- Most useful of all is tr() in order to have those strings translated (see below for an example;
{0}
,{1}
, … are placeholders for additional arguments)
- Most useful of all is tr() in order to have those strings translated (see below for an example;
- In addition, the placeholders
{i.key}
,{i.value}
,{i.tag}
are evaluated which refer to the corresponding i-th match condition - If at least one
fixAdd
/fixRemove
/fixChangeKey
is specified, those changes are executed when fixing presets matching this test - If
suggestAlternative
is/are present, those alternatives are displayed together with the test message
Examples
See *.mapcss
files in source:trunk/data/validator/ for the checks included in JOSM's core.
*[barrier=wire_fence] { throwWarning: tr("{0} is deprecated", "{0.tag}"); /* "{0.tag}" evaluates to "barrier=wire_fence" fixAdd: "barrier=fence"; fixAdd: "fence_type=chain_link"; assertMatch: "way barrier=wire_fence"; assertNoMatch: "way barrier=fence"; }
Attachments (1)
- testgroup.png (13.3 KB ) - added by 8 years ago.
Download all attachments as: .zip
Note:
See TracWiki
for help on using the wiki.