forked from MapComplete/MapComplete
Add ifnot-tags for multianswers, in order to indicate something is _not_ possible (e.g.: playment:coins=no)
This commit is contained in:
parent
972128516b
commit
ae9d93138b
8 changed files with 99 additions and 131 deletions
|
@ -294,7 +294,7 @@ export default class MetaTagging {
|
|||
MetaTagging.isOpen,
|
||||
MetaTagging.carriageWayWidth,
|
||||
MetaTagging.directionSimplified,
|
||||
MetaTagging.currentTime
|
||||
// MetaTagging.currentTime
|
||||
|
||||
];
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import {Utils} from "../Utils";
|
||||
import {type} from "os";
|
||||
|
||||
export abstract class TagsFilter {
|
||||
abstract matches(tags: { k: string, v: string }[]): boolean
|
||||
|
@ -16,6 +17,8 @@ export abstract class TagsFilter {
|
|||
}
|
||||
|
||||
abstract asHumanString(linkToWiki: boolean, shorten: boolean);
|
||||
|
||||
abstract usedKeys(): string[];
|
||||
}
|
||||
|
||||
|
||||
|
@ -86,6 +89,13 @@ export class RegexTag extends TagsFilter {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
usedKeys(): string[] {
|
||||
if (typeof this.key === "string") {
|
||||
return [this.key];
|
||||
}
|
||||
throw "Key cannot be determined as it is a regex"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -163,6 +173,10 @@ export class Tag extends TagsFilter {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
usedKeys(): string[] {
|
||||
return [this.key];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -228,6 +242,10 @@ export class Or extends TagsFilter {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
usedKeys(): string[] {
|
||||
return [].concat(this.or.map(subkeys => subkeys.usedKeys()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -343,6 +361,10 @@ export class And extends TagsFilter {
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
usedKeys(): string[] {
|
||||
return [].concat(this.and.map(subkeys => subkeys.usedKeys()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -456,10 +478,10 @@ export class TagUtils {
|
|||
const splitted = TagUtils.SplitKeys([tag]);
|
||||
for (const splitKey in splitted) {
|
||||
const neededValues = splitted[splitKey];
|
||||
if(tags[splitKey] === undefined) {
|
||||
if (tags[splitKey] === undefined) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const actualValue = tags[splitKey].split(";");
|
||||
for (const neededValue of neededValues) {
|
||||
if (actualValue.indexOf(neededValue) < 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue