Loading lib/jsduck/meta_tag.rb +2 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ module JsDuck # # {:long => "something", :short => "SOM"} # # Additionally the hash can contain a :tooltip which is the text # to be shown when the signature bubble is hovered over in docs. attr_reader :signature # True to include all lines up to next @tag as part of this meta-tag Loading lib/jsduck/options.rb +1 −0 Original line number Diff line number Diff line Loading @@ -138,6 +138,7 @@ module JsDuck reg = MetaTagRegistry.new reg.load([:builtins] + @meta_tag_paths) reg[:new].create_tooltip!(@imports, @new_since) MetaTagRegistry.instance = reg end Loading lib/jsduck/renderer.rb +12 −6 Original line number Diff line number Diff line Loading @@ -260,21 +260,27 @@ module JsDuck end end after = "" MetaTagRegistry.instance.signatures.each do |s| after += "<strong class='#{s[:key]} signature'>#{s[:long]}</strong>" if m[:meta][s[:key]] end uri = "#!/api/#{m[:owner]}-#{m[:id]}" return [ before, "<a href='#{uri}' class='name #{expandable}'>#{name}</a>", params, after render_meta_signatures(m) ] end def render_meta_signatures(m) html = "" MetaTagRegistry.instance.signatures.each do |s| if m[:meta][s[:key]] title = s[:tooltip] ? "title='#{s[:tooltip]}'" : "" html += "<strong class='#{s[:key]} signature' #{title}>#{s[:long]}</strong>" end end html end def render_short_param(param) p = param[:html_type] + " " + param[:name] return param[:optional] ? "["+p+"]" : p Loading lib/jsduck/tag/new.rb +13 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,19 @@ module JsDuck::Tag @boolean = true end # Initializes the tooltip text. # # HACK: This is a special method that's only called for the @new # tag. It doesn't fit well into the current meta-tags system. But # until we rework the meta-tags system, this will have to do. def create_tooltip!(imports, new_since) if new_since @signature[:tooltip] = "New since #{new_since}" elsif imports.length > 0 @signature[:tooltip] = "New since #{imports.last[:version]}" end end def to_value(contents) true end Loading Loading
lib/jsduck/meta_tag.rb +2 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ module JsDuck # # {:long => "something", :short => "SOM"} # # Additionally the hash can contain a :tooltip which is the text # to be shown when the signature bubble is hovered over in docs. attr_reader :signature # True to include all lines up to next @tag as part of this meta-tag Loading
lib/jsduck/options.rb +1 −0 Original line number Diff line number Diff line Loading @@ -138,6 +138,7 @@ module JsDuck reg = MetaTagRegistry.new reg.load([:builtins] + @meta_tag_paths) reg[:new].create_tooltip!(@imports, @new_since) MetaTagRegistry.instance = reg end Loading
lib/jsduck/renderer.rb +12 −6 Original line number Diff line number Diff line Loading @@ -260,21 +260,27 @@ module JsDuck end end after = "" MetaTagRegistry.instance.signatures.each do |s| after += "<strong class='#{s[:key]} signature'>#{s[:long]}</strong>" if m[:meta][s[:key]] end uri = "#!/api/#{m[:owner]}-#{m[:id]}" return [ before, "<a href='#{uri}' class='name #{expandable}'>#{name}</a>", params, after render_meta_signatures(m) ] end def render_meta_signatures(m) html = "" MetaTagRegistry.instance.signatures.each do |s| if m[:meta][s[:key]] title = s[:tooltip] ? "title='#{s[:tooltip]}'" : "" html += "<strong class='#{s[:key]} signature' #{title}>#{s[:long]}</strong>" end end html end def render_short_param(param) p = param[:html_type] + " " + param[:name] return param[:optional] ? "["+p+"]" : p Loading
lib/jsduck/tag/new.rb +13 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,19 @@ module JsDuck::Tag @boolean = true end # Initializes the tooltip text. # # HACK: This is a special method that's only called for the @new # tag. It doesn't fit well into the current meta-tags system. But # until we rework the meta-tags system, this will have to do. def create_tooltip!(imports, new_since) if new_since @signature[:tooltip] = "New since #{new_since}" elsif imports.length > 0 @signature[:tooltip] = "New since #{imports.last[:version]}" end end def to_value(contents) true end Loading