@pnorman requested changes on this pull request.


> @@ -97,6 +99,22 @@ def linkify(text, mode = :urls)
 
     private
 
+    def linkify_users(text)
+      regex = 
/(?<!\w)@(?:“([^”]+?)”|”([^”]+?)”|‘([^’]+?)’|’([^’]+?)’|"([^"]+?)"|'([^']+?)'|(\w+))/

Is there some way to match that doesn't involve an unreadable regular 
expression? 

> @@ -97,6 +99,22 @@ def linkify(text, mode = :urls)
 
     private
 
+    def linkify_users(text)
+      regex = 
/(?<!\w)@(?:“([^”]+?)”|”([^”]+?)”|‘([^’]+?)’|’([^’]+?)’|"([^"]+?)"|'([^']+?)'|(\w+))/

There's also a lot of logic in this regular expression that is not tested. It 
looks like it matches
- `“”`
- `””`
- `‘’`
- `’’`
- `""`
- `''`

Should we have a test that shows that it doesn't linkify something like 
`@"foo'`? What happens if there are multiple potential matches? e.g. 
`@“foo@”bar”`

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

Message ID: 
<openstreetmap/openstreetmap-website/pull/6616/review/[email protected]>
_______________________________________________
rails-dev mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to