Properly link documentation files

This commit is contained in:
pietervdvn 2022-02-15 00:11:11 +01:00
parent ea6471336a
commit 0a43a69a0c
7 changed files with 23 additions and 13 deletions

View file

@ -784,4 +784,4 @@ The following layers are included in MapComplete:
- [watermill](./Layers/watermill.md)
This document is autogenerated from [AllKnownLayers.ts](https://github.com/pietervdvn/MapComplete/blob/develop/AllKnownLayers.ts)
This document is autogenerated from [Customizations/AllKnownLayouts.ts](https://github.com/pietervdvn/MapComplete/blob/develop/Customizations/AllKnownLayouts.ts)

View file

@ -378,4 +378,4 @@ Read-only tagrendering
Read-only tagrendering
This document is autogenerated from [SharedTagRendings.ts](https://github.com/pietervdvn/MapComplete/blob/develop/SharedTagRendings.ts), [assets/tagRenderings/questions.json](https://github.com/pietervdvn/MapComplete/blob/develop/assets/tagRenderings/questions.json)
This document is autogenerated from [Customizations/SharedTagRenderings.ts](https://github.com/pietervdvn/MapComplete/blob/develop/Customizations/SharedTagRenderings.ts), [assets/tagRenderings/questions.json](https://github.com/pietervdvn/MapComplete/blob/develop/assets/tagRenderings/questions.json)

View file

@ -292,4 +292,4 @@ For example: `_part_of_walking_routes=feat.memberships().map(r => r.relation.tag
0. key
This document is autogenerated from [SimpleMetaTagger](https://github.com/pietervdvn/MapComplete/blob/develop/SimpleMetaTagger), [ExtraFunction](https://github.com/pietervdvn/MapComplete/blob/develop/ExtraFunction)
This document is autogenerated from [Logic/SimpleMetaTagger.ts](https://github.com/pietervdvn/MapComplete/blob/develop/Logic/SimpleMetaTagger.ts), [Logic/ExtraFunctions.ts](https://github.com/pietervdvn/MapComplete/blob/develop/Logic/ExtraFunctions.ts)

View file

@ -231,4 +231,4 @@ postfix | Piece of text that will always be added to the end of the generated op
Shows a color picker
This document is autogenerated from [ValidatedTextField.ts](https://github.com/pietervdvn/MapComplete/blob/develop/ValidatedTextField.ts)
This document is autogenerated from [UI/Input/ValidatedTextField.ts](https://github.com/pietervdvn/MapComplete/blob/develop/UI/Input/ValidatedTextField.ts)

View file

@ -624,4 +624,4 @@ icon | ./assets/svg/robot.svg | The icon to show on the button
`{auto_apply(,,,,./assets/svg/robot.svg)}`
This document is autogenerated from [UI/SpecialVisualisations.ts](https://github.com/pietervdvn/MapComplete/blob/develop/UI/SpecialVisualisations.ts)
This document is autogenerated from [UI/SpecialVisualizations.ts](https://github.com/pietervdvn/MapComplete/blob/develop/UI/SpecialVisualizations.ts)

View file

@ -219,4 +219,4 @@ Finally, the URL-hash is the part after the `#`. It is `node/1234` in this case.
Wether or not the layer with id <layer-id> is shown The default value is _true_
This document is autogenerated from [QueryParameters](https://github.com/pietervdvn/MapComplete/blob/develop/QueryParameters)
This document is autogenerated from [Logic/Web/QueryParameters.ts](https://github.com/pietervdvn/MapComplete/blob/develop/Logic/Web/QueryParameters.ts), [UI/QueryParameterDocumentation.ts](https://github.com/pietervdvn/MapComplete/blob/develop/UI/QueryParameterDocumentation.ts)

View file

@ -1,7 +1,7 @@
import Combine from "../UI/Base/Combine";
import BaseUIElement from "../UI/BaseUIElement";
import Translations from "../UI/i18n/Translations";
import {writeFileSync} from "fs";
import {existsSync, writeFileSync} from "fs";
import {AllKnownLayouts} from "../Customizations/AllKnownLayouts";
import TableOfContents from "../UI/Base/TableOfContents";
import SimpleMetaTaggers, {SimpleMetaTagger} from "../Logic/SimpleMetaTagger";
@ -20,6 +20,16 @@ import SharedTagRenderings from "../Customizations/SharedTagRenderings";
function WriteFile(filename, html: BaseUIElement, autogenSource: string[]): void {
for (const source of autogenSource) {
if(source.indexOf("*") > 0){
continue
}
if(!existsSync(source)){
throw "While creating a documentation file and checking that the generation sources are properly linked: source file "+source+" was not found. Typo?"
}
}
if (html instanceof Combine) {
const toc = new TableOfContents(html);
const els = html.getElements();
@ -46,13 +56,13 @@ AllKnownLayouts.GenOverviewsForSingleLayer((layer, element) => {
WriteFile("./Docs/Layers/" + layer.id + ".md", element, [`assets/layers/${layer.id}/${layer.id}.json`])
})
WriteFile("./Docs/SpecialRenderings.md", SpecialVisualizations.HelpMessage(), ["UI/SpecialVisualisations.ts"])
WriteFile("./Docs/SpecialRenderings.md", SpecialVisualizations.HelpMessage(), ["UI/SpecialVisualizations.ts"])
WriteFile("./Docs/CalculatedTags.md", new Combine([new Title("Metatags", 1),
SimpleMetaTaggers.HelpText(), ExtraFunctions.HelpText()]).SetClass("flex-col"),
["SimpleMetaTagger", "ExtraFunction"])
WriteFile("./Docs/SpecialInputElements.md", ValidatedTextField.HelpText(), ["ValidatedTextField.ts"]);
WriteFile("./Docs/BuiltinLayers.md", AllKnownLayouts.GenLayerOverviewText(), ["AllKnownLayers.ts"])
WriteFile("./Docs/BuiltinQuestions.md", SharedTagRenderings.HelpText(), ["SharedTagRendings.ts","assets/tagRenderings/questions.json"])
["Logic/SimpleMetaTagger.ts", "Logic/ExtraFunctions.ts"])
WriteFile("./Docs/SpecialInputElements.md", ValidatedTextField.HelpText(), ["UI/Input/ValidatedTextField.ts"]);
WriteFile("./Docs/BuiltinLayers.md", AllKnownLayouts.GenLayerOverviewText(), ["Customizations/AllKnownLayouts.ts"])
WriteFile("./Docs/BuiltinQuestions.md", SharedTagRenderings.HelpText(), ["Customizations/SharedTagRenderings.ts","assets/tagRenderings/questions.json"])
{
// Generate the builtinIndex which shows interlayer dependencies
@ -137,7 +147,7 @@ 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(), ["QueryParameters"])
WriteFile("./Docs/URL_Parameters.md", QueryParameterDocumentation.GenerateQueryParameterDocs(), ["Logic/Web/QueryParameters.ts", "UI/QueryParameterDocumentation.ts"])
console.log("Generated docs")