Ignore:
Timestamp:
2017-05-19T22:29:13+02:00 (7 years ago)
Author:
Klumbumbus
Message:

fix #14786 - Test for proper "ele" values (patch by naoliv)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/data/validator/numeric.mapcss

    r11640 r12215  
    218218  assertNoMatch: "node direction=anticlockwise"; /* both spellings are in use and even wiki uses both */
    219219}
     220
     221/* #14786 (should be safe to just remove the meters unit from the value) */
     222*[ele][ele =~ /^-?[0-9]+(\.[0-9]+)? ?m$/] {
     223  throwWarning: tr("{0} must be a numeric value, in meters and without units", "{0.key}");
     224  fixAdd: concat("ele=", trim(replace(tag("ele"), "m", "")));
     225  set .ele_is_fixable;
     226  assertMatch: "node ele=12m";
     227  assertMatch: "node ele=12 m";
     228  assertNoMatch: "node ele=12km";
     229  assertMatch: "node ele=12.1m";
     230  assertMatch: "node ele=-12.1 m";
     231  assertNoMatch: "node ele=12";
     232  assertNoMatch: "node ele=high";
     233}
     234*[ele][ele !~ /^-?[0-9]+(\.[0-9]+)?$/]!.ele_is_fixable{
     235  throwWarning: tr("{0} must be a numeric value, in meters and without units", "{0.key}");
     236  assertNoMatch: "node ele=12m";
     237  assertNoMatch: "node ele=12 m";
     238  assertMatch: "node ele=12km";
     239  assertNoMatch: "node ele=12.1m";
     240  assertNoMatch: "node ele=-12.1 m";
     241  assertNoMatch: "node ele=12";
     242  assertMatch: "node ele=high";
     243}
Note: See TracChangeset for help on using the changeset viewer.