Browse Source

etymology: hide name:etymology from default body, show in category body

railway-rails
parent
commit
ddb8995113
  1. 2
      detailsBody.html
  2. 20
      etymology.yaml
  3. 2
      popupBody.html

2
detailsBody.html

@ -35,7 +35,7 @@
</li> </li>
{% endif %} {% endif %}
{% if attribute(tags, 'name:etymology') or attribute(tags, 'name:etymology:wikidata') %}
{% if layer_id|split('/')|last != 'etymology' and (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>

20
etymology.yaml

@ -34,18 +34,24 @@ feature:
body: | body: |
<ul> <ul>
{% if not attribute(tags, "name:etymology") and attribute(tags, 'name:etymology:wikidata') %}
{% 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'> <span class='value'>
{% 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 %}
{% 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 %} {% endfor %}
{{ result|enumerate|raw }}
{% else %}
{{ attribute(tags, "name:etymology")|enumerate }}
{% endif %}
</span> </span>
</li> </li>
{% endif %} {% endif %}

2
popupBody.html

@ -35,7 +35,7 @@
</li> </li>
{% endif %} {% endif %}
{% if attribute(tags, 'name:etymology') or attribute(tags, 'name:etymology:wikidata') %}
{% if layer_id|split('/')|last != 'etymology' and (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>

Loading…
Cancel
Save