From 0ca19a5a03f7fe3b653e33f9fe06b528f0dae3a1 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Sun, 26 Sep 2021 19:59:51 +0200 Subject: [PATCH] Add ids to layers in themes --- assets/themes/artwork/artwork.json | 12 ++-- assets/themes/campersite/campersite.json | 21 ++++--- assets/themes/climbing/climbing.json | 55 ++++++++++--------- .../themes/cycle_highways/cycle_highways.json | 9 ++- .../themes/facadegardens/facadegardens.json | 9 ++- assets/themes/fruit_trees/fruit_trees.json | 12 ++-- assets/themes/hackerspaces/hackerspaces.json | 9 ++- assets/themes/shops/shops.json | 18 ++++-- assets/themes/speelplekken/speelplekken.json | 2 +- scripts/lint.ts | 8 ++- 10 files changed, 95 insertions(+), 60 deletions(-) diff --git a/assets/themes/artwork/artwork.json b/assets/themes/artwork/artwork.json index c02fc72fe..c03d7c023 100644 --- a/assets/themes/artwork/artwork.json +++ b/assets/themes/artwork/artwork.json @@ -342,7 +342,8 @@ "nb_NO": "Flisarbeid" } } - ] + ], + "id": "artwork-artwork_type" }, { "question": { @@ -369,7 +370,8 @@ }, "freeform": { "key": "artist_name" - } + }, + "id": "artwork-artist_name" }, { "question": { @@ -398,7 +400,8 @@ "freeform": { "key": "website", "type": "url" - } + }, + "id": "artwork-website" }, { "question": { @@ -426,7 +429,8 @@ "freeform": { "key": "wikidata", "type": "wikidata" - } + }, + "id": "artwork-wikidata" } ] } diff --git a/assets/themes/campersite/campersite.json b/assets/themes/campersite/campersite.json index 7b24124e5..566bb2e00 100644 --- a/assets/themes/campersite/campersite.json +++ b/assets/themes/campersite/campersite.json @@ -138,7 +138,8 @@ }, "freeform": { "key": "name" - } + }, + "id": "caravansites-name" }, { "question": { @@ -226,7 +227,8 @@ "and": [ "fee=yes" ] - } + }, + "id": "caravansites-charge" }, { "question": { @@ -295,7 +297,8 @@ "freeform": { "key": "capacity", "type": "pnat" - } + }, + "id": "caravansites-capacity" }, { "question": { @@ -491,7 +494,8 @@ "zh_Hant": "這個地方有網站嗎?", "fr": "Ce lieu a-t’il un site internet ?", "pt_BR": "Este lugar tem um website?" - } + }, + "id": "caravansites-website" }, { "question": { @@ -575,7 +579,8 @@ "freeform": { "key": "description", "type": "text" - } + }, + "id": "caravansites-description" }, "questions", "reviews" @@ -749,7 +754,8 @@ "and": [ "fee=yes" ] - } + }, + "id": "dumpstations-charge" }, { "question": { @@ -957,7 +963,8 @@ }, "freeform": { "key": "network" - } + }, + "id": "dumpstations-network" } ], "icon": { diff --git a/assets/themes/climbing/climbing.json b/assets/themes/climbing/climbing.json index 44a2520db..16765d8cb 100644 --- a/assets/themes/climbing/climbing.json +++ b/assets/themes/climbing/climbing.json @@ -138,7 +138,8 @@ }, "freeform": { "key": "name" - } + }, + "id": "climbing_club-name" }, { "render": "{minimap(18): height: 5rem; overflow: hidden; border-radius:3rem; }" @@ -268,7 +269,6 @@ "render": "{minimap(18): height: 5rem; overflow: hidden; border-radius:3rem; }" }, { - "#": "name", "render": { "en": "{name}", "nl": "{name}", @@ -288,7 +288,8 @@ }, "freeform": { "key": "name" - } + }, + "id": "name" }, "website", "phone", @@ -361,7 +362,6 @@ "render": "{minimap(18): height: 5rem; overflow: hidden; border-radius:3rem; }" }, { - "#": "Name", "render": { "en": "{name}", "nl": "{name}", @@ -401,10 +401,10 @@ "fr": "Cette voie n’a pas de nom" } } - ] + ], + "id": "Name" }, { - "#": "Length", "question": { "en": "How long is this climbing route (in meters)?", "nl": "Hoe lang is deze klimroute (in meters)?", @@ -423,10 +423,10 @@ "freeform": { "key": "climbing:length", "type": "pnat" - } + }, + "id": "Length" }, { - "#": "Difficulty", "question": { "en": "What is the difficulty of this climbing route according to the french/belgian system?", "nl": "Hoe moeilijk is deze klimroute volgens het Franse/Belgische systeem?", @@ -443,10 +443,10 @@ }, "freeform": { "key": "climbing:grade:french" - } + }, + "id": "Difficulty" }, { - "#": "Bolts", "question": { "en": "How much bolts does this route have before reaching the moulinette?", "fr": "Combien de prises cette voie possède avant d’atteindre la moulinette ?" @@ -478,25 +478,26 @@ "fr": "Cette voie n’a pas de prises" } } - ] + ], + "id": "Bolts" }, { - "#": "Description", "question": "Is there other relevant info?", "render": "

Description


{description}", "freeform": { "key": "description" - } + }, + "id": "Description" }, { - "#": "Rock type", "render": { "en": "The rock type is {_embedding_features_with_rock:rock} as stated on the surrounding crag", "fr": "Le type de roche est {_embedding_features_with_rock:rock} selon le mur" }, "freeform": { "key": "_embedding_features_with_rock:rock" - } + }, + "id": "Rock type" }, "reviews" ], @@ -621,31 +622,30 @@ "render": "{minimap(18, id, _contained_climbing_route_ids): height: 9rem; overflow: hidden; border-radius:3rem; }" }, { - "#": "Contained routes length hist", "render": { "en": "

Length overview

{histogram(_length_hist)}", "fr": "

Résumé de longueur

{histogram(_length_hist)}" }, - "condition": "_length_hist!~\\[\\]" + "condition": "_length_hist!~\\[\\]", + "id": "Contained routes length hist" }, { - "#": "Contained routes hist", "render": { "en": "

Difficulties overview

{histogram(_difficulty_hist)}", "fr": "

Résumé des difficultés

{histogram(_difficulty_hist)}" }, - "condition": "_difficulty_hist!~\\[\\]" + "condition": "_difficulty_hist!~\\[\\]", + "id": "Contained routes hist" }, { - "#": "Containe {_contained_climbing_routes_count} routes", "render": { "en": "

Contains {_contained_climbing_routes_count} routes

", "fr": "

Contient {_contained_climbing_routes_count} voies

" }, - "condition": "_contained_climbing_routes~*" + "condition": "_contained_climbing_routes~*", + "id": "Containe {_contained_climbing_routes_count} routes" }, { - "#": "name", "render": { "en": "{name}", "nl": "{name}", @@ -682,10 +682,10 @@ "fr": "Ce site n’a pas de nom" } } - ] + ], + "id": "name" }, { - "#": "Type", "question": "What kind of climbing opportunity is this?", "mappings": [ { @@ -706,10 +706,10 @@ "if": "climbing=area", "then": "A climbing area with one or more climbing crags and/or boulders" } - ] + ], + "id": "Type" }, { - "#": "Rock type (crag/rock/cliff only)", "question": { "en": "What is the rock type here?", "fr": "Quel est le type de roche ?" @@ -737,7 +737,8 @@ "natural=cliff", "natural=bare_rock" ] - } + }, + "id": "Rock type (crag/rock/cliff only)" }, "reviews" ], diff --git a/assets/themes/cycle_highways/cycle_highways.json b/assets/themes/cycle_highways/cycle_highways.json index 85a91aa7d..d31bb7322 100644 --- a/assets/themes/cycle_highways/cycle_highways.json +++ b/assets/themes/cycle_highways/cycle_highways.json @@ -33,14 +33,16 @@ "question": "What is the name of this cycle highway?", "freeform": { "key": "name" - } + }, + "id": "cycle_highways-name" }, { "render": "Referentienummer is {ref}", "question": "What is the reference number of this cycle highway?", "freeform": { "key": "ref" - } + }, + "id": "cycle_highways-ref" }, { "render": "The current state of this link is {state}", @@ -84,7 +86,8 @@ "if": "state=", "then": "This link is operational and signposted" } - ] + ], + "id": "cycle_highways-state" }, { "render": "This part is {_length:km}km long" diff --git a/assets/themes/facadegardens/facadegardens.json b/assets/themes/facadegardens/facadegardens.json index f3e28a1ef..7fd95f76e 100644 --- a/assets/themes/facadegardens/facadegardens.json +++ b/assets/themes/facadegardens/facadegardens.json @@ -125,7 +125,8 @@ "freeform": { "type": "direction", "key": "direction" - } + }, + "id": "facadegardens-direction" }, { "mappings": [ @@ -241,7 +242,8 @@ "freeform": { "key": "start_date", "type": "text" - } + }, + "id": "facadegardens-start_date" }, { "mappings": [ @@ -355,7 +357,8 @@ "freeform": { "key": "description", "type": "text" - } + }, + "id": "facadegardens-description" } ], "icon": { diff --git a/assets/themes/fruit_trees/fruit_trees.json b/assets/themes/fruit_trees/fruit_trees.json index 60d6e8a23..f5c18a0ba 100644 --- a/assets/themes/fruit_trees/fruit_trees.json +++ b/assets/themes/fruit_trees/fruit_trees.json @@ -101,7 +101,8 @@ }, "freeform": { "key": "species:nl" - } + }, + "id": "fruitboom-species:nl" }, { "render": { @@ -117,7 +118,8 @@ "and": [ "species:nl~*" ] - } + }, + "id": "fruitboom-taxon" }, { "render": { @@ -128,7 +130,8 @@ }, "freeform": { "key": "description" - } + }, + "id": "fruitboom-description" }, { "render": { @@ -139,7 +142,8 @@ }, "freeform": { "key": "ref" - } + }, + "id": "fruitboom-ref" } ], "icon": { diff --git a/assets/themes/hackerspaces/hackerspaces.json b/assets/themes/hackerspaces/hackerspaces.json index 538bc0414..515205202 100644 --- a/assets/themes/hackerspaces/hackerspaces.json +++ b/assets/themes/hackerspaces/hackerspaces.json @@ -76,7 +76,8 @@ }, "freeform": { "key": "name" - } + }, + "id": "hackerspaces-name" }, "website", "email", @@ -103,7 +104,8 @@ "en": "Opened 24/7" } } - ] + ], + "id": "hackerspaces-opening_hours" }, "wheelchair-access", { @@ -143,7 +145,8 @@ "freeform": { "key": "start_date", "type": "date" - } + }, + "id": "hackerspaces-start_date" } ], "icon": { diff --git a/assets/themes/shops/shops.json b/assets/themes/shops/shops.json index 09209f3f4..e2db84ab7 100644 --- a/assets/themes/shops/shops.json +++ b/assets/themes/shops/shops.json @@ -111,7 +111,8 @@ "render": "This shop is called {name}", "freeform": { "key": "name" - } + }, + "id": "shops-name" }, { "render": { @@ -220,7 +221,8 @@ "ja": "自動車ディーラー" } } - ] + ], + "id": "shops-shop" }, { "render": { @@ -241,7 +243,8 @@ "freeform": { "key": "phone", "type": "phone" - } + }, + "id": "shops-phone" }, { "render": { @@ -262,7 +265,8 @@ "freeform": { "key": "website", "type": "url" - } + }, + "id": "shops-website" }, { "render": { @@ -282,7 +286,8 @@ "freeform": { "key": "email", "type": "email" - } + }, + "id": "shops-email" }, { "render": { @@ -301,7 +306,8 @@ "freeform": { "key": "opening_hours", "type": "opening_hours" - } + }, + "id": "shops-opening_hours" }, "questions", "reviews" diff --git a/assets/themes/speelplekken/speelplekken.json b/assets/themes/speelplekken/speelplekken.json index 3ad9693d7..5f9859bfe 100644 --- a/assets/themes/speelplekken/speelplekken.json +++ b/assets/themes/speelplekken/speelplekken.json @@ -172,7 +172,7 @@ } }, { - "id":"walk-type", + "id": "walk-type", "mappings": [ { "if": "route=iwn", diff --git a/scripts/lint.ts b/scripts/lint.ts index 63cf1ab2f..a4f3902a6 100644 --- a/scripts/lint.ts +++ b/scripts/lint.ts @@ -14,6 +14,10 @@ import {LayerConfigJson} from "../Models/ThemeConfig/Json/LayerConfigJson"; * In place fix */ function fixLayerConfig(config: LayerConfigJson) : void{ + if(config.tagRenderings === undefined){ + return + } + for (const tagRendering of config.tagRenderings) { if(tagRendering["#"] !== undefined){ tagRendering["id"] = tagRendering["#"] @@ -32,7 +36,7 @@ for (const layerFile of layerFiles) { fixLayerConfig(layerFile.parsed) writeFileSync(layerFile.path, JSON.stringify(layerFile.parsed, null, " ")) } -/* + const themeFiles = ScriptUtils.getThemeFiles() for (const themeFile of themeFiles) { for (const layerConfig of themeFile.parsed.layers ?? []) { @@ -42,6 +46,6 @@ for (const themeFile of themeFiles) { // @ts-ignore fixLayerConfig(layerConfig) } - // writeFileSync(themeFile.path, JSON.stringify(themeFile.parsed, null, " ")) + writeFileSync(themeFile.path, JSON.stringify(themeFile.parsed, null, " ")) } //*/ \ No newline at end of file