Class: JsDuck::Tag::DeprecatedTag
- Defined in:
- lib/jsduck/tag/deprecated_tag.rb
Overview
Base class for both @deprecated and @removed. Child classes only need to define the @tagname attribute and call #super - all the correct behavior will the fall out automatically.
Direct Known Subclasses
Constant Summary
Constants inherited from Tag
Tag::POS_ASIDE, Tag::POS_DEFAULT, Tag::POS_DEPRECATED, Tag::POS_DOC, Tag::POS_ENUM, Tag::POS_FIRES, Tag::POS_LOCALDOC, Tag::POS_OVERRIDES, Tag::POS_PARAM, Tag::POS_PREVENTABLE, Tag::POS_PRIVATE, Tag::POS_RETURN, Tag::POS_SINCE, Tag::POS_SUBPROPERTIES, Tag::POS_TEMPLATE, Tag::POS_THROWS
Instance Attribute Summary
Attributes inherited from Tag
#css, #ext_define_default, #ext_define_pattern, #html_position, #pattern, #repeatable, #signature, #tagname
Instance Method Summary collapse
- #format(context, formatter) ⇒ Object
-
#initialize ⇒ DeprecatedTag
constructor
A new instance of DeprecatedTag.
- #parse_doc(p, pos) ⇒ Object
- #process_doc(h, tags, pos) ⇒ Object
- #to_html(context) ⇒ Object
Methods inherited from Tag
descendants, #parse_ext_define
Constructor Details
#initialize ⇒ DeprecatedTag
Returns a new instance of DeprecatedTag.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/jsduck/tag/deprecated_tag.rb', line 8 def initialize if @tagname @pattern = @tagname.to_s @signature = {:long => @tagname.to_s, :short => @tagname.to_s[0..2].upcase} @html_position = POS_DEPRECATED @css += <<-EOCSS .deprecated-tag-box { text-align: center; color: #600; background-color: #fee; } .deprecated-tag-box strong { text-transform: uppercase; border-radius: 2px; padding: 0 3px; } EOCSS end end |
Instance Method Details
#format(context, formatter) ⇒ Object
42 43 44 |
# File 'lib/jsduck/tag/deprecated_tag.rb', line 42 def format(context, formatter) context[@tagname][:text] = formatter.format(context[@tagname][:text]) end |
#parse_doc(p, pos) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/jsduck/tag/deprecated_tag.rb', line 28 def parse_doc(p, pos) { :tagname => @tagname, :version => p.match(/[0-9.]+/), :doc => :multiline, } end |
#process_doc(h, tags, pos) ⇒ Object
36 37 38 39 40 |
# File 'lib/jsduck/tag/deprecated_tag.rb', line 36 def process_doc(h, , pos) v = {:text => [0][:doc] || ""} v[:version] = [0][:version] if [0][:version] h[@tagname] = v end |
#to_html(context) ⇒ Object
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/jsduck/tag/deprecated_tag.rb', line 46 def to_html(context) depr = context[@tagname] v = depr[:version] ? "since " + depr[:version] : "" <<-EOHTML <div class='rounded-box #{@tagname}-box deprecated-tag-box'> <p>This #{context[:tagname]} has been <strong>#{@tagname}</strong> #{v}</p> #{depr[:text]} </div> EOHTML end |