Loading lib/jsduck/accessors.rb +14 −6 Original line number Diff line number Diff line Loading @@ -57,8 +57,7 @@ module JsDuck :owner => cfg[:owner], :files => cfg[:files], :id => "method-" + name, :deprecated => cfg[:deprecated], :attributes => {}, :attributes => clone_attributes(cfg), :meta => cfg[:meta], } end Loading @@ -81,8 +80,7 @@ module JsDuck :owner => cfg[:owner], :files => cfg[:files], :id => "method-" + name, :deprecated => cfg[:deprecated], :attributes => {}, :attributes => clone_attributes(cfg), :meta => cfg[:meta] } end Loading Loading @@ -119,8 +117,7 @@ module JsDuck :owner => cfg[:owner], :files => cfg[:files], :id => "event-" + name, :deprecated => cfg[:deprecated], :attributes => {}, :attributes => clone_attributes(cfg), :meta => cfg[:meta] } end Loading @@ -128,6 +125,17 @@ module JsDuck def upcase_first(str) str[0,1].upcase + str[1..-1] end # Create copy of all attributes of config, except the :required # attribute which only applies to configs and must not be # propagated to methods or events. def clone_attributes(cfg) h = {} cfg[:attributes].each_pair do |key, value| h[:key] = value unless key == :required end h end end end lib/jsduck/app_exporter.rb +1 −1 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ module JsDuck def compact_member(m) m_copy = {} [:name, :tagname, :owner, :deprecated, :attributes, :id].each do |key| [:name, :tagname, :owner, :attributes, :id].each do |key| m_copy[key] = m[key] end m_copy Loading lib/jsduck/class_formatter.rb +3 −2 Original line number Diff line number Diff line Loading @@ -36,7 +36,8 @@ module JsDuck def format_member(m) @formatter.doc_context = m[:files][0] m[:doc] = @formatter.format(m[:doc]) if m[:doc] m[:deprecated][:text] = @formatter.format(m[:deprecated][:text]) if m[:deprecated] depr = m[:attributes][:deprecated] depr[:text] = @formatter.format(depr[:text]) if depr if expandable?(m) || @formatter.too_long?(m[:doc]) m[:shortDoc] = @formatter.shorten(m[:doc]) end Loading @@ -52,7 +53,7 @@ module JsDuck end def expandable?(m) m[:params] || (m[:properties] && m[:properties].length > 0) || m[:default] || m[:deprecated] || m[:attributes][:template] m[:params] || (m[:properties] && m[:properties].length > 0) || m[:default] || m[:attributes][:deprecated] || m[:attributes][:template] end def format_item(it, is_css_tag) Loading lib/jsduck/merger.rb +3 −5 Original line number Diff line number Diff line Loading @@ -221,7 +221,6 @@ module JsDuck hash.merge!({ :private => !!doc_map[:private], :inheritable => !!doc_map[:inheritable], :deprecated => detect_deprecated(doc_map), :inheritdoc => doc_map[:inheritdoc] ? doc_map[:inheritdoc].first : nil, :attributes => detect_attributes(doc_map), :meta => detect_meta(doc_map), Loading Loading @@ -362,10 +361,6 @@ module JsDuck meta end def detect_deprecated(doc_map) doc_map[:deprecated] ? doc_map[:deprecated].first : nil end def detect_singleton(doc_map, code) !!(doc_map[:singleton] || code[:type] == :ext_define && code[:singleton]) end Loading @@ -375,6 +370,9 @@ module JsDuck (doc_map[:attribute] || []).each do |tag| attributes[tag[:name]] = true end # @deprecated and (required) are detected in special ways from # doc-comment but merged into :attributes hash. attributes[:deprecated] = doc_map[:deprecated].first if doc_map[:deprecated] attributes[:required] = true if detect_required(doc_map) attributes end Loading lib/jsduck/renderer.rb +6 −5 Original line number Diff line number Diff line Loading @@ -227,7 +227,7 @@ module JsDuck if m[:attributes][:static] after += "<strong class='static signature'>static</strong>" end if m[:deprecated] if m[:attributes][:deprecated] after += "<strong class='deprecated signature'>deprecated</strong>" end if m[:attributes][:required] Loading Loading @@ -265,17 +265,18 @@ module JsDuck doc << "<p>Defaults to: <code>" + CGI.escapeHTML(m[:default]) + "</code></p>" end if m[:deprecated] v = m[:deprecated][:version] ? "since " + m[:deprecated][:version] : "" if m[:attributes][:deprecated] depr = m[:attributes][:deprecated] v = depr[:version] ? "since " + depr[:version] : "" doc << [ "<div class='signature-box deprecated'>", "<p>This #{m[:tagname]} has been <strong>deprecated</strong> #{v}</p>", m[:deprecated][:text], depr[:text], "</div>", ] end if m[:template] if m[:attributes][:template] doc << [ "<div class='signature-box template'>", "<p>This is a template method. A hook into the functionality of this class.", Loading Loading
lib/jsduck/accessors.rb +14 −6 Original line number Diff line number Diff line Loading @@ -57,8 +57,7 @@ module JsDuck :owner => cfg[:owner], :files => cfg[:files], :id => "method-" + name, :deprecated => cfg[:deprecated], :attributes => {}, :attributes => clone_attributes(cfg), :meta => cfg[:meta], } end Loading @@ -81,8 +80,7 @@ module JsDuck :owner => cfg[:owner], :files => cfg[:files], :id => "method-" + name, :deprecated => cfg[:deprecated], :attributes => {}, :attributes => clone_attributes(cfg), :meta => cfg[:meta] } end Loading Loading @@ -119,8 +117,7 @@ module JsDuck :owner => cfg[:owner], :files => cfg[:files], :id => "event-" + name, :deprecated => cfg[:deprecated], :attributes => {}, :attributes => clone_attributes(cfg), :meta => cfg[:meta] } end Loading @@ -128,6 +125,17 @@ module JsDuck def upcase_first(str) str[0,1].upcase + str[1..-1] end # Create copy of all attributes of config, except the :required # attribute which only applies to configs and must not be # propagated to methods or events. def clone_attributes(cfg) h = {} cfg[:attributes].each_pair do |key, value| h[:key] = value unless key == :required end h end end end
lib/jsduck/app_exporter.rb +1 −1 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ module JsDuck def compact_member(m) m_copy = {} [:name, :tagname, :owner, :deprecated, :attributes, :id].each do |key| [:name, :tagname, :owner, :attributes, :id].each do |key| m_copy[key] = m[key] end m_copy Loading
lib/jsduck/class_formatter.rb +3 −2 Original line number Diff line number Diff line Loading @@ -36,7 +36,8 @@ module JsDuck def format_member(m) @formatter.doc_context = m[:files][0] m[:doc] = @formatter.format(m[:doc]) if m[:doc] m[:deprecated][:text] = @formatter.format(m[:deprecated][:text]) if m[:deprecated] depr = m[:attributes][:deprecated] depr[:text] = @formatter.format(depr[:text]) if depr if expandable?(m) || @formatter.too_long?(m[:doc]) m[:shortDoc] = @formatter.shorten(m[:doc]) end Loading @@ -52,7 +53,7 @@ module JsDuck end def expandable?(m) m[:params] || (m[:properties] && m[:properties].length > 0) || m[:default] || m[:deprecated] || m[:attributes][:template] m[:params] || (m[:properties] && m[:properties].length > 0) || m[:default] || m[:attributes][:deprecated] || m[:attributes][:template] end def format_item(it, is_css_tag) Loading
lib/jsduck/merger.rb +3 −5 Original line number Diff line number Diff line Loading @@ -221,7 +221,6 @@ module JsDuck hash.merge!({ :private => !!doc_map[:private], :inheritable => !!doc_map[:inheritable], :deprecated => detect_deprecated(doc_map), :inheritdoc => doc_map[:inheritdoc] ? doc_map[:inheritdoc].first : nil, :attributes => detect_attributes(doc_map), :meta => detect_meta(doc_map), Loading Loading @@ -362,10 +361,6 @@ module JsDuck meta end def detect_deprecated(doc_map) doc_map[:deprecated] ? doc_map[:deprecated].first : nil end def detect_singleton(doc_map, code) !!(doc_map[:singleton] || code[:type] == :ext_define && code[:singleton]) end Loading @@ -375,6 +370,9 @@ module JsDuck (doc_map[:attribute] || []).each do |tag| attributes[tag[:name]] = true end # @deprecated and (required) are detected in special ways from # doc-comment but merged into :attributes hash. attributes[:deprecated] = doc_map[:deprecated].first if doc_map[:deprecated] attributes[:required] = true if detect_required(doc_map) attributes end Loading
lib/jsduck/renderer.rb +6 −5 Original line number Diff line number Diff line Loading @@ -227,7 +227,7 @@ module JsDuck if m[:attributes][:static] after += "<strong class='static signature'>static</strong>" end if m[:deprecated] if m[:attributes][:deprecated] after += "<strong class='deprecated signature'>deprecated</strong>" end if m[:attributes][:required] Loading Loading @@ -265,17 +265,18 @@ module JsDuck doc << "<p>Defaults to: <code>" + CGI.escapeHTML(m[:default]) + "</code></p>" end if m[:deprecated] v = m[:deprecated][:version] ? "since " + m[:deprecated][:version] : "" if m[:attributes][:deprecated] depr = m[:attributes][:deprecated] v = depr[:version] ? "since " + depr[:version] : "" doc << [ "<div class='signature-box deprecated'>", "<p>This #{m[:tagname]} has been <strong>deprecated</strong> #{v}</p>", m[:deprecated][:text], depr[:text], "</div>", ] end if m[:template] if m[:attributes][:template] doc << [ "<div class='signature-box template'>", "<p>This is a template method. A hook into the functionality of this class.", Loading