Fix link to lexemes, fix #507
This commit is contained in:
parent
ed161afc7e
commit
5f5079ddfe
2 changed files with 10 additions and 1 deletions
|
@ -273,6 +273,15 @@ export default class Wikidata {
|
|||
return undefined;
|
||||
}
|
||||
|
||||
public static IdToArticle(id: string){
|
||||
if(id.startsWith("Q")){
|
||||
return "https://wikidata.org/wiki/"+id
|
||||
}
|
||||
if(id.startsWith("L")){
|
||||
return "https://wikidata.org/wiki/Lexeme:"+id
|
||||
}
|
||||
throw "Unknown id type: "+id
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a wikidata page
|
||||
|
|
|
@ -51,7 +51,7 @@ export default class WikidataPreviewBox extends VariableUiElement {
|
|||
wikidata.id,
|
||||
Svg.wikidata_ui().SetStyle("width: 2.5rem").SetClass("block")
|
||||
]).SetClass("flex"),
|
||||
"https://wikidata.org/wiki/"+wikidata.id ,true).SetClass("must-link")
|
||||
Wikidata.IdToArticle(wikidata.id) ,true).SetClass("must-link")
|
||||
|
||||
console.log(wikidata)
|
||||
let info = new Combine( [
|
||||
|
|
Loading…
Reference in a new issue