rdoc 6.3.0 → 6.4.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rdoc might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 18741ef6dd2db34af2ea15a9e8a154a760c1f01bb0d69d15dc3af3f70cc00d7c
4
- data.tar.gz: e61ab91ee4b0e776dd36e934da0534e6d52aa259ddff18be057955e109db08b4
3
+ metadata.gz: d6c9787594ed9d69a7a9177e449d925063acbc6ace0273f7d0b1fc9ca6a31139
4
+ data.tar.gz: 5f5afd10a18a1aeabc8319350c191eeaa137e5f715a2e95cbf2443f5dca7f96c
5
5
  SHA512:
6
- metadata.gz: 9ea75c4b0339de23f73f84c890b23cb0b7bacb87ea191258f54160a28a4519c0e8edfbf6bc17ef67e631d923b17cb2030f79048d269b032eefe8b92f62fdb9df
7
- data.tar.gz: bdbf42dea5706d0b13ce653a8591ff9fc0ece11b4d49c18e7d32bd725e901a3dd2e5feb3479b4185a874d12e024e7f77b6324592405a9b826efd00bb68589373
6
+ metadata.gz: 94fbc007d81c0cc1774b44d5f174b5e011ef5ae3d998344b981a8b6170f1c630c3c80e45f87bcc4c05f97f51e34e9f3ede791846e0c01e4015c45cc8aab1b05e
7
+ data.tar.gz: '068da922a56b61ca85fa7b61d5554cdbe1533c30caae11e7d81894e41fca58157971c18a76c55391538324c168a720c2cbbc8150a12dc276eab033e70fae0217'
data/Gemfile CHANGED
@@ -3,10 +3,10 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  group :development do
6
- gem "rake"
7
- gem "racc", "> 1.4.10"
8
- gem "kpeg"
9
- gem "test-unit"
10
- gem "minitest" # for test_rdoc_rubygems_hook.rb
11
- gem "rubocop"
6
+ gem 'rake'
7
+ gem 'racc', '> 1.4.10'
8
+ gem 'kpeg', github: 'evanphx/kpeg'
9
+ gem 'test-unit'
10
+ gem 'rubocop'
11
+ gem 'gettext'
12
12
  end
data/Rakefile CHANGED
@@ -2,7 +2,6 @@ $:.unshift File.expand_path 'lib'
2
2
  require 'rdoc/task'
3
3
  require 'bundler/gem_tasks'
4
4
  require 'rake/testtask'
5
- require 'rubocop/rake_task'
6
5
 
7
6
  task :docs => :generate
8
7
  task :test => [:normal_test, :rubygems_test]
@@ -62,13 +61,13 @@ package_parser_files = PARSER_FILES.map do |parser_file|
62
61
  end
63
62
 
64
63
  parsed_files = PARSER_FILES.map do |parser_file|
65
- name = File.basename(parser_file, File.extname(parser_file))
66
- _path = File.dirname(parser_file)
67
- parsed_file = "#{_path}/#{name}.rb"
64
+ ext = File.extname(parser_file)
65
+ parsed_file = "#{parser_file.chomp(ext)}.rb"
68
66
 
69
- file parsed_file do |t|
67
+ file parsed_file => parser_file do |t|
70
68
  puts "Generating #{parsed_file}..."
71
- if parser_file =~ /\.ry\z/ # need racc
69
+ case ext
70
+ when '.ry' # need racc
72
71
  racc = Gem.bin_path 'racc', 'racc'
73
72
  rb_file = parser_file.gsub(/\.ry\z/, ".rb")
74
73
  ruby "#{racc} -l -o #{rb_file} #{parser_file}"
@@ -77,7 +76,7 @@ parsed_files = PARSER_FILES.map do |parser_file|
77
76
  f.rewind
78
77
  f.write newtext
79
78
  end
80
- elsif parser_file =~ /\.kpeg\z/ # need kpeg
79
+ when '.kpeg' # need kpeg
81
80
  kpeg = Gem.bin_path 'kpeg', 'kpeg'
82
81
  rb_file = parser_file.gsub(/\.kpeg\z/, ".rb")
83
82
  ruby "#{kpeg} -fsv -o #{rb_file} #{parser_file}"
@@ -88,12 +87,21 @@ parsed_files = PARSER_FILES.map do |parser_file|
88
87
  end
89
88
 
90
89
  task "#{path}.gem" => package_parser_files
90
+ desc "Generate all files used racc and kpeg"
91
+ task :generate => parsed_files
91
92
 
92
- RuboCop::RakeTask.new(:rubocop) do |t|
93
- t.options = [*parsed_files]
93
+ task :clean do
94
+ parsed_files.each do |path|
95
+ File.delete(path) if File.exist?(path)
96
+ end
94
97
  end
95
98
 
96
- desc "Genrate all files used racc and kpeg"
97
- task :generate => parsed_files
98
-
99
- task :build => [:generate, "rubocop:auto_correct"]
99
+ begin
100
+ require 'rubocop/rake_task'
101
+ rescue LoadError
102
+ else
103
+ RuboCop::RakeTask.new(:rubocop) do |t|
104
+ t.options = [*parsed_files]
105
+ end
106
+ task :build => [:generate, "rubocop:auto_correct"]
107
+ end
@@ -26,6 +26,9 @@ class RDoc::AnyMethod < RDoc::MethodAttr
26
26
 
27
27
  attr_accessor :c_function
28
28
 
29
+ # The section title of the method (if defined in a C file via +:category:+)
30
+ attr_accessor :section_title
31
+
29
32
  # Parameters for this method
30
33
 
31
34
  attr_accessor :params
@@ -356,6 +359,6 @@ class RDoc::AnyMethod < RDoc::MethodAttr
356
359
  entry =~ /\s#{ignore}\s/
357
360
  end
358
361
 
359
- matching.join "\n"
362
+ matching.empty? ? nil : matching.join("\n")
360
363
  end
361
364
  end
@@ -19,7 +19,7 @@ class RDoc::CrossReference
19
19
  #
20
20
  # See CLASS_REGEXP_STR
21
21
 
22
- METHOD_REGEXP_STR = '([a-z]\w*[!?=]?|%|===|\[\]=?|<<|>>|\+@|-@|-|\+|\*)(?:\([\w.+*/=<>-]*\))?'
22
+ METHOD_REGEXP_STR = '([A-Za-z]\w*[!?=]?|%|===?|\[\]=?|<<|>>|\+@|-@|-|\+|\*)(?:\([\w.+*/=<>-]*\))?'
23
23
 
24
24
  ##
25
25
  # Regular expressions matching text that should potentially have
@@ -34,12 +34,6 @@ class RDoc::CrossReference
34
34
  # A::B::C.meth
35
35
  #{CLASS_REGEXP_STR}(?:[.#]|::)#{METHOD_REGEXP_STR}
36
36
 
37
- # Stand-alone method (preceded by a #)
38
- | \\?\##{METHOD_REGEXP_STR}
39
-
40
- # Stand-alone method (preceded by ::)
41
- | ::#{METHOD_REGEXP_STR}
42
-
43
37
  # A::B::C
44
38
  # The stuff after CLASS_REGEXP_STR is a
45
39
  # nasty hack. CLASS_REGEXP_STR unfortunately matches
@@ -56,6 +50,12 @@ class RDoc::CrossReference
56
50
  # marker.
57
51
  | #{CLASS_REGEXP_STR}(?=[@\s).?!,;<\000]|\z)
58
52
 
53
+ # Stand-alone method (preceded by a #)
54
+ | \\?\##{METHOD_REGEXP_STR}
55
+
56
+ # Stand-alone method (preceded by ::)
57
+ | ::#{METHOD_REGEXP_STR}
58
+
59
59
  # Things that look like filenames
60
60
  # The key thing is that there must be at least
61
61
  # one special character (period, slash, or
@@ -82,12 +82,12 @@ class RDoc::CrossReference
82
82
  # A::B::C.meth
83
83
  #{CLASS_REGEXP_STR}(?:[.#]|::)#{METHOD_REGEXP_STR}
84
84
 
85
- # Stand-alone method
86
- | \\?#{METHOD_REGEXP_STR}
87
-
88
85
  # A::B::C
89
86
  | #{CLASS_REGEXP_STR}(?=[@\s).?!,;<\000]|\z)
90
87
 
88
+ # Stand-alone method
89
+ | \\?#{METHOD_REGEXP_STR}
90
+
91
91
  # Things that look like filenames
