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.

74 lines
3.3 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 url = attribute(tags, 'name:etymology:website')
  49. |default(attribute(tags, 'name:etymology:url'))
  50. |default(wikidata.sitelinks[user.data_lang ~ 'wiki'].url)
  51. |default(wikidata.sitelinks[user.ui_lang ~ 'wiki'].url)
  52. |default(etymWikidata[i] ? 'https://wikidata.org/wiki/' ~ etymWikidata[i]|url_encode : null)
  53. %}
  54. {% set result = result|merge([ url ? '<a target="_blank" href="' ~ url ~ '">' ~ (etymName[i]|default(label))|e ~ '</a>' ~ (desc ? ' (' ~ desc|e ~ ')' : '') : etymName[i]|e ~ (desc ? ' (' ~ desc|e ~ ')' : '') ]) %}
  55. {% endfor %}
  56. {{ result|enumerate|raw }}
  57. </span>
  58. </li>
  59. {% endif %}
  60. {% if attribute(tags, 'name:start_date') %}
  61. <li class='hasSymbol'>
  62. <i class="fa fa-book" aria-hidden="true"></i>
  63. <span class='key'>{{ keyTrans('name:start_date') }}:</span>
  64. <span class='value'>{{ attribute(tags, 'name:start_date')|osmFormatDate({ format: 'short' }) }}</span>
  65. </li>
  66. {% endif %}
  67. </ul>