jsduck 4.10.4 → 5.0.0.beta01

Sign up to get free protection for your applications and to get access to all the features.
Files changed (183) hide show
  1. data/.travis.yml +0 -1
  2. data/README.md +32 -6
  3. data/Rakefile +10 -18
  4. data/bin/compare +5 -5
  5. data/bin/jsduck +2 -3
  6. data/jsduck.gemspec +3 -4
  7. data/lib/jsduck/aggregator.rb +21 -80
  8. data/lib/jsduck/app.rb +7 -14
  9. data/lib/jsduck/app_data.rb +4 -5
  10. data/lib/jsduck/assets.rb +4 -7
  11. data/lib/jsduck/base_type.rb +53 -0
  12. data/lib/jsduck/batch_parser.rb +8 -87
  13. data/lib/jsduck/batch_processor.rb +77 -0
  14. data/lib/jsduck/categories/auto.rb +83 -0
  15. data/lib/jsduck/categories/class_name.rb +63 -0
  16. data/lib/jsduck/categories/factory.rb +113 -0
  17. data/lib/jsduck/categories/file.rb +75 -0
  18. data/lib/jsduck/class.rb +3 -9
  19. data/lib/jsduck/class_doc_expander.rb +1 -1
  20. data/lib/jsduck/css/lexer.rb +203 -0
  21. data/lib/jsduck/css/parser.rb +121 -0
  22. data/lib/jsduck/doc/comment.rb +40 -0
  23. data/lib/jsduck/doc/map.rb +23 -0
  24. data/lib/jsduck/doc/parser.rb +128 -0
  25. data/lib/jsduck/doc/processor.rb +52 -0
  26. data/lib/jsduck/doc/scanner.rb +76 -0
  27. data/lib/jsduck/doc/standard_tag_parser.rb +154 -0
  28. data/lib/jsduck/doc/subproperties.rb +64 -0
  29. data/lib/jsduck/docs_code_comparer.rb +31 -0
  30. data/lib/jsduck/export_writer.rb +2 -2
  31. data/lib/jsduck/exporter/app.rb +16 -4
  32. data/lib/jsduck/exporter/full.rb +2 -2
  33. data/lib/jsduck/format/batch.rb +58 -0
  34. data/lib/jsduck/format/class.rb +62 -0
  35. data/lib/jsduck/format/doc.rb +172 -0
  36. data/lib/jsduck/format/html_stack.rb +109 -0
  37. data/lib/jsduck/format/shortener.rb +55 -0
  38. data/lib/jsduck/format/subproperties.rb +64 -0
  39. data/lib/jsduck/guides.rb +32 -14
  40. data/lib/jsduck/index_html.rb +3 -1
  41. data/lib/jsduck/inline/auto_link.rb +2 -2
  42. data/lib/jsduck/inline/link.rb +4 -3
  43. data/lib/jsduck/inline/link_renderer.rb +2 -2
  44. data/lib/jsduck/inline/video.rb +8 -2
  45. data/lib/jsduck/js/ast.rb +361 -0
  46. data/lib/jsduck/js/esprima.rb +39 -0
  47. data/lib/jsduck/{esprima → js/esprima}/esprima.js +0 -0
  48. data/lib/jsduck/js/evaluator.rb +70 -0
  49. data/lib/jsduck/js/ext_patterns.rb +70 -0
  50. data/lib/jsduck/js/function.rb +206 -0
  51. data/lib/jsduck/js/node.rb +194 -0
  52. data/lib/jsduck/js/node_array.rb +36 -0
  53. data/lib/jsduck/js/parser.rb +223 -0
  54. data/lib/jsduck/js/serializer.rb +263 -0
  55. data/lib/jsduck/js/utils.rb +21 -0
  56. data/lib/jsduck/logger.rb +3 -13
  57. data/lib/jsduck/members_index.rb +3 -4
  58. data/lib/jsduck/merger.rb +25 -145
  59. data/lib/jsduck/options.rb +29 -132
  60. data/lib/jsduck/parser.rb +76 -0
  61. data/lib/jsduck/process/accessors.rb +133 -0
  62. data/lib/jsduck/process/circular_deps.rb +58 -0
  63. data/lib/jsduck/process/enums.rb +91 -0
  64. data/lib/jsduck/process/ext4_events.rb +43 -0
  65. data/lib/jsduck/process/global_members.rb +36 -0
  66. data/lib/jsduck/process/ignored_classes.rb +16 -0
  67. data/lib/jsduck/process/importer.rb +58 -0
  68. data/lib/jsduck/process/inherit_doc.rb +197 -0
  69. data/lib/jsduck/process/lint.rb +135 -0
  70. data/lib/jsduck/process/overrides.rb +99 -0
  71. data/lib/jsduck/process/return_values.rb +72 -0
  72. data/lib/jsduck/process/versions.rb +102 -0
  73. data/lib/jsduck/relations.rb +5 -0
  74. data/lib/jsduck/render/class.rb +144 -0
  75. data/lib/jsduck/render/sidebar.rb +97 -0
  76. data/lib/jsduck/render/signature.rb +94 -0
  77. data/lib/jsduck/render/subproperties.rb +99 -0
  78. data/lib/jsduck/render/tags.rb +38 -0
  79. data/lib/jsduck/search_data.rb +19 -13
  80. data/lib/jsduck/source/file.rb +8 -17
  81. data/lib/jsduck/tag/abstract.rb +4 -7
  82. data/lib/jsduck/tag/accessor.rb +10 -0
  83. data/lib/jsduck/tag/alias.rb +61 -0
  84. data/lib/jsduck/tag/alternate_class_names.rb +17 -0
  85. data/lib/jsduck/tag/aside.rb +28 -31
  86. data/lib/jsduck/tag/author.rb +9 -5
  87. data/lib/jsduck/tag/boolean_tag.rb +24 -0
  88. data/lib/jsduck/tag/cfg.rb +45 -0
  89. data/lib/jsduck/tag/chainable.rb +5 -7
  90. data/lib/jsduck/tag/class.rb +28 -0
  91. data/lib/jsduck/tag/class_list_tag.rb +40 -0
  92. data/lib/jsduck/tag/constructor.rb +24 -0
  93. data/lib/jsduck/tag/css_mixin.rb +17 -0
  94. data/lib/jsduck/tag/css_var.rb +29 -0
  95. data/lib/jsduck/tag/default.rb +31 -0
  96. data/lib/jsduck/tag/deprecated.rb +13 -27
  97. data/lib/jsduck/tag/deprecated_tag.rb +58 -0
  98. data/lib/jsduck/tag/doc.rb +32 -0
  99. data/lib/jsduck/tag/docauthor.rb +4 -5
  100. data/lib/jsduck/tag/enum.rb +70 -0
  101. data/lib/jsduck/tag/event.rb +28 -0
  102. data/lib/jsduck/tag/evented.rb +10 -0
  103. data/lib/jsduck/tag/extends.rb +45 -0
  104. data/lib/jsduck/tag/ftype.rb +18 -0
  105. data/lib/jsduck/tag/hide.rb +4 -11
  106. data/lib/jsduck/tag/ignore.rb +6 -7
  107. data/lib/jsduck/tag/inheritable.rb +10 -0
  108. data/lib/jsduck/tag/inheritdoc.rb +48 -0
  109. data/lib/jsduck/tag/markdown.rb +8 -6
  110. data/lib/jsduck/tag/member.rb +24 -0
  111. data/lib/jsduck/tag/method.rb +35 -0
  112. data/lib/jsduck/tag/mixins.rb +26 -0
  113. data/lib/jsduck/tag/name.rb +36 -0
  114. data/lib/jsduck/tag/new.rb +13 -27
  115. data/lib/jsduck/tag/override.rb +37 -0
  116. data/lib/jsduck/tag/overrides.rb +29 -0
  117. data/lib/jsduck/tag/param.rb +87 -0
  118. data/lib/jsduck/tag/preventable.rb +19 -10
  119. data/lib/jsduck/tag/private.rb +28 -13
  120. data/lib/jsduck/tag/property.rb +39 -0
  121. data/lib/jsduck/tag/protected.rb +5 -7
  122. data/lib/jsduck/tag/ptype.rb +18 -0
  123. data/lib/jsduck/tag/readonly.rb +4 -7
  124. data/lib/jsduck/tag/removed.rb +21 -29
  125. data/lib/jsduck/tag/required.rb +11 -9
  126. data/lib/jsduck/tag/requires.rb +12 -0
  127. data/lib/jsduck/tag/return.rb +47 -0
  128. data/lib/jsduck/tag/since.rb +19 -11
  129. data/lib/jsduck/tag/singleton.rb +15 -0
  130. data/lib/jsduck/tag/static.rb +5 -7
  131. data/lib/jsduck/tag/subproperties.rb +23 -0
  132. data/lib/jsduck/tag/tag.rb +208 -0
  133. data/lib/jsduck/tag/template.rb +14 -9
  134. data/lib/jsduck/tag/throws.rb +38 -0
  135. data/lib/jsduck/tag/type.rb +48 -0
  136. data/lib/jsduck/tag/uses.rb +12 -0
  137. data/lib/jsduck/tag/xtype.rb +30 -0
  138. data/lib/jsduck/tag_loader.rb +39 -0
  139. data/lib/jsduck/tag_registry.rb +189 -0
  140. data/lib/jsduck/type_parser.rb +3 -3
  141. data/lib/jsduck/web_writer.rb +2 -2
  142. data/lib/jsduck/welcome.rb +1 -1
  143. metadata +578 -538
  144. data/lib/jsduck/accessors.rb +0 -136
  145. data/lib/jsduck/ast.rb +0 -524
  146. data/lib/jsduck/auto_categories.rb +0 -80
  147. data/lib/jsduck/batch_formatter.rb +0 -60
  148. data/lib/jsduck/categories.rb +0 -73
  149. data/lib/jsduck/categories_class_name.rb +0 -37
  150. data/lib/jsduck/circular_deps.rb +0 -56
  151. data/lib/jsduck/class_formatter.rb +0 -102
  152. data/lib/jsduck/columns.rb +0 -56
  153. data/lib/jsduck/css_lexer.rb +0 -201
  154. data/lib/jsduck/css_parser.rb +0 -119
  155. data/lib/jsduck/doc_ast.rb +0 -319
  156. data/lib/jsduck/doc_formatter.rb +0 -142
  157. data/lib/jsduck/doc_parser.rb +0 -611
  158. data/lib/jsduck/doc_type.rb +0 -59
  159. data/lib/jsduck/enum.rb +0 -73
  160. data/lib/jsduck/esprima.rb +0 -51
  161. data/lib/jsduck/evaluator.rb +0 -69
  162. data/lib/jsduck/ext_patterns.rb +0 -58
  163. data/lib/jsduck/file_categories.rb +0 -76
  164. data/lib/jsduck/function_ast.rb +0 -206
  165. data/lib/jsduck/guide_anchors.rb +0 -32
  166. data/lib/jsduck/guide_toc.rb +0 -49
  167. data/lib/jsduck/html_stack.rb +0 -105
  168. data/lib/jsduck/importer.rb +0 -121
  169. data/lib/jsduck/inherit_doc.rb +0 -193
  170. data/lib/jsduck/js_parser.rb +0 -221
  171. data/lib/jsduck/lint.rb +0 -133
  172. data/lib/jsduck/meta_tag.rb +0 -88
  173. data/lib/jsduck/meta_tag_loader.rb +0 -67
  174. data/lib/jsduck/meta_tag_registry.rb +0 -111
  175. data/lib/jsduck/meta_tag_renderer.rb +0 -34
  176. data/lib/jsduck/news.rb +0 -128
  177. data/lib/jsduck/override.rb +0 -87
  178. data/lib/jsduck/renderer.rb +0 -361
  179. data/lib/jsduck/return_values.rb +0 -72
  180. data/lib/jsduck/serializer.rb +0 -262
  181. data/lib/jsduck/shortener.rb +0 -58
  182. data/lib/jsduck/signature_renderer.rb +0 -91
  183. data/lib/jsduck/source/file_parser.rb +0 -72