92
92
  | (?:\.\.\/)*[-\/\w]+[_\/.][-\w\/.]+
93
93
 
@@ -115,15 +115,8 @@ class RDoc::CrossReference
115
115
  @seen = {}
116
116
  end
117
117
 
118
- ##
119
- # Returns a reference to +name+.
120
- #
121
- # If the reference is found and +name+ is not documented +text+ will be
122
- # returned. If +name+ is escaped +name+ is returned. If +name+ is not
123
- # found +text+ is returned.
124
-
125
- def resolve name, text
126
- return @seen[name] if @seen.include? name
118
+ def resolve_method name
119
+ ref = nil
127
120
 
128
121
  if /#{CLASS_REGEXP_STR}([.#]|::)#{METHOD_REGEXP_STR}/o =~ name then
129
122
  type = $2
@@ -165,12 +158,27 @@ class RDoc::CrossReference
165
158
  end
166
159
  end
167
160
 
161
+ ref
162
+ end
163
+
164
+ ##
165
+ # Returns a reference to +name+.
166
+ #
167
+ # If the reference is found and +name+ is not documented +text+ will be
168
+ # returned. If +name+ is escaped +name+ is returned. If +name+ is not
169
+ # found +text+ is returned.
170
+
171
+ def resolve name, text
172
+ return @seen[name] if @seen.include? name
173
+
168
174
  ref = case name
