class JsDuck::Tag::Doc

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

Public Class Methods

new() click to toggle source
# File lib/jsduck/tag/doc.rb, line 8
def initialize
  @tagname = :doc
  @html_position = POS_DOC
  @shortener = JsDuck::Format::Shortener.new
end

Public Instance Methods

format(m, formatter) click to toggle source
# 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) click to toggle source
# File lib/jsduck/tag/doc.rb, line 22
def to_html(m)
  m[:doc]
end

Private Instance Methods

expandable?(m) click to toggle source
# File lib/jsduck/tag/doc.rb, line 28
def expandable?(m)
  m[:params] || (m[:properties] && m[:properties].length > 0) || m[:default] || m[:deprecated] || m[:template]
end