@@ -0,0 +1,37 @@
1
+ require "jsduck/tag/tag"
2
+ require "jsduck/js/utils"
3
+
4
+ module JsDuck::Tag
5
+ class Override < Tag
6
+ def initialize
7
+ @pattern = "override"
8
+ @tagname = :override
9
+ @ext_define_pattern = "override"
10
+ end
11
+
12
+ # @override nameOfOverride
13
+ def parse_doc(p)
14
+ if classname = p.ident_chain
15
+ {
16
+ :tagname => :override,
17
+ :override => classname,
18
+ }
19
+ else
20
+ # When @override not followed by class name, ignore the tag.
21
+ # That's because the current ext codebase has some methods
22
+ # tagged with @override to denote they override something.
23
+ # But that's not what @override is meant for in JSDuck.
24
+ nil
25
+ end
26
+ end
27
+
28
+ def process_doc(h, tags, pos)
29
+ h[:override] = tags[0][:override]
30
+ end
31
+
32
+ def parse_ext_define(cls, ast)
33
+ cls[:override] = JsDuck::Js::Utils.make_string(ast)
34
+ end
35
+
36
+ end
37
+ end
@@ -0,0 +1,29 @@
1
+ require "jsduck/tag/tag"
2
+
3
+ module JsDuck::Tag
4
+ # There is no @overrides tag. Though there is a separate @override
5
+ # tag, this class here has little to do with it.
6
+ #
7
+ # This here covers the HTML rendering of :overrides field, which
8
+ # gets added to members that override a member in their parent
9
+ # class.
10
+ class Overrides < Tag
11
+ def initialize
12
+ @tagname = :overrides
13
+ @html_position = POS_OVERRIDES
14
+ end
15
+
16
+ # Generate HTML links from :overrides data.
17
+ def format(m, formatter)
18
+ m[:overrides].each do |o|
19
+ label = o[:owner] + "." + o[:name]
20
+ o[:link] = formatter.link(o[:owner], o[:name], label, m[:tagname], m[:static])
21
+ end
22
+ end
23
+
24
+ def to_html(m)
25
+ "<p>Overrides: " + m[:overrides].map {|o| o[:link] }.join(", ") + "</p>"
26
+ end
27
+
28
+ end
29
+ end
@@ -0,0 +1,87 @@
1
+ require "jsduck/tag/tag"
2
+ require "jsduck/doc/subproperties"
3
+ require "jsduck/render/subproperties"
4
+ require "jsduck/docs_code_comparer"
5
+ require "jsduck/logger"
6
+
7
+ module JsDuck::Tag
8
+ class Param < Tag
9
+ def initialize
10
+ @pattern = "param"
11
+ @tagname = :params
12
+ @merge_context = :method_like
13
+ @html_position = POS_PARAM
14
+ end
15
+
16
+ # @param {Type} [name=default] (optional) ...
17
+ def parse_doc(p)
18
+ tag = p.standard_tag({:tagname => :params, :type => true, :name => true})
19
+ tag[:optional] = true if parse_optional(p)
20
+ tag[:doc] = :multiline
21
+ tag
22
+ end
23
+
24
+ def parse_optional(p)
25
+ p.hw.match(/\(optional\)/i)
26
+ end
27
+
28
+ def process_doc(h, tags, pos)
29
+ h[:params] = JsDuck::Doc::Subproperties.nest(tags, pos)
30
+ end
31
+
32
+ def merge(h, docs, code)
33
+ h[:params] = merge_params(docs, code, h[:files].first)
34
+ end
35
+
36
+ def format(m, formatter)
37
+ m[:params].each {|p| formatter.format_subproperty(p) }
38
+ end
39
+
40
+ def to_html(m)
41
+ JsDuck::Render::Subproperties.render_params(m[:params]) if m[:params].length > 0
42
+ end
43
+
44
+ private
45
+
46
+ def merge_params(docs, code, file)
47
+ explicit = docs[:params] || []
48
+ implicit = JsDuck::DocsCodeComparer.matches?(docs, code) ? (code[:params] || []) : []
49
+ ex_len = explicit.length
50
+ im_len = implicit.length
51
+
52
+ if ex_len == 0 || im_len == 0
53
+ # Skip
54
+ elsif ex_len < im_len
55
+ # Warn when less parameters documented than found from code.
56
+ JsDuck::Logger.warn(:param_count, "Detected #{im_len} params, but only #{ex_len} documented.", file[:filename], file[:linenr])
57
+ elsif ex_len > im_len
58
+ # Warn when more parameters documented than found from code.
59
+ JsDuck::Logger.warn(:param_count, "Detected #{im_len} params, but #{ex_len} documented.", file[:filename], file[:linenr])
60
+ elsif implicit.map {|p| p[:name] } != explicit.map {|p| p[:name] }
61
+ # Warn when parameter names don't match up.
62
+ ex_names = explicit.map {|p| p[:name] }
63
+ im_names = implicit.map {|p| p[:name] }
64
+ str = ex_names.zip(im_names).map {|p| ex, im = p; ex == im ? ex : (ex||"")+"/"+(im||"") }.join(", ")
65
+ JsDuck::Logger.warn(:param_count, "Documented and auto-detected params don't match: #{str}", file[:filename], file[:linenr])
66
+ end
67
+
68
+ # Override implicit parameters with explicit ones
69
+ # But if explicit ones exist, don't append the implicit ones.
70
+ params = []
71
+ (ex_len > 0 ? ex_len : im_len).times do |i|
72
+ im = implicit[i] || {}
73
+ ex = explicit[i] || {}
74
+ params << {
75
+ :type => ex[:type] || im[:type] || "Object",
76
+ :name => ex[:name] || im[:name] || "",
77
+ :doc => ex[:doc] || im[:doc] || "",
78
+ :optional => ex[:optional] || false,
79
+ :default => ex[:default],
80
+ :properties => ex[:properties] || [],
81
+ }
82
+ end
83
+ params
84
+ end
85
+
86
+ end
87
+ end
@@ -1,23 +1,33 @@
1
- require "jsduck/meta_tag"
1
+ require "jsduck/tag/tag"
2
2
 
3
3
  module JsDuck::Tag
4
- # Implementation of @preventable tag
5
- class Preventable < JsDuck::MetaTag
4
+ # That's pretty much a boolean tag, but we don't inherit from
5
+ # BooleanTag as unlike other boolean tags it can be followed by some
6
+ # text.
7
+ class Preventable < Tag
6
8
  def initialize
7
- @name = "preventable"
8
- @key = :preventable
9
+ @pattern = "preventable"
10
+ @tagname = :preventable
9
11
  @signature = {:long => "preventable", :short => "PREV"}
12
+ @html_position = POS_PREVENTABLE
13
+ # Use the default white box with dark gray border.
14
+ @css = ".preventable-box { text-align: center }"
10
15
  end
11
16
 
12
17
  # @preventable is optionally followed by some method name, but we
13
18
  # don't document it.
14
- def to_value(contents)
15
- true
19
+ def parse_doc(p)
20
+ p.match(/.*$/)
21
+ {:tagname => :preventable}
16
22
  end
17
23
 
18
- def to_html(v)
24
+ def process_doc(h, docs, pos)
25
+ h[:preventable] = true
26
+ end
27
+
28
+ def to_html(context)
19
29
  <<-EOHTML
20
- <div class='signature-box preventable'>
30
+ <div class='rounded-box preventable-box'>
21
31
  <p>This action following this event is <b>preventable</b>.
22
32
  When any of the listeners returns false, the action is cancelled.</p>
23
33
  </div>
@@ -25,4 +35,3 @@ module JsDuck::Tag
25
35
  end
26
36
  end
27
37
  end
28
-
@@ -1,20 +1,35 @@
1
- require "jsduck/meta_tag"
1
+ require "jsduck/tag/boolean_tag"
2
2
 
3
3
  module JsDuck::Tag
4
- # Implementation of @private tag.
5
- #
6
- # Marks class/member as private.
7
- #
8
- # Because :private is accessed a lot internally, it's also injected
9
- # to the main hash of documentation item.
10
- #
11
- class Private < JsDuck::MetaTag
4
+ class Private < BooleanTag
12
5
  def initialize
13
- @name = "private"
14
- @key = :private
15
- @boolean = true
6
+ @pattern = "private"
16
7
  @signature = {:long => "private", :short => "PRI"}
8
+ @html_position = POS_PRIVATE
9
+ @css = <<-EOCSS
10
+ .signature .private {
11
+ background-color: #FD6B1B; /* orange */
12
+ }
13
+ .private-box {
14
+ background-color: #fee;
15
+ text-align: center;
16
+ color: #600;
17
+ margin-bottom: 1em;
18
+ }
19
+ EOCSS
20
+ super
21
+ end
22
+
23
+ # Add notice to private classes
24
+ def to_html(context)
25
+ return unless context[:tagname] == :class
26
+
27
+ return [
28
+ "<div class='rounded-box private-box'>",
29
+ "<p><strong>NOTE:</strong> This is a private utility class for internal use ",
30
+ "by the framework. Don't rely on its existence.</p>",
31
+ "</div>",
32
+ ]
17
33
  end
