forked from MapComplete/MapComplete
		
	Fix deployment, fix documentation generation, add a small markdown generator
This commit is contained in:
		
							parent
							
								
									e480c97676
								
							
						
					
					
						commit
						8e72b70742
					
				
					 27 changed files with 478 additions and 399 deletions
				
			
		|  | @ -1,25 +1,53 @@ | |||
| import {Utils} from "../Utils"; | ||||
| 
 | ||||
| Utils.runningFromConsole = true; | ||||
| import SpecialVisualizations from "../UI/SpecialVisualizations"; | ||||
| import {writeFileSync} from "fs"; | ||||
| import {UIElement} from "../UI/UIElement"; | ||||
| import SimpleMetaTagger from "../Logic/SimpleMetaTagger"; | ||||
| import Combine from "../UI/Base/Combine"; | ||||
| import {ExtraFunction} from "../Logic/ExtraFunction"; | ||||
| import ValidatedTextField from "../UI/Input/ValidatedTextField"; | ||||
| import BaseUIElement from "../UI/BaseUIElement"; | ||||
| import Translations from "../UI/i18n/Translations"; | ||||
| import {writeFileSync} from "fs"; | ||||
| import LayoutConfig from "../Customizations/JSON/LayoutConfig"; | ||||
| import State from "../State"; | ||||
| import {QueryParameters} from "../Logic/Web/QueryParameters"; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| const TurndownService = require('turndown') | ||||
| 
 | ||||
| function WriteFile(filename, html: UIElement) : void { | ||||
|     const md = new TurndownService().turndown(html.InnerRenderAsString()); | ||||
|     writeFileSync(filename, md); | ||||
| function WriteFile(filename, html: string | BaseUIElement): void { | ||||
|     writeFileSync(filename, Translations.W(html).AsMarkdown()); | ||||
| } | ||||
| 
 | ||||
| WriteFile("./Docs/SpecialRenderings.md", SpecialVisualizations.HelpMessage) | ||||
| WriteFile("./Docs/CalculatedTags.md", new Combine([SimpleMetaTagger.HelpText(), ExtraFunction.HelpText()])) | ||||
| writeFileSync("./Docs/SpecialInputElements.md", ValidatedTextField.HelpText()); | ||||
| WriteFile("./Docs/CalculatedTags.md", new Combine([SimpleMetaTagger.HelpText(), ExtraFunction.HelpText()]).SetClass("flex-col")) | ||||
| WriteFile("./Docs/SpecialInputElements.md", ValidatedTextField.HelpText()); | ||||
| 
 | ||||
| 
 | ||||
| new State(new LayoutConfig({ | ||||
|     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~*" | ||||
|             } | ||||
|         } | ||||
|     ] | ||||
| 
 | ||||
| })) | ||||
| QueryParameters.GetQueryParameter("layer-<layer-id>", "true", "Wether or not the layer with id <layer-id> is shown") | ||||
| 
 | ||||
| WriteFile("./Docs/URL_Parameters.md", QueryParameters.GenerateQueryParameterDocs()) | ||||
| 
 | ||||
| console.log("Generated docs") | ||||
| 
 | ||||
|  |  | |||
|  | @ -88,8 +88,8 @@ async function createManifest(layout: LayoutConfig) { | |||
|         console.log(icon) | ||||
|         throw "Icon is not an svg for " + layout.id | ||||
|     } | ||||
|     const ogTitle = Translations.W(layout.title).InnerRenderAsString(); | ||||
|     const ogDescr = Translations.W(layout.description ?? "").InnerRenderAsString(); | ||||
|     const ogTitle = Translations.W(layout.title).ConstructElement()?.innerText; | ||||
|     const ogDescr = Translations.W(layout.description ?? "").ConstructElement()?.innerText; | ||||
| 
 | ||||
|     return { | ||||
|         name: name, | ||||
|  | @ -109,8 +109,8 @@ async function createLandingPage(layout: LayoutConfig, manifest) { | |||
| 
 | ||||
|     Locale.language.setData(layout.language[0]); | ||||
| 
 | ||||
|     const ogTitle = Translations.W(layout.title)?.InnerRenderAsString(); | ||||
|     const ogDescr = Translations.W(layout.shortDescription ?? "Easily add and edit geodata with OpenStreetMap")?.InnerRenderAsString(); | ||||
|     const ogTitle = Translations.W(layout.title)?.ConstructElement()?.innerText; | ||||
|     const ogDescr = Translations.W(layout.shortDescription ?? "Easily add and edit geodata with OpenStreetMap")?.ConstructElement()?.innerText; | ||||
|     const ogImage = layout.socialImage; | ||||
| 
 | ||||
|     let customCss = ""; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue