Skip to content

Commit

Permalink
Add support for Unicode links
Browse files Browse the repository at this point in the history
* In function 'external?', URI is now escaped before split.
* Class Addressable is used for parsing since it is capable of parsing Unicode URIs (IRIs). Another option would be to escape the URI before parsing but URI.escape is deprecated and alternatives (e.g. CGI.escape) work differently.
* Resolves #33.
  • Loading branch information
mukrop committed Dec 5, 2020
1 parent f6fb51a commit 6438850
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/jekyll-target-blank.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def not_mailto_link?(link)
# link - a url.
def external?(link)
if link&.match?(URI.regexp(%w(http https)))
URI.parse(link).host != URI.parse(@site_url).host
Addressable::URI.parse(link).host != Addressable::URI.parse(@site_url).host
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/jekyll-target-blank/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module JekyllTargetBlank
VERSION = "2.0.0"
VERSION = "2.0.1"
end

0 comments on commit 6438850

Please sign in to comment.