18
34
  end
19
35
  end
20
-
@@ -0,0 +1,39 @@
1
+ require "jsduck/tag/tag"
2
+ require "jsduck/doc/subproperties"
3
+
4
+ module JsDuck::Tag
5
+ class Property < Tag
6
+ def initialize
7
+ @pattern = "property"
8
+ @tagname = :property
9
+ @member_type = {
10
+ :name => :property,
11
+ :category => :property_like,
12
+ :title => "Properties",
13
+ :position => MEMBER_POS_PROPERTY,
14
+ :subsections => [
15
+ {:title => "Instance properties", :filter => {:static => false}, :default => true},
16
+ {:title => "Static properties", :filter => {:static => true}},
17
+ ]
18
+ }
19
+ end
20
+
21
+ # @property {Type} [name=default] ...
22
+ def parse_doc(p)
23
+ tag = p.standard_tag({:tagname => :property, :type => true, :name => true})
24
+ tag[:doc] = :multiline
25
+ tag
26
+ end
27
+
28
+ def process_doc(h, tags, pos)
29
+ p = tags[0]
30
+ h[:name] = p[:name]
31
+ # Type might also come from @type, don't overwrite it with nil.
32
+ h[:type] = p[:type] if p[:type]
33
+ h[:default] = p[:default]
34
+ h[:properties] = JsDuck::Doc::Subproperties.nest(tags, pos)[0][:properties]
35
+ # Documentation after the first @property is part of the top-level docs.
36
+ h[:doc] += p[:doc]
37
+ end
38
+ end
39
+ end
@@ -1,14 +1,12 @@
1
- require "jsduck/meta_tag"
1
+ require "jsduck/tag/boolean_tag"
2
2
 
