rdoc 7.2.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 (150) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +4 -7
  3. data/LICENSE.rdoc +4 -0
  4. data/README.md +43 -2
  5. data/RI.md +75 -75
  6. data/doc/markup_reference/markdown.md +104 -3
  7. data/exe/rdoc +2 -2
  8. data/lib/rdoc/code_object/alias.rb +70 -74
  9. data/lib/rdoc/code_object/any_method.rb +305 -298
  10. data/lib/rdoc/code_object/attr.rb +150 -143
  11. data/lib/rdoc/code_object/class_module.rb +801 -765
  12. data/lib/rdoc/code_object/constant.rb +178 -150
  13. data/lib/rdoc/code_object/context/section.rb +133 -160
  14. data/lib/rdoc/code_object/context.rb +925 -952
  15. data/lib/rdoc/code_object/extend.rb +7 -5
  16. data/lib/rdoc/code_object/include.rb +7 -5
  17. data/lib/rdoc/code_object/method_attr.rb +325 -324
  18. data/lib/rdoc/code_object/mixin.rb +97 -95
  19. data/lib/rdoc/code_object/normal_class.rb +77 -78
  20. data/lib/rdoc/code_object/normal_module.rb +61 -59
  21. data/lib/rdoc/code_object/require.rb +23 -39
  22. data/lib/rdoc/code_object/single_class.rb +21 -19
  23. data/lib/rdoc/code_object/top_level.rb +212 -213
  24. data/lib/rdoc/code_object.rb +305 -305
  25. data/lib/rdoc/comment.rb +274 -337
  26. data/lib/rdoc/cross_reference.rb +194 -212
  27. data/lib/rdoc/encoding.rb +105 -103
  28. data/lib/rdoc/erb_partial.rb +13 -11
  29. data/lib/rdoc/erbio.rb +29 -27
  30. data/lib/rdoc/generator/aliki.rb +165 -140
  31. data/lib/rdoc/generator/darkfish.rb +647 -631
  32. data/lib/rdoc/generator/json_index.rb +233 -229
  33. data/lib/rdoc/generator/markup.rb +165 -122
  34. data/lib/rdoc/generator/pot/message_extractor.rb +57 -51
  35. data/lib/rdoc/generator/pot/po.rb +52 -51
  36. data/lib/rdoc/generator/pot/po_entry.rb +138 -132
  37. data/lib/rdoc/generator/pot.rb +85 -81
  38. data/lib/rdoc/generator/ri.rb +23 -19
  39. data/lib/rdoc/generator/template/aliki/DESIGN.md +538 -0
  40. data/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +1 -1
  41. data/lib/rdoc/generator/template/aliki/_footer.rhtml +1 -1
  42. data/lib/rdoc/generator/template/aliki/_head.rhtml +11 -11
  43. data/lib/rdoc/generator/template/aliki/_header.rhtml +29 -44
  44. data/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +8 -6
  45. data/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +8 -6
  46. data/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +1 -1
  47. data/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +2 -2
  48. data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +4 -4
  49. data/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +1 -1
  50. data/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +1 -1
  51. data/lib/rdoc/generator/template/aliki/class.rhtml +56 -46
  52. data/lib/rdoc/generator/template/aliki/css/rdoc.css +538 -283
  53. data/lib/rdoc/generator/template/aliki/index.rhtml +1 -1
  54. data/lib/rdoc/generator/template/aliki/js/aliki.js +80 -102
  55. data/lib/rdoc/generator/template/aliki/page.rhtml +1 -1
  56. data/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +1 -1
  57. data/lib/rdoc/generator/template/aliki/servlet_root.rhtml +2 -2
  58. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +1 -1
  59. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +8 -6
  60. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +8 -6
  61. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +1 -1
  62. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +1 -1
  63. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +1 -1
  64. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +5 -5
  65. data/lib/rdoc/generator/template/darkfish/class.rhtml +18 -21
  66. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +0 -1
  67. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +3 -3
  68. data/lib/rdoc/generator.rb +48 -46
  69. data/lib/rdoc/i18n/locale.rb +99 -95
  70. data/lib/rdoc/i18n/text.rb +109 -105
  71. data/lib/rdoc/i18n.rb +7 -5
  72. data/lib/rdoc/markdown/byte_runtime.rb +80 -0
  73. data/lib/rdoc/markdown.kpeg +30 -21
  74. data/lib/rdoc/markdown.rb +329 -151
  75. data/lib/rdoc/markup/block_quote.rb +12 -8
  76. data/lib/rdoc/markup/document.rb +127 -123
  77. data/lib/rdoc/markup/formatter.rb +215 -221
  78. data/lib/rdoc/markup/heading.rb +1 -4
  79. data/lib/rdoc/markup/include.rb +33 -29
  80. data/lib/rdoc/markup/indented_paragraph.rb +37 -33
  81. data/lib/rdoc/markup/inline_parser.rb +281 -277
  82. data/lib/rdoc/markup/list.rb +80 -88
  83. data/lib/rdoc/markup/list_item.rb +73 -85
  84. data/lib/rdoc/markup/paragraph.rb +23 -19
  85. data/lib/rdoc/markup/parser.rb +501 -497
  86. data/lib/rdoc/markup/pre_process.rb +284 -305
  87. data/lib/rdoc/markup/raw.rb +2 -2
  88. data/lib/rdoc/markup/rule.rb +16 -12
  89. data/lib/rdoc/markup/to_ansi.rb +143 -139
  90. data/lib/rdoc/markup/to_bs.rb +72 -68
  91. data/lib/rdoc/markup/to_html.rb +600 -493
  92. data/lib/rdoc/markup/to_html_crossref.rb +221 -191
  93. data/lib/rdoc/markup/to_html_snippet.rb +232 -227
  94. data/lib/rdoc/markup/to_joined_paragraph.rb +40 -41
  95. data/lib/rdoc/markup/to_label.rb +63 -59
  96. data/lib/rdoc/markup/to_markdown.rb +212 -208
  97. data/lib/rdoc/markup/to_rdoc.rb +336 -332
  98. data/lib/rdoc/markup/to_table_of_contents.rb +66 -62
  99. data/lib/rdoc/markup/to_test.rb +60 -56
  100. data/lib/rdoc/markup/to_tt_only.rb +83 -86
  101. data/lib/rdoc/markup/verbatim.rb +62 -58
  102. data/lib/rdoc/markup.rb +198 -196
  103. data/lib/rdoc/options.rb +1063 -1076
  104. data/lib/rdoc/parser/c.rb +1039 -1036
  105. data/lib/rdoc/parser/changelog.rb +319 -315
  106. data/lib/rdoc/parser/markdown.rb +17 -13
  107. data/lib/rdoc/parser/rbs.rb +279 -0
  108. data/lib/rdoc/parser/rd.rb +17 -13
  109. data/lib/rdoc/parser/ruby.rb +1231 -2222
  110. data/lib/rdoc/parser/ruby_colorizer.rb +303 -0
  111. data/lib/rdoc/parser/simple.rb +31 -27
  112. data/lib/rdoc/parser/text.rb +12 -8
  113. data/lib/rdoc/parser.rb +230 -221
  114. data/lib/rdoc/rbs_helper.rb +186 -0
  115. data/lib/rdoc/rd/inline.rb +57 -53
  116. data/lib/rdoc/rd.rb +90 -88
  117. data/lib/rdoc/rdoc.rb +547 -366
  118. data/lib/rdoc/ri/driver.rb +1141 -1130
  119. data/lib/rdoc/ri/formatter.rb +7 -3
  120. data/lib/rdoc/ri/paths.rb +140 -136
  121. data/lib/rdoc/ri/servlet.rb +456 -0
  122. data/lib/rdoc/ri/store.rb +4 -2
  123. data/lib/rdoc/ri/task.rb +55 -51
  124. data/lib/rdoc/ri.rb +14 -11
  125. data/lib/rdoc/rubygems_hook.rb +194 -192
  126. data/lib/rdoc/server.rb +462 -0
  127. data/lib/rdoc/stats/normal.rb +46 -42
  128. data/lib/rdoc/stats/quiet.rb +39 -35
  129. data/lib/rdoc/stats/verbose.rb +35 -31
  130. data/lib/rdoc/stats.rb +363 -338
  131. data/lib/rdoc/store.rb +919 -725
  132. data/lib/rdoc/task.rb +260 -255
  133. data/lib/rdoc/text.rb +130 -245
  134. data/lib/rdoc/token_stream.rb +101 -115
  135. data/lib/rdoc/tom_doc.rb +203 -201
  136. data/lib/rdoc/version.rb +1 -1
  137. data/lib/rdoc.rb +35 -7
  138. data/lib/rubygems_plugin.rb +2 -11
  139. data/rdoc-logo.svg +43 -0
  140. data/rdoc.gemspec +6 -4
  141. metadata +36 -20
  142. data/lib/rdoc/code_object/anon_class.rb +0 -10
  143. data/lib/rdoc/code_object/ghost_method.rb +0 -6
  144. data/lib/rdoc/code_object/meta_method.rb +0 -6
  145. data/lib/rdoc/markdown/literals.kpeg +0 -21
  146. data/lib/rdoc/markdown/literals.rb +0 -454
  147. data/lib/rdoc/parser/prism_ruby.rb +0 -1112
  148. data/lib/rdoc/parser/ripper_state_lex.rb +0 -302
  149. data/lib/rdoc/parser/ruby_tools.rb +0 -163
  150. data/lib/rdoc/servlet.rb +0 -452
