Changeset 14057 in josm


Ignore:
Timestamp:
2018-07-28T01:16:04+02:00 (6 years ago)
Author:
Don-vip
Message:

fix #16495 - make wikipedia validation rules case insensitive

File:
1 edited

Legend:

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

    r12415 r14057  
    4949*[wikipedia =~ /(?i)^[-a-z]{2,12}:.*%[0-9A-F][0-9A-F]/] {
    5050  throwError: tr("{0} tag should not have URL-encoded values like ''%27''", "{0.tag}");
    51   fixAdd: concat("wikipedia=", get(regexp_match("^([-a-z]+:)(.*)$", tag("wikipedia")),1), trim(replace(URL_decode(get(regexp_match("^([-a-z]+:)(.+)$", tag("wikipedia")),2)), "_", " ")));
     51  fixAdd: concat("wikipedia=", get(regexp_match("(?i)^([-a-z]+:)(.*)$", tag("wikipedia")),1), trim(replace(URL_decode(get(regexp_match("(?i)^([-a-z]+:)(.+)$", tag("wikipedia")),2)), "_", " ")));
    5252  assertMatch: "node wikipedia=en:Foo%27s";
    5353  assertNoMatch: "node wikipedia=en:Foo";
     
    5656*[wikipedia =~ /(?i)^[-a-z]{2,12}: /] {
    5757  throwWarning: tr("wikipedia title should not start with a space after language code");
    58   fixAdd: concat("wikipedia=", get(regexp_match("^([-a-z]+:)(.*)$", tag("wikipedia")),1), trim(get(regexp_match("^([-a-z]+:)(.*)$", tag("wikipedia")),2)));
     58  fixAdd: concat("wikipedia=", get(regexp_match("(?i)^([-a-z]+:)(.*)$", tag("wikipedia")),1), trim(get(regexp_match("(?i)^([-a-z]+:)(.*)$", tag("wikipedia")),2)));
    5959  assertMatch: "node wikipedia=en: foo";
    6060  assertNoMatch: "node wikipedia=en:foo";
     
    6363*[wikipedia =~ /(?i)^[-a-z]{2,12}:wiki\//] {
    6464  throwWarning: tr("wikipedia title should not have ''{0}'' prefix", "wiki/");
    65   fixAdd: concat("wikipedia=", get(regexp_match("^([-a-z]+:)wiki/(.*)$", tag("wikipedia")),1), trim(get(regexp_match("^([-a-z]+:)wiki/(.*)$", tag("wikipedia")),2)));
     65  fixAdd: concat("wikipedia=", get(regexp_match("(?i)^([-a-z]+:)wiki/(.*)$", tag("wikipedia")),1), trim(get(regexp_match("(?i)^([-a-z]+:)wiki/(.*)$", tag("wikipedia")),2)));
    6666  assertMatch: "node wikipedia=en:wiki/foo";
    6767  assertNoMatch: "node wikipedia=en:foo";
     
    7373*[wikipedia =~ /^[-a-zA-Z]{2,12}:\p{Ll}/][wikipedia !~ /^jbo:/][wikipedia !~ /(?i)^[-a-z]{2,12}:https?:/] {
    7474  throwWarning: tr("wikipedia page title should have first letter capitalized");
    75   fixAdd: concat("wikipedia=", get(regexp_match("^([-a-z]+:)(.)(.*)$", tag("wikipedia")),1), upper(get(regexp_match("^([-a-z]+:)(.)(.*)$", tag("wikipedia")),2)), get(regexp_match("^([-a-z]+:)(.)(.*)$", tag("wikipedia")),3));
     75  fixAdd: concat("wikipedia=", get(regexp_match("(?i)^([-a-z]+:)(.)(.*)$", tag("wikipedia")),1), upper(get(regexp_match("(?i)^([-a-z]+:)(.)(.*)$", tag("wikipedia")),2)), get(regexp_match("(?i)^([-a-z]+:)(.)(.*)$", tag("wikipedia")),3));
    7676  assertMatch: "node wikipedia=en:foo";
    7777  assertNoMatch: "node wikipedia=en:Foo";
     
    8282*[wikipedia =~ /(?i)^[-a-z]{2,12}:.*_/][wikipedia !~ /(?i)^[-a-z]{2,12}:https?:/] {
    8383  throwWarning: tr("wikipedia page title should have spaces instead of underscores (''_''→'' '')");
    84   fixAdd: concat("wikipedia=", get(regexp_match("^([-a-z]+:)(.+)$", tag("wikipedia")),1), trim(replace(get(regexp_match("^([-a-z]+:)(.+)$", tag("wikipedia")),2), "_", " ")));
     84  fixAdd: concat("wikipedia=", get(regexp_match("(?i)^([-a-z]+:)(.+)$", tag("wikipedia")),1), trim(replace(get(regexp_match("(?i)^([-a-z]+:)(.+)$", tag("wikipedia")),2), "_", " ")));
    8585  assertMatch: "node wikipedia=en:foo_bar";
    8686  assertNoMatch: "node wikipedia=en:foo bar";
     
    111111*[wikipedia ^= "zh:zh:"] {
    112112  throwWarning: tr("wikipedia language seems to be duplicated, e.g. en:en:Foo");
    113   fixAdd: concat("wikipedia=", get(regexp_match("^([-a-z]+:)([-a-z]+:)(.*)$", tag("wikipedia")),2), trim(get(regexp_match("^([-a-z]+:)([-a-z]+:)(.*)$", tag("wikipedia")),3)));
     113  fixAdd: concat("wikipedia=", get(regexp_match("(?i)^([-a-z]+:)([-a-z]+:)(.*)$", tag("wikipedia")),2), trim(get(regexp_match("(?i)^([-a-z]+:)([-a-z]+:)(.*)$", tag("wikipedia")),3)));
    114114  assertMatch: "node wikipedia=en:en:Foo";
    115115  assertMatch: "node wikipedia=en:fr:Foo";
Note: See TracChangeset for help on using the changeset viewer.