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> </li>
{% endif %} {% endif %}
{% if attribute(tags, 'name:etymology') %}
{% if attribute(tags, 'name:etymology') or attribute(tags, 'name:etymology:wikidata') %}
<li class='hasSymbol'> <li class='hasSymbol'>
<i class="fa fa-book" aria-hidden="true"></i> <i class="fa fa-book" aria-hidden="true"></i>
<span class='key'>{{ keyTrans('name:etymology') }}:</span> <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> </li>
{% endif %} {% endif %}

18
popupBody.html

@ -35,11 +35,25 @@
</li> </li>
{% endif %} {% endif %}
{% if attribute(tags, 'name:etymology') %}
{% if attribute(tags, 'name:etymology') or attribute(tags, 'name:etymology:wikidata') %}
<li class='hasSymbol'> <li class='hasSymbol'>
<i class="fa fa-book" aria-hidden="true"></i> <i class="fa fa-book" aria-hidden="true"></i>
<span class='key'>{{ keyTrans('name:etymology') }}:</span> <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> </li>
{% endif %} {% endif %}

Loading…
Cancel
Save