@@ -0,0 +1,186 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'erb'
4
+ require 'pathname'
5
+ require 'rbs'
6
+ require 'rdoc/markup/formatter'
7
+
8
+ ##
9
+ # RBS type signature support.
10
+ # Loads type information from .rbs files, validates inline annotations,
11
+ # and converts type signatures to HTML with linked type names.
12
+
13
+ module RDoc
14
+ module RbsHelper
15
+ class << self
16
+
17
+ ##
18
+ # Returns true if +sig+ is a valid RBS method type signature.
19
+
20
+ def valid_method_type?(sig)
21
+ RBS::Parser.parse_method_type(sig, require_eof: true)
22
+ true
23
+ rescue RBS::ParsingError
24
+ false
25
+ end
26
+
27
+ ##
28
+ # Returns true if +sig+ is a valid RBS type signature.
29
+
30
+ def valid_type?(sig)
31
+ RBS::Parser.parse_type(sig, require_eof: true)
32
+ true
33
+ rescue RBS::ParsingError
34
+ false
35
+ end
36
+
37
+ ##
38
+ # Loads RBS signatures from the given directories.
39
+ # Returns a Hash mapping "ClassName#method_name" => ["type sig string", ...].
40
+
41
+ def load_signatures(*dirs)
42
+ loader = RBS::EnvironmentLoader.new
43
+ dirs.each { |dir| loader.add(path: Pathname(dir)) }
44
+
45
+ env = RBS::Environment.new
46
+ loader.load(env: env)
47
+
48
+ signatures = {}
49
+
50
+ env.class_decls.each do |type_name, entry|
51
+ class_name = type_name.to_s.delete_prefix('::')
52
+
53
+ entry.each_decl do |decl|
54
+ decl.members.each do |member|
55
+ case member
56
+ when RBS::AST::Members::MethodDefinition
57
+ sigs = member.overloads.map { |o| o.method_type.to_s }
58
+ method_keys_for(class_name, member).each do |key|
59
+ signatures[key] ||= sigs
60
+ end
61
+ when RBS::AST::Members::AttrReader, RBS::AST::Members::AttrWriter, RBS::AST::Members::AttrAccessor
62
+ key = member.kind == :singleton ? "#{class_name}.#{member.name}" : "#{class_name}##{member.name}"
63
+ signatures[key] ||= [member.type.to_s]
64
+ end
65
+ end
66
+ end
67
+ end
68
+
69
+ signatures
70
+ end
71
+
72
+ ##
73
+ # Converts type signature lines to HTML with type names linked to
74
+ # their documentation pages. Uses the RBS parser to extract type
75
+ # name locations precisely.
76
+ #
77
+ # +lines+ is an Array of signature line strings.
78
+ # +lookup+ is a Hash mapping type names to their doc paths.
79
+ # +from_path+ is the current page path for generating relative URLs.
80
+ #
81
+ # Returns escaped HTML with +->+ replaced by +→+.
82
+
83
+ def signature_to_html(lines, lookup:, from_path:)
84
+ lines.map { |line|
85
+ link_type_names_in_line(line, lookup, from_path).gsub('-&gt;', '&rarr;')
86
+ }.join("\n")
87
+ end
88
+
89
+ private
90
+
91
+ # `def self?.foo: ...` produces a member whose kind is :singleton_instance —
92
+ # it defines both Class.foo (singleton) and a private Class#foo (instance),
93
+ # so we need to register the signature under both keys.
94
+ def method_keys_for(class_name, member)
95
+ case member.kind
96
+ when :singleton
97
+ ["#{class_name}.#{member.name}"]
98
+ when :singleton_instance
99
+ ["#{class_name}.#{member.name}", "#{class_name}##{member.name}"]
100
+ else
101
+ ["#{class_name}##{member.name}"]
102
+ end
103
+ end
104
+
105
+ def link_type_names_in_line(line, lookup, from_path)
106
+ escaped = ERB::Util.html_escape(line)
107
+
108
+ locs = collect_type_name_locations(line)
109
+ return escaped if locs.empty?
110
+
111
+ result = escaped.dup
112
+
113
+ # Replace type names with links, working backwards to preserve positions.
114
+ # HTML escaping (e.g. -> becomes -&gt;) shifts positions, so we
115
+ # re-escape the prefix to find the correct offset in the result.
116
+ locs.sort_by { |l| -l[:start] }.each do |loc|
117
+ name = loc[:name]
118
+ next unless (target_path = lookup[name])
119
+
120
+ prefix = ERB::Util.html_escape(line[0...loc[:start]])
121
+ escaped_name = ERB::Util.html_escape(name)
122
+ start_in_escaped = prefix.length
123
+ end_in_escaped = start_in_escaped + escaped_name.length
124
+
125
+ href = ERB::Util.html_escape(Markup::Formatter.gen_relative_url(from_path, target_path))
126
+ result[start_in_escaped...end_in_escaped] =
127
+ "<a href=\"#{href}\" class=\"rbs-type\">#{escaped_name}</a>"
128
+ end
129
+
130
+ result
131
+ end
132
+
133
+ ##
134
+ # Extracts type name locations from a signature line using the RBS parser.
135
+
136
+ def collect_type_name_locations(line)
137
+ locs = []
138
+
139
+ begin
140
+ mt = RBS::Parser.parse_method_type(line, require_eof: true)
141
+ rescue RBS::ParsingError
142
+ begin
143
+ type = RBS::Parser.parse_type(line, require_eof: true)
144
+ collect_from_type(type, locs)
145
+ return locs
146
+ rescue RBS::ParsingError
147
+ return locs
148
+ end
149
+ end
150
+
151
+ mt.type.each_param { |p| collect_from_type(p.type, locs) }
152
+ if mt.block
153
+ mt.block.type.each_param { |p| collect_from_type(p.type, locs) }
154
+ collect_from_type(mt.block.type.return_type, locs)
155
+ end
156
+ collect_from_type(mt.type.return_type, locs)
157
+
158
+ locs
159
+ end
160
+
161
+ ##
162
+ # Recursively collects type name locations from an RBS type AST node.
163
+
164
+ def collect_from_type(type, locs)
165
+ case type
166
+ when RBS::Types::ClassInstance
167
+ name = type.name.to_s.delete_prefix('::')
168
+ if type.location
169
+ name_loc = type.location[:name] || type.location
170
+ locs << { name: name, start: name_loc.end_pos - name.length }
171
+ end
172
+ type.args.each { |a| collect_from_type(a, locs) }
173
+ when RBS::Types::Union, RBS::Types::Intersection, RBS::Types::Tuple
174
+ type.types.each { |t| collect_from_type(t, locs) }
175
+ when RBS::Types::Optional
176
+ collect_from_type(type.type, locs)
177
+ when RBS::Types::Record
178
+ type.all_fields.each_value { |t| collect_from_type(t, locs) }
179
+ when RBS::Types::Proc
180
+ type.type.each_param { |p| collect_from_type(p.type, locs) }
181
+ collect_from_type(type.type.return_type, locs)
182
+ end
183
+ end
184
+ end
185
+ end
186
+ end
@@ -1,71 +1,75 @@
1
1
  # frozen_string_literal: true
