From 1906a9ccaf8381c7f26346480d8ea399c45b45bd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= <skunk@cg.tuwien.ac.at>
Date: Wed, 6 Mar 2019 14:27:16 +0100
Subject: [PATCH] shop: rewrite from array with types to hash; also enable Font
 Awesome regular

---
 shop.json | 532 ++++++++++++++++++++++++------------------------------
 1 file changed, 238 insertions(+), 294 deletions(-)

diff --git a/shop.json b/shop.json
index c19ffc6..33e8fb2 100644
--- a/shop.json
+++ b/shop.json
@@ -24,324 +24,268 @@
         "16": "(node[shop];way[shop];relation[shop];);"
     },
     "feature": {
-        "pre": "{% set shop0 = tags.shop|split(';')[0] %}{% set current = const.default %}{% for v in const.shops %}{% if shop0 in v.types %}{% set current = v %}{% endif %}{% endfor %}",
+        "pre": [
+            "{% set shop0 = tags.shop|split(';')[0] %}",
+            "{% set current = const.default %}",
+            "{% if const.shops[shop0] %}",
+            "  {% set current = const.shops[shop0] %}",
+            "{% endif %}"
+        ],
         "description": "{{ tagTransList('shop', tags.shop) }}",
-        "markerSign": "{% set c = current.sign %}{% if c|slice(0, 3) == 'fa-' %}<i class=\"fa {{ c }}\"></i>{% elseif c|slice(0, 5) == 'maki:' %}<img data-src=\"{{ c }}\">{% else %}{{ c|raw }}{% endif %}"
+        "markerSign": [
+            "{% set c = current.sign %}",
+            "{% if c|slice(0, 4) == 'fas:' %}",
+            "  <i class=\"fas fa-{{ c|slice(4) }}\"></i>",
+            "{% elseif c|slice(0, 4) == 'far:' %}",
+            "  <i class=\"far fa-{{ c|slice(4) }}\"></i>",
+            "{% elseif c|slice(0, 5) == 'maki:' %}",
+            "  <img data-src=\"{{ c }}\">",
+            "{% else %}",
+            "  {{ c|raw }}",
+            "{% endif %}"
+        ]
     },
     "const": {
         "default": {
-            "sign": "fa-shopping-bag"
+            "sign": "fas:shopping-bag"
         },
-        "shops": [
-            {
-                "types": [
-                    "vacant"
-                ],
-                "sign": "fa-times"
-            },
-            {
-                "types": [
-                    "alcohol",
-                    "beverages"
-                ],
-                "sign": "fa-wine-bottle"
-            },
-            {
-                "types": [
-                    "baby_goods"
-                ],
-                "sign": "&#128700;"
-            },
-            {
-                "types": [
-                    "bag",
-                    "general",
-                    "variety_store"
-                ],
-                "sign": "fa-shopping-bag"
-            },
-            {
-                "types": [
-                    "bakery",
-                    "confectionery",
-                    "pastry"
-                ],
-                "sign": "fa-birthday-cake"
-            },
-            {
-                "types": [
-                    "bicycle"
-                ],
-                "sign": "fa-bicycle"
-            },
-            {
-                "types": [
-                    "motorcycle"
-                ],
-                "sign": "fa-motorcycle"
-            },
-            {
-                "types": [
-                    "boutique",
-                    "clothes",
-                    "fabric",
-                    "fashion",
-                    "leather",
-                    "sewing",
-                    "tailor",
-                    "dry_cleaning"
-                ],
+        "shops": {
+            "vacant": {
+                "sign": "fas:times"
+            },
+            "alcohol": {
+                "sign": "fas:wine-bottle"
+            },
+            "beverages": {
+                "sign": "fas:wine-bottle"
+            },
+            "baby_goods": {
+                "sign": "fas:baby"
+            },
+            "bag": {
+                "sign": "fas:shopping-bag"
+            },
+            "general": {
+                "sign": "fas:shopping-bag"
+            },
+            "variety_store": {
+                "sign": "fas:shopping-bag"
+            },
+            "bakery": {
+                "sign": "fas:birthday-cake"
+            },
+            "confectionery": {
+                "sign": "fas:birthday-cake"
+            },
+            "pastry": {
+                "sign": "fas:birthday-cake"
+            },
+            "bicycle": {
+                "sign": "fas:bicycle"
+            },
+            "motorcycle": {
+                "sign": "fas:motorcycle"
+            },
+            "boutique": {
+                "sign": "&#128090;"
+            },
+            "clothes": {
+                "sign": "&#128090;"
+            },
+            "fabric": {
+                "sign": "&#128090;"
+            },
+            "fashion": {
+                "sign": "&#128090;"
+            },
+            "leather": {
                 "sign": "&#128090;"
             },
-            {
-                "types": [
-                    "sea_food"
-                ],
-                "sign": "fa-fish"
-            },
-            {
-                "types": [
-                    "butcher",
-                    "cheese",
-                    "chocolate",
-                    "deli",
-                    "dairy",
-                    "farm",
-                    "greengrocer",
-                    "pasta",
-                    "spices"
-                ],
-                "sign": "fa-cutlery"
-            },
-            {
-                "types": [
-                    "coffee",
-                    "tea"
-                ],
-                "sign": "fa-coffee"
-            },
-            {
-                "types": [
-                    "convenience"
-                ],
-                "sign": "fa-shopping-basket"
-            },
-            {
-                "types": [
-                    "department_store",
-                    "mall"
-                ],
-                "sign": "fa-building"
-            },
-            {
-                "types": [
-                    "electronics",
-                    "computer"
-                ],
-                "sign": "fa-tv"
-            },
-            {
-                "types": [
-                    "electrical"
-                ],
-                "sign": "fa-bolt"
-            },
-            {
-                "types": [
-                    "lighting"
-                ],
-                "sign": "fa-bulb"
-            },
-            {
-                "types": [
-                    "fishing"
-                ],
-                "sign": "&#127907;"
-            },
-            {
-                "types": [
-                    "toys"
-                ],
-                "sign": "fa-dice"
-            },
-            {
-                "types": [
-                    "florist",
-                    "garden_centre"
-                ],
+            "sewing": {
+                "sign": "&#128090;"
+            },
+            "tailor": {
+                "sign": "&#128090;"
+            },
+            "dry_cleaning": {
+                "sign": "&#128090;"
+            },
+            "sea_food": {
+                "sign": "fas:fish"
+            },
+            "butcher": {
+                "sign": "fas:utensils"
+            },
+            "cheese": {
+                "sign": "fas:utensils"
+            },
+            "chocolate": {
+                "sign": "fas:utensils"
+            },
+            "deli": {
+                "sign": "fas:utensils"
+            },
+            "dairy": {
+                "sign": "fas:utensils"
+            },
+            "farm": {
+                "sign": "fas:utensils"
+            },
+            "greengrocer": {
+                "sign": "fas:utensils"
+            },
+            "pasta": {
+                "sign": "fas:utensils"
+            },
+            "spices": {
+                "sign": "fas:utensils"
+            },
+            "coffee": {
+                "sign": "fas:coffee"
+            },
+            "tea": {
+                "sign": "fas:coffee"
+            },
+            "convenience": {
+                "sign": "fas:shopping-basket"
+            },
+            "department_store": {
+                "sign": "fas:building"
+            },
+            "mall": {
+                "sign": "fas:building"
+            },
+            "electronics": {
+                "sign": "fas:tv"
+            },
+            "computer": {
+                "sign": "fas:desktop"
+            },
+            "electrical": {
+                "sign": "fas:bolt"
+            },
+            "lighting": {
+                "sign": "fas:bulb"
+            },
+            "fishing": {
+                "sign": "fas:fish"
+            },
+            "toys": {
+                "sign": "fas:dice"
+            },
+            "florist": {
                 "sign": "&#127799;"
             },
-            {
-                "types": [
-                    "hairdresser"
-                ],
+            "garden_centre": {
+                "sign": "&#127799;"
+            },
+            "hairdresser": {
                 "sign": "&#128113;"
             },
-            {
-                "types": [
-                    "ice_cream"
-                ],
-                "sign": "&#127848;"
-            },
-            {
-                "types": [
-                    "jewelry"
-                ],
-                "sign": "fa-ring"
-            },
-            {
-                "types": [
-                    "kiosk",
-                    "newsagent"
-                ],
-                "sign": "fa-newspaper-o"
-            },
-            {
-                "types": [
-                    "shoes"
-                ],
-                "sign": "fa-shoe-prints"
-            },
-            {
-                "types": [
-                    "travel_agency"
-                ],
+            "ice_cream": {
+                "sign": "fas:ice-cream"
+            },
+            "jewelry": {
+                "sign": "fas:ring"
+            },
+            "kiosk": {
+                "sign": "fas:newspaper"
+            },
+            "newsagent": {
+                "sign": "fas:newspaper"
+            },
+            "shoes": {
+                "sign": "fas:shoe-prints"
+            },
+            "travel_agency": {
                 "sign": "&#129523;"
             },
-            {
-                "types": [
-                    "supermarket"
-                ],
-                "sign": "fa-shopping-cart"
-            },
-            {
-                "types": [
-                    "watches"
-                ],
-                "sign": "&#8986;"
-            },
-            {
-                "types": [
-                    "gift"
-                ],
-                "sign": "fa-gift"
-            },
-            {
-                "types": [
-                    "locksmith"
-                ],
-                "sign": "fa-key"
-            },
-            {
-                "types": [
-                    "doityourself",
-                    "hardware"
-                ],
-                "sign": "fa-tools"
-            },
-            {
-                "types": [
-                    "art"
-                ],
-                "sign": "fa-palette"
-            },
-            {
-                "types": [
-                    "stationery"
-                ],
-                "sign": "fa-pencil-ruler"
-            },
-            {
-                "types": [
-                    "funeral_directors"
-                ],
+            "supermarket": {
+                "sign": "fas:shopping-cart"
+            },
+            "watches": {
+                "sign": "far:clock"
+            },
+            "gift": {
+                "sign": "fas:gift"
+            },
+            "locksmith": {
+                "sign": "fas:key"
+            },
+            "doityourself": {
+                "sign": "fas:tools"
+            },
+            "hardware": {
+                "sign": "fas:tools"
+            },
+            "art": {
+                "sign": "fas:palette"
+            },
+            "stationery": {
+                "sign": "fas:pencil-ruler"
+            },
+            "funeral_directors": {
                 "sign": "maki:monument"
             },
-            {
-                "types": [
-                    "copyshop"
-                ],
-                "sign": "fa-copy"
-            },
-            {
-                "types": [
-                    "tobacco"
-                ],
-                "sign": "fa-smoking"
-            },
-            {
-                "types": [
-                    "furniture",
-                    "interior_decoration"
-                ],
-                "sign": "fa-couch"
-            },
-            {
-                "types": [
-                    "car_repair",
-                    "car",
-                    "car_parts",
-                    "tyres"
-                ],
-                "sign": "fa-car"
-            },
-            {
-                "types": [
-                    "beauty",
-                    "cosmetics"
-                ],
+            "copyshop": {
+                "sign": "fas:copy"
+            },
+            "tobacco": {
+                "sign": "fas:smoking"
+            },
+            "furniture": {
+                "sign": "fas:couch"
+            },
+            "interior_decoration": {
+                "sign": "fas:couch"
+            },
+            "car_repair": {
+                "sign": "fas:car"
+            },
+            "car": {
+                "sign": "fas:car"
+            },
+            "car_parts": {
+                "sign": "fas:car"
+            },
+            "tyres": {
+                "sign": "fas:car"
+            },
+            "beauty": {
                 "sign": ""
             },
-            {
-                "types": [
-                    "music"
-                ],
-                "sign": "fa-guitar"
-            },
-            {
-                "types": [
-                    "optician"
-                ],
-                "sign": "fa-glasses"
-            },
-            {
-                "types": [
-                    "books"
-                ],
-                "sign": "fa-book"
-            },
-            {
-                "types": [
-                    "sports"
-                ],
-                "sign": "fa-basketball-ball"
-            },
-            {
-                "types": [
-                    "chemist"
-                ],
-                "sign": "fa-tablets"
-            },
-            {
-                "types": [
-                    "pet"
-                ],
-                "sign": "fa-paw"
-            },
-            {
-                "types": [
-                    "mobile_phone"
-                ],
-                "sign": "fa-mobile-alt"
+            "cosmetics": {
+                "sign": ""
+            },
+            "music": {
+                "sign": "fas:guitar"
+            },
+            "optician": {
+                "sign": "fas:glasses"
+            },
+            "books": {
+                "sign": "fas:book"
+            },
+            "sports": {
+                "sign": "fas:basketball-ball"
+            },
+            "chemist": {
+                "sign": "fas:tablets"
+            },
+            "pet": {
+                "sign": "fas:paw"
+            },
+            "mobile_phone": {
+                "sign": "fas:mobile-alt"
             }
-        ]
+        }
     },
     "filter": {
         "shop": {
             "name": "{{ trans('filter:type') }}",
             "type": "select",
             "show_default": "true",
-            "values": "{% set list = [] %}{% for k, v in const.shops %}{% for t in v.types %}<option value=\"{{ t }}\">{% set list = list|merge([ t ]) %}{{ tagTrans('shop', t) }}</option>{% endfor %}{% endfor %}<option weight='1' value='other' query='nwr[shop][shop!~\"^(|.*;)({{ list|join('|') }})(|;.*)$\"]'>{{ trans('other') }}</option>",
+            "values": "{% set list = [] %}{% for k, v in const.shops %}<option value=\"{{ k }}\">{% set list = list|merge([ k ]) %}{{ tagTrans('shop', k) }}</option>{% endfor %}<option weight='1' value='other' query='nwr[shop][shop!~\"^(|.*;)({{ list|join('|') }})(|;.*)$\"]'>{{ trans('other') }}</option>",
             "sort": "natsort",
             "op": "has"
         }