Skip to content

Commit

Permalink
Autolink to symbols containing & < >
Browse files Browse the repository at this point in the history
  • Loading branch information
johnfairh committed Jul 30, 2017
1 parent a9c2fd4 commit c438e5c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/jazzy/sourcekitten.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
require 'pathname'
require 'shellwords'
require 'xcinvoke'
require 'CGI'

require 'jazzy/config'
require 'jazzy/executable'
Expand All @@ -27,7 +28,7 @@ def autolink_block(doc_url, middle_regex, after_highlight)
gsub(autolink_regex(middle_regex, after_highlight)) do
original = Regexp.last_match(0)
start_tag, raw_name, end_tag = Regexp.last_match.captures
link_target = yield(raw_name)
link_target = yield(CGI.unescape_html(raw_name))

if link_target &&
!link_target.type.extension? &&
Expand Down Expand Up @@ -540,7 +541,7 @@ def self.name_match(name_part, docs)
return nil unless name_part
wildcard_expansion = Regexp.escape(name_part)
.gsub('\.\.\.', '[^)]*')
.gsub(/&lt;.*&gt;/, '')
.gsub(/<.*>/, '')
whole_name_pat = /\A#{wildcard_expansion}\Z/
docs.find do |doc|
whole_name_pat =~ doc.name
Expand Down

0 comments on commit c438e5c

Please sign in to comment.