rdoc 8.0.0 → 8.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +1 -3
  3. data/RI.md +75 -75
  4. data/exe/rdoc +2 -2
  5. data/lib/rdoc/code_object/alias.rb +71 -69
  6. data/lib/rdoc/code_object/any_method.rb +305 -303
  7. data/lib/rdoc/code_object/attr.rb +150 -148
  8. data/lib/rdoc/code_object/class_module.rb +798 -792
  9. data/lib/rdoc/code_object/constant.rb +175 -173
  10. data/lib/rdoc/code_object/context/section.rb +142 -138
  11. data/lib/rdoc/code_object/context.rb +926 -958
  12. data/lib/rdoc/code_object/extend.rb +7 -5
  13. data/lib/rdoc/code_object/include.rb +7 -5
  14. data/lib/rdoc/code_object/method_attr.rb +326 -319
  15. data/lib/rdoc/code_object/mixin.rb +97 -95
  16. data/lib/rdoc/code_object/normal_class.rb +77 -78
  17. data/lib/rdoc/code_object/normal_module.rb +61 -59
  18. data/lib/rdoc/code_object/require.rb +23 -39
  19. data/lib/rdoc/code_object/single_class.rb +21 -19
  20. data/lib/rdoc/code_object/top_level.rb +212 -219
  21. data/lib/rdoc/code_object.rb +305 -303
  22. data/lib/rdoc/comment.rb +275 -273
  23. data/lib/rdoc/cross_reference.rb +192 -190
  24. data/lib/rdoc/encoding.rb +105 -103
  25. data/lib/rdoc/erb_partial.rb +13 -11
  26. data/lib/rdoc/erbio.rb +29 -27
  27. data/lib/rdoc/generator/aliki.rb +161 -153
  28. data/lib/rdoc/generator/darkfish.rb +645 -635
  29. data/lib/rdoc/generator/json_index.rb +233 -229
  30. data/lib/rdoc/generator/markup.rb +164 -146
  31. data/lib/rdoc/generator/pot/message_extractor.rb +57 -51
  32. data/lib/rdoc/generator/pot/po.rb +52 -51
  33. data/lib/rdoc/generator/pot/po_entry.rb +138 -132
  34. data/lib/rdoc/generator/pot.rb +85 -81
  35. data/lib/rdoc/generator/ri.rb +23 -19
  36. data/lib/rdoc/generator/template/aliki/DESIGN.md +6 -4
  37. data/lib/rdoc/generator/template/aliki/_footer.rhtml +1 -1
  38. data/lib/rdoc/generator/template/aliki/_head.rhtml +10 -10
  39. data/lib/rdoc/generator/template/aliki/_header.rhtml +29 -44
  40. data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +4 -4
  41. data/lib/rdoc/generator/template/aliki/css/rdoc.css +207 -178
  42. data/lib/rdoc/generator/template/aliki/js/aliki.js +60 -84
  43. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +1 -1
  44. data/lib/rdoc/generator.rb +48 -46
  45. data/lib/rdoc/i18n/locale.rb +99 -95
  46. data/lib/rdoc/i18n/text.rb +109 -105
  47. data/lib/rdoc/i18n.rb +7 -5
  48. data/lib/rdoc/markdown/byte_runtime.rb +80 -0
  49. data/lib/rdoc/markdown.kpeg +15 -11
  50. data/lib/rdoc/markdown.rb +40 -47
  51. data/lib/rdoc/markup/block_quote.rb +12 -8
  52. data/lib/rdoc/markup/document.rb +127 -123
  53. data/lib/rdoc/markup/formatter.rb +219 -215
  54. data/lib/rdoc/markup/include.rb +33 -29
  55. data/lib/rdoc/markup/indented_paragraph.rb +37 -33
  56. data/lib/rdoc/markup/inline_parser.rb +281 -277
  57. data/lib/rdoc/markup/list.rb +80 -88
  58. data/lib/rdoc/markup/list_item.rb +73 -85
  59. data/lib/rdoc/markup/paragraph.rb +23 -19
  60. data/lib/rdoc/markup/parser.rb +501 -497
  61. data/lib/rdoc/markup/pre_process.rb +283 -279
  62. data/lib/rdoc/markup/raw.rb +2 -2
  63. data/lib/rdoc/markup/rule.rb +16 -12
  64. data/lib/rdoc/markup/to_ansi.rb +143 -139
  65. data/lib/rdoc/markup/to_bs.rb +72 -68
  66. data/lib/rdoc/markup/to_html.rb +594 -565
  67. data/lib/rdoc/markup/to_html_crossref.rb +234 -230
  68. data/lib/rdoc/markup/to_html_snippet.rb +232 -227
  69. data/lib/rdoc/markup/to_joined_paragraph.rb +36 -32
  70. data/lib/rdoc/markup/to_label.rb +63 -59
  71. data/lib/rdoc/markup/to_markdown.rb +212 -208
  72. data/lib/rdoc/markup/to_rdoc.rb +336 -332
  73. data/lib/rdoc/markup/to_table_of_contents.rb +66 -62
  74. data/lib/rdoc/markup/to_test.rb +60 -56
  75. data/lib/rdoc/markup/to_tt_only.rb +84 -80
  76. data/lib/rdoc/markup/verbatim.rb +62 -58
  77. data/lib/rdoc/markup.rb +198 -196
  78. data/lib/rdoc/options.rb +1063 -1061
  79. data/lib/rdoc/parser/c.rb +1039 -1037
  80. data/lib/rdoc/parser/changelog.rb +319 -315
  81. data/lib/rdoc/parser/markdown.rb +17 -13
  82. data/lib/rdoc/parser/rbs.rb +239 -235
  83. data/lib/rdoc/parser/rd.rb +17 -13
  84. data/lib/rdoc/parser/ruby.rb +1245 -1124
  85. data/lib/rdoc/parser/ruby_colorizer.rb +263 -213
  86. data/lib/rdoc/parser/simple.rb +31 -27
  87. data/lib/rdoc/parser/text.rb +12 -8
  88. data/lib/rdoc/parser.rb +228 -220
  89. data/lib/rdoc/rbs_helper.rb +1 -1
  90. data/lib/rdoc/rd/inline.rb +57 -53
  91. data/lib/rdoc/rd.rb +90 -88
  92. data/lib/rdoc/rdoc.rb +500 -491
  93. data/lib/rdoc/ri/driver.rb +1140 -1135
  94. data/lib/rdoc/ri/formatter.rb +7 -3
  95. data/lib/rdoc/ri/paths.rb +140 -136
  96. data/lib/rdoc/ri/servlet.rb +354 -350
  97. data/lib/rdoc/ri/store.rb +4 -2
  98. data/lib/rdoc/ri/task.rb +55 -51
  99. data/lib/rdoc/ri.rb +14 -12
  100. data/lib/rdoc/rubygems_hook.rb +183 -181
  101. data/lib/rdoc/server.rb +349 -347
  102. data/lib/rdoc/stats/normal.rb +46 -42
  103. data/lib/rdoc/stats/quiet.rb +39 -35
  104. data/lib/rdoc/stats/verbose.rb +35 -31
  105. data/lib/rdoc/stats.rb +365 -363
  106. data/lib/rdoc/store.rb +888 -902
  107. data/lib/rdoc/task.rb +260 -256
  108. data/lib/rdoc/text.rb +135 -133
  109. data/lib/rdoc/token_stream.rb +101 -93
  110. data/lib/rdoc/tom_doc.rb +203 -201
  111. data/lib/rdoc/version.rb +1 -1
  112. metadata +4 -5
  113. data/lib/rdoc/markdown/literals.kpeg +0 -21
  114. data/lib/rdoc/markdown/literals.rb +0 -454
