Ignore:
Timestamp:
2023-05-16T23:30:39+02:00 (3 years ago)
Author:
taylor.smock
Message:

Fix #21286: Add validator rule for min_height < height (patch by skyper, modified)

This additionally fixes an error introduced in r18730.

File:
1 edited

Legend:

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

    r18535 r18731  
    298298  assertNoMatch: "node width=10'5\"";
    299299  assertNoMatch: "node width=10'";
     300}
     301
     302*[min_height][min_height =~ /^-?[0-9]+(\.[0-9]+)?(( )*(metre|metres|meter|meters|Metre|Metres|Meter|Meters)|m)$/] {
     303  throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}");
     304  fixAdd: concat("min_height=", get(regexp_match("(-?[0-9.]+)( )*(.+)",tag("min_height")),1)," m");
     305  set min_height_meter_autofix;
     306  assertMatch: "node min_height=6.78 meters";
     307  assertMatch: "node min_height=5  metre";
     308  assertMatch: "node min_height=2m";
     309  assertNoMatch: "node min_height=2 m";
     310  assertNoMatch: "node min_height=5";
     311}
     312*[min_height][min_height =~ /^-?[0-9]+,[0-9][0-9]?( m|\')?$/] {
     313  throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
     314  fixAdd: concat("min_height=", replace(tag("min_height"), ",", "."));
     315  set min_height_separator_autofix;
     316  assertMatch: "node min_height=5,5";
     317  assertMatch: "node min_height=12,00";
     318  assertMatch: "node min_height=12,5'";
     319  assertNoMatch: "node min_height=12,000";
     320  assertNoMatch: "node min_height=3,50,5";
     321  assertNoMatch: "node min_height=3.5";
     322  assertNoMatch: "node min_height=4";
     323}
     324*[min_height ][min_height  !~ /^(-?([0-9]+(\.[0-9]+)?( m)?)|(-?[1-9][0-9]*\'((10|11|[0-9])((\.[0-9]+)?)\")?))$/]!.min_height_separator_autofix!.min_height_meter_autofix!.min_height_foot_autofix {
     325  throwWarning: tr("unusual value of {0}: {1} is default; point is decimal separator; if units, put space then unit", "{0.key}", tr("meters"));
     326  assertMatch: "node min_height=\"12. m\"";
     327  assertNoMatch: "node min_height=-5";
    300328}
    301329
Note: See TracChangeset for help on using the changeset viewer.