Better documentation

This commit is contained in:
pietervdvn 2022-05-18 01:56:09 +02:00
parent 2f0f0847fb
commit e55b299864
2 changed files with 33 additions and 28 deletions

View file

@ -4,6 +4,8 @@ import Title from "./Base/Title";
import List from "./Base/List";
import Translations from "./i18n/Translations";
import {QueryParameters} from "../Logic/Web/QueryParameters";
import FeatureSwitchState from "../Logic/State/FeatureSwitchState";
import LayoutConfig from "../Models/ThemeConfig/LayoutConfig";
export default class QueryParameterDocumentation {
@ -24,6 +26,37 @@ export default class QueryParameterDocumentation {
"Finally, the URL-hash is the part after the `#`. It is `node/1234` in this case."
])
public static UrlParamDocs(): object{
const dummyLayout = new LayoutConfig({
id: ">theme<",
maintainer: "pietervdvn",
version: "0",
title: {en:"<theme>"},
description: "A theme to generate docs with",
socialImage: "./assets/SocialImage.png",
startLat: 0,
startLon: 0,
startZoom: 0,
icon: undefined,
layers: [
{
name: "<layer>",
id: "&lt;layer&gt;",
source: {
osmTags: "id~*"
},
mapRendering: null,
}
]
})
new FeatureSwitchState(dummyLayout)
QueryParameters.GetQueryParameter("layer-&lt;layer-id&gt;", "true", "Wether or not the layer with id <layer-id> is shown")
return QueryParameters.documentation
}
public static GenerateQueryParameterDocs(): BaseUIElement {
const docs: (string | BaseUIElement)[] = [...QueryParameterDocumentation.QueryParamDocsIntro];
for (const key in QueryParameters.documentation) {

View file

@ -128,34 +128,6 @@ Minimap.createMiniMap = _ => {
}
const dummyLayout = new LayoutConfig({
id: "&gt;theme&lt;",
maintainer: "pietervdvn",
version: "0",
title: {en:"<theme>"},
description: "A theme to generate docs with",
socialImage: "./assets/SocialImage.png",
startLat: 0,
startLon: 0,
startZoom: 0,
icon: undefined,
layers: [
{
name: "<layer>",
id: "&lt;layer&gt;",
source: {
osmTags: "id~*"
},
mapRendering: null,
}
]
})
new FeatureSwitchState(dummyLayout)
QueryParameters.GetQueryParameter("layer-&lt;layer-id&gt;", "true", "Wether or not the layer with id <layer-id> is shown")
WriteFile("./Docs/URL_Parameters.md", QueryParameterDocumentation.GenerateQueryParameterDocs(), ["Logic/Web/QueryParameters.ts", "UI/QueryParameterDocumentation.ts"])
console.log("Generated docs")