3
3
  module JsDuck::Tag
4
- # Implementation of @protected tag
5
- class Protected < JsDuck::MetaTag
4
+ class Protected < BooleanTag
6
5
  def initialize
7
- @name = "protected"
8
- @key = :protected
6
+ @pattern = "protected"
9
7
  @signature = {:long => "protected", :short => "PRO"}
10
- @boolean = true
8
+ @css = ".signature .protected { background-color: #9B86FC }" # Violet
9
+ super
11
10
  end
12
11
  end
13
12
  end
14
-
@@ -0,0 +1,18 @@
1
+ require "jsduck/tag/xtype"
2
+
3
+ module JsDuck::Tag
4
+ class Ptype < Xtype
5
+ def initialize
6
+ @pattern = "ptype"
7
+ end
8
+
9
+ # @ptype name
10
+ def parse_doc(p)
11
+ {
12
+ :tagname => :aliases,
13
+ :name => parse_alias_shorthand(p, "plugin")
14
+ }
15
+ end
16
+
17
+ end
18
+ end
@@ -1,14 +1,11 @@
1
- require "jsduck/meta_tag"
1
+ require "jsduck/tag/boolean_tag"
2
2
 
3
3
  module JsDuck::Tag
4
- # Implementation of @readonly tag
5
- class Readonly < JsDuck::MetaTag
4
+ class Readonly < BooleanTag
6
5
  def initialize
