Skip to content

Commit ec054b3

Browse files
committed
support : in tags key for Overpass Wizard
1 parent ecfd28d commit ec054b3

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

better-osm-org.user.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24180,12 +24180,16 @@ function yetAnotherWizard(s) {
2418024180
// name ~ пятёрочка, i
2418124181
// https://github.com/drolbr/Overpass-API/issues/751
2418224182
const kv_match = s.match(
24183-
/^(?<prefix>[~!]?)(?<key>[a-zA-Z0-9_\p{L}^$.*+]+)\s*(?<op>(=|~|!=|!~))\s*(?<value>[a-zA-Z0-9_\p{L}^$.*+]+)(?<suffix>\s*,\s*i)?$/u,
24183+
/^(?<prefix>[~!]?)(?<key>[a-zA-Z0-9_\p{L}^$:.*+]+)\s*(?<op>(=|~|!=|!~))\s*(?<value>[a-zA-Z0-9_\p{L}^$.*+]+)(?<suffix>\s*,\s*i)?$/u,
2418424184
)?.groups
2418524185
if (kv_match) {
2418624186
return `nwr[${kv_match["prefix"] ?? ""}"${kv_match["key"]}"${kv_match["op"]}"${kv_match["value"]}"${kv_match["suffix"] ?? ""}];`
2418724187
} else {
24188-
return `nwr[${s}];`
24188+
if (s.match(/^[a-zA-Z0-9_:]+$/)) {
24189+
return `nwr["${s}"];`
24190+
} else {
24191+
return `nwr[${s}];`
24192+
}
2418924193
}
2419024194
}
2419124195
}

src/4-modules/72-overpass-search.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ function yetAnotherWizard(s) {
1010
// name ~ пятёрочка, i
1111
// https://github.com/drolbr/Overpass-API/issues/751
1212
const kv_match = s.match(
13-
/^(?<prefix>[~!]?)(?<key>[a-zA-Z0-9_\p{L}^$.*+]+)\s*(?<op>(=|~|!=|!~))\s*(?<value>[a-zA-Z0-9_\p{L}^$.*+]+)(?<suffix>\s*,\s*i)?$/u,
13+
/^(?<prefix>[~!]?)(?<key>[a-zA-Z0-9_\p{L}^$:.*+]+)\s*(?<op>(=|~|!=|!~))\s*(?<value>[a-zA-Z0-9_\p{L}^$.*+]+)(?<suffix>\s*,\s*i)?$/u,
1414
)?.groups
1515
if (kv_match) {
1616
return `nwr[${kv_match["prefix"] ?? ""}"${kv_match["key"]}"${kv_match["op"]}"${kv_match["value"]}"${kv_match["suffix"] ?? ""}];`
1717
} else {
18-
return `nwr[${s}];`
18+
if (s.match(/^[a-zA-Z0-9_:]+$/)) {
19+
return `nwr["${s}"];`
20+
} else {
21+
return `nwr[${s}];`
22+
}
1923
}
2024
}
2125
}

0 commit comments

Comments
 (0)