From 256dc891930ff690b36b686532576f808ea92ec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Sun, 29 Jul 2018 17:41:51 +0200 Subject: [PATCH] cycle_routes, hiking_routes: improve code --- cycle_routes.json | 13 ++++++++----- hiking_routes.json | 20 +++++++++++--------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/cycle_routes.json b/cycle_routes.json index a0a648ae..d5ad8fee 100644 --- a/cycle_routes.json +++ b/cycle_routes.json @@ -27,7 +27,7 @@ "{% set refs = [] %}", "", "{% for master in masters %}", - " {% set _p = {icn:0,ncn:1,rcn:2,lcn:3}[master.tags.network] %}", + " {% set _p = {icn:0,ncn:1,rcn:2,lcn:3}[master.tags.network]|default(4) %}", " {% if _p < priority %}", " {% set priority = _p %}", " {% set network = master.tags.network %}", @@ -39,11 +39,10 @@ ], "title": "", "body": [ + "

Routes

", "" ], @@ -74,6 +73,10 @@ "lcn": { "color": "#0000ff", "zoom": 15 + }, + "": { + "color": "#007fff", + "zoom": 15 } }, "info": [ @@ -82,7 +85,7 @@ "{% if data.zoom <= map.zoom %}", " ", " {{ markerLine({ 'width': 4, color: data.color })|raw }}", - " {{ tagTrans('network', value) }}", + " {% if value %}{{ tagTrans('network', value) }}{% else %}{{ trans('unknown') }}{% endif %}", " ", "{% endif %}", "{% endfor %}", diff --git a/hiking_routes.json b/hiking_routes.json index c1b5391d..486238b4 100644 --- a/hiking_routes.json +++ b/hiking_routes.json @@ -15,9 +15,9 @@ }, "members": true, "feature": { - "priority": "{{ {iwn:0,nwn:1,rwn:2,lwn:3}[tags.network] }}", - "description": "{{ tagTrans('network', tags.network) }}", - "listMarkerSymbol": "{{ markerLine({ 'width': 4, 'color': const[tags.network].color })|raw }}", + "priority": "{{ {iwn:0,nwn:1,rwn:2,lwn:3}[tags.network]|default(4) }}", + "description": "{% if tags.network %}{{ tagTrans('network', tags.network) }}{% endif %}", + "listMarkerSymbol": "{{ markerLine({ 'width': 4, 'color': const[tags.network|default('')].color })|raw }}", "styles": "" }, "memberFeature": { @@ -27,7 +27,7 @@ "{% set refs = [] %}", "", "{% for master in masters %}", - " {% set _p = {iwn:0,nwn:1,rwn:2,lwn:3}[master.tags.network] %}", + " {% set _p = {iwn:0,nwn:1,rwn:2,lwn:3}[master.tags.network]|default(4) %}", " {% if _p < priority %}", " {% set priority = _p %}", " {% set network = master.tags.network %}", @@ -37,13 +37,11 @@ " {% endif %}", "{% endfor %}" ], - "title": "", "body": [ + "

Routes

", "" ], @@ -74,6 +72,10 @@ "lwn": { "color": "#0000ff", "zoom": 14 + }, + "": { + "color": "#007fff", + "zoom": 14 } }, "info": [ @@ -82,7 +84,7 @@ "{% if data.zoom <= map.zoom %}", " ", " {{ markerLine({ 'width': 4, color: data.color })|raw }}", - " {{ tagTrans('network', value) }}", + " {% if value %}{{ tagTrans('network', value) }}{% else %}{{ trans('unknown') }}{% endif %}", " ", "{% endif %}", "{% endfor %}",