From 9da039f8cc3379e3a324d2720923be64335e4110 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= <skunk@xover.mud.at>
Date: Tue, 29 Sep 2020 22:22:03 +0200
Subject: [PATCH] Layouts: split details from description; remove 'unnamed'

---
 buildings-height.json        | 15 +++++++++++++++
 car_maxspeed.json            |  3 ++-
 car_routes.json              |  2 +-
 communication.json           |  1 -
 cycle_amenities.json         |  2 +-
 cycle_routes.json            |  2 +-
 hiking_routes.json           |  4 ++--
 mtb-routes.json              |  2 +-
 natural.json                 |  5 +----
 power_routes.json            |  2 +-
 pt.json                      |  2 +-
 public.json                  |  1 -
 railway-electrification.json | 11 +++++------
 railway-gauge.json           |  5 +++--
 railway-infrastructure.json  |  2 +-
 railway-routes.json          |  2 +-
 16 files changed, 36 insertions(+), 25 deletions(-)

diff --git a/buildings-height.json b/buildings-height.json
index dc08cf3..a29e75e 100644
--- a/buildings-height.json
+++ b/buildings-height.json
@@ -34,6 +34,21 @@
             "{% endif %}"
         ],
         "description": [
+            "{% if tags.building == 'yes' and tags.military %}",
+            "{{ tagTrans('building', 'military') }}",
+            "{% elseif tags.building == 'yes' %}",
+            "{{ keyTrans('building') }}",
+            "{% else %}",
+            "{{ tagTransList('building', tags.building) }}",
+            "{% endif %}",
+            "{% if tags.building == 'construction' and tags.construction %}",
+            "({{ tagTransList('building', tags.construction) }})",
+            "{% endif %}",
+            "{% if tags.building in  [ 'yes', 'military' ] and tags.military %}",
+            "({{ tagTransList('military', tags.military) }})",
+            "{% endif %}"
+        ],
+        "details": [
             "{% if tags.height is defined %}",
             "  {% if tags.height|matches('(m|ft)$') %}{{ tags.height -}}",
             "  {% else %}{{ tags.height }}&nbsp;m",
diff --git a/car_maxspeed.json b/car_maxspeed.json
index b504733..9805d07 100644
--- a/car_maxspeed.json
+++ b/car_maxspeed.json
@@ -93,7 +93,8 @@
             "{% set colorB = colorInterpolate(const.colorMap, (maxspeedBKmh - const.offsetColorSpeed) / const.highestColorSpeed) %}",
             "{% endif %}"
         ],
