Skip to content

Commit

Permalink
Fix parenthesis after commas (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsutsu3 committed May 7, 2022
1 parent d04075d commit 119af39
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 6 additions & 6 deletions linkify_it/ucre.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def _re_src_path(opts):
+ "|[']).)+\\'|"
+ "\\'(?="
+ SRC_PSEUDO_LETTER
+ "|[-]).|"
+ "|[-])|"
+ "\\.{2,}[a-zA-Z0-9%/&]|"
# google has many dots in "google search" links (#66, #81).
# github has ... in commit range links,
Expand All @@ -183,20 +183,20 @@ def _re_src_path(opts):
# until more examples found.
+ "\\.(?!"
+ SRC_ZCC
+ "|[.]).|"
+ "|[.]|$)|"
+ options
+ ",(?!"
+ SRC_ZCC
+ ").|" # allow `,,,` in paths
+ "|$)|" # allow `,,,` in paths
+ ";(?!"
+ SRC_ZCC
+ ").|" # allow `,,,` in paths
+ "|$)|" # allow `,,,` in paths
+ "\\!+(?!"
+ SRC_ZCC
+ "|[!]).|" # allow `!!!` in paths, but not at the end
+ "|[!]|$)|" # allow `!!!` in paths, but not at the end
+ "\\?(?!"
+ SRC_ZCC
+ "|[?])."
+ "|[?]|$)"
+ ")+"
+ "|\\/"
+ ")?"
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/links.txt
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ http://example.com/foo_bar/
http://example.com/foo_bar,
http://example.com/foo_bar

http://index-of.es/Android/Professional.Android.2.Application.Development.(Wrox,.2010,.0470565527).pdf

https://github.com/markdown-it/linkify-it/compare/360b13a733f521a8d4903d3a5e1e46c357e9d3ce...f580766349525150a80a32987bb47c2d592efc33

https://www.google.com/search?sxsrf=ACYBGNTJFmX-GjNJ8fM-2LCkqyNyxGU1Ng%3A1575534146332&ei=Qr7oXf7rE4rRrgSEgrmoAw&q=clover&oq=clover&gs_l=psy-ab.3..0i67j0l9.2986.3947..4187...0.2..0.281.1366.1j0j5......0....1..gws-wiz.......0i71j35i39j0i131.qWp1nz4IJVA&ved=0ahUKEwj-lP6Iip7mAhWKqIsKHQRBDjUQ4dUDCAs&uact=5
Expand Down

0 comments on commit 119af39

Please sign in to comment.