Commit graph

178 commits

Author SHA1 Message Date
Mark Felder
26fa3bffeb Try to make intelligent decisions when deciding if parens should be stripped before linking
This logic is torture and needs some rework.

Rules:

- Always strip leading (, as it can't be part of a URL
- Short circuit to only strip leading if no trailing
- If valid email address when trailing ) stripped, we can strip trailing )
- If not even a valid URL without trailing ), short circuit to only strip leading
- If query parameters detected, strip trailing. It should have been encoded as %29.
- If there isn't a / the trailing ) can't be part of the URL, strip trailing.
- If there isn't at least one ( in the URI.path, only strip leading. Assume ) is not part of the URL.
- If we have an equal count of ( and ) chars with the leading ( already stripped, only strip leading
2021-01-26 18:30:35 -06:00
lain
bd7a759911 Merge branch 'release/0.4.1' into 'master'
Release/0.4.1

See merge request pleroma/elixir-libraries/linkify!36
2020-12-22 13:23:18 +00:00
Lain Soykaf
603cf8c720 Mix: Update version 2020-12-22 14:18:02 +01:00
Lain Soykaf
e0fd2e7620 LinkifyTest: Add test for short IPv4 bug. 2020-12-22 14:17:13 +01:00
Mark Felder
8091bdbc7b Document fix, prepare for release 2020-12-21 14:02:04 -06:00
Mark Felder
713b986fa5 Only support IPv4 for the moment 2020-12-21 11:32:05 -06:00
Mark Felder
26fec6cff1 Fix invalid IPv4 linking; optimize
thx @href !
2020-12-19 13:20:11 -06:00
lain
33558484a6 Merge branch 'release/0.4.0' into 'master'
Release: Change changelog and mix version

See merge request pleroma/elixir-libraries/linkify!34
2020-11-27 11:17:19 +00:00
Lain Soykaf
506c23f8eb Release: Change changelog and mix version 2020-11-24 17:50:12 +01:00
Haelwenn
a32f582aa8 Merge branch 'chores/bump-tlds' into 'master'
priv/tlds.txt: Bump to 2020111900

See merge request pleroma/elixir-libraries/linkify!32
2020-11-19 22:22:52 +00:00
Haelwenn (lanodan) Monnier
f923aa0ac1
priv/tlds.txt: Bump to 2020111900
Version 2020111900, Last Updated Thu Nov 19 07:07:01 2020 UTC

curl https://data.iana.org/TLD/tlds-alpha-by-domain.txt | grep -v '^#' | tr '[:upper:]' '[:lower:]' > priv/tlds.txt
2020-11-19 23:19:13 +01:00
Haelwenn
9b86e5e5e4 Merge branch 'features/hostname_validation' into 'master'
Add .onion in the default TLDs, Validate IPv6, IDN compatibility in email and mentions

See merge request pleroma/elixir-libraries/linkify!29
2020-11-19 20:42:20 +00:00
Haelwenn
62b385674d Apply 1 suggestion(s) to 1 file(s) 2020-11-19 20:35:56 +00:00
Mark Felder
9925f4514e Add .onion domain tests 2020-11-19 19:49:21 +00:00
Mark Felder
5573fe6d97 Test IDN and punycode domains in mentions 2020-11-19 19:30:20 +00:00
rinpatch
df559cd2ae Merge branch 'handle-href' into 'master'
Add handle_href option for href pre-processing

Closes #19

See merge request pleroma/elixir-libraries/linkify!31
2020-11-19 19:25:18 +00:00
Mark Felder
3ce2c34709 Fix linking URLs/domains with trailing punctuation 2020-11-19 18:55:17 +00:00
Mark Felder
17126aa662 Move tests under correct group, add test for URLs with IPv4 for domain 2020-11-19 18:29:41 +00:00
Mark Felder
31d41920ed Fix test group name 2020-11-19 18:25:54 +00:00
Mark Felder
c14ac019af Add IDN and punycode domain test 2020-11-19 18:13:55 +00:00
Haelwenn (lanodan) Monnier
649fc9125d parser: Validate IPv6, IDN compatibility in email and mentions 2020-11-19 17:42:34 +00:00
Haelwenn (lanodan) Monnier
26f5310379 parser: Add onion as an extra TLD 2020-11-19 17:42:34 +00:00
Justin Tormey
d84ca4d0b7 Fix formatting in test 2020-11-19 09:48:28 -06:00
Justin Tormey
8713d4141a Add handle_href option for href pre-processing 2020-11-19 09:40:47 -06:00
feld
b50bd58d70 Merge branch 'fix/fqdn-domain' into 'master'
Support linking URLs with FQDNs

See merge request pleroma/elixir-libraries/linkify!30
2020-11-18 17:47:54 +00:00
Mark Felder
372879c8d4 Verify trailing periods as sentence punctuation do not link 2020-11-18 17:41:12 +00:00
Mark Felder
1f8680f4b4 Document FQDN support 2020-11-18 17:26:17 +00:00
Mark Felder
b87be206a7 Support URLs with FQDNs (trailing period on the tld) 2020-11-18 17:24:44 +00:00
feld
815343e824 Merge branch 'chore/readme' into 'master'
Add example to README showing how we link user mentions

See merge request pleroma/elixir-libraries/linkify!28
2020-11-17 15:49:46 +00:00
Mark Felder
c4f3b56219 Add example to README showing how we link user mentions 2020-11-17 15:45:38 +00:00
lain
175ee6cbea Merge branch 'release-0.3.0' into 'master'
Release v0.3.0

See merge request pleroma/elixir-libraries/linkify!26
2020-11-17 14:50:43 +00:00
Egor Kislitsyn
4a1d1e6336 Update ex_doc 2020-11-17 18:41:43 +04:00
Egor Kislitsyn
b846e25b83 Version bump 2020-11-17 18:41:43 +04:00
Egor Kislitsyn
971b5f3a69
Update CHANGELOG 2020-11-17 18:41:39 +04:00
Egor Kislitsyn
cbf5128a8a
Update dependencies 2020-11-17 18:38:27 +04:00
rinpatch
272b9abea9 Merge branch 'fix/incorrect-mentions-parsing' into 'master'
Fix incorrect mentions parsing

See merge request pleroma/elixir-libraries/linkify!27
2020-11-17 12:55:25 +00:00
Sergey Suprunenko
45e970d604
Upgrade credo 2020-11-16 23:18:32 +01:00
Sergey Suprunenko
2a050e1cbe
Ignore non-word chars in the beginning of mentions 2020-11-16 23:03:24 +01:00
Sergey Suprunenko
e16136f709
Do not parse mention if there is something before it 2020-11-10 21:24:50 +01:00
rinpatch
5581840992 Merge branch 'fix/parser-url-bugs' into 'master'
Fix small parser bugs

Closes #23, #21, #16, #15, #13, and #10

See merge request pleroma/elixir-libraries/linkify!24
2020-10-06 19:56:01 +00:00
Sergey Suprunenko
c4b4cb95fb
Linkify.Parser.restore_stripped_symbols/3 must always return iodata 2020-10-06 21:49:01 +02:00
Sergey Suprunenko
7005cda9e4
Handle punctuation marks and new lines 2020-10-06 21:49:00 +02:00
Sergey Suprunenko
8d88833dc5
Remove unused clauses 2020-10-06 21:46:58 +02:00
Sergey Suprunenko
74afaca73b
Handle punctuation marks and angle bracket in the end of a link 2020-10-06 21:43:35 +02:00
Sergey Suprunenko
e5a8cf2b08
Do not parse html links inside html tags 2020-10-06 21:43:04 +02:00
rinpatch
86afaf49e5 Merge branch 'fix/hashtag-link-parsing' into 'master'
Handle hashtags followed by skipped html tags (a, pre, code)

Closes #22

See merge request pleroma/elixir-libraries/linkify!25
2020-10-06 19:39:23 +00:00
Sergey Suprunenko
69902de571
Handle hashtags followed by skipped html tags 2020-08-31 20:48:04 +02:00
rinpatch
4764e1819e Merge branch 'iodata' into 'master'
Support returning result as iodata and as safe iodata

Closes #20

See merge request pleroma/elixir-libraries/linkify!23
2020-08-30 18:31:48 +00:00
Justin Tormey
e720efd50c Accumulate as iodata, only convert to binary if necessary 2020-08-20 13:39:59 -05:00
Justin Tormey
61871d137a Reduce work for checking precense of type in opts 2020-07-27 13:37:15 -05:00