Browse Source

default body: if name:etymology:wikidata is defined, link etymology to wikidata

railway-rails
parent
commit
293064f9dc
  1. 18
      detailsBody.html
  2. 18
      popupBody.html

18
detailsBody.html

@ -35,11 +35,25 @@
</li>
{% endif %}
{% if attribute(tags, 'name:etymology') %}
{% 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'>{{ enumerate(attribute(tags, "name:etymology")) }}</span>
<span class='value'>
{% set etymWikidata = attribute(tags, 'name:etymology:wikidata') %}
{% if etymWikidata %}
{% set etymWikidata = etymWikidata|split(';') %}
{% set etymName = attribute(tags, 'name:etymology')|split(';') %}
{% set result = [] %}
{% for i in 0..max(etymName|length - 1, etymWikidata|length - 1) %}
{% set result = result|merge([ etymWikidata[i] ? '<a target="_blank" href="https://wikidata.org/wiki/' ~ etymWikidata[i]|url_encode ~ '">' ~ (etymName[i]|default(etymWikidata[i]))|e ~ '</a>' : etymName[i]|e ]) %}
{% endfor %}
{{ result|enumerate|raw }}
{% else %}
{{ attribute(tags, "name:etymology")|enumerate }}
{% endif %}
</span>
</li>
{% endif %}

18
popupBody.html

@ -35,11 +35,25 @@
</li>
{% endif %}
{% if attribute(tags, 'name:etymology') %}
{% 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'>{{ enumerate(attribute(tags, "name:etymology")) }}</span>
<span class='value'>
{% set etymWikidata = attribute(tags, 'name:etymology:wikidata') %}
{% if etymWikidata %}
{% set etymWikidata = etymWikidata|split(';') %}
{% set etymName = attribute(tags, 'name:etymology')|split(';') %}
{% set result = [] %}
{% for i in 0..max(etymName|length - 1, etymWikidata|length - 1) %}
{% set result = result|merge([ etymWikidata[i] ? '<a target="_blank" href="https://wikidata.org/wiki/' ~ etymWikidata[i]|url_encode ~ '">' ~ (etymName[i]|default(etymWikidata[i]))|e ~ '</a>' : etymName[i]|e ]) %}
{% endfor %}
{{ result|enumerate|raw }}
{% else %}
{{ enumerate(attribute(tags, "name:etymology")) }}
{% endif %}
</span>
</li>
{% endif %}

Loading…
Cancel
Save