@@ -1,101 +1,93 @@
1
1
  # frozen_string_literal: true
2
- ##
3
- # A List is a homogeneous set of ListItems.
4
- #
5
- # The supported list types include:
6
- #
7
- # :BULLET::
8
- # An unordered list
9
- # :LABEL::
10
- # An unordered definition list, but using an alternate RDoc::Markup syntax
11
- # :LALPHA::
12
- # An ordered list using increasing lowercase English letters
13
- # :NOTE::
14
- # An unordered definition list
15
- # :NUMBER::
16
- # An ordered list using increasing Arabic numerals
17
- # :UALPHA::
18
- # An ordered list using increasing uppercase English letters
19
- #
20
- # Definition lists behave like HTML definition lists. Each list item can
21
- # describe multiple terms. See RDoc::Markup::ListItem for how labels and
22
- # definition are stored as list items.
23
2
 
24
- class RDoc::Markup::List
25
-
26
- ##
27
- # The list's type
28
-
29
- attr_accessor :type
30
-
31
- ##
32
- # Items in the list
33
-
34
- attr_reader :items
35
-
36
- ##
37
- # Creates a new list of +type+ with +items+. Valid list types are:
38
- # +:BULLET+, +:LABEL+, +:LALPHA+, +:NOTE+, +:NUMBER+, +:UALPHA+
39
-
40
- def initialize(type = nil, *items)
41
- @type = type
42
- @items = []
43
- @items.concat items
44
- end
45
-
46
- ##
47
- # Appends +item+ to the list
48
-
49
- def <<(item)
50
- @items << item
51
- end
52
-
53
- def ==(other) # :nodoc:
54
- self.class == other.class and
55
- @type == other.type and
56
- @items == other.items
57
- end
58
-
59
- ##
60
- # Runs this list and all its #items through +visitor+
61
-
62
- def accept(visitor)
63
- visitor.accept_list_start self
3
+ module RDoc
4
+ class Markup
5
+ # A List is a homogeneous set of ListItems.
6
+ #
7
+ # The supported list types include:
8
+ #
9
+ # :BULLET::
10
+ # An unordered list
11
+ # :LABEL::
12
+ # An unordered definition list, but using an alternate RDoc::Markup syntax
13
+ # :LALPHA::
14
+ # An ordered list using increasing lowercase English letters
15
+ # :NOTE::
16
+ # An unordered definition list
17
+ # :NUMBER::
18
+ # An ordered list using increasing Arabic numerals
19
+ # :UALPHA::
20
+ # An ordered list using increasing uppercase English letters
21
+ #
22
+ # Definition lists behave like HTML definition lists. Each list item can
23
+ # describe multiple terms. See RDoc::Markup::ListItem for how labels and
24
+ # definitions are stored as list items.
25
+ class List < Element
26
+ # The list's type
27
+ #: Symbol?
28
+ attr_accessor :type
29
+
30
+ # Items in the list
31
+ #: Array[ListItem]
32
+ attr_reader :items
33
+
34
+ # Creates a new list of +type+ with +items+. Valid list types are:
35
+ # +:BULLET+, +:LABEL+, +:LALPHA+, +:NOTE+, +:NUMBER+, +:UALPHA+
36
+ #: (Symbol?, *ListItem) -> void
37
+ def initialize(type = nil, *items)
38
+ @type = type
39
+ @items = items
40
+ end
64
41
 
