diff --git a/lib/jsduck/tag/deprecated.rb b/lib/jsduck/tag/deprecated.rb index d2f3971a2bd7f5f37c66381ba78ed359b3a67400..83b0c78219d0c561bf9b09ab92301ec198883d5f 100644 --- a/lib/jsduck/tag/deprecated.rb +++ b/lib/jsduck/tag/deprecated.rb @@ -4,10 +4,14 @@ module JsDuck::Tag class Deprecated < DeprecatedTag def initialize @tagname = :deprecated + @msg = "This {TAGNAME} has been deprected" @css = <<-EOCSS .signature .deprecated { background-color: #aa0000; } + .deprecated-box { + border: 2px solid #aa0000; + } .deprecated-box strong { color: white; background-color: #aa0000; diff --git a/lib/jsduck/tag/deprecated_tag.rb b/lib/jsduck/tag/deprecated_tag.rb index b76cfc486fe161f8f472ecc581185cb2903ca438..322b683c3ae93c40f6cd796ca882dfd29a4e4027 100644 --- a/lib/jsduck/tag/deprecated_tag.rb +++ b/lib/jsduck/tag/deprecated_tag.rb @@ -2,14 +2,15 @@ require "jsduck/tag/tag" module JsDuck::Tag # 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. + # need to define the @tagname and @msg attributes and call #super - + # all the correct behavior will the fall out automatically. class DeprecatedTag < Tag def initialize if @tagname @pattern = @tagname.to_s @signature = {:long => @tagname.to_s, :short => @tagname.to_s[0..2].upcase} @html_position = POS_DEPRECATED + @since = "since" unless @since @css += <<-EOCSS .deprecated-tag-box { text-align: center; @@ -45,10 +46,11 @@ module JsDuck::Tag def to_html(context) depr = context[@tagname] - v = depr[:version] ? "since " + depr[:version] : "" + msg = @msg.sub(/\{TAGNAME\}/, context[:tagname].to_s) + v = depr[:version] ? "#{@since} " + depr[:version] : "" <<-EOHTML
-

This #{context[:tagname]} has been #{@tagname} #{v}

+

#{msg} #{v}

#{depr[:text]}
EOHTML diff --git a/lib/jsduck/tag/experimental.rb b/lib/jsduck/tag/experimental.rb new file mode 100644 index 0000000000000000000000000000000000000000..66c98e25c30fe482f89e20e768eba4aa8aff36b6 --- /dev/null +++ b/lib/jsduck/tag/experimental.rb @@ -0,0 +1,28 @@ +require "jsduck/tag/deprecated_tag" + +module JsDuck::Tag + class Experimental < DeprecatedTag + def initialize + @tagname = :experimental + @msg = "This {TAGNAME} is experimental" + @since = "Introduced in" + # dashed border + @css = <<-EOCSS + .signature .experimental { + color: #a00; + border: 1px dashed #a00; + background-color: #fee; + } + .experimental-box { + border: 2px dashed #ccc; + } + .experimental-box strong { + margin: 0 3px; + border: 2px dashed #a00; + color: #a00; + } + EOCSS + super + end + end +end diff --git a/lib/jsduck/tag/removed.rb b/lib/jsduck/tag/removed.rb index f5a01cb1c0b42ed5e28ac387ca441dfb8c3ef4b8..50ce994dd729e1f765b342af3fca04dd0016abe7 100644 --- a/lib/jsduck/tag/removed.rb +++ b/lib/jsduck/tag/removed.rb @@ -7,6 +7,7 @@ module JsDuck::Tag class Removed < DeprecatedTag def initialize @tagname = :removed + @msg = "This {TAGNAME} has been removed" # striked-through text with red border. @css = <<-EOCSS .signature .removed { @@ -15,9 +16,12 @@ module JsDuck::Tag border: 1px solid #aa0000; text-decoration: line-through; } + .removed-box { + border: 2px solid #aa0000; + } .removed-box strong { color: #aa0000; - border: 1px solid #aa0000; + border: 2px solid #aa0000; background-color: transparent; text-decoration: line-through; }