Loading lib/jsduck/class_formatter.rb +3 −5 Original line number Diff line number Diff line Loading @@ -24,10 +24,9 @@ module JsDuck @cls = cls @formatter.class_context = cls[:name] @formatter.doc_context = cls[:files][0] cls[:doc] = @formatter.format(cls[:doc]) if cls[:doc] format_tags(cls) # format all members (except hidden ones) cls[:members] = cls[:members].map {|m| m[:hide] ? m : format_member(m) } format_tags_data(cls) cls end Loading @@ -40,7 +39,7 @@ module JsDuck def format_member(m) @formatter.doc_context = m[:files][0] m[:doc] = @formatter.format(m[:doc]) if m[:doc] format_tags(m) if expandable?(m) || Shortener.too_long?(m[:doc]) m[:shortDoc] = Shortener.shorten(m[:doc]) end Loading @@ -53,7 +52,6 @@ module JsDuck m[:return] = format_item(m[:return], is_css_tag) if m[:return] m[:throws] = m[:throws].map {|t| format_item(t, is_css_tag) } if m[:throws] m[:properties] = m[:properties].map {|b| format_item(b, is_css_tag) } if m[:properties] format_tags_data(m) m end Loading Loading @@ -83,7 +81,7 @@ module JsDuck end end def format_tags_data(context) def format_tags(context) TagRegistry.html_renderers.each do |tag| if context[tag.key] tag.format(context, @formatter) Loading lib/jsduck/renderer.rb +2 −2 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ module JsDuck render_sidebar, "<div class='doc-contents'>", render_tags(@cls, :top), @cls[:doc], render_tags(@cls, :doc), render_tags(@cls, :bottom), "</div>", "<div class='members'>", Loading Loading @@ -218,7 +218,7 @@ module JsDuck doc << render_tags(m, :top) doc << m[:doc] doc << render_tags(m, :doc) doc << render_tags(m, :bottom) Loading lib/jsduck/tag/doc.rb 0 → 100644 +20 −0 Original line number Diff line number Diff line require "jsduck/tag/tag" module JsDuck::Tag # A special class for rendering the documentation field inside # classes and members. class Doc < Tag def initialize @key = :doc @html_position = :doc end def format(m, formatter) m[:doc] = formatter.format(m[:doc]) end def to_html(m) m[:doc] end end end lib/jsduck/tag_registry.rb +2 −2 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ module JsDuck @keys = {} @mergers = {} @signatures = [] @html_renderers = {:top => [], :bottom => []} @html_renderers = {:top => [], :doc => [], :bottom => []} @member_types = [] @loader = TagLoader.new Loading Loading @@ -97,7 +97,7 @@ module JsDuck # for both sections are returned. def html_renderers(position = :all) if position == :all @html_renderers[:top] + @html_renderers[:bottom] @html_renderers[:top] + @html_renderers[:doc] + @html_renderers[:bottom] else @html_renderers[position] end Loading Loading
lib/jsduck/class_formatter.rb +3 −5 Original line number Diff line number Diff line Loading @@ -24,10 +24,9 @@ module JsDuck @cls = cls @formatter.class_context = cls[:name] @formatter.doc_context = cls[:files][0] cls[:doc] = @formatter.format(cls[:doc]) if cls[:doc] format_tags(cls) # format all members (except hidden ones) cls[:members] = cls[:members].map {|m| m[:hide] ? m : format_member(m) } format_tags_data(cls) cls end Loading @@ -40,7 +39,7 @@ module JsDuck def format_member(m) @formatter.doc_context = m[:files][0] m[:doc] = @formatter.format(m[:doc]) if m[:doc] format_tags(m) if expandable?(m) || Shortener.too_long?(m[:doc]) m[:shortDoc] = Shortener.shorten(m[:doc]) end Loading @@ -53,7 +52,6 @@ module JsDuck m[:return] = format_item(m[:return], is_css_tag) if m[:return] m[:throws] = m[:throws].map {|t| format_item(t, is_css_tag) } if m[:throws] m[:properties] = m[:properties].map {|b| format_item(b, is_css_tag) } if m[:properties] format_tags_data(m) m end Loading Loading @@ -83,7 +81,7 @@ module JsDuck end end def format_tags_data(context) def format_tags(context) TagRegistry.html_renderers.each do |tag| if context[tag.key] tag.format(context, @formatter) Loading
lib/jsduck/renderer.rb +2 −2 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ module JsDuck render_sidebar, "<div class='doc-contents'>", render_tags(@cls, :top), @cls[:doc], render_tags(@cls, :doc), render_tags(@cls, :bottom), "</div>", "<div class='members'>", Loading Loading @@ -218,7 +218,7 @@ module JsDuck doc << render_tags(m, :top) doc << m[:doc] doc << render_tags(m, :doc) doc << render_tags(m, :bottom) Loading
lib/jsduck/tag/doc.rb 0 → 100644 +20 −0 Original line number Diff line number Diff line require "jsduck/tag/tag" module JsDuck::Tag # A special class for rendering the documentation field inside # classes and members. class Doc < Tag def initialize @key = :doc @html_position = :doc end def format(m, formatter) m[:doc] = formatter.format(m[:doc]) end def to_html(m) m[:doc] end end end
lib/jsduck/tag_registry.rb +2 −2 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ module JsDuck @keys = {} @mergers = {} @signatures = [] @html_renderers = {:top => [], :bottom => []} @html_renderers = {:top => [], :doc => [], :bottom => []} @member_types = [] @loader = TagLoader.new Loading Loading @@ -97,7 +97,7 @@ module JsDuck # for both sections are returned. def html_renderers(position = :all) if position == :all @html_renderers[:top] + @html_renderers[:bottom] @html_renderers[:top] + @html_renderers[:doc] + @html_renderers[:bottom] else @html_renderers[position] end Loading