Class: JsDuck::Tag::Doc

Inherits:
JsDuck::Tag show all
Defined in:
lib/jsduck/tag/doc.rb

Overview

A special class for rendering the documentation field inside classes and members.

Instance Method Summary collapse

Constructor Details

#initializeDoc

Returns a new instance of Doc.



8
9
10
11
12
# File 'lib/jsduck/tag/doc.rb', line 8

def initialize
  @tagname = :doc
  @html_position = POS_DOC
  @shortener = JsDuck::Format::Shortener.new
end

Instance Method Details

#format(m, formatter) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/jsduck/tag/doc.rb', line 14

def format(m, formatter)
  m[:doc] = formatter.format(m[:doc])

  if expandable?(m) || @shortener.too_long?(m[:doc])
    m[:short_doc] = @shortener.shorten(m[:doc])
  end
end

#to_html(m) ⇒ Object



22
23
24
# File 'lib/jsduck/tag/doc.rb', line 22

def to_html(m)
  m[:doc]
end