]> git.openstreetmap.org Git - rails.git/commitdiff
Added support for 2 more secondary wikidata tag links
authorŠtefan Baebler <stefan.baebler@gmail.com>
Sun, 4 Mar 2018 23:01:19 +0000 (00:01 +0100)
committerTom Hughes <tom@compton.nu>
Mon, 5 Mar 2018 08:38:50 +0000 (08:38 +0000)
Listed on in https://wiki.openstreetmap.org/wiki/Key:wikidata :
* name:etymology:wikidata
* network:wikidata

app/helpers/browse_helper.rb
test/helpers/browse_helper_test.rb

index b90e27f8545b6995fdb0631e7329946b40f6bd27..b99ba93384b603efd3ea9de115a77b31d2bb87dc 100644 (file)
@@ -167,7 +167,7 @@ module BrowseHelper
         :title => value
       }]
     # Key has to be one of the accepted wikidata-tags
         :title => value
       }]
     # Key has to be one of the accepted wikidata-tags
-    elsif key =~ /(architect|artist|brand|operator|subject):wikidata/ &&
+    elsif key =~ /(architect|artist|brand|name:etymology|network|operator|subject):wikidata/ &&
           # Value has to be a semicolon-separated list of wikidata-IDs (whitespaces allowed before and after semicolons)
           value =~ /^[Qq][1-9][0-9]*(\s*;\s*[Qq][1-9][0-9]*)*$/
       # Splitting at every semicolon to get a separate hash for each wikidata-ID
           # Value has to be a semicolon-separated list of wikidata-IDs (whitespaces allowed before and after semicolons)
           value =~ /^[Qq][1-9][0-9]*(\s*;\s*[Qq][1-9][0-9]*)*$/
       # Splitting at every semicolon to get a separate hash for each wikidata-ID
index e313858e5ee0805122a2f8220fdf3bc3d629dc4f..bc362fc3f069c2f0a65ba499be397310d616cc4b 100644 (file)
@@ -131,6 +131,9 @@ class BrowseHelperTest < ActionView::TestCase
 
     html = format_value("operator:wikidata", "Q12;Q98")
     assert_dom_equal "<a title=\"The Q12 item on Wikidata\" href=\"//www.wikidata.org/wiki/Q12?uselang=en\">Q12</a>;<a title=\"The Q98 item on Wikidata\" href=\"//www.wikidata.org/wiki/Q98?uselang=en\">Q98</a>", html
 
     html = format_value("operator:wikidata", "Q12;Q98")
     assert_dom_equal "<a title=\"The Q12 item on Wikidata\" href=\"//www.wikidata.org/wiki/Q12?uselang=en\">Q12</a>;<a title=\"The Q98 item on Wikidata\" href=\"//www.wikidata.org/wiki/Q98?uselang=en\">Q98</a>", html
+
+    html = format_value("name:etymology:wikidata", "Q123")
+    assert_dom_equal "<a title=\"The Q123 item on Wikidata\" href=\"//www.wikidata.org/wiki/Q123?uselang=en\">Q123</a>", html
   end
 
   def test_icon_tags
   end
 
   def test_icon_tags