Modify ↓
Opened 2 years ago
Closed 6 months ago
#22486 closed enhancement (fixed)
Warn about invalid currency symbol in charge
Reported by: | Famlam | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core validator | Version: | tested |
Keywords: | charge | Cc: |
Description (last modified by )
The wiki of charge
defines the format as charge = <amount> <currency code>[/<unit>][/<time unit>]
. Currency code is the 3-letter, uppercase code from ISO 4217.
Despite this, there is a significant usage where either the currency is not specified, or the currency is written using the symbol (either before or after the number), as can be seen on TagInfo
Hence, I would propose to add the following rule to the validator rules:
*[charge][charge!=0][charge!~/^[0-9]+(\.[0-9]+)? [A-Z]{3}($|\/|;)/] { throwWarning: tr("{0} should be structured as <(decimal) number><space><(uppercase) three letter currency code>[/optional unit][/optional time unit]", "{0.key}"); assertMatch: "node charge=€12"; assertMatch: "node charge=\"0.22 $/liter\""; assertMatch: "node charge=12.22"; assertMatch: "node charge=\"12 EURO\""; assertMatch: "node charge=\"12 eur\""; assertMatch: "node charge=12EUR"; assertMatch: "node charge=EUR12"; assertNoMatch: "node charge=0"; assertNoMatch: "node charge=\"12 EUR\""; assertNoMatch: "node charge=\"12 EUR/person; 18 EUR/child\""; assertNoMatch: "node charge=\"0.223 USD/liter\""; assertNoMatch: "node charge=\"12.223 YEN/1 person/1 hour\""; }
Attachments (0)
Change History (2)
comment:1 by , 2 years ago
Description: | modified (diff) |
---|
comment:2 by , 6 months ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
I made this a separate rule set instead:
https://josm.openstreetmap.de/wiki/Rules/ChargeRules