support French
This commit is contained in:
parent
1bd56a552a
commit
3ceaf266da
2 changed files with 16 additions and 1 deletions
|
@ -44,7 +44,7 @@ defmodule AutoLinker.Parser do
|
|||
# https://www.w3.org/TR/html5/forms.html#valid-e-mail-address
|
||||
@match_email ~r/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/u
|
||||
|
||||
@match_hashtag ~r/^(?<tag>\#[[:word:]_]*[[:alpha:]_·][[:word:]_]*)/u
|
||||
@match_hashtag ~r/^(?<tag>\#[[:word:]_]*[[:alpha:]_·][[:word:]_·]*)/u
|
||||
|
||||
@prefix_extra [
|
||||
"magnet:?",
|
||||
|
|
|
@ -164,6 +164,21 @@ defmodule AutoLinkerTest do
|
|||
) == expected
|
||||
end
|
||||
|
||||
test "support French" do
|
||||
text = "#administrateur·rice·s #ingénieur·e·s"
|
||||
|
||||
expected =
|
||||
"<a href=\"/t/administrateur·rice·s\">#administrateur·rice·s</a> <a href=\"/t/ingénieur·e·s\">#ingénieur·e·s</a>"
|
||||
|
||||
assert AutoLinker.link(text,
|
||||
hashtag: true,
|
||||
hashtag_prefix: "/t/",
|
||||
class: false,
|
||||
rel: false,
|
||||
new_window: false
|
||||
) == expected
|
||||
end
|
||||
|
||||
test "do not turn urls with hashes into hashtags" do
|
||||
text = "google.com#test #test google.com/#test #tag"
|
||||
|
||||
|
|
Loading…
Reference in a new issue