From 6b0d727e58c4c3d14149ad9ea17e501af8a63d4b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= <skunk@xover.mud.at>
Date: Tue, 1 Oct 2024 21:55:31 +0200
Subject: [PATCH] railway-rails: highlight unknown rail type + info

---
 railway-rails.yaml | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/railway-rails.yaml b/railway-rails.yaml
index 809833e..7ecc004 100644
--- a/railway-rails.yaml
+++ b/railway-rails.yaml
@@ -14,10 +14,10 @@ feature:
     {% set lifecyle = 'active' %}
     {% if tags.railway in ['abandoned', 'construction', 'proposed', 'disused', 'razed'] %}
       {% set lifecyle = tags.railway %}
-      {% set type = attribute(tags, tags.railway)|default(attribute(tags, tags.railway ~ ':railway')) %}
+      {% set type = attribute(tags, tags.railway)|default(attribute(tags, tags.railway ~ ':railway'))|default('unknown') %}
     {% endif %}
 
-    {% set color = const.types[type ~ '/' ~ tags.usage].color|default(const.types[type].color)|default(const.types.default.color) %}
+    {% set color = const.types[type ~ '/' ~ tags.usage].color|default(const.types[type].color)|default(const.types.unknown.color) %}
 
     {% if tags.tunnel and tags.tunnel != 'no' %}
       {% set color = colorInterpolate([ color, '#ffffff' ], 0.3) %}
@@ -140,7 +140,13 @@ info: |-
       {% else %}
       <tr>
         <td>{{ markerLine(evaluate({ "railway": k }))|raw }}</td>
-        <td>{{ tagTrans('railway', k) }}</td>
+        <td>
+        {% if v.title %}
+          {{ trans(v.title) }}
+        {% else %}
+          {{ tagTrans('railway', k) }}
+        {% endif %}
+        </td>
       </tr>
       {% endif %}
     {% endif %}
@@ -179,14 +185,14 @@ const:
     tram:
       color: '#ff00ff'
     light_rail:
-      color: '#ff007f'
+      color: '#7f007f'
     funicular:
       color: '#00BD14'
     monorail:
       color: '#007f00'
-    default:
+    unknown:
       color: '#ff0000'
-      hideInfo: true
+      title: 'unknown'
   lifecyle:
     active:
       dashArray: ''