diff --git a/CHANGELOG.md b/CHANGELOG.md index e1b8b61de..241ddfa59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ [#361](https://github.com/realm/jazzy/issues/361) [#547](https://github.com/realm/jazzy/issues/547) -* Fully qualified references to Objective-C methods are now autolinked. +* References to Objective-C methods are now autolinked. [Minh Nguyễn](https://github.com/1ec5) [#362](https://github.com/realm/jazzy/issues/362) diff --git a/lib/jazzy/sourcekitten.rb b/lib/jazzy/sourcekitten.rb index 30486261c..4ffe0d094 100644 --- a/lib/jazzy/sourcekitten.rb +++ b/lib/jazzy/sourcekitten.rb @@ -534,20 +534,21 @@ def self.autolink_text(text, doc, root_decls, after_highlight = false) # Traverse children via subsequence components, if any name_traversal(parts, name_root) - end.autolink_block(doc.url, '[+-]\[\w+ [\w:]+\]', + end.autolink_block(doc.url, '[+-]\[\w+(?: ?\(\w+\))? [\w:]+\]', after_highlight) do |raw_name| - match = raw_name.match(/([+-])\[(\w+) ([\w:]+)\]/) + match = raw_name.match(/([+-])\[(\w+(?: ?\(\w+\))?) ([\w:]+)\]/) # Subject component can match any ancestor or top-level doc - subject = match[2] + subject = match[2].delete(' ') name_root = ancestor_name_match(subject, doc) || name_match(subject, root_decls) if name_root # Look up the verb in the subject’s children - verb = match[1] + match[3] - name_match(verb, name_root.children) + name_match(match[1] + match[3], name_root.children) end + end.autolink_block(doc.url, '[+-]\w[\w:]*', after_highlight) do |raw_name| + name_match(raw_name, doc.children) end end diff --git a/spec/integration_specs b/spec/integration_specs index 1fdea5730..37ebd2224 160000 --- a/spec/integration_specs +++ b/spec/integration_specs @@ -1 +1 @@ -Subproject commit 1fdea573086d24cfedf80d1c76cf061ff947d0ff +Subproject commit 37ebd222427336a865549fda800fabb25a7f371c