65
- @items.each do |item|
66
- item.accept visitor
67
- end
42
+ # Appends +item+ to the list
43
+ #: (ListItem) -> void
44
+ def <<(item)
45
+ @items << item
46
+ end
68
47
 
69
- visitor.accept_list_end self
70
- end
48
+ #: (top) -> bool
49
+ def ==(other) # :nodoc:
50
+ self.class == other.class &&
51
+ @type == other.type &&
52
+ @items == other.items
53
+ end
71
54
 
72
- ##
73
- # Is the list empty?
55
+ # Runs this list and all its #items through +visitor+
56
+ # @override
57
+ #: (untyped) -> void
58
+ def accept(visitor)
59
+ visitor.accept_list_start(self)
60
+ @items.each { |item| item.accept(visitor) }
61
+ visitor.accept_list_end(self)
62
+ end
74
63
 
75
- def empty?
76
- @items.empty?
77
- end
64
+ # Is the list empty?
65
+ #: () -> bool
66
+ def empty?
67
+ @items.empty?
68
+ end
78
69
 
79
- ##
80
- # Returns the last item in the list
70
+ # Returns the last item in the list
71
+ #: () -> ListItem?
72
+ def last
73
+ @items.last
74
+ end
81
75
 
82
- def last
83
- @items.last
84
- end
76
+ # @override
77
+ #: (PP) -> void
78
+ def pretty_print(q) # :nodoc:
79
+ q.group(2, "[list: #{@type} ", ']') do
80
+ q.seplist(@items) do |item|
81
+ q.pp(item)
82
+ end
83
+ end
84
+ end
85
85
 
86
- def pretty_print(q) # :nodoc:
87
- q.group 2, "[list: #{@type} ", ']' do
88
- q.seplist @items do |item|
89
- q.pp item
86
+ # Appends +items+ to the list
87
+ #: (*ListItem) -> void
88
+ def push(*items)
89
+ @items.concat(items)
90
90
  end
91
91
  end
92
92
  end
93
-
94
- ##
95
- # Appends +items+ to the list
96
-
97
- def push(*items)
98
- @items.concat items
99
- end
100
-
101
93
  end
@@ -1,99 +1,87 @@
1
1
  # frozen_string_literal: true
2
- ##
3
- # An item within a List that contains paragraphs, headings, etc.
4
- #
5
- # For BULLET, NUMBER, LALPHA and UALPHA lists, the label will always be nil.
6
- # For NOTE and LABEL lists, the list label may contain:
7
- #
8
- # * a single String for a single label
9
- # * an Array of Strings for a list item with multiple terms
10
- # * nil for an extra description attached to a previously labeled list item
11
2
 
12
- class RDoc::Markup::ListItem
13
-
14
- ##
15
- # The label for the ListItem
16
-
17
- attr_accessor :label
18
-
19
- ##
20
- # Parts of the ListItem
21
-
22
- attr_reader :parts
23
-
24
- ##
25
- # Creates a new ListItem with an optional +label+ containing +parts+
26
-
27
- def initialize(label = nil, *parts)
28
- @label = label
29
- @parts = []
30
- @parts.concat parts
31
- end
32
-
33
- ##
34
- # Appends +part+ to the ListItem
35
-
36
- def <<(part)
37
- @parts << part
38
- end
39
-
40
- def ==(other) # :nodoc:
41
- self.class == other.class and
42
- @label == other.label and
43
- @parts == other.parts
44
- end
45
-
46
- ##
47
- # Runs this list item and all its #parts through +visitor+
48
-
49
- def accept(visitor)
50
- visitor.accept_list_item_start self
51
-
52
- @parts.each do |part|
53
- part.accept visitor
54
- end
3
+ module RDoc
4
+ class Markup
5
+ # An item within a List that contains paragraphs, headings, etc.
6
+ #
7
+ # For BULLET, NUMBER, LALPHA and UALPHA lists, the label will always be nil.
8
+ # For NOTE and LABEL lists, the list label may contain:
9
+ #
10
+ # * a single String for a single label
11
+ # * an Array of Strings for a list item with multiple terms
12
+ # * nil for an extra description attached to a previously labeled list item
13
+ class ListItem < Element
14
+ # The label for the ListItem
15
+ #: (Array[String] | String)?
16
+ attr_accessor :label
17
+
18
+ # Parts of the ListItem
19
+ #: Array[untyped]
20
+ attr_reader :parts
21
+
22
+ # Creates a new ListItem with an optional +label+ containing +parts+
23
+ #: ((Array[String] | String)?, *untyped) -> void
24
+ def initialize(label = nil, *parts)
25
+ @label = label
26
+ @parts = parts
27
+ end
55
28
 
56
- visitor.accept_list_item_end self
57
- end
29
+ # Appends +part+ to the ListItem
30
+ #: (untyped) -> void
31
+ def <<(part)
32
+ @parts << part
33
+ end
58
34
 
59
- ##
60
- # Is the ListItem empty?
35
+ #: (top) -> bool
36
+ def ==(other) # :nodoc:
37
+ self.class == other.class &&
38
+ @label == other.label &&
39
+ @parts == other.parts
40
+ end
61
41
 
62
- def empty?
63
- @parts.empty?
64
- end
42
+ # Runs this list item and all its #parts through +visitor+
43
+ # @override
44
+ #: (untyped) -> void
45
+ def accept(visitor)
46
+ visitor.accept_list_item_start(self)
47
+ @parts.each { |part| part.accept(visitor) }
48
+ visitor.accept_list_item_end(self)
49
+ end
65
50
 
66
- ##
67
- # Length of parts in the ListItem
51
+ # Is the ListItem empty?
52
+ #: () -> bool
53
+ def empty?
54
+ @parts.empty?
55
+ end
68
56
 
69
- def length
70
- @parts.length
71
- end
57
+ # Length of parts in the ListItem
58
+ #: () -> Integer
59
+ def length
60
+ @parts.length
61
+ end
72
62
 
73
- def pretty_print(q) # :nodoc:
74
- q.group 2, '[item: ', ']' do
75
- case @label
76
- when Array then
77
- q.pp @label
78
- q.text ';'
79
- q.breakable
80
- when String then
81
- q.pp @label
82
- q.text ';'
83
- q.breakable
63
+ # @override
64
+ #: (PP) -> void
65
+ def pretty_print(q) # :nodoc:
66
+ q.group(2, '[item: ', ']') do
67
+ case @label
68
+ when Array, String
69
+ q.pp(@label)
70
+ q.text(';')
71
+ q.breakable
72
+ end
73
+
74
+ q.seplist(@parts) do |part|
75
+ q.pp(part)
76
+ end
77
+ end
84
78
  end
85
79
 
86
- q.seplist @parts do |part|
87
- q.pp part
80
+ # Adds +parts+ to the ListItem
81
+ #: (*untyped) -> void
82
+ def push(*parts)
83
+ @parts.concat(parts)
88
84
  end
89
85
  end
90
86
  end
91
-
92
- ##
93
- # Adds +parts+ to the ListItem
94
-
95
- def push(*parts)
96
- @parts.concat parts
97
- end
98
-
99
87
  end
@@ -1,28 +1,32 @@
1
1
  # frozen_string_literal: true
2
- ##
3
- # A Paragraph of text
2
+ module RDoc
3
+ class Markup
4
+ ##
5
+ # A Paragraph of text
4
6
 
5
- class RDoc::Markup::Paragraph < RDoc::Markup::Raw
7
+ class Paragraph < Markup::Raw
6
8
 
7
- ##
8
- # Calls #accept_paragraph on +visitor+
9
+ ##
10
+ # Calls #accept_paragraph on +visitor+
9
11
 
10
- def accept(visitor)
11
- visitor.accept_paragraph self
12
- end
12
+ def accept(visitor)
13
+ visitor.accept_paragraph self
14
+ end
13
15
 
14
- ##
15
- # Joins the raw paragraph text and converts inline HardBreaks to the
16
- # +hard_break+ text.
16
+ ##
17
+ # Joins the raw paragraph text and converts inline HardBreaks to the
18
+ # +hard_break+ text.
17
19
 
18
- def text(hard_break = '')
19
- @parts.map do |part|
20
- if RDoc::Markup::HardBreak === part then
21
- hard_break
22
- else
23
- part
20
+ def text(hard_break = '')
21
+ @parts.map do |part|
22
+ if Markup::HardBreak === part
23
+ hard_break
24
+ else
25
+ part
26
+ end
27
+ end.join
24
28
  end
25
- end.join
26
- end
27
29
 
30
+ end
31
+ end
28
32
  end