-        "description": [
+        "description": "{{ tagTransList('highway', tags.highway) }}",
+        "details": [
             "{% if maxspeedF or maxspeedB %}",
             "<span style='color: {{ colorB }}'>{{ maxspeedB == 'other' ? attribute(tags, 'maxspeed:backward') : const.colorOther[maxspeedB] ? tagTrans('maxspeed', maxspeedB) : maxspeedB|default(trans('unknown')) }}</span> / <span style='color: {{ colorF }}'>{{ maxspeedF == 'other' ? attribute(tags, 'maxspeed:forward') : const.colorOther[maxspeedF] ? tagTrans('maxspeed', maxspeedF) : maxspeedF|default(trans('unknown')) }}</span> {{ unit }}",
             "{% elseif maxspeed %}",
diff --git a/car_routes.json b/car_routes.json
index d1c7734..a60530a 100644
--- a/car_routes.json
+++ b/car_routes.json
@@ -13,7 +13,7 @@
     "feature": {
         "pre": "{% set color = '#' ~ tags.network|default('')|md5|slice(0, 6) %}",
         "description": "{% if tags.network %}{{ tagTrans('network', tags.network) }}{% endif %}",
-        "title": "{% if tags.ref and tags.name %}{{ tags.ref }} - {{ tags.name }}{% elseif tags.ref %}{{ tags.ref }}{% elseif tags.name %}{{ tags.name }}{% else %}{{ trans('unnamed') }}{% endif %}",
+        "title": "{% if tags.ref and tags.name %}{{ tags.ref }} - {{ tags.name }}{% elseif tags.ref %}{{ tags.ref }}{% elseif tags.name %}{{ tags.name }}{% endif %}",
         "listMarkerSymbol": "{{ markerLine({ 'width': 4, 'color': color })|raw }}",
         "markerSymbol": "",
         "styles": ""
diff --git a/communication.json b/communication.json
index 3053b3e..5fc3d48 100644
--- a/communication.json
+++ b/communication.json
@@ -46,7 +46,6 @@
             "  {% set value = tags.office %}",
             "{% endif %}"
         ],
-        "title": "{{ localizedTag(tags, 'name') |default(localizedTag(tags, 'operator')) |default(tagTrans('amenity', tags.amenity)) }}",
         "description": [
             "{% if key == 'office' %}",
             "  {{ keyTrans('office') }} ({{ tagTrans('office', tags.office) }})",
diff --git a/cycle_amenities.json b/cycle_amenities.json
index 925ade8..e38afff 100644
--- a/cycle_amenities.json
+++ b/cycle_amenities.json
@@ -56,7 +56,7 @@
             "{% set constIndex = (key ~ \"=\" ~ value) %}"
         ],
         "title": [
-            "{{ localizedTag(tags, 'name') |default(localizedTag(tags, 'operator')) | default(localizedTag(tags, 'ref')) | default(trans('unnamed')) }}",
+            "{{ localizedTag(tags, 'name') |default(localizedTag(tags, 'operator')) | default(localizedTag(tags, 'ref')) }}",
             "",
             "{% if tags.capacity %}({{ tags.capacity }}){% endif %}"
         ],
diff --git a/cycle_routes.json b/cycle_routes.json
index a3c5ceb..69ccde1 100644
--- a/cycle_routes.json
+++ b/cycle_routes.json
@@ -16,7 +16,7 @@
     },
     "members": true,
     "feature": {
-        "title": "{% if tags.ref and tags.name %}{{ tags.ref }} - {{ tags.name }}{% elseif tags.ref %}{{ tags.ref }}{% elseif tags.name %}{{ tags.name }}{% else %}{{ trans('unnamed') }}{% endif %}",
+        "title": "{% if tags.ref and tags.name %}{{ tags.ref }} - {{ tags.name }}{% elseif tags.ref %}{{ tags.ref }}{% elseif tags.name %}{{ tags.name }}{% endif %}",
         "description": "{{ tagTrans('network', tags.network) }}",
         "markerSymbol": "",
         "listMarkerSymbol": "{{ markerLine({ 'width': 4, 'color': const[tags.network].color|default(const[''].color) })|raw }}",
diff --git a/hiking_routes.json b/hiking_routes.json
index 53ce1e5..2e1e25e 100644
--- a/hiking_routes.json
+++ b/hiking_routes.json
@@ -19,7 +19,7 @@
         "priority": "{{ const[tags.network].priority|default(4) }}",
         "description": "{% if tags.network %}{{ tagTrans('network', tags.network) }}{% endif %}",
         "listMarkerSymbol": "{{ markerLine({ 'width': 4, 'color': const[tags.network|default('')].color|default(const[''].color) })|raw }}",
-        "title": "{% if tags.ref and tags.name %}{{ tags.ref }} - {{ tags.name }}{% elseif tags.ref %}{{ tags.ref }}{% elseif tags.name %}{{ tags.name }}{% else %}{{ trans('unnamed') }}{% endif %}",
+        "title": "{% if tags.ref and tags.name %}{{ tags.ref }} - {{ tags.name }}{% elseif tags.ref %}{{ tags.ref }}{% elseif tags.name %}{{ tags.name }}{% endif %}",
         "styles": "",
         "markerSymbol": ""
     },
@@ -46,7 +46,7 @@
             "{% for master in masters %}",
             "  <li data-object=\"{{ master.id }}\">",
             "    <span class='markerParent'><div class='marker'>{{ markerLine({ width: 4, color: const[master.tags.network].color|default(const[''].color) })|raw }}</div></span>",
-            "    <span class='title'>{% if master.tags.ref and master.tags.name %}{{ master.tags.ref }} - {{ master.tags.name|default(master.tags.ref) }}{% elseif master.tags.ref %}{{ master.tags.ref }}{% elseif master.tags.name %}{{ master.tags.name }}{% else %}{{ trans('unnamed') }}{% endif %}</span>",
+            "    <span class='title'>{% if master.tags.ref and master.tags.name %}{{ master.tags.ref }} - {{ master.tags.name|default(master.tags.ref) }}{% elseif master.tags.ref %}{{ master.tags.ref }}{% elseif master.tags.name %}{{ master.tags.name }}{% endif %}</span>",
             "    <span class='description'>{{ tagTrans('network', master.tags.network) }}</span>",
             "  </li>",
             "{% endfor %}",
diff --git a/mtb-routes.json b/mtb-routes.json
index b793061..2d0d524 100644
--- a/mtb-routes.json
+++ b/mtb-routes.json
@@ -13,7 +13,7 @@
     "feature": {
         "description": "{{ tagTrans('route', 'mtb') }}",
         "listMarkerSymbol": "{{ markerLine({ 'width': 4, 'color': '#007fff' })|raw }}",
-        "title": "{% if tags.ref and tags.name %}{{ tags.ref }} - {{ tags.name }}{% elseif tags.ref %}{{ tags.ref }}{% elseif tags.name %}{{ tags.name }}{% else %}{{ trans('unnamed') }}{% endif %}",
+        "title": "{% if tags.ref and tags.name %}{{ tags.ref }} - {{ tags.name }}{% elseif tags.ref %}{{ tags.ref }}{% elseif tags.name %}{{ tags.name }}{% endif %}",
         "styles": "",
         "markerSymbol": ""
     },
diff --git a/natural.json b/natural.json
index 53749c3..b2f09c6 100644
--- a/natural.json
+++ b/natural.json
@@ -39,10 +39,7 @@
         ]
     },
     "feature": {
-        "title": [
-            "{{ localizedTag(tags, 'name') | default(trans('unnamed')) }}",
-            "{% if tags.natural == 'peak' and tags.ele %}({{ tags.ele }}m){% endif %}"
-        ],
+        "details": "{% if tags.natural == 'peak' and tags.ele %}{{ tags.ele }}m{% endif %}",
         "description": "{{ tagTrans('natural', tags.natural) }}",
         "style": {
             "color": "{{ const[tags.natural].color|default('#f2756a') }}"
diff --git a/power_routes.json b/power_routes.json
index e90591c..7794763 100644
--- a/power_routes.json
+++ b/power_routes.json
@@ -13,7 +13,7 @@
     "feature": {
         "pre": "{% set color = '#' ~ tags.operator|default('')|md5|slice(0, 6) %}",
         "description": "{% if tags.operator %}{{ tags.operator }}{% endif %}",
-        "title": "{% if tags.ref and tags.name %}{{ tags.ref }} - {{ tags.name }}{% elseif tags.ref %}{{ tags.ref }}{% elseif tags.name %}{{ tags.name }}{% else %}{{ trans('unnamed') }}{% endif %}",
+        "title": "{% if tags.ref and tags.name %}{{ tags.ref }} - {{ tags.name }}{% elseif tags.ref %}{{ tags.ref }}{% elseif tags.name %}{{ tags.name }}{% endif %}",
         "listMarkerSymbol": "{{ markerLine({ 'width': 4, 'color': color })|raw }}",
         "markerSymbol": "",
         "styles": ""
diff --git a/pt.json b/pt.json
index 6bbd5ac..6b066fe 100644
--- a/pt.json
+++ b/pt.json
@@ -54,7 +54,7 @@
         "title": [
             "{% if tags.ref %}{{ tags.ref }} - {% endif %}",
             "",
-            "{{ localizedTag(tags, 'name') |default(localizedTag(tags, 'operator')) | default(localizedTag(tags, 'ref')) | default(trans('unnamed')) }}"
+            "{{ localizedTag(tags, 'name') |default(localizedTag(tags, 'operator')) | default(localizedTag(tags, 'ref')) }}"
         ],
         "description": "{{ tagTrans('route', tags.route) }}",
         "body": [
diff --git a/public.json b/public.json
index 3c95f11..2421b81 100644
--- a/public.json
+++ b/public.json
@@ -53,7 +53,6 @@
             "{% set value = tags.office %}",
             "{% endif %}"
         ],
-        "title": "{{ tags.name|default(tags.operator)|default(tagTrans('amenity', value)) }}",
         "description": [
             "{% if key == 'office' %}",
             "  {{ keyTrans('office') }} ({{ tagTrans('office', tags.office) }})",
diff --git a/railway-electrification.json b/railway-electrification.json
index 66bb031..01fd618 100644
--- a/railway-electrification.json
+++ b/railway-electrification.json
@@ -44,14 +44,13 @@
             "  {% endif %}",
             "{% endif %}"
         ],
-        "title": "{% if tags.ref %}{{ localizedTag(tags, 'ref') }} - {% endif %}{{ localizedTag(tags, 'name')|default(localizedTag(tags, 'operator'))|default(trans('unnamed')) }}",
-        "description": [
-            "{{ tagTrans('railway', tags.railway) }}",
-            "",
+        "title": "{% if tags.ref %}{{ localizedTag(tags, 'ref') }} - {% endif %}{{ localizedTag(tags, 'name')|default(localizedTag(tags, 'operator')) }}",
+        "description": "{{ tagTrans('railway', tags.railway) }}",
+        "details": [
             "{% if tags.electrified == 'no' %}",
-            "  - {{ tagTrans('electrified', 'no') }}",
+            "{{ tagTrans('electrified', 'no') }}",
             "{% elseif tags.electrified %}",
-            "  - {{ tags.voltage|default(trans('unknown')) }}V, {{ tags.frequency|default(trans('unknown')) }}Hz",
+            "{{ tags.voltage|default(trans('unknown')) }}V, {{ tags.frequency|default(trans('unknown')) }}Hz",
             "{% endif %}"
         ],
         "body": [
diff --git a/railway-gauge.json b/railway-gauge.json
index 4771b27..f9a8046 100644
--- a/railway-gauge.json
+++ b/railway-gauge.json
@@ -12,8 +12,9 @@
             "{% set gauges = tags.gauge|split(';')|sort|reverse %}",
             "{% set width = max(3, 3 / map.metersPerPixel) %}"
         ],
-        "title": "{% if tags.ref %}{{ localizedTag(tags, 'ref') }} - {% endif %}{{ localizedTag(tags, 'name')|default(localizedTag(tags, 'operator'))|default(trans('unnamed')) }}",
-        "description": "{{ tags.gauge|default(trans('unknown'))|enumerate }}",
+        "title": "{% if tags.ref %}{{ localizedTag(tags, 'ref') }} - {% endif %}{{ localizedTag(tags, 'name')|default(localizedTag(tags, 'operator')) }}",
+        "description": "{{ tagTrans('railway', tags.railway) }}",
+        "details": "{{ tags.gauge|default(trans('unknown'))|enumerate }}",
         "body": [
             "{{ tagTrans('railway', tags.railway) }}<br/>",
             "{% if tags.operator %}{{ keyTrans('operator') }}: {{ localizedTag(tags, 'operator') }}<br>{% endif %}",
diff --git a/railway-infrastructure.json b/railway-infrastructure.json
index 9381048..43edcc6 100644
--- a/railway-infrastructure.json
+++ b/railway-infrastructure.json
@@ -14,7 +14,7 @@
         "17": "(node[railway];way[railway];)"
     },
     "feature": {
-        "title": "{% if tags.ref %}{{ localizedTag(tags, 'ref') }} - {% endif %}{{ localizedTag(tags, 'name')|default(localizedTag(tags, 'operator'))|default(trans('unnamed')) }}",
+        "title": "{% if tags.ref %}{{ localizedTag(tags, 'ref') }} - {% endif %}{{ localizedTag(tags, 'name')|default(localizedTag(tags, 'operator')) }}",
         "description": [
             "{{ tagTrans('railway', tags.railway) -}}",
             "{%- if tags.usage %}",
diff --git a/railway-routes.json b/railway-routes.json
index f06a1d3..f163c5c 100644
--- a/railway-routes.json
+++ b/railway-routes.json
@@ -14,7 +14,7 @@
         "pre": "{% set color = '#' ~ tags.operator|default('')|md5|slice(0, 6) %}",
         "listMarkerSymbol": "{{ markerLine({ 'width': 4, 'color': color })|raw }}",
         "description": "{{ tags.operator }}",
-        "title": "{% if tags.ref and tags.name %}{{ tags.ref }} - {{ tags.name }}{% elseif tags.ref %}{{ tags.ref }}{% elseif tags.name %}{{ tags.name }}{% else %}{{ trans('unnamed') }}{% endif %}",
+        "title": "{% if tags.ref and tags.name %}{{ tags.ref }} - {{ tags.name }}{% elseif tags.ref %}{{ tags.ref }}{% elseif tags.name %}{{ tags.name }}{% endif %}",
         "styles": "",
         "markerSymbol": ""
     },