Skip to content

Commit

Permalink
Don't count ; at the end of link (when followed with space)
Browse files Browse the repository at this point in the history
- close #98
  • Loading branch information
Vitaly Puzrin committed Oct 1, 2021
1 parent 5196b02 commit 2014a2c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
3.0.3 / 2021-10-01
------------------

- Fixed #98. Don't count `;` at the end of link (when followed with space).


3.0.2 / 2020-05-20
------------------

Expand Down
5 changes: 3 additions & 2 deletions lib/re.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports = function (opts) {
'(?:' +
'[/?#]' +
'(?:' +
'(?!' + re.src_ZCc + '|' + text_separators + '|[()[\\]{}.,"\'?!\\-]).|' +
'(?!' + re.src_ZCc + '|' + text_separators + '|[()[\\]{}.,"\'?!\\-;]).|' +
'\\[(?:(?!' + re.src_ZCc + '|\\]).)*\\]|' +
'\\((?:(?!' + re.src_ZCc + '|[)]).)*\\)|' +
'\\{(?:(?!' + re.src_ZCc + '|[}]).)*\\}|' +
Expand All @@ -70,7 +70,8 @@ module.exports = function (opts) {
:
'\\-+|'
) +
'\\,(?!' + re.src_ZCc + ').|' + // allow `,,,` in paths
',(?!' + re.src_ZCc + ').|' + // allow `,,,` in paths
';(?!' + re.src_ZCc + ').|' + // allow `;` if not followed by space-like char
'\\!+(?!' + re.src_ZCc + '|[!]).|' + // allow `!!!` in paths, but not at the end
'\\?(?!' + re.src_ZCc + '|[?]).' +
')+' +
Expand Down
5 changes: 5 additions & 0 deletions test/fixtures/links.txt
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ http://example.com/123

http://example.com/foo--bar

See http://example.com/123; Example link.
http://example.com/123

http://example.com/123;123

% some sites have links with trailing dashes
http://www.bloomberg.com/news/articles/2015-06-26/from-deutsche-bank-to-siemens-what-s-troubling-germany-inc-

Expand Down

0 comments on commit 2014a2c

Please sign in to comment.