Add small overview document for every layer

This commit is contained in:
Pieter Vander Vennet 2022-01-14 19:34:00 +01:00
parent eba52836b2
commit 77e9151095
41 changed files with 1325 additions and 2040 deletions

View file

@ -17,7 +17,11 @@ export default class Combine extends BaseUIElement {
}
AsMarkdown(): string {
return this.uiElements.map(el => el.AsMarkdown()).join(this.HasClass("flex-col") ? "\n\n" : " ");
let sep = " ";
if(this.HasClass("flex-col")){
sep = "\n\n"
}
return this.uiElements.map(el => el.AsMarkdown()).join(sep);
}
Destroy() {

View file

@ -53,5 +53,17 @@ export default class Img extends BaseUIElement {
}
return el;
}
AsMarkdown(): string {
if(this._rawSvg === true){
console.warn("Converting raw svgs to markdown is not supported");
return undefined
}
let src = this._src
if(this._src.startsWith("./")){
src = "https://mapcomplete.osm.be/"+src
}
return "![]("+src+")";
}
}

View file

@ -13,6 +13,9 @@ export default class Link extends BaseUIElement {
this._embeddedShow = Translations.W(embeddedShow);
this._href = href;
this._newTab = newTab;
if(this._embeddedShow === undefined){
throw "Error: got a link where embeddedShow is undefined"
}
}
@ -40,5 +43,16 @@ export default class Link extends BaseUIElement {
el.appendChild(embeddedShow)
return el;
}
public static OsmWiki(key: string, value?: string, hideKey = false){
if(value !== undefined){
let k = "";
if(!hideKey){
k = key+"="
}
return new Link(k+value,`https://wiki.openstreetmap.org/wiki/Tag:${key}%3D${value}`)
}
return new Link(key, "https://wiki.openstreetmap.org/wiki/Key:" + key)
}
}

View file

@ -1,5 +1,6 @@
import {UIEventSource} from "../../Logic/UIEventSource";
import BaseUIElement from "../BaseUIElement";
import Combine from "./Combine";
export class VariableUiElement extends BaseUIElement {
private readonly _contents: UIEventSource<string | BaseUIElement | BaseUIElement[]>;
@ -46,4 +47,15 @@ export class VariableUiElement extends BaseUIElement {
});
return el;
}
AsMarkdown(): string {
const d = this._contents.data;
if(typeof d === "string"){
return d;
}
if(d instanceof BaseUIElement){
return d.AsMarkdown()
}
return new Combine(<BaseUIElement[]>d).AsMarkdown()
}
}