Skip to content

Commit

Permalink
Add unicode support. (#23)
Browse files Browse the repository at this point in the history
* Add unicode support.

* Add visible unicode tests
  • Loading branch information
KaneCohen authored and thewilkybarkid committed Aug 17, 2017
1 parent 40d6f92 commit 26b5d8a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Misd/Linkify/Linkify.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ protected function linkifyUrls($text, $options = array('attr' => ''))
| # or
[^\s`!\-()\[\]{};:\'".,<>?«»“”‘’] # not a space or one of these punct chars
)
~';
~u';

$callback = function ($match) use ($options) {
$caption = $match[0];
Expand Down Expand Up @@ -201,7 +201,7 @@ protected function linkifyEmails($text, $options = array('attr' => ''))
[A-Z0-9.-]+ # Domain
\. # Dot
[A-Z]{2,4} # Something
~';
~u';

$callback = function ($match) use ($options) {
if (isset($options['callback'])) {
Expand Down
8 changes: 8 additions & 0 deletions tests/data/email.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@
"test": "[email protected].",
"expected": "<a href=\"mailto:[email protected]\">[email protected]</a>."
},
{
"test": "[email protected] ",
"expected": "<a href=\"mailto:[email protected]\">[email protected]</a> "
},
{
"test": "Привет [email protected]!",
"expected": "Привет <a href=\"mailto:[email protected]\">[email protected]</a>!"
},
{
"test": "([email protected])",
"expected": "(<a href=\"mailto:[email protected]\">[email protected]</a>)"
Expand Down
8 changes: 8 additions & 0 deletions tests/data/url.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@
"test": "http://www.example.com/example/",
"expected": "<a href=\"http://www.example.com/example/\">http://www.example.com/example/</a>"
},
{
"test": "www.example.com ",
"expected": "<a href=\"http://www.example.com\">www.example.com</a> "
},
{
"test": "Линк: https://ru.wikipedia.org/wiki/Футбол",
"expected": "Линк: <a href=\"https://ru.wikipedia.org/wiki/Футбол\">https://ru.wikipedia.org/wiki/Футбол</a>"
},
{
"test": "(http://www.example.com/)",
"expected": "(<a href=\"http://www.example.com/\">http://www.example.com/</a>)"
Expand Down

0 comments on commit 26b5d8a

Please sign in to comment.