Method: JsDuck::Inline::AutoLink#replace

Defined in:
lib/jsduck/inline/auto_link.rb

#replace(input) ⇒ Object

Looks input text for patterns like:

My.ClassName
MyClass#method
#someProperty

and converts them to links, as if they were surrounded with @link tag. One notable exception is that Foo is not created to link, even when Foo class exists, but Foo.Bar is. This is to avoid turning normal words into links. For example:

Math involves a lot of numbers. Ext JS is a JavaScript framework.

In these sentences we don’t want to link “Math” and “Ext” to the corresponding JS classes. And that’s why we auto-link only class names containing a dot “.”



41
42
43
44
45
46
47
# File 'lib/jsduck/inline/auto_link.rb', line 41

def replace(input)
  input.gsub(@magic_link_re) do
    cls = $1 || $3
    member = $2 || $4
    replace_magic_link(cls, member)
  end
end