2
- ##
3
- # Inline keeps track of markup and labels to create proper links.
2
+ module RDoc
3
+ class RD
4
+ ##
5
+ # Inline keeps track of markup and labels to create proper links.
4
6
 
5
- class RDoc::RD::Inline
7
+ class Inline
6
8
 
7
- ##
8
- # The text of the reference
9
+ ##
10
+ # The text of the reference
9
11
 
10
- attr_reader :reference
12
+ attr_reader :reference
11
13
 
12
- ##
13
- # The markup of this reference in RDoc format
14
+ ##
15
+ # The markup of this reference in RDoc format
14
16
 
15
- attr_reader :rdoc
17
+ attr_reader :rdoc
16
18
 
17
- ##
18
- # Creates a new Inline for +rdoc+ and +reference+.
19
- #
20
- # +rdoc+ may be another Inline or a String. If +reference+ is not given it
21
- # will use the text from +rdoc+.
19
+ ##
20
+ # Creates a new Inline for +rdoc+ and +reference+.
21
+ #
22
+ # +rdoc+ may be another Inline or a String. If +reference+ is not given it
23
+ # will use the text from +rdoc+.
22
24
 
23
- def self.new(rdoc, reference = rdoc)
24
- if self === rdoc and reference.equal? rdoc then
25
- rdoc
26
- else
27
- super
28
- end
29
- end
25
+ def self.new(rdoc, reference = rdoc)
26
+ if self === rdoc and reference.equal? rdoc
27
+ rdoc
28
+ else
29
+ super
30
+ end
31
+ end
30
32
 
