Sha256: 346febdb580d1c95e1c2ccf416f070ecaf747892f167fea52c8024a7084d6e75

Contents?: true

Size: 852 Bytes

Versions: 23

Compression:

Stored size: 852 Bytes

Contents

require 'jsduck/meta_tag_registry'

module JsDuck

  # Performs the rendering of meta tags.
  class MetaTagRenderer

    # Renders full meta tags of a particular section.
    #
    # Returns array of rendered HTML or nil if no meta data.
    def self.render(meta_data, position)
      return if meta_data.size == 0

      MetaTagRegistry.instance.tags(position).map do |tag|
        meta_data[tag.key]
      end
    end

    # Renders the meta-tag signatures for a class member.
    # Returns a string.
    def self.render_signature(member)
      html = []
      MetaTagRegistry.instance.signatures.each do |s|
        if member[:meta][s[:key]]
          title = s[:tooltip] ? "title='#{s[:tooltip]}'" : ""
          html << "<strong class='#{s[:key]} signature' #{title}>#{s[:long]}</strong>"
        end
      end
      html.join
    end

  end

end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
jsduck-4.10.4 lib/jsduck/meta_tag_renderer.rb
jsduck-4.10.3 lib/jsduck/meta_tag_renderer.rb
jsduck-4.10.2 lib/jsduck/meta_tag_renderer.rb
jsduck-4.10.1 lib/jsduck/meta_tag_renderer.rb
jsduck-4.10.0 lib/jsduck/meta_tag_renderer.rb
jsduck-4.9.0 lib/jsduck/meta_tag_renderer.rb
jsduck-4.8.0 lib/jsduck/meta_tag_renderer.rb
jsduck-4.7.1 lib/jsduck/meta_tag_renderer.rb
jsduck-4.7.0 lib/jsduck/meta_tag_renderer.rb
jsduck-4.6.2 lib/jsduck/meta_tag_renderer.rb
jsduck-4.6.1 lib/jsduck/meta_tag_renderer.rb
jsduck-4.6.0 lib/jsduck/meta_tag_renderer.rb
jsduck-4.5.1 lib/jsduck/meta_tag_renderer.rb
jsduck-4.5.0 lib/jsduck/meta_tag_renderer.rb
jsduck-4.4.1 lib/jsduck/meta_tag_renderer.rb
jsduck-4.4.0 lib/jsduck/meta_tag_renderer.rb
jsduck-4.3.2 lib/jsduck/meta_tag_renderer.rb
jsduck-4.3.1 lib/jsduck/meta_tag_renderer.rb
jsduck-4.3.0 lib/jsduck/meta_tag_renderer.rb
jsduck-4.2.1 lib/jsduck/meta_tag_renderer.rb