forked from MapComplete/MapComplete
Merge documentation-branch, regenerate documentation
This commit is contained in:
commit
4f7f93e9c1
121 changed files with 17652 additions and 1477 deletions
|
@ -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() {
|
||||
|
|
|
@ -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 "";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
}
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue