Add ids to layers in themes

This commit is contained in:
pietervdvn 2021-09-26 19:59:51 +02:00
parent 39166ff806
commit 0ca19a5a03
10 changed files with 95 additions and 60 deletions

View file

@ -342,7 +342,8 @@
"nb_NO": "Flisarbeid" "nb_NO": "Flisarbeid"
} }
} }
] ],
"id": "artwork-artwork_type"
}, },
{ {
"question": { "question": {
@ -369,7 +370,8 @@
}, },
"freeform": { "freeform": {
"key": "artist_name" "key": "artist_name"
} },
"id": "artwork-artist_name"
}, },
{ {
"question": { "question": {
@ -398,7 +400,8 @@
"freeform": { "freeform": {
"key": "website", "key": "website",
"type": "url" "type": "url"
} },
"id": "artwork-website"
}, },
{ {
"question": { "question": {
@ -426,7 +429,8 @@
"freeform": { "freeform": {
"key": "wikidata", "key": "wikidata",
"type": "wikidata" "type": "wikidata"
} },
"id": "artwork-wikidata"
} }
] ]
} }

View file

@ -138,7 +138,8 @@
}, },
"freeform": { "freeform": {
"key": "name" "key": "name"
} },
"id": "caravansites-name"
}, },
{ {
"question": { "question": {
@ -226,7 +227,8 @@
"and": [ "and": [
"fee=yes" "fee=yes"
] ]
} },
"id": "caravansites-charge"
}, },
{ {
"question": { "question": {
@ -295,7 +297,8 @@
"freeform": { "freeform": {
"key": "capacity", "key": "capacity",
"type": "pnat" "type": "pnat"
} },
"id": "caravansites-capacity"
}, },
{ {
"question": { "question": {
@ -491,7 +494,8 @@
"zh_Hant": "這個地方有網站嗎?", "zh_Hant": "這個地方有網站嗎?",
"fr": "Ce lieu a-til un site internet ?", "fr": "Ce lieu a-til un site internet ?",
"pt_BR": "Este lugar tem um website?" "pt_BR": "Este lugar tem um website?"
} },
"id": "caravansites-website"
}, },
{ {
"question": { "question": {
@ -575,7 +579,8 @@
"freeform": { "freeform": {
"key": "description", "key": "description",
"type": "text" "type": "text"
} },
"id": "caravansites-description"
}, },
"questions", "questions",
"reviews" "reviews"
@ -749,7 +754,8 @@
"and": [ "and": [
"fee=yes" "fee=yes"
] ]
} },
"id": "dumpstations-charge"
}, },
{ {
"question": { "question": {
@ -957,7 +963,8 @@
}, },
"freeform": { "freeform": {
"key": "network" "key": "network"
} },
"id": "dumpstations-network"
} }
], ],
"icon": { "icon": {

View file

@ -138,7 +138,8 @@
}, },
"freeform": { "freeform": {
"key": "name" "key": "name"
} },
"id": "climbing_club-name"
}, },
{ {
"render": "{minimap(18): height: 5rem; overflow: hidden; border-radius:3rem; }" "render": "{minimap(18): height: 5rem; overflow: hidden; border-radius:3rem; }"
@ -268,7 +269,6 @@
"render": "{minimap(18): height: 5rem; overflow: hidden; border-radius:3rem; }" "render": "{minimap(18): height: 5rem; overflow: hidden; border-radius:3rem; }"
}, },
{ {
"#": "name",
"render": { "render": {
"en": "<strong>{name}</strong>", "en": "<strong>{name}</strong>",
"nl": "<strong>{name}</strong>", "nl": "<strong>{name}</strong>",
@ -288,7 +288,8 @@
}, },
"freeform": { "freeform": {
"key": "name" "key": "name"
} },
"id": "name"
}, },
"website", "website",
"phone", "phone",
@ -361,7 +362,6 @@
"render": "{minimap(18): height: 5rem; overflow: hidden; border-radius:3rem; }" "render": "{minimap(18): height: 5rem; overflow: hidden; border-radius:3rem; }"
}, },
{ {
"#": "Name",
"render": { "render": {
"en": "<strong>{name}</strong>", "en": "<strong>{name}</strong>",
"nl": "<strong>{name}</strong>", "nl": "<strong>{name}</strong>",
@ -401,10 +401,10 @@
"fr": "Cette voie na pas de nom" "fr": "Cette voie na pas de nom"
} }
} }
] ],
"id": "Name"
}, },
{ {
"#": "Length",
"question": { "question": {
"en": "How long is this climbing route (in meters)?", "en": "How long is this climbing route (in meters)?",
"nl": "Hoe lang is deze klimroute (in meters)?", "nl": "Hoe lang is deze klimroute (in meters)?",
@ -423,10 +423,10 @@
"freeform": { "freeform": {
"key": "climbing:length", "key": "climbing:length",
"type": "pnat" "type": "pnat"
} },
"id": "Length"
}, },
{ {
"#": "Difficulty",
"question": { "question": {
"en": "What is the difficulty of this climbing route according to the french/belgian system?", "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?", "nl": "Hoe moeilijk is deze klimroute volgens het Franse/Belgische systeem?",
@ -443,10 +443,10 @@
}, },
"freeform": { "freeform": {
"key": "climbing:grade:french" "key": "climbing:grade:french"
} },
"id": "Difficulty"
}, },
{ {
"#": "Bolts",
"question": { "question": {
"en": "How much bolts does this route have before reaching the moulinette?", "en": "How much bolts does this route have before reaching the moulinette?",
"fr": "Combien de prises cette voie possède avant datteindre la moulinette ?" "fr": "Combien de prises cette voie possède avant datteindre la moulinette ?"
@ -478,25 +478,26 @@
"fr": "Cette voie na pas de prises" "fr": "Cette voie na pas de prises"
} }
} }
] ],
"id": "Bolts"
}, },
{ {
"#": "Description",
"question": "Is there other relevant info?", "question": "Is there other relevant info?",
"render": "<h3>Description</h3><br/>{description}", "render": "<h3>Description</h3><br/>{description}",
"freeform": { "freeform": {
"key": "description" "key": "description"
} },
"id": "Description"
}, },
{ {
"#": "Rock type",
"render": { "render": {
"en": "The rock type is {_embedding_features_with_rock:rock} as stated <a href='#{_embedding_features_with_rock:id}'>on the surrounding crag</a>", "en": "The rock type is {_embedding_features_with_rock:rock} as stated <a href='#{_embedding_features_with_rock:id}'>on the surrounding crag</a>",
"fr": "Le type de roche est {_embedding_features_with_rock:rock} selon <a href='#{_embedding_features_with_rock:id}'>le mur</a>" "fr": "Le type de roche est {_embedding_features_with_rock:rock} selon <a href='#{_embedding_features_with_rock:id}'>le mur</a>"
}, },
"freeform": { "freeform": {
"key": "_embedding_features_with_rock:rock" "key": "_embedding_features_with_rock:rock"
} },
"id": "Rock type"
}, },
"reviews" "reviews"
], ],
@ -621,31 +622,30 @@
"render": "{minimap(18, id, _contained_climbing_route_ids): height: 9rem; overflow: hidden; border-radius:3rem; }" "render": "{minimap(18, id, _contained_climbing_route_ids): height: 9rem; overflow: hidden; border-radius:3rem; }"
}, },
{ {
"#": "Contained routes length hist",
"render": { "render": {
"en": "<h3>Length overview</h3>{histogram(_length_hist)}", "en": "<h3>Length overview</h3>{histogram(_length_hist)}",
"fr": "<h3>Résumé de longueur</h3>{histogram(_length_hist)}" "fr": "<h3>Résumé de longueur</h3>{histogram(_length_hist)}"
}, },
"condition": "_length_hist!~\\[\\]" "condition": "_length_hist!~\\[\\]",
"id": "Contained routes length hist"
}, },
{ {
"#": "Contained routes hist",
"render": { "render": {
"en": "<h3>Difficulties overview</h3>{histogram(_difficulty_hist)}", "en": "<h3>Difficulties overview</h3>{histogram(_difficulty_hist)}",
"fr": "<h3>Résumé des difficultés</h3>{histogram(_difficulty_hist)}" "fr": "<h3>Résumé des difficultés</h3>{histogram(_difficulty_hist)}"
}, },
"condition": "_difficulty_hist!~\\[\\]" "condition": "_difficulty_hist!~\\[\\]",
"id": "Contained routes hist"
}, },
{ {
"#": "Containe {_contained_climbing_routes_count} routes",
"render": { "render": {
"en": "<h3>Contains {_contained_climbing_routes_count} routes</h3> <ul>{_contained_climbing_routes}</ul>", "en": "<h3>Contains {_contained_climbing_routes_count} routes</h3> <ul>{_contained_climbing_routes}</ul>",
"fr": "<h3>Contient {_contained_climbing_routes_count} voies</h3> <ul>{_contained_climbing_routes}</ul>" "fr": "<h3>Contient {_contained_climbing_routes_count} voies</h3> <ul>{_contained_climbing_routes}</ul>"
}, },
"condition": "_contained_climbing_routes~*" "condition": "_contained_climbing_routes~*",
"id": "Containe {_contained_climbing_routes_count} routes"
}, },
{ {
"#": "name",
"render": { "render": {
"en": "<strong>{name}</strong>", "en": "<strong>{name}</strong>",
"nl": "<strong>{name}</strong>", "nl": "<strong>{name}</strong>",
@ -682,10 +682,10 @@
"fr": "Ce site na pas de nom" "fr": "Ce site na pas de nom"
} }
} }
] ],
"id": "name"
}, },
{ {
"#": "Type",
"question": "What kind of climbing opportunity is this?", "question": "What kind of climbing opportunity is this?",
"mappings": [ "mappings": [
{ {
@ -706,10 +706,10 @@
"if": "climbing=area", "if": "climbing=area",
"then": "A climbing area with one or more climbing crags and/or boulders" "then": "A climbing area with one or more climbing crags and/or boulders"
} }
] ],
"id": "Type"
}, },
{ {
"#": "Rock type (crag/rock/cliff only)",
"question": { "question": {
"en": "What is the rock type here?", "en": "What is the rock type here?",
"fr": "Quel est le type de roche ?" "fr": "Quel est le type de roche ?"
@ -737,7 +737,8 @@
"natural=cliff", "natural=cliff",
"natural=bare_rock" "natural=bare_rock"
] ]
} },
"id": "Rock type (crag/rock/cliff only)"
}, },
"reviews" "reviews"
], ],

View file

@ -33,14 +33,16 @@
"question": "What is the name of this cycle highway?", "question": "What is the name of this cycle highway?",
"freeform": { "freeform": {
"key": "name" "key": "name"
} },
"id": "cycle_highways-name"
}, },
{ {
"render": "Referentienummer is <b>{ref}</b>", "render": "Referentienummer is <b>{ref}</b>",
"question": "What is the reference number of this cycle highway?", "question": "What is the reference number of this cycle highway?",
"freeform": { "freeform": {
"key": "ref" "key": "ref"
} },
"id": "cycle_highways-ref"
}, },
{ {
"render": "The current state of this link is {state}", "render": "The current state of this link is {state}",
@ -84,7 +86,8 @@
"if": "state=", "if": "state=",
"then": "This link is operational and signposted" "then": "This link is operational and signposted"
} }
] ],
"id": "cycle_highways-state"
}, },
{ {
"render": "This part is {_length:km}km long" "render": "This part is {_length:km}km long"

View file

@ -125,7 +125,8 @@
"freeform": { "freeform": {
"type": "direction", "type": "direction",
"key": "direction" "key": "direction"
} },
"id": "facadegardens-direction"
}, },
{ {
"mappings": [ "mappings": [
@ -241,7 +242,8 @@
"freeform": { "freeform": {
"key": "start_date", "key": "start_date",
"type": "text" "type": "text"
} },
"id": "facadegardens-start_date"
}, },
{ {
"mappings": [ "mappings": [
@ -355,7 +357,8 @@
"freeform": { "freeform": {
"key": "description", "key": "description",
"type": "text" "type": "text"
} },
"id": "facadegardens-description"
} }
], ],
"icon": { "icon": {

View file

@ -101,7 +101,8 @@
}, },
"freeform": { "freeform": {
"key": "species:nl" "key": "species:nl"
} },
"id": "fruitboom-species:nl"
}, },
{ {
"render": { "render": {
@ -117,7 +118,8 @@
"and": [ "and": [
"species:nl~*" "species:nl~*"
] ]
} },
"id": "fruitboom-taxon"
}, },
{ {
"render": { "render": {
@ -128,7 +130,8 @@
}, },
"freeform": { "freeform": {
"key": "description" "key": "description"
} },
"id": "fruitboom-description"
}, },
{ {
"render": { "render": {
@ -139,7 +142,8 @@
}, },
"freeform": { "freeform": {
"key": "ref" "key": "ref"
} },
"id": "fruitboom-ref"
} }
], ],
"icon": { "icon": {

View file

@ -76,7 +76,8 @@
}, },
"freeform": { "freeform": {
"key": "name" "key": "name"
} },
"id": "hackerspaces-name"
}, },
"website", "website",
"email", "email",
@ -103,7 +104,8 @@
"en": "Opened 24/7" "en": "Opened 24/7"
} }
} }
] ],
"id": "hackerspaces-opening_hours"
}, },
"wheelchair-access", "wheelchair-access",
{ {
@ -143,7 +145,8 @@
"freeform": { "freeform": {
"key": "start_date", "key": "start_date",
"type": "date" "type": "date"
} },
"id": "hackerspaces-start_date"
} }
], ],
"icon": { "icon": {

View file

@ -111,7 +111,8 @@
"render": "This shop is called <i>{name}</i>", "render": "This shop is called <i>{name}</i>",
"freeform": { "freeform": {
"key": "name" "key": "name"
} },
"id": "shops-name"
}, },
{ {
"render": { "render": {
@ -220,7 +221,8 @@
"ja": "自動車ディーラー" "ja": "自動車ディーラー"
} }
} }
] ],
"id": "shops-shop"
}, },
{ {
"render": { "render": {
@ -241,7 +243,8 @@
"freeform": { "freeform": {
"key": "phone", "key": "phone",
"type": "phone" "type": "phone"
} },
"id": "shops-phone"
}, },
{ {
"render": { "render": {
@ -262,7 +265,8 @@
"freeform": { "freeform": {
"key": "website", "key": "website",
"type": "url" "type": "url"
} },
"id": "shops-website"
}, },
{ {
"render": { "render": {
@ -282,7 +286,8 @@
"freeform": { "freeform": {
"key": "email", "key": "email",
"type": "email" "type": "email"
} },
"id": "shops-email"
}, },
{ {
"render": { "render": {
@ -301,7 +306,8 @@
"freeform": { "freeform": {
"key": "opening_hours", "key": "opening_hours",
"type": "opening_hours" "type": "opening_hours"
} },
"id": "shops-opening_hours"
}, },
"questions", "questions",
"reviews" "reviews"

View file

@ -14,6 +14,10 @@ import {LayerConfigJson} from "../Models/ThemeConfig/Json/LayerConfigJson";
* In place fix * In place fix
*/ */
function fixLayerConfig(config: LayerConfigJson) : void{ function fixLayerConfig(config: LayerConfigJson) : void{
if(config.tagRenderings === undefined){
return
}
for (const tagRendering of config.tagRenderings) { for (const tagRendering of config.tagRenderings) {
if(tagRendering["#"] !== undefined){ if(tagRendering["#"] !== undefined){
tagRendering["id"] = tagRendering["#"] tagRendering["id"] = tagRendering["#"]
@ -32,7 +36,7 @@ for (const layerFile of layerFiles) {
fixLayerConfig(layerFile.parsed) fixLayerConfig(layerFile.parsed)
writeFileSync(layerFile.path, JSON.stringify(layerFile.parsed, null, " ")) writeFileSync(layerFile.path, JSON.stringify(layerFile.parsed, null, " "))
} }
/*
const themeFiles = ScriptUtils.getThemeFiles() const themeFiles = ScriptUtils.getThemeFiles()
for (const themeFile of themeFiles) { for (const themeFile of themeFiles) {
for (const layerConfig of themeFile.parsed.layers ?? []) { for (const layerConfig of themeFile.parsed.layers ?? []) {
@ -42,6 +46,6 @@ for (const themeFile of themeFiles) {
// @ts-ignore // @ts-ignore
fixLayerConfig(layerConfig) fixLayerConfig(layerConfig)
} }
// writeFileSync(themeFile.path, JSON.stringify(themeFile.parsed, null, " ")) writeFileSync(themeFile.path, JSON.stringify(themeFile.parsed, null, " "))
} }
//*/ //*/