Sha256: db1706a92b9d6249acf82c23e8ceda3db3d00a0746a77dae18d62cc15735bd69

Contents?: true

Size: 1.05 KB

Versions: 28

Compression:

Stored size: 1.05 KB

Contents

require "jsduck/tag/tag"
require "jsduck/doc/subproperties"
require "jsduck/render/subproperties"

module JsDuck::Tag
  class Param < Tag
    def initialize
      @pattern = "param"
      @tagname = :params
      @repeatable = true
      @html_position = POS_PARAM
    end

    # @param {Type} [name=default] (optional) ...
    def parse_doc(p, pos)
      tag = p.standard_tag({
          :tagname => :params,
          :type => true,
          :name => true,
          :default => true,
          :optional => true
        })
      tag[:optional] = true if parse_optional(p)
      tag[:doc] = :multiline
      tag
    end

    def parse_optional(p)
      p.hw.match(/\(optional\)/i)
    end

    def process_doc(h, tags, pos)
      h[:params] = JsDuck::Doc::Subproperties.nest(tags, pos)
      h[:params] = nil if h[:params].length == 0
    end

    def format(m, formatter)
      m[:params].each {|p| formatter.format_subproperty(p) }
    end

    def to_html(m)
      JsDuck::Render::Subproperties.render_params(m[:params]) if m[:params].length > 0
    end

  end
end

Version data entries

28 entries across 28 versions & 3 rubygems

Version Path
solvas-jsduck-6.0.0.30539 lib/jsduck/tag/param.rb
solvas-jsduck-6.0.0.9571 lib/jsduck/tag/param.rb
solvas-jsduck-6.0.0.6154 lib/jsduck/tag/param.rb
solvas-jsduck-6.0.0.4021 lib/jsduck/tag/param.rb
solvas-jsduck-6.0.0.2554 lib/jsduck/tag/param.rb
solvas-jsduck-6.0.0.1891 lib/jsduck/tag/param.rb
solvas-jsduck-6.0.0.beta.1888 lib/jsduck/tag/param.rb
jsduck-troopjs-0.0.10 lib/jsduck/tag/param.rb
jsduck-troopjs-0.0.9 lib/jsduck/tag/param.rb
jsduck-troopjs-0.0.8 lib/jsduck/tag/param.rb
jsduck-troopjs-0.0.7 lib/jsduck/tag/param.rb
jsduck-troopjs-0.0.5 lib/jsduck/tag/param.rb
jsduck-troopjs-0.0.4 lib/jsduck/tag/param.rb
jsduck-troopjs-0.0.3 lib/jsduck/tag/param.rb
jsduck-troopjs-0.0.1 lib/jsduck/tag/param.rb
jsduck-6.0.0beta lib/jsduck/tag/param.rb
jsduck-5.3.4 lib/jsduck/tag/param.rb
jsduck-5.3.3 lib/jsduck/tag/param.rb
jsduck-5.3.2 lib/jsduck/tag/param.rb
jsduck-5.3.1 lib/jsduck/tag/param.rb