forked from MapComplete/MapComplete
		
	Add ToC to generated pages
This commit is contained in:
		
							parent
							
								
									b4529e4f63
								
							
						
					
					
						commit
						752538ec14
					
				
					 18 changed files with 346 additions and 243 deletions
				
			
		|  | @ -11,20 +11,35 @@ import {QueryParameters} from "../Logic/Web/QueryParameters"; | |||
| import LayoutConfig from "../Models/ThemeConfig/LayoutConfig"; | ||||
| import Minimap from "../UI/Base/Minimap"; | ||||
| import FeatureSwitchState from "../Logic/State/FeatureSwitchState"; | ||||
| import AllKnownLayers from "../Customizations/AllKnownLayers"; | ||||
| import {AllKnownLayouts} from "../Customizations/AllKnownLayouts"; | ||||
| import TableOfContents from "../UI/Base/TableOfContents"; | ||||
| import Title from "../UI/Base/Title"; | ||||
| import QueryParameterDocumentation from "../UI/QueryParameterDocumentation"; | ||||
| 
 | ||||
| Utils.runningFromConsole = true; | ||||
| 
 | ||||
| 
 | ||||
| function WriteFile(filename, html: string | BaseUIElement, autogenSource: string[]): void { | ||||
| function WriteFile(filename, html: BaseUIElement, autogenSource: string[]): void { | ||||
| 
 | ||||
|     if (html instanceof Combine) { | ||||
|          | ||||
|         const toc = new TableOfContents(html); | ||||
|         const els = html.getElements(); | ||||
|         html = new Combine( | ||||
|             [els.shift(), | ||||
|                 toc, | ||||
|                 ...els | ||||
|             ] | ||||
|         ) | ||||
|     } | ||||
| 
 | ||||
|     writeFileSync(filename, new Combine([Translations.W(html), | ||||
|         "\n\nThis document is autogenerated from " + autogenSource.join(", ") | ||||
|     ]).AsMarkdown()); | ||||
| } | ||||
| 
 | ||||
| WriteFile("./Docs/SpecialRenderings.md", SpecialVisualizations.HelpMessage(), ["UI/SpecialVisualisations.ts"]) | ||||
| WriteFile("./Docs/CalculatedTags.md", new Combine([SimpleMetaTagger.HelpText(), ExtraFunction.HelpText()]).SetClass("flex-col"), | ||||
| WriteFile("./Docs/CalculatedTags.md", new Combine([new Title("Metatags", 1), SimpleMetaTagger.HelpText(), ExtraFunction.HelpText()]).SetClass("flex-col"), | ||||
|     ["SimpleMetaTagger", "ExtraFunction"]) | ||||
| WriteFile("./Docs/SpecialInputElements.md", ValidatedTextField.HelpText(), ["ValidatedTextField.ts"]); | ||||
| WriteFile("./Docs/BuiltinLayers.md", AllKnownLayouts.GenLayerOverviewText(), ["AllKnownLayers.ts"]) | ||||
|  | @ -52,7 +67,7 @@ const dummyLayout = new LayoutConfig({ | |||
|             source: { | ||||
|                 osmTags: "id~*" | ||||
|             }, | ||||
|             mapRendering: [] | ||||
|             mapRendering: null, | ||||
|         } | ||||
|     ] | ||||
| 
 | ||||
|  | @ -62,7 +77,7 @@ new FeatureSwitchState(dummyLayout) | |||
| 
 | ||||
| QueryParameters.GetQueryParameter("layer-<layer-id>", "true", "Wether or not the layer with id <layer-id> is shown") | ||||
| 
 | ||||
| WriteFile("./Docs/URL_Parameters.md", QueryParameters.GenerateQueryParameterDocs(), ["QueryParameters"]) | ||||
| WriteFile("./Docs/URL_Parameters.md", QueryParameterDocumentation.GenerateQueryParameterDocs(), ["QueryParameters"]) | ||||
| 
 | ||||
| console.log("Generated docs") | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue