Refactoring: remove unused file

This commit is contained in:
Pieter Vander Vennet 2025-07-11 20:24:51 +02:00
parent 4e033a93a5
commit 6383311dc2
4 changed files with 34 additions and 76 deletions

26
src/Logic/Osm/OsmWiki.ts Normal file
View file

@ -0,0 +1,26 @@
/**
* Various tools for the OSM wiki
*/
export default class OsmWiki {
/**
* Create a link to the wiki for the given key and value (optional)
* @param key
* @param value
*/
public static constructLink(key: string, value?: string) : string{
if (value !== undefined) {
return `https://wiki.openstreetmap.org/wiki/Tag:${key}%3D${value}`
}
return "https://wiki.openstreetmap.org/wiki/Key:" + key
}
public static constructLinkMd(key: string, value?: string) : string {
const link = this.constructLink(key, value)
let displayed = key
if(value){
displayed += "="+value
}
return `[${displayed}](${link})`
}
}

View file

@ -6,6 +6,7 @@ import { RegexTag } from "./RegexTag"
import { OptimizedTag } from "./TagTypes"
import { Or } from "./Or"
import { And } from "./And"
import OsmWiki from "../Osm/OsmWiki"
export class Tag extends TagsFilter {
public key: string
@ -113,10 +114,12 @@ export class Tag extends TagsFilter {
return "<span class='line-through'>" + this.key + "</span>"
}
if (linkToWiki) {
const hrefK = OsmWiki.constructLink(this.key)
const hrefKV = OsmWiki.constructLink(this.key, this.value)
return (
`<a href='https://wiki.openstreetmap.org/wiki/Key:${this.key}' target='_blank'>${this.key}</a>` +
`<a href='${hrefK}' target='_blank'>${this.key}</a>` +
`=` +
`<a href='https://wiki.openstreetmap.org/wiki/Tag:${this.key}%3D${this.value}' target='_blank'>${v}</a>`
`<a href='${hrefKV}' target='_blank'>${v}</a>`
)
}
return this.key + "=" + v