From f10910dc63407ccf9122cc298bd09acbad2609e9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= <skunk@xover.mud.at>
Date: Thu, 9 Aug 2018 22:03:07 +0200
Subject: [PATCH] popupBody: link to wikipedia

---
 popupBody.html | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/popupBody.html b/popupBody.html
index c5e9e9e..ffa09d2 100644
--- a/popupBody.html
+++ b/popupBody.html
@@ -115,4 +115,25 @@
 </li>
 {% endif %}
 
+{% set wikipedia = null %}
+{% if attribute(tags, 'wikipedia') %}
+  {% set wikipedia = tags.wikipedia|matches("^([^:]+):(.*)$") %}
+{% endif %}
+
+{% if not wikipedia %}
+  {% for k, v in tags %}
+    {% set m = k|matches("^wikipedia:(.*)$") %}
+    {% if m %}
+      {% set wikipedia = [ 0, m[1], v ] %}
+    {% endif %}
+  {% endfor %}
+{% endif %}
+
+{% if wikipedia %}
+<li class='hasSymbol'>
+  <i class="fa fa-wikipedia-w" aria-hidden="true"></i>
+  <span class='key'>{{ keyTrans('wikipedia') }}:</span>
+  <span class='value'><a href="https://{{ wikipedia[1] }}.wikipedia.org/wiki/{{ wikipedia[2]|replace({ ' ': '_' }) }}">{{ wikipedia[2] }}</a></span>
+{% endif %}
+
 </ul>