Browse Source

etymology: in body, show label from wikidata

railway-rails
parent
commit
3be2192113
  1. 5
      etymology.yaml

5
etymology.yaml

@ -46,7 +46,10 @@ feature:
{% set result = [] %} {% set result = [] %}
{% for i in 0..max(etymName|length - 1, etymWikidata|length - 1) %} {% 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 ]) %}
{% set wikidata = etymWikidata[i]|wikidataEntity %}
{% set label = wikidata ? (wikidata.labels[user.data_lang]|default(wikidata.labels[user.ui_lang])|default(wikidata.labels.en)).value : wd %}
{% set result = result|merge([ etymWikidata[i] ? '<a target="_blank" href="https://wikidata.org/wiki/' ~ etymWikidata[i]|url_encode ~ '">' ~ (etymName[i]|default(label))|e ~ '</a>' : etymName[i]|e ]) %}
{% endfor %} {% endfor %}
{{ result|enumerate|raw }} {{ result|enumerate|raw }}
{% else %} {% else %}

Loading…
Cancel
Save