[openstreetmap/openstreetmap-website] Remove secondary wiki prefix list (PR #7136)

Tom Hughes notifications at github.com
Tue Jun 9 17:38:48 UTC 2026


@tomhughes commented on this pull request.



> @@ -80,10 +76,13 @@ def wikipedia_links(key, value)
     # Some k/v's are wikipedia=http://en.wikipedia.org/wiki/Full%20URL
     return nil if %r{^https?://}.match?(value)
 
+    # regex to match all language codes from de to zh-classical
+    language_code_pattern = /[a-z]{1,2}[a-z-]{0,7}[a-z]{1,3}/

The wikipedia names are a bit mad - the vast majority are standard language tags but there's a few doing their own thing.

Fundamentally all of them are just one or two (or in one case three) alphabetic strings separated by hyphens so I'd suggest something like:

```ruby
/[a-z]+(?:-[a-z]+)*/
```

The way the current regex is matching is just bonkers - for example the edge case of `simple` will match against all three components in your regex.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/7136#discussion_r3382679699
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/7136/review/4461048025 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260609/ed1efa73/attachment.htm>


More information about the rails-dev mailing list