From ea69d063c49b0e5c87413fb0c3adfafd5eae4a91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Sun, 15 Jul 2018 22:40:33 +0200 Subject: [PATCH] pt: remove duplicate refs, order naturally --- pt.json | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pt.json b/pt.json index 838c83c..d2021f4 100644 --- a/pt.json +++ b/pt.json @@ -91,6 +91,7 @@ "{% set isStop = false %}", "{% set isWay = false %}", "{% set aRoute = null %}", + "{% set refs = [] %}", "{% for master in masters %}", " {% if master.tags.public_transport == 'stop_area' %}", " {% set stopName = master.tags.name %}", @@ -101,8 +102,14 @@ " {% set isWay = true %}", " {% endif %}", " {% set aRoute = master %}", + "", + " {% if master.tags.ref %}", + " {% set refs = refs|merge([ master.tags.ref ]) %}", + " {% endif %}", " {% endif %}", - "{% endfor %}" + "{% endfor %}", + "", + "{% set refs = refs|unique|natsort({ insensitive: true }) %}" ], "listStopsMarkerSymbol": "{{ markerCircle({})|raw }}", "styles": "{% if isStop %}stop{% elseif isWay %}way{% else %}platform{% endif %}", @@ -111,7 +118,7 @@ "{{ const[aRoute.tags.route].color|default('#ff0000') }}" ], "width": "3", - "text": "{% for master in masters %}{{ master.tags.ref }} {% endfor %} ", + "text": "{{ refs|join(' ') }} ", "textRepeat": "1", "textOffset": "12", "textFontWeight": "bold" @@ -129,7 +136,7 @@ }, "title": "{% if tags.public_transport == 'stop_position' %}{{ tags.name|default(stopName)|default(id) }}{% endif %}", "listStopsTitle": "{{ tags.name|default(stopName)|default(id) }}", - "listStopsDescription": "{% for master in masters %}{{ master.tags.ref }} {% endfor %}", + "listStopsDescription": "{{ refs|join(' ') }}", "body": [ "

Routes

", "