31
- ##
32
- # Initializes the Inline with +rdoc+ and +inline+
33
+ ##
34
+ # Initializes the Inline with +rdoc+ and +inline+
33
35
 
34
- def initialize(rdoc, reference) # :not-new:
35
- @reference = reference.equal?(rdoc) ? reference.dup : reference
36
+ def initialize(rdoc, reference) # :not-new:
37
+ @reference = reference.equal?(rdoc) ? reference.dup : reference
36
38
 
37
- # unpack
38
- @reference = @reference.reference if self.class === @reference
39
- @rdoc = rdoc
40
- end
39
+ # unpack
40
+ @reference = @reference.reference if self.class === @reference
41
+ @rdoc = rdoc
42
+ end
41
43
 
42
- def ==(other) # :nodoc:
43
- self.class === other and
44
- @reference == other.reference and @rdoc == other.rdoc
45
- end
44
+ def ==(other) # :nodoc:
45
+ self.class === other and
46
+ @reference == other.reference and @rdoc == other.rdoc
47
+ end
46
48
 
47
- ##
48
- # Appends +more+ to this inline. +more+ may be a String or another Inline.
49
-
50
- def append(more)
51
- case more
52
- when String then
53
- @reference += more
54
- @rdoc += more
55
- when RDoc::RD::Inline then
56
- @reference += more.reference
57
- @rdoc += more.rdoc
58
- else
59
- raise "unknown thingy #{more}"
60
- end
49
+ ##
50
+ # Appends +more+ to this inline. +more+ may be a String or another Inline.
61
51
 
