Changeset 13345 in josm


Ignore:
Timestamp:
2018-01-20T17:44:51+01:00 (3 months ago)
Author:
Klumbumbus
Message:

see #15719 - provide autofix for replacing single comma by point for several numeric tags

File:
1 edited

Legend:

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

    r13343 r13345  
    1 /* measurement values and units warnings (ticket #8687) */
     1/* measurement values and units warnings (tickets #8687, #15719) */
    22
    33*[/^[0-9]+$/] {
     
    5555}
    5656
    57 *[height][height !~ /^(([0-9]+\.?[0-9]*( (m|ft))?)|([1-9][0-9]*\'((10|11|[0-9])((\.[0-9]+)?)\")?))$/] {
    58   throwWarning: tr("unusual value of {0}: meters is default; point is separator; if units, put space then unit", "{0.key}");
     57*[height][height =~ /^[0-9]+,[0-9]+( (m|ft))?$/] {
     58  throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
     59  fixAdd: concat("height=", replace(tag("height"), ",", "."));
     60  set height_separator_autofix;
     61  assertMatch: "node height=5,5";
     62  assertMatch: "node height=12,00";
     63  assertMatch: "node height=12,5 ft";
     64  assertNoMatch: "node height=3,50,5";
     65  assertNoMatch: "node height=3.5";
     66  assertNoMatch: "node height=4";
     67}
     68*[height][height !~ /^(([0-9]+\.?[0-9]*( (m|ft))?)|([1-9][0-9]*\'((10|11|[0-9])((\.[0-9]+)?)\")?))$/]!.height_separator_autofix {
     69  throwWarning: tr("unusual value of {0}: meters is default; point is decimal separator; if units, put space then unit", "{0.key}");
    5970  assertMatch: "node height=medium";
    6071  assertMatch: "node height=-5";
     
    6677}
    6778
    68 *[maxheight][maxheight !~ /^(([1-9][0-9]*(\.[0-9]+)?( (m|ft))?)|([0-9]+\'(([0-9]|10|11)(\.[0-9]*)?\")?)|none|default)$/] {
    69   throwWarning: tr("unusual value of {0}: meters is default; point is separator; if units, put space then unit", "{0.key}");
     79*[maxheight][maxheight =~ /^[0-9]+,[0-9]+( (m|ft))?$/] {
     80  throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
     81  fixAdd: concat("maxheight=", replace(tag("maxheight"), ",", "."));
     82  set maxheight_separator_autofix;
     83  assertMatch: "node maxheight=5,5";
     84  assertMatch: "node maxheight=12,00";
     85  assertMatch: "node maxheight=12,5 ft";
     86  assertNoMatch: "node maxheight=3,50,5";
     87  assertNoMatch: "node maxheight=3.5";
     88  assertNoMatch: "node maxheight=4";
     89}
     90*[maxheight][maxheight !~ /^(([1-9][0-9]*(\.[0-9]+)?( (m|ft))?)|([0-9]+\'(([0-9]|10|11)(\.[0-9]*)?\")?)|none|default)$/]!.maxheight_separator_autofix {
     91  throwWarning: tr("unusual value of {0}: meters is default; point is decimal separator; if units, put space then unit", "{0.key}");
    7092  assertMatch: "node maxheight=something";
    7193  assertMatch: "node maxheight=-5";
     
    79101}
    80102
    81 way[width][width !~ /^(([0-9]+\.?[0-9]*( [a-z]+)?)|([0-9]+\'([0-9]+\.?[0-9]*\")?))$/] {
    82   throwWarning: tr("unusual value of {0}: meters is default; point is separator; if units, put space then unit", "{0.key}");
     103*[width][width =~ /^[0-9]+,[0-9]+$/] {
     104  throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
     105  fixAdd: concat("width=", replace(tag("width"), ",", "."));
     106  set width_separator_autofix;
     107  assertMatch: "node width=5,5";
     108  assertMatch: "node width=12,00";
     109  assertNoMatch: "node width=3,50,5";
     110  assertNoMatch: "node width=3.5";
     111  assertNoMatch: "node width=4";
     112}
     113*[width][width !~ /^(([0-9]+\.?[0-9]*( [a-z]+)?)|([0-9]+\'([0-9]+\.?[0-9]*\")?))$/]!.width_separator_autofix {
     114  throwWarning: tr("unusual value of {0}: meters is default; point is decimal separator; if units, put space then unit", "{0.key}");
    83115  assertMatch: "way width=something";
    84116  assertMatch: "way width=-5";
     
    91123}
    92124
    93 *[maxwidth][maxwidth !~ /^(([0-9]+\.?[0-9]*( (m|ft))?)|([0-9]+\'[0-9]+\.?[0-9]*\"))$/] {
    94   throwWarning: tr("unusual value of {0}: meters is default; point is separator; if units, put space then unit", "{0.key}");
     125*[maxwidth][maxwidth =~ /^[0-9]+,[0-9]+( (m|ft))?$/] {
     126  throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
     127  fixAdd: concat("maxwidth=", replace(tag("maxwidth"), ",", "."));
     128  set maxwidth_separator_autofix;
     129  assertMatch: "node maxwidth=5,5";
     130  assertMatch: "node maxwidth=12,00";
     131  assertNoMatch: "node maxwidth=3,50,5";
     132  assertNoMatch: "node maxwidth=3.5";
     133  assertNoMatch: "node maxwidth=4";
     134}
     135*[maxwidth][maxwidth !~ /^(([0-9]+\.?[0-9]*( (m|ft))?)|([0-9]+\'[0-9]+\.?[0-9]*\"))$/]!.maxwidth_separator_autofix {
     136  throwWarning: tr("unusual value of {0}: meters is default; point is decimal separator; if units, put space then unit", "{0.key}");
    95137  assertMatch: "way maxwidth=something";
    96138  assertMatch: "way maxwidth=-5";
     
    100142  assertNoMatch: "way maxwidth=7 ft";
    101143}
    102 *[maxweight][maxweight !~ /^(([0-9]+\.?[0-9]*( (t|kg|lbs))?)|([0-9]+\'[0-9]+\.?[0-9]*\"))$/] {
    103   throwWarning: tr("unusual value of {0}: tonne is default; point is separator; if units, put space then unit", "{0.key}");
     144
     145*[maxweight][maxweight =~ /^[0-9]+,[0-9]+( (t|kg|lbs))?$/] {
     146  throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
     147  fixAdd: concat("maxweight=", replace(tag("maxweight"), ",", "."));
     148  set maxweight_separator_autofix;
     149  assertMatch: "node maxweight=5,5";
     150  assertMatch: "node maxweight=12,00";
     151  assertNoMatch: "node maxweight=3,50,5";
     152  assertNoMatch: "node maxweight=3.5";
     153  assertNoMatch: "node maxweight=4";
     154}
     155*[maxweight][maxweight !~ /^(([0-9]+\.?[0-9]*( (t|kg|lbs))?)|([0-9]+\'[0-9]+\.?[0-9]*\"))$/]!.maxweight_separator_autofix {
     156  throwWarning: tr("unusual value of {0}: tonne is default; point is decimal separator; if units, put space then unit", "{0.key}");
    104157  assertMatch: "way maxweight=something";
    105158  assertMatch: "way maxweight=-5";
     
    109162  assertNoMatch: "way maxweight=7 kg";
    110163}
     164
    111165way[maxspeed][maxspeed !~ /^(signals|none|unposted|variable|walk|[1-9][0-9]*( [a-z]+)?|[A-Z][A-Z]:(urban|rural|living_street|motorway))$/],
    112166way[maxspeed:forward][maxspeed:forward !~ /^(signals|none|unposted|variable|walk|[1-9][0-9]*( [a-z]+)?|[A-Z][A-Z]:(urban|rural|living_street|motorway))$/],
     
    127181}
    128182
    129 *[distance][distance !~ /^(([0-9]+\.?[0-9]*( (m|km|mi|nmi))?)|([0-9]+\'[0-9]+\.?[0-9]*\"))$/] {
    130   throwWarning: tr("unusual value of {0}: kilometers is default; point is separator; if units, put space then unit", "{0.key}");
     183*[distance][distance =~ /^[0-9]+,[0-9]+( (m|km|mi|nmi))?$/] {
     184  throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
     185  fixAdd: concat("distance=", replace(tag("distance"), ",", "."));
     186  set distance_separator_autofix;
     187  assertMatch: "node distance=5,5";
     188  assertMatch: "node distance=12,00";
     189  assertNoMatch: "node distance=3,50,5";
     190  assertNoMatch: "node distance=3.5";
     191  assertNoMatch: "node distance=4";
     192}
     193*[distance][distance !~ /^(([0-9]+\.?[0-9]*( (m|km|mi|nmi))?)|([0-9]+\'[0-9]+\.?[0-9]*\"))$/]!.distance_separator_autofix {
     194  throwWarning: tr("unusual value of {0}: kilometers is default; point is decimal separator; if units, put space then unit", "{0.key}");
    131195  assertMatch: "way distance=something";
    132196  assertMatch: "way distance=-5";
     
    244308  throwWarning: tr("{0} must be a numeric value, in meters and without units", "{0.key}");
    245309  fixAdd: concat("ele=", trim(replace(tag("ele"), "m", "")));
    246   set .ele_is_fixable;
     310  set ele_meter_remove_autofix;
    247311  assertMatch: "node ele=12m";
    248312  assertMatch: "node ele=12 m";
     
    253317  assertNoMatch: "node ele=high";
    254318}
    255 *[ele][ele !~ /^-?[0-9]+(\.[0-9]+)?$/]!.ele_is_fixable{
     319*[ele][ele =~ /^[0-9]+,[0-9]+$/] {
     320  throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
     321  fixAdd: concat("ele=", replace(tag("ele"), ",", "."));
     322  set ele_separator_autofix;
     323  assertMatch: "node ele=5,5";
     324  assertMatch: "node ele=12,00";
     325  assertNoMatch: "node ele=3,50,5";
     326  assertNoMatch: "node ele=3.5";
     327  assertNoMatch: "node ele=4";
     328}
     329*[ele][ele !~ /^-?[0-9]+(\.[0-9]+)?$/]!.ele_meter_remove_autofix!.ele_separator_autofix{
    256330  throwWarning: tr("{0} must be a numeric value, in meters and without units", "{0.key}");
    257331  assertNoMatch: "node ele=12m";
Note: See TracChangeset for help on using the changeset viewer.