7
- @name = "readonly"
8
- @key = :readonly
6
+ @pattern = "readonly"
9
7
  @signature = {:long => "readonly", :short => "R O"}
10
- @boolean = true
8
+ super
11
9
  end
12
10
  end
13
11
  end
14
-
@@ -1,36 +1,28 @@
1
- require "jsduck/meta_tag"
1
+ require "jsduck/tag/deprecated_tag"
2
2
 
3
3
  module JsDuck::Tag
4
- # Implementation of @removed tag.
5
- #
6
4
  # To document members that were present in previous version but are
7
- # completely gone now. Other than that it behaves exactly like @deprecated.
8
- class Removed < JsDuck::MetaTag
5
+ # completely gone now. Other than that it behaves exactly like
6
+ # @deprecated.
7
+ class Removed < DeprecatedTag
9
8
  def initialize
10
- @name = "removed"
11
- @key = :removed
12
- @signature = {:long => "removed", :short => "REM"}
13
- @multiline = true
14
- end
15
-
16
- def to_value(contents)
17
- text = contents[0]
18
- if text =~ /\A([0-9.]+)(.*)\Z/
19
- {:version => $1, :text => $2.strip}
20
- else
21
- {:text => text || ""}
22
- end
23
- end
24
-
25
- def to_html(val)
26
- ver = val[:version] ? "since " + val[:version] : ""
27
- <<-EOHTML
28
- <div class='signature-box removed'>
29
- <p>This #{@context[:tagname]} has been <strong>removed</strong> #{ver}</p>
30
- #{format(val[:text])}
31
- </div>
32
- EOHTML
9
+ @tagname = :removed
10
+ # striked-through text with red border.
11
+ @css = <<-EOCSS
12
+ .signature .removed {
13
+ color: #aa0000;
14
+ background-color: transparent;
15
+ border: 1px solid #aa0000;
16
+ text-decoration: line-through;
17
+ }
18
+ .removed-box strong {
19
+ color: #aa0000;
20
+ border: 1px solid #aa0000;
21
+ background-color: transparent;
22
+ text-decoration: line-through;
23
+ }
24
+ EOCSS
25
+ super
33
26
  end
34
27
  end
35
28
  end
36
-
@@ -1,4 +1,4 @@
1
- require "jsduck/meta_tag"
1
+ require "jsduck/tag/tag"
2
2
 
3
3
  module JsDuck::Tag
4
4
  # There is no @required tag.
@@ -6,16 +6,18 @@ module JsDuck::Tag
6
6
  #
7
7
  # @cfg {Type} someName (required)
8
8
  #
9
- # This class is only used for displaying the required attribute, not
10
- # for detecting it. The detection is done with custom logic in
11
- # DocParser and Merger classes.
12
- class Required < JsDuck::MetaTag
9
+ # This class is only used for rendering the required attribute in
10
+ # HTML documentation, not for detecting it. The detection is done
11
+ # with custom logic in @cfg and DocAst classes.
12
+ class Required < Tag
13
13
  def initialize
14
- @name = "--non-matching-requried-tag--"
15
- @key = :required
14
+ @tagname = :required
16
15
  @signature = {:long => "required", :short => "REQ"}
17
- @boolean = true
16
+ @css = ".signature .required { background-color: #484848 }" # Docs text color
17
+ end
18
+
19
+ def process_doc(h, docs, pos)
20
+ h[:required] = true
18
21
  end
19
22
  end
20
23
  end
21
-