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

name:
en: Etymology
query: |
(
nwr["name:etymology"];
nwr["name:etymology:wikidata"];
)
feature:
description: |
{% set value = null %}
{% 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'] %}
{% if not value and tags[tag] %}
{% set value = attribute(tags, tag) %}
{% if value in ['yes'] %}
{{ keyTrans(tag) }}
{% else %}
{{ tagTransList(tag, value) }}
{% endif %}
{% endif %}
{% endfor %}
details: |
{% if not attribute(tags, "name:etymology") and attribute(tags, 'name:etymology:wikidata') %}
{% for i, wd in attribute(tags, 'name:etymology:wikidata')|split(';') %}
{%- if i != 0 %},{% endif %}
{% if wd %}
{% set wikidata = wd|wikidataEntity %}
{{ wikidata ? (wikidata.labels[user.data_lang]|default(wikidata.labels[user.ui_lang])|default(wikidata.labels.en)).value : wd }}
{% endif %}
{% endfor %}
{% else %}
{{ attribute(tags, "name:etymology")|enumerate }}
{% endif %}
body: |
<ul>
{% if attribute(tags, "name:etymology") or attribute(tags, 'name:etymology:wikidata') %}
<li class='hasSymbol'>
<i class="fa fa-book" aria-hidden="true"></i>
<span class='key'>{{ keyTrans('name:etymology') }}:</span>
<span class='value'>
{% set etymWikidata = attribute(tags, 'name:etymology:wikidata')|split(';') %}
{% set etymName = attribute(tags, 'name:etymology')|split(';') %}
{% set etymDesc = attribute(tags, 'name:etymology:description')|split(';') %}
{% set result = [] %}
{% for i in 0..max(etymName|length - 1, etymWikidata|length - 1) %}
{% set wikidata = etymWikidata[i]|wikidataEntity %}
{% set label = wikidata ? (wikidata.labels[user.data_lang]|default(wikidata.labels[user.ui_lang])|default(wikidata.labels.en)).value : etymName[i]|default(etymWikidata[i]) %}
{% set desc = wikidata ? (wikidata.descriptions[user.data_lang]|default(wikidata.descriptions[user.ui_lang])|default(wikidata.descriptions.en)).value|default(etymDesc) : etymDesc %}
{% set url = attribute(tags, 'name:etymology:website')
|default(attribute(tags, 'name:etymology:url'))
|default(wikidata.sitelinks[user.data_lang ~ 'wiki'].url)
|default(wikidata.sitelinks[user.ui_lang ~ 'wiki'].url)
|default(etymWikidata[i] ? 'https://wikidata.org/wiki/' ~ etymWikidata[i]|url_encode : null)
%}
{% 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 ~ ')' : '') ]) %}
{% endfor %}
{{ result|enumerate|raw }}
</span>
</li>
{% endif %}
{% if attribute(tags, 'name:start_date') %}
<li class='hasSymbol'>
<i class="fa fa-book" aria-hidden="true"></i>
<span class='key'>{{ keyTrans('name:start_date') }}:</span>
<span class='value'>{{ attribute(tags, 'name:start_date')|osmFormatDate({ format: 'short' }) }}</span>
</li>
{% endif %}
</ul>