169
175
  when /^\\(#{CLASS_REGEXP_STR})$/o then
170
176
  @context.find_symbol $1
171
177
  else
172
178
  @context.find_symbol name
173
- end unless ref
179
+ end
180
+
181
+ ref = resolve_method name unless ref
174
182
 
175
183
  # Try a page name
176
184
  ref = @store.page name if not ref and name =~ /^[\w.]+$/
@@ -220,8 +220,8 @@ class RDoc::Generator::Darkfish
220
220
  install_rdoc_static_file @template_dir + item, "./#{item}", options
221
221
  end
222
222
 
223
- @options.template_stylesheets.each do |stylesheet|
224
- FileUtils.cp stylesheet, '.', options
223
+ unless @options.template_stylesheets.empty?
224
+ FileUtils.cp @options.template_stylesheets, '.', **options
225
225
  end
226
226
 
227
227
  Dir[(@template_dir + "{js,images}/**/*").to_s].each do |path|
@@ -15,8 +15,6 @@
15
15
 
16
16
  <link href="<%= asset_rel_prefix %>/css/fonts.css" rel="stylesheet">
17
17
  <link href="<%= asset_rel_prefix %>/css/rdoc.css" rel="stylesheet">
18
- <%- if @options.template_stylesheets.flatten.any? then -%>
19
- <%- @options.template_stylesheets.flatten.each do |stylesheet| -%>
18
+ <%- @options.template_stylesheets.each do |stylesheet| -%>
20
19
  <link href="<%= asset_rel_prefix %>/<%= File.basename stylesheet %>" rel="stylesheet">
21
- <%- end -%>
22
20
  <%- end -%>
@@ -79,6 +79,25 @@ pre {
79
79
  border-radius: 0.2em;
80
80
  }
81
81
 
82
+ table {
83
+ margin: 0;
84
+ border-spacing: 0;
85
+ border-collapse: collapse;
86
+ }
87
+
88
+ table tr th, table tr td {
89
+ padding: 0.2em 0.4em;
90
+ border: 1px solid #ccc;
91
+ }
92
+
93
+ table tr th {
94
+ background-color: #eceaed;
95
+ }
96
+
97
+ table tr:nth-child(even) td {
98
+ background-color: #f5f4f6;
99
+ }
100
+
82
101
  /* @group Generic Classes */
83
102
 
84
103
  .initially-hidden {
@@ -166,6 +185,7 @@ nav {
166
185
  width: 260px;
167
186
  font-family: Helvetica, sans-serif;
168
187
  font-size: 14px;
188
+ border-right: 1px solid #ccc;
169
189
  }
170
190
 
171
191
  main {
@@ -174,9 +174,8 @@ class RDoc::Markdown::Literals
174
174
  end
175
175
 
176
176
  def scan(reg)
177
- if m = reg.match(@string[@pos..-1])
178
- width = m.end(0)
179
- @pos += width
177
+ if m = reg.match(@string, @pos)
178
+ @pos = m.end(0)
180
179
  return true
181
180
  end
182
181
 
@@ -366,14 +365,14 @@ class RDoc::Markdown::Literals
366
365
 
367
366
  # Alphanumeric = /\p{Word}/
368
367
  def _Alphanumeric
369
- _tmp = scan(/\A(?-mix:\p{Word})/)
368
+ _tmp = scan(/\G(?-mix:\p{Word})/)
370
369
  set_failed_rule :_Alphanumeric unless _tmp
371
370
  return _tmp
372
371
  end
373
372
 
374
373
  # AlphanumericAscii = /[A-Za-z0-9]/
375
374
  def _AlphanumericAscii
376
- _tmp = scan(/\A(?-mix:[A-Za-z0-9])/)
375
+ _tmp = scan(/\G(?-mix:[A-Za-z0-9])/)
377
376
  set_failed_rule :_AlphanumericAscii unless _tmp
378
377
  return _tmp
379
378
  end
@@ -387,21 +386,21 @@ class RDoc::Markdown::Literals
387
386
 
388
387
  # Newline = /\n|\r\n?|\p{Zl}|\p{Zp}/
389
388
  def _Newline
390
- _tmp = scan(/\A(?-mix:\n|\r\n?|\p{Zl}|\p{Zp})/)
389
+ _tmp = scan(/\G(?-mix:\n|\r\n?|\p{Zl}|\p{Zp})/)
391
390
  set_failed_rule :_Newline unless _tmp
392
391
  return _tmp
393
392
  end
394
393
 
395
394
  # NonAlphanumeric = /\p{^Word}/
396
395
  def _NonAlphanumeric
397
- _tmp = scan(/\A(?-mix:\p{^Word})/)
396
+ _tmp = scan(/\G(?-mix:\p{^Word})/)
398
397
  set_failed_rule :_NonAlphanumeric unless _tmp
399
398
  return _tmp
400
399
  end
401
400
 
402
401
  # Spacechar = /\t|\p{Zs}/
403
402
  def _Spacechar
404
- _tmp = scan(/\A(?-mix:\t|\p{Zs})/)
403
+ _tmp = scan(/\G(?-mix:\t|\p{Zs})/)
405
404
  set_failed_rule :_Spacechar unless _tmp
406
405
  return _tmp
407
406
  end
@@ -506,6 +506,7 @@ Block = @BlankLine*
506
506
  ( BlockQuote
507
507
  | Verbatim
508
508
  | CodeFence
509
+ | Table
509
510
  | Note
510
511
  | Reference
511
512
  | HorizontalRule
@@ -896,7 +897,8 @@ StyleBlock = < InStyleTags >
896
897
  end }
897
898
 
898
899
  Inlines = ( !@Endline Inline:i { i }
899
- | @Endline:c &Inline { c } )+:chunks @Endline?
900
+ | @Endline:c !( &{ github? } Ticks3 /[^`\n]*$/ )
901
+ &Inline { c } )+:chunks @Endline?
900
902
  { chunks }
901
903
 
902
904
  Inline = Str
@@ -1195,6 +1197,22 @@ CodeFence = &{ github? }
1195
1197
  verbatim
1196
1198
  }
1197
1199
 
1200
+ Table = &{ github? }
1201
+ TableRow:header TableLine:line TableRow+:body
1202
+ { table = RDoc::Markup::Table.new(header, line, body) }
1203
+
1204
+ TableRow = TableItem+:row "|" @Newline
1205
+ { row }
1206
+ TableItem = "|" < (!"|" !@Newline .)+ >
1207
+ { text.strip }
1208
+
1209
+ TableLine = TableColumn+:line "|" @Newline
1210
+ { line }
1211
+ TableColumn = "|" < ( "-"+ ":"? | ":" "-"* ) >
1212
+ { text.start_with?(":") ? :left :
1213
+ text.end_with?(":") ? :right : nil
1214
+ }
1215
+
1198
1216
  DefinitionList = &{ definition_lists? }
1199
1217
  ( DefinitionListItem+:list )
1200
1218
  { RDoc::Markup::List.new :NOTE, *list.flatten }