2021-03-13 19:07:11 +01:00
|
|
|
import {Utils} from "../Utils";
|
|
|
|
import SpecialVisualizations from "../UI/SpecialVisualizations";
|
2021-03-24 01:25:57 +01:00
|
|
|
import SimpleMetaTagger from "../Logic/SimpleMetaTagger";
|
2021-03-24 02:01:04 +01:00
|
|
|
import Combine from "../UI/Base/Combine";
|
2021-03-25 15:19:44 +01:00
|
|
|
import {ExtraFunction} from "../Logic/ExtraFunction";
|
2021-05-11 02:39:51 +02:00
|
|
|
import ValidatedTextField from "../UI/Input/ValidatedTextField";
|
2021-06-15 00:28:59 +02:00
|
|
|
import BaseUIElement from "../UI/BaseUIElement";
|
|
|
|
import Translations from "../UI/i18n/Translations";
|
|
|
|
import {writeFileSync} from "fs";
|
|
|
|
import {QueryParameters} from "../Logic/Web/QueryParameters";
|
2021-08-07 23:11:34 +02:00
|
|
|
import LayoutConfig from "../Models/ThemeConfig/LayoutConfig";
|
2021-10-28 03:21:17 +02:00
|
|
|
import Minimap from "../UI/Base/Minimap";
|
|
|
|
import FeatureSwitchState from "../Logic/State/FeatureSwitchState";
|
2021-03-24 01:25:57 +01:00
|
|
|
|
2021-11-07 16:34:51 +01:00
|
|
|
Utils.runningFromConsole = true;
|
|
|
|
|
2021-06-16 21:23:03 +02:00
|
|
|
|
|
|
|
function WriteFile(filename, html: string | BaseUIElement, autogenSource: string[]): void {
|
2021-06-16 17:09:32 +02:00
|
|
|
writeFileSync(filename, new Combine([Translations.W(html),
|
2021-09-09 00:05:51 +02:00
|
|
|
"Generated from " + autogenSource.join(", ")
|
2021-06-16 17:09:32 +02:00
|
|
|
]).AsMarkdown());
|
2021-06-15 00:28:59 +02:00
|
|
|
}
|
2021-03-13 19:07:11 +01:00
|
|
|
|
2021-10-29 18:16:51 +02:00
|
|
|
WriteFile("./Docs/SpecialRenderings.md", SpecialVisualizations.HelpMessage(), ["UI/SpecialVisualisations.ts"])
|
2021-06-16 17:09:32 +02:00
|
|
|
WriteFile("./Docs/CalculatedTags.md", new Combine([SimpleMetaTagger.HelpText(), ExtraFunction.HelpText()]).SetClass("flex-col"),
|
2021-09-09 00:05:51 +02:00
|
|
|
["SimpleMetaTagger", "ExtraFunction"])
|
|
|
|
WriteFile("./Docs/SpecialInputElements.md", ValidatedTextField.HelpText(), ["ValidatedTextField.ts"]);
|
2021-03-13 19:07:11 +01:00
|
|
|
|
2021-10-28 03:21:17 +02:00
|
|
|
Minimap.createMiniMap = _ => {
|
|
|
|
console.log("Not creating a minimap, it is disabled");
|
|
|
|
return undefined
|
|
|
|
}
|
|
|
|
|
2021-03-22 01:06:24 +01:00
|
|
|
|
2021-10-28 03:21:17 +02:00
|
|
|
const dummyLayout = new LayoutConfig({
|
2021-06-15 00:28:59 +02:00
|
|
|
language: ["en"],
|
|
|
|
id: "<theme>",
|
|
|
|
maintainer: "pietervdvn",
|
|
|
|
version: "0",
|
|
|
|
title: "<theme>",
|
|
|
|
description: "A theme to generate docs with",
|
|
|
|
startLat: 0,
|
|
|
|
startLon: 0,
|
|
|
|
startZoom: 0,
|
|
|
|
icon: undefined,
|
|
|
|
layers: [
|
|
|
|
{
|
|
|
|
name: "<layer>",
|
|
|
|
id: "<layer>",
|
|
|
|
source: {
|
|
|
|
osmTags: "id~*"
|
2021-10-28 03:21:17 +02:00
|
|
|
},
|
|
|
|
mapRendering: []
|
2021-06-15 00:28:59 +02:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2021-10-28 03:21:17 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
new FeatureSwitchState(dummyLayout)
|
|
|
|
|
2021-06-15 00:28:59 +02:00
|
|
|
QueryParameters.GetQueryParameter("layer-<layer-id>", "true", "Wether or not the layer with id <layer-id> is shown")
|
|
|
|
|
2021-06-16 21:23:03 +02:00
|
|
|
WriteFile("./Docs/URL_Parameters.md", QueryParameters.GenerateQueryParameterDocs(), ["QueryParameters"])
|
2021-03-22 01:06:24 +01:00
|
|
|
|
|
|
|
console.log("Generated docs")
|
|
|
|
|