62
- self
63
- end
52
+ def append(more)
53
+ case more
54
+ when String
55
+ @reference += more
56
+ @rdoc += more
57
+ when RD::Inline
58
+ @reference += more.reference
59
+ @rdoc += more.rdoc
60
+ else
61
+ raise "unknown thingy #{more}"
62
+ end
64
63
 
65
- def inspect # :nodoc:
66
- "(inline: #{self})"
67
- end
64
+ self
65
+ end
66
+
67
+ def inspect # :nodoc:
68
+ "(inline: #{self})"
69
+ end
68
70
 
69
- alias to_s rdoc # :nodoc:
71
+ alias to_s rdoc # :nodoc:
70
72
 
73
+ end
74
+ end
71
75
  end
data/lib/rdoc/rd.rb CHANGED
@@ -1,99 +1,101 @@
1
1
  # frozen_string_literal: true
2
- ##
3
- # RDoc::RD implements the RD format from the rdtool gem.
4
- #
5
- # To choose RD as your only default format see
6
- # RDoc::Options@Saved+Options for instructions on setting up a
7
- # <code>.doc_options</code> file to store your project default.
8
- #
9
- # == LICENSE
10
- #
11
- # The grammar that produces RDoc::RD::BlockParser and RDoc::RD::InlineParser
12
- # is included in RDoc under the Ruby License.
13
- #
14
- # You can find the original source for rdtool at
15
- # https://github.com/uwabami/rdtool/
16
- #
17
- # You can use, re-distribute or change these files under Ruby's License or GPL.
18
- #
19
- # 1. You may make and give away verbatim copies of the source form of the
20
- # software without restriction, provided that you duplicate all of the
21
- # original copyright notices and associated disclaimers.
22
- #
23
- # 2. You may modify your copy of the software in any way, provided that
24
- # you do at least ONE of the following:
25
- #
26
- # a. place your modifications in the Public Domain or otherwise
27
- # make them Freely Available, such as by posting said
28
- # modifications to Usenet or an equivalent medium, or by allowing
29
- # the author to include your modifications in the software.
30
- #
31
- # b. use the modified software only within your corporation or
32
- # organization.
33
- #
34
- # c. give non-standard binaries non-standard names, with
35
- # instructions on where to get the original software distribution.
36
- #
37
- # d. make other distribution arrangements with the author.
38
- #
39
- # 3. You may distribute the software in object code or binary form,
40
- # provided that you do at least ONE of the following:
41
- #
42
- # a. distribute the binaries and library files of the software,
43
- # together with instructions (in the manual page or equivalent)
44
- # on where to get the original distribution.
45
- #
46
- # b. accompany the distribution with the machine-readable source of
47
- # the software.
48
- #
49
- # c. give non-standard binaries non-standard names, with
50
- # instructions on where to get the original software distribution.
51
- #
52
- # d. make other distribution arrangements with the author.
53
- #
54
- # 4. You may modify and include the part of the software into any other
55
- # software (possibly commercial). But some files in the distribution
56
- # are not written by the author, so that they are not under these terms.
57
- #
58
- # For the list of those files and their copying conditions, see the
59
- # file LEGAL.
60
- #
61
- # 5. The scripts and library files supplied as input to or produced as
62
- # output from the software do not automatically fall under the
63
- # copyright of the software, but belong to whomever generated them,
64
- # and may be sold commercially, and may be aggregated with this
65
- # software.
66
- #
67
- # 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
68
- # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
69
- # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
70
- # PURPOSE.
2
+ module RDoc
3
+ ##
4
+ # RDoc::RD implements the RD format from the rdtool gem.
5
+ #
6
+ # To choose RD as your only default format see
7
+ # RDoc::Options@Saved+Options for instructions on setting up a
8
+ # <code>.doc_options</code> file to store your project default.
9
+ #
10
+ # == LICENSE
11
+ #
12
+ # The grammar that produces RDoc::RD::BlockParser and RDoc::RD::InlineParser
13
+ # is included in RDoc under the Ruby License.
14
+ #
15
+ # You can find the original source for rdtool at
16
+ # https://github.com/uwabami/rdtool/
17
+ #
18
+ # You can use, re-distribute or change these files under Ruby's License or GPL.
19
+ #
20
+ # 1. You may make and give away verbatim copies of the source form of the
21
+ # software without restriction, provided that you duplicate all of the
22
+ # original copyright notices and associated disclaimers.
23
+ #
24
+ # 2. You may modify your copy of the software in any way, provided that
25
+ # you do at least ONE of the following:
26
+ #
27
+ # a. place your modifications in the Public Domain or otherwise
28
+ # make them Freely Available, such as by posting said
29
+ # modifications to Usenet or an equivalent medium, or by allowing
30
+ # the author to include your modifications in the software.
31
+ #
32
+ # b. use the modified software only within your corporation or
33
+ # organization.
34
+ #
35
+ # c. give non-standard binaries non-standard names, with
36
+ # instructions on where to get the original software distribution.
37
+ #
38
+ # d. make other distribution arrangements with the author.
39
+ #
40
+ # 3. You may distribute the software in object code or binary form,
41
+ # provided that you do at least ONE of the following:
42
+ #
43
+ # a. distribute the binaries and library files of the software,
44
+ # together with instructions (in the manual page or equivalent)
45
+ # on where to get the original distribution.
46
+ #
47
+ # b. accompany the distribution with the machine-readable source of
48
+ # the software.
49
+ #
50
+ # c. give non-standard binaries non-standard names, with
51
+ # instructions on where to get the original software distribution.
52
+ #
53
+ # d. make other distribution arrangements with the author.
54
+ #
55
+ # 4. You may modify and include the part of the software into any other
56
+ # software (possibly commercial). But some files in the distribution
57
+ # are not written by the author, so that they are not under these terms.
58
+ #
59
+ # For the list of those files and their copying conditions, see the
60
+ # file LEGAL.
61
+ #
62
+ # 5. The scripts and library files supplied as input to or produced as
63
+ # output from the software do not automatically fall under the
64
+ # copyright of the software, but belong to whomever generated them,
65
+ # and may be sold commercially, and may be aggregated with this
66
+ # software.
67
+ #
68
+ # 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
69
+ # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
70
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
71
+ # PURPOSE.
71
72
 
72
- class RDoc::RD
73
+ class RD
73
74
 
74
- ##
75
- # Parses +rd+ source and returns an RDoc::Markup::Document. If the
76
- # <tt>=begin</tt> or <tt>=end</tt> lines are missing they will be added.
75
+ ##
76
+ # Parses +rd+ source and returns an RDoc::Markup::Document. If the
77
+ # <tt>=begin</tt> or <tt>=end</tt> lines are missing they will be added.
77
78
 
78
- def self.parse(rd)
79
- rd = rd.lines.to_a
79
+ def self.parse(rd)
80
+ rd = rd.lines.to_a
80
81
 
81
- if rd.find { |i| /\S/ === i } and !rd.find{|i| /^=begin\b/ === i } then
82
- rd.unshift("=begin\n").push("=end\n")
83
- end
82
+ if rd.find { |i| /\S/ === i } and !rd.find{|i| /^=begin\b/ === i }
83
+ rd.unshift("=begin\n").push("=end\n")
84
+ end
84
85
 
85
- parser = RDoc::RD::BlockParser.new
86
- document = parser.parse rd
86
+ parser = RD::BlockParser.new
87
+ document = parser.parse rd
87
88
 
88
- # isn't this always true?
89
- document.parts.shift if RDoc::Markup::BlankLine === document.parts.first
90
- document.parts.pop if RDoc::Markup::BlankLine === document.parts.last
89
+ # isn't this always true?
90
+ document.parts.shift if Markup::BlankLine === document.parts.first
91
+ document.parts.pop if Markup::BlankLine === document.parts.last
91
92
 
92
- document
93
- end
93
+ document
94
+ end
94
95
 
95
- autoload :BlockParser, "#{__dir__}/rd/block_parser"
96
- autoload :InlineParser, "#{__dir__}/rd/inline_parser"
97
- autoload :Inline, "#{__dir__}/rd/inline"
96
+ autoload :BlockParser, "#{__dir__}/rd/block_parser"
97
+ autoload :InlineParser, "#{__dir__}/rd/inline_parser"
98
+ autoload :Inline, "#{__dir__}/rd/inline"
98
99
 
100
+ end
99
101
  end