Loading lib/jsduck/renderer.rb +0 −21 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ module JsDuck "<div class='doc-contents'>", render_tags(@cls, :top), @cls[:doc], render_enum_class_notice, render_tags(@cls, :bottom), "</div>", "<div class='members'>", Loading @@ -31,26 +30,6 @@ module JsDuck ].flatten.compact.join end def render_enum_class_notice return if !@cls[:enum] if @cls[:enum][:doc_only] first = @cls[:members][:property][0] || {:name => 'foo', :default => '"foo"'} [ "<p class='enum'><strong>ENUM:</strong> ", "This enumeration defines a set of String values. ", "It exists primarily for documentation purposes - ", "in code use the actual string values like #{first[:default]}, ", "don't reference them through this class like #{@cls[:name]}.#{first[:name]}.</p>", ] else [ "<p class='enum'><strong>ENUM:</strong> ", "This enumeration defines a set of #{@cls[:enum][:type]} values.</p>", ] end end def render_tags(member, position) TagRenderer.render(member, position) end Loading lib/jsduck/tag/enum.rb +19 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ module JsDuck::Tag @pattern = "enum" @key = :enum @merge_context = :class @html_position = :bottom end # @enum {Type} [name=default] ... Loading Loading @@ -35,5 +36,23 @@ module JsDuck::Tag h[:enum][:doc_only] = docs[:enum][:doc_only] || (code[:enum] && code[:enum][:doc_only]) end def to_html(cls) if cls[:enum][:doc_only] first = cls[:members][:property][0] || {:name => 'foo', :default => '"foo"'} [ "<p class='enum'><strong>ENUM:</strong> ", "This enumeration defines a set of String values. ", "It exists primarily for documentation purposes - ", "in code use the actual string values like #{first[:default]}, ", "don't reference them through this class like #{cls[:name]}.#{first[:name]}.</p>", ] else [ "<p class='enum'><strong>ENUM:</strong> ", "This enumeration defines a set of #{cls[:enum][:type]} values.</p>", ] end end end end Loading
lib/jsduck/renderer.rb +0 −21 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ module JsDuck "<div class='doc-contents'>", render_tags(@cls, :top), @cls[:doc], render_enum_class_notice, render_tags(@cls, :bottom), "</div>", "<div class='members'>", Loading @@ -31,26 +30,6 @@ module JsDuck ].flatten.compact.join end def render_enum_class_notice return if !@cls[:enum] if @cls[:enum][:doc_only] first = @cls[:members][:property][0] || {:name => 'foo', :default => '"foo"'} [ "<p class='enum'><strong>ENUM:</strong> ", "This enumeration defines a set of String values. ", "It exists primarily for documentation purposes - ", "in code use the actual string values like #{first[:default]}, ", "don't reference them through this class like #{@cls[:name]}.#{first[:name]}.</p>", ] else [ "<p class='enum'><strong>ENUM:</strong> ", "This enumeration defines a set of #{@cls[:enum][:type]} values.</p>", ] end end def render_tags(member, position) TagRenderer.render(member, position) end Loading
lib/jsduck/tag/enum.rb +19 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ module JsDuck::Tag @pattern = "enum" @key = :enum @merge_context = :class @html_position = :bottom end # @enum {Type} [name=default] ... Loading Loading @@ -35,5 +36,23 @@ module JsDuck::Tag h[:enum][:doc_only] = docs[:enum][:doc_only] || (code[:enum] && code[:enum][:doc_only]) end def to_html(cls) if cls[:enum][:doc_only] first = cls[:members][:property][0] || {:name => 'foo', :default => '"foo"'} [ "<p class='enum'><strong>ENUM:</strong> ", "This enumeration defines a set of String values. ", "It exists primarily for documentation purposes - ", "in code use the actual string values like #{first[:default]}, ", "don't reference them through this class like #{cls[:name]}.#{first[:name]}.</p>", ] else [ "<p class='enum'><strong>ENUM:</strong> ", "This enumeration defines a set of #{cls[:enum][:type]} values.</p>", ] end end end end