Skip to main content
Topic: Autolinking (Read 1742 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Autolinking

I was adding a link to github within parenthesis and it reminded me the discussion we had while working on SMF, so some tests:

Elk links everything for all of them, while github doesn't link the parenthesis when at the end of the url unless there is another one inside the link. So 2 is linked like http://www.elkarte.net/index.php?board=2.0).

I think it make sense, though I don't know if it is worth (or possible) to do the same for us.

Spuds? :P
Bugs creator.
Features destroyer.
Template killer.

Re: Autolinking

Reply #1
Well we could do the same, but I think the question becomes is that link invalid to RFC3986 and if so it should be linked ...

Now I'll admit that I often get confused when I read through those specs :P but I believe the link in #2 is valid and should be linked ... maybe there is an online validator for this spec that we can test against?

Re: Autolinking

Reply #2
I'm certain it is valid (like it should be http://www.elkarte.net/index.php?action=search2;search=elk;brd[]=1 as far a I understand O:-)), I'm not arguing that.

What I'm considering here is more user expectation and likelihoods.

I *think* (no data handy apart from what I do), the likelihood of a link that end with a ")" and without an open one before is low, while it is much more frequent that people put links just before a closing parenthesis that has nothing to do with the link (e.g. like I frequently do in posts like this http://www.elkarte.net/index.php?topic=499.msg3734). <= in that very case it brings in parenthesis *and* dot, both of which are obviously not related.

While I was writing that message, I tried also with emails:
* my mail client (Thunderbird),
* Gmail,
* Yahoo mail,
* hotmail webmail.

My client doesn't link the parenthesis in both 2 and 3, while it does in 4 and 5.
Gmail has the same behaviour as Github (expected :P)
Neither Yahoo nor Hotmail link any parenthesis at all so none of them is linked properly (unless the parenthesis in the first position after the question mark is not valid, but I should check the specs and I'm too lazy to do :P).

Dunno, just for consideration. ;D
Bugs creator.
Features destroyer.
Template killer.

 

Re: Autolinking

Reply #3
Ah gotcha now ...

My option would be just to validate to spec, and TBH the regex in the code is "just ok"  when it comes to that.  Its really just intended to sniff test the url to see if its somewhat compliant.  

To properly add in some link forensics we would need a separate function,  and in that function we could properly check to the spec and do in context checking as well.  Would not be to hard to write and could be useful in other places.