Sha256: eea43882d88736ab4179b1509f3bc30295e4fd6d10fb77fd419f308793d25a33
Contents?: true
Size: 1.42 KB
Versions: 4
Compression:
Stored size: 1.42 KB
Contents
module JsDuck # Abstract base class for all meta tag implementations. # # Child classes must define value for @name attribute. They can # also provide @multiline, and override #to_html method. class MetaTag # Name of the tag (required) attr_reader :name # True to include all lines up to next @tag as part of this meta-tag attr_reader :multiline # Override this to transform the content of meta-tag to HTML to be # included into documentation. # # It gets passed an array of contents gathered from all meta-tags # of given type. It should return an HTML string to inject into # document. For help in that it can use the #format method to # easily support Markdown and {@link/img} tags inside the contents # of meta-tag. # # By default the method returns nil, which means the tag will not # be rendered at all. def to_html(contents) end # This is used to inject the formatter object for #markdown method attr_accessor :formatter # Helper method to format the text in standard JsDuck way. # This means running it through Markdown engine and expanding # {@link} and {@img} tags. def format(text) @formatter.format(text) end # Returns all descendants of MetaTag class. def self.descendants result = [] ObjectSpace.each_object(::Class) do |cls| result << cls if cls < self end result end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
jsduck-3.1.0 | lib/jsduck/meta_tag.rb |
jsduck-3.0.1 | lib/jsduck/meta_tag.rb |
jsduck-3.0 | lib/jsduck/meta_tag.rb |
jsduck-3.0.pre3 | lib/jsduck/meta_tag.rb |