Main categories of OpenStreetBrowser
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
3.0 KiB

  1. name:
  2. en: Etymology
  3. query: |
  4. (
  5. nwr["name:etymology"];
  6. nwr["name:etymology:wikidata"];
  7. )
  8. feature:
  9. description: |
  10. {% set value = null %}
  11. {% for tag in ['highway', 'railway', 'amenity', 'leisure', 'shop', 'man_made', 'landuse', 'natural', 'waterway', 'place', 'route', 'aeroway', 'aerialway', 'craft', 'office', 'military', 'building', 'barrier','geological','historic', 'power', 'tourism', 'boundary'] %}
  12. {% if not value and tags[tag] %}
  13. {% set value = attribute(tags, tag) %}
  14. {% if value in ['yes'] %}
  15. {{ keyTrans(tag) }}
  16. {% else %}
  17. {{ tagTransList(tag, value) }}
  18. {% endif %}
  19. {% endif %}
  20. {% endfor %}
  21. details: |
  22. {% if not attribute(tags, "name:etymology") and attribute(tags, 'name:etymology:wikidata') %}
  23. {% for i, wd in attribute(tags, 'name:etymology:wikidata')|split(';') %}
  24. {%- if i != 0 %},{% endif %}
  25. {% if wd %}
  26. {% set wikidata = wd|wikidataEntity %}
  27. {{ wikidata ? (wikidata.labels[user.data_lang]|default(wikidata.labels[user.ui_lang])|default(wikidata.labels.en)).value : wd }}
  28. {% endif %}
  29. {% endfor %}
  30. {% else %}
  31. {{ attribute(tags, "name:etymology")|enumerate }}
  32. {% endif %}
  33. body: |
  34. <ul>
  35. {% if attribute(tags, "name:etymology") or attribute(tags, 'name:etymology:wikidata') %}
  36. <li class='hasSymbol'>
  37. <i class="fa fa-book" aria-hidden="true"></i>
  38. <span class='key'>{{ keyTrans('name:etymology') }}:</span>
  39. <span class='value'>
  40. {% set etymWikidata = attribute(tags, 'name:etymology:wikidata')|split(';') %}
  41. {% set etymName = attribute(tags, 'name:etymology')|split(';') %}
  42. {% set etymDesc = attribute(tags, 'name:etymology:description')|split(';') %}
  43. {% set result = [] %}
  44. {% for i in 0..max(etymName|length - 1, etymWikidata|length - 1) %}
  45. {% set wikidata = etymWikidata[i]|wikidataEntity %}
  46. {% set label = wikidata ? (wikidata.labels[user.data_lang]|default(wikidata.labels[user.ui_lang])|default(wikidata.labels.en)).value : etymName[i]|default(etymWikidata[i]) %}
  47. {% set desc = wikidata ? (wikidata.descriptions[user.data_lang]|default(wikidata.descriptions[user.ui_lang])|default(wikidata.descriptions.en)).value|default(etymDesc) : etymDesc %}
  48. {% set result = result|merge([ etymWikidata[i] ? '<a target="_blank" href="https://wikidata.org/wiki/' ~ etymWikidata[i]|url_encode ~ '">' ~ (etymName[i]|default(label))|e ~ '</a>' ~ (desc ? ' (' ~ desc|e ~ ')' : '') : etymName[i]|e ~ (desc ? ' (' ~ desc|e ~ ')' : '') ]) %}
  49. {% endfor %}
  50. {{ result|enumerate|raw }}
  51. </span>
  52. </li>
  53. {% endif %}
  54. {% if attribute(tags, 'name:start_date') %}
  55. <li class='hasSymbol'>
  56. <i class="fa fa-book" aria-hidden="true"></i>
  57. <span class='key'>{{ keyTrans('name:start_date') }}:</span>
  58. <span class='value'>{{ attribute(tags, 'name:start_date')|osmFormatDate({ format: 'short' }) }}</span>
  59. </li>
  60. {% endif %}
  61. </ul>