Changeset 13357 in josm for trunk


Ignore:
Timestamp:
2018-01-26T22:34:54+01:00 (7 years ago)
Author:
Klumbumbus
Message:

fix #15719 - restrict comma autofix to max. 2 decimal places to avoid false fixes of thousands separators

File:
1 edited

Legend:

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

    r13349 r13357  
    5555}
    5656
    57 *[height][height =~ /^[0-9]+,[0-9]+( (m|ft))?$/] {
     57*[height][height =~ /^[0-9]+,[0-9][0-9]?( (m|ft))?$/] {
    5858  throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
    5959  fixAdd: concat("height=", replace(tag("height"), ",", "."));
     
    6262  assertMatch: "node height=12,00";
    6363  assertMatch: "node height=12,5 ft";
     64  assertNoMatch: "node height=12,000";
    6465  assertNoMatch: "node height=3,50,5";
    6566  assertNoMatch: "node height=3.5";
     
    7778}
    7879
    79 *[maxheight][maxheight =~ /^[0-9]+,[0-9]+( (m|ft))?$/] {
     80*[maxheight][maxheight =~ /^[0-9]+,[0-9][0-9]?( (m|ft))?$/] {
    8081  throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
    8182  fixAdd: concat("maxheight=", replace(tag("maxheight"), ",", "."));
     
    8485  assertMatch: "node maxheight=12,00";
    8586  assertMatch: "node maxheight=12,5 ft";
     87  assertNoMatch: "node maxheight=12,000";
    8688  assertNoMatch: "node maxheight=3,50,5";
    8789  assertNoMatch: "node maxheight=3.5";
     
    101103}
    102104
    103 *[width][width =~ /^[0-9]+,[0-9]+( (m|ft))?$/] {
     105*[width][width =~ /^[0-9]+,[0-9][0-9]?( (m|ft))?$/] {
    104106  throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
    105107  fixAdd: concat("width=", replace(tag("width"), ",", "."));
     
    107109  assertMatch: "node width=5,5";
    108110  assertMatch: "node width=12,00";
     111  assertNoMatch: "node width=12,000";
    109112  assertNoMatch: "node width=3,50,5";
    110113  assertNoMatch: "node width=3.5";
     
    123126}
    124127
    125 *[maxwidth][maxwidth =~ /^[0-9]+,[0-9]+( (m|ft))?$/] {
     128*[maxwidth][maxwidth =~ /^[0-9]+,[0-9][0-9]?( (m|ft))?$/] {
    126129  throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
    127130  fixAdd: concat("maxwidth=", replace(tag("maxwidth"), ",", "."));
     
    129132  assertMatch: "node maxwidth=5,5";
    130133  assertMatch: "node maxwidth=12,00";
     134  assertNoMatch: "node maxwidth=12,000";
    131135  assertNoMatch: "node maxwidth=3,50,5";
    132136  assertNoMatch: "node maxwidth=3.5";
     
    143147}
    144148
    145 *[maxweight][maxweight =~ /^[0-9]+,[0-9]+( (t|kg|lbs))?$/] {
     149*[maxweight][maxweight =~ /^[0-9]+,[0-9][0-9]?( (t|kg|lbs))?$/] {
    146150  throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
    147151  fixAdd: concat("maxweight=", replace(tag("maxweight"), ",", "."));
     
    149153  assertMatch: "node maxweight=5,5";
    150154  assertMatch: "node maxweight=12,00";
     155  assertNoMatch: "node maxweight=12,000";
    151156  assertNoMatch: "node maxweight=3,50,5";
    152157  assertNoMatch: "node maxweight=3.5";
     
    181186}
    182187
    183 *[distance][distance =~ /^[0-9]+,[0-9]+( (m|km|mi|nmi))?$/] {
     188*[distance][distance =~ /^[0-9]+,[0-9][0-9]?( (m|km|mi|nmi))?$/] {
    184189  throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
    185190  fixAdd: concat("distance=", replace(tag("distance"), ",", "."));
     
    187192  assertMatch: "node distance=5,5";
    188193  assertMatch: "node distance=12,00";
     194  assertNoMatch: "node distance=12,000";
    189195  assertNoMatch: "node distance=3,50,5";
    190196  assertNoMatch: "node distance=3.5";
     
    317323  assertNoMatch: "node ele=high";
    318324}
    319 *[ele][ele =~ /^[0-9]+,[0-9]+$/] {
     325*[ele][ele =~ /^[0-9]+,[0-9][0-9]?$/] {
    320326  throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
    321327  fixAdd: concat("ele=", replace(tag("ele"), ",", "."));
     
    323329  assertMatch: "node ele=5,5";
    324330  assertMatch: "node ele=12,00";
     331  assertNoMatch: "node ele=8,848"; /* wrongly used thousands separator */
    325332  assertNoMatch: "node ele=3,50,5";
    326333  assertNoMatch: "node ele=3.5";
Note: See TracChangeset for help on using the changeset viewer.