Loading lib/jsduck/class_formatter.rb +9 −5 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ module JsDuck cls[group][type] = members.map {|m| format_member(m) } end end cls[:html_meta] = format_meta_data(cls[:meta]) cls[:html_meta] = format_meta_data(cls) cls end Loading @@ -49,7 +49,7 @@ module JsDuck m[:params] = m[:params].map {|p| format_item(p, is_css_tag) } if m[:params] m[:return] = format_item(m[:return], is_css_tag) if m[:return] m[:properties] = m[:properties].map {|b| format_item(b, is_css_tag) } if m[:properties] m[:html_meta] = format_meta_data(m[:meta]) m[:html_meta] = format_meta_data(m) m end Loading Loading @@ -79,10 +79,14 @@ module JsDuck end end def format_meta_data(meta_data) def format_meta_data(context) result = {} meta_data.each_pair do |key, value| result[key] = MetaTagRegistry.instance[key].to_html(value) if value context[:meta].each_pair do |key, value| if value tag = MetaTagRegistry.instance[key] tag.context = context result[key] = tag.to_html(value) end end result end Loading lib/jsduck/meta_tag.rb +6 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,12 @@ module JsDuck # existance of the tag. attr_reader :boolean # Here the appropriate class or member will be injected, # so the to_value and to_html methods can for produce # different output based on whether the tag is inside class, # method, event, etc. attr_accessor :context # It gets passed an array of contents gathered from all meta-tags # of given type. It should return the value to be stored for this # meta-tag at :key. The returned value is also passed to #to_html Loading lib/jsduck/tag/deprecated.rb +1 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ module JsDuck::Tag v = depr[:version] ? "since " + depr[:version] : "" <<-EOHTML <div class='signature-box deprecated'> <p>This member has been <strong>deprecated</strong> #{v}</p> <p>This #{@context[:tagname]} has been <strong>deprecated</strong> #{v}</p> #{format(depr[:text])} </div> EOHTML Loading Loading
lib/jsduck/class_formatter.rb +9 −5 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ module JsDuck cls[group][type] = members.map {|m| format_member(m) } end end cls[:html_meta] = format_meta_data(cls[:meta]) cls[:html_meta] = format_meta_data(cls) cls end Loading @@ -49,7 +49,7 @@ module JsDuck m[:params] = m[:params].map {|p| format_item(p, is_css_tag) } if m[:params] m[:return] = format_item(m[:return], is_css_tag) if m[:return] m[:properties] = m[:properties].map {|b| format_item(b, is_css_tag) } if m[:properties] m[:html_meta] = format_meta_data(m[:meta]) m[:html_meta] = format_meta_data(m) m end Loading Loading @@ -79,10 +79,14 @@ module JsDuck end end def format_meta_data(meta_data) def format_meta_data(context) result = {} meta_data.each_pair do |key, value| result[key] = MetaTagRegistry.instance[key].to_html(value) if value context[:meta].each_pair do |key, value| if value tag = MetaTagRegistry.instance[key] tag.context = context result[key] = tag.to_html(value) end end result end Loading
lib/jsduck/meta_tag.rb +6 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,12 @@ module JsDuck # existance of the tag. attr_reader :boolean # Here the appropriate class or member will be injected, # so the to_value and to_html methods can for produce # different output based on whether the tag is inside class, # method, event, etc. attr_accessor :context # It gets passed an array of contents gathered from all meta-tags # of given type. It should return the value to be stored for this # meta-tag at :key. The returned value is also passed to #to_html Loading
lib/jsduck/tag/deprecated.rb +1 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ module JsDuck::Tag v = depr[:version] ? "since " + depr[:version] : "" <<-EOHTML <div class='signature-box deprecated'> <p>This member has been <strong>deprecated</strong> #{v}</p> <p>This #{@context[:tagname]} has been <strong>deprecated</strong> #{v}</p> #{format(depr[:text])} </div> EOHTML Loading