forked from MapComplete/MapComplete
		
	Merge develop
This commit is contained in:
		
						commit
						94f39e89fe
					
				
					 174 changed files with 3695 additions and 3420 deletions
				
			
		|  | @ -39,7 +39,7 @@ export default class ScriptUtils { | |||
| 
 | ||||
|     public static DownloadFileTo(url, targetFilePath: string): Promise<void> { | ||||
|         ScriptUtils.erasableLog("Downloading", url, "to", targetFilePath) | ||||
|         return new Promise<void>((resolve, err) => { | ||||
|         return new Promise<void>((resolve) => { | ||||
|             https.get(url, (res) => { | ||||
|                 const filePath = fs.createWriteStream(targetFilePath) | ||||
|                 res.pipe(filePath) | ||||
|  |  | |||
|  | @ -112,7 +112,7 @@ export class Conflate extends Script { | |||
| 
 | ||||
|         const changedObjects: OsmObject[] = [] | ||||
|         for (const { match, replayed } of bestMatches) { | ||||
|             const { external_feature, d, osm_feature } = match | ||||
|             const { d, osm_feature } = match | ||||
|             const { possibly_imported, certainly_imported, resting_properties } = replayed | ||||
|             const status = resting_properties["status"] | ||||
|             delete resting_properties["status"] | ||||
|  |  | |||
|  | @ -7,6 +7,7 @@ function genImages(dryrun = false) { | |||
|         "add", | ||||
|         "addSmall", | ||||
|         "back", | ||||
|         "circle", | ||||
|         "blocked", | ||||
|         "brick_wall", | ||||
|         "brick_wall_raw", | ||||
|  | @ -33,6 +34,7 @@ function genImages(dryrun = false) { | |||
|         "duplicate", | ||||
|         "elevator", | ||||
|         "elevator_wheelchair", | ||||
|         "envelope", | ||||
|         "eye", | ||||
|         "filter", | ||||
|         "filter_disable", | ||||
|  | @ -65,6 +67,7 @@ function genImages(dryrun = false) { | |||
|         "mapillary_black", | ||||
|         "mastodon", | ||||
|         "min", | ||||
|         "move", | ||||
|         "move-arrows", | ||||
|         "move_confirm", | ||||
|         "move_not_allowed", | ||||
|  | @ -72,13 +75,19 @@ function genImages(dryrun = false) { | |||
|         "osm_logo_us", | ||||
|         "osm-logo-us", | ||||
|         "party", | ||||
|         "pencil", | ||||
|         "person", | ||||
|         "pin", | ||||
|         "plantnet_logo", | ||||
|         "plus", | ||||
|         "reload", | ||||
|         "resolved", | ||||
|         "ring", | ||||
|         "robot", | ||||
|         "scissors", | ||||
|         "search", | ||||
|         "search_disable", | ||||
|         "share", | ||||
|         "SocialImageForeground", | ||||
|         "speech_bubble", | ||||
|         "speech_bubble_black_outline", | ||||
|  | @ -89,8 +98,10 @@ function genImages(dryrun = false) { | |||
|         "star_outline", | ||||
|         "teardrop", | ||||
|         "teardrop_with_hole_green", | ||||
|         "statistics", | ||||
|         "translate", | ||||
|         "triangle", | ||||
|         "up", | ||||
|         "Upload", | ||||
|         "wikidata", | ||||
|         "wikimedia-commons-white", | ||||
|  |  | |||
|  | @ -5,7 +5,6 @@ import { readFileSync, writeFileSync } from "fs" | |||
| import LayoutConfig from "../src/Models/ThemeConfig/LayoutConfig" | ||||
| import LayerConfig from "../src/Models/ThemeConfig/LayerConfig" | ||||
| import { Utils } from "../src/Utils" | ||||
| import TagRenderingConfig from "../src/Models/ThemeConfig/TagRenderingConfig" | ||||
| 
 | ||||
| /** | ||||
|  * Generates all the files in "Docs/TagInfo". These are picked up by the taginfo project, showing a link to the mapcomplete theme if the key is used | ||||
|  |  | |||
|  | @ -30,17 +30,6 @@ t.OnEveryLanguage((txt, ln) => { | |||
|     return txt | ||||
| }) | ||||
| 
 | ||||
| const articles = { | ||||
|     /*  de: "eine", | ||||
|     es: 'una', | ||||
|     fr: 'une', | ||||
|     it: 'una', | ||||
|     nb_NO: 'en', | ||||
|     nl: 'een', | ||||
|     pt: 'uma', | ||||
|     pt_BR : 'uma',//*/
 | ||||
| } | ||||
| 
 | ||||
| function reorder(object: object, order: string[]) { | ||||
|     const allKeys = new Set<string>(Object.keys(object)) | ||||
|     const copy = {} | ||||
|  | @ -54,38 +43,6 @@ function reorder(object: object, order: string[]) { | |||
|     return copy | ||||
| } | ||||
| 
 | ||||
| function addArticleToPresets(layerConfig: { presets?: { title: any }[] }) { | ||||
|     /* | ||||
|     if(layerConfig.presets === undefined){ | ||||
|         return | ||||
|     } | ||||
|     for (const preset of layerConfig.presets) { | ||||
|         preset.title = new Translation(preset.title, "autofix") | ||||
|             .OnEveryLanguage((txt, lang) => { | ||||
|                 let article = articles[lang] | ||||
|                 if(lang === "en"){ | ||||
|                    if(["a","e","u","o","i"].some(vowel => txt.toLowerCase().startsWith(vowel))) { | ||||
|                         article = "an" | ||||
|                    }else{ | ||||
|                        article = "a" | ||||
|                    } | ||||
|                 } | ||||
|                 if(article === undefined){ | ||||
|                     return txt; | ||||
|                 } | ||||
|                 if(txt.startsWith(article+" ")){ | ||||
|                     return txt; | ||||
|                 } | ||||
|                 if(txt.startsWith("an ")){ | ||||
|                     return txt; | ||||
|                 } | ||||
|                 return article +" " +  txt.toLowerCase(); | ||||
|             }) | ||||
|             .translations | ||||
|     } | ||||
|     //*/
 | ||||
| } | ||||
| 
 | ||||
| const layerFiles = ScriptUtils.getLayerFiles() | ||||
| for (const layerFile of layerFiles) { | ||||
|     try { | ||||
|  | @ -95,7 +52,6 @@ for (const layerFile of layerFiles) { | |||
|                 ConversionContext.construct([layerFile.path.split("/").at(-1)], ["update legacy"]) | ||||
|             ) | ||||
|         ) | ||||
|         addArticleToPresets(fixed) | ||||
|         const reordered = reorder(fixed, layerAttributesOrder) | ||||
|         writeFileSync(layerFile.path, JSON.stringify(reordered, null, "  ") + "\n") | ||||
|     } catch (e) { | ||||
|  | @ -110,11 +66,7 @@ for (const themeFile of themeFiles) { | |||
|             themeFile.parsed, | ||||
|             ConversionContext.construct([themeFile.path.split("/").at(-1)], ["update legacy layer"]) | ||||
|         ) | ||||
|         for (const layer of fixed.layers) { | ||||
|             if (layer["presets"] !== undefined) { | ||||
|                 addArticleToPresets(<any>layer) | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         // extractInlineLayer(fixed)
 | ||||
|         const endsWithNewline = themeFile.raw.at(-1) === "\n" | ||||
|         const ordered = reorder(fixed, themeAttributesOrder) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue