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 +4 -4
- data/Gemfile +6 -6
- data/Rakefile +21 -13
- data/lib/rdoc/any_method.rb +4 -1
- data/lib/rdoc/cross_reference.rb +28 -20
- data/lib/rdoc/generator/darkfish.rb +2 -2
- data/lib/rdoc/generator/template/darkfish/_head.rhtml +1 -3
- data/lib/rdoc/generator/template/darkfish/css/rdoc.css +20 -0
- data/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf +0 -0
- data/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf +0 -0
- data/lib/rdoc/markdown/literals.rb +7 -8
- data/lib/rdoc/markdown.kpeg +19 -1
- data/lib/rdoc/markdown.rb +457 -60
- data/lib/rdoc/markup/attr_span.rb +8 -2
- data/lib/rdoc/markup/attribute_manager.rb +93 -28
- data/lib/rdoc/markup/pre_process.rb +2 -0
- data/lib/rdoc/markup/table.rb +47 -0
- data/lib/rdoc/markup/to_html.rb +27 -0
- data/lib/rdoc/markup/to_joined_paragraph.rb +1 -0
- data/lib/rdoc/markup/to_rdoc.rb +28 -0
- data/lib/rdoc/markup/to_table_of_contents.rb +1 -0
- data/lib/rdoc/markup.rb +1 -0
- data/lib/rdoc/options.rb +63 -2
- data/lib/rdoc/parser/c.rb +21 -9
- data/lib/rdoc/parser/changelog.rb +145 -14
- data/lib/rdoc/parser/ruby.rb +18 -0
- data/lib/rdoc/rd/block_parser.rb +1 -1
- data/lib/rdoc/rd/inline_parser.rb +1 -1
- data/lib/rdoc/rdoc.rb +3 -24
- data/lib/rdoc/ri/driver.rb +11 -4
- data/lib/rdoc/rubygems_hook.rb +3 -1
- data/lib/rdoc/text.rb +12 -4
- data/lib/rdoc/version.rb +1 -1
- data/rdoc.gemspec +5 -2
- metadata +20 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6c9787594ed9d69a7a9177e449d925063acbc6ace0273f7d0b1fc9ca6a31139
|
4
|
+
data.tar.gz: 5f5afd10a18a1aeabc8319350c191eeaa137e5f715a2e95cbf2443f5dca7f96c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
7
|
-
gem
|
8
|
-
gem
|
9
|
-
gem
|
10
|
-
gem
|
11
|
-
gem
|
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
|
-
|
66
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
93
|
-
|
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
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
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
|
data/lib/rdoc/any_method.rb
CHANGED
@@ -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
|
362
|
+
matching.empty? ? nil : matching.join("\n")
|
360
363
|
end
|
361
364
|
end
|
data/lib/rdoc/cross_reference.rb
CHANGED
@@ -19,7 +19,7 @@ class RDoc::CrossReference
|
|
19
19
|
#
|
20
20
|
# See CLASS_REGEXP_STR
|
21
21
|
|
22
|
-
METHOD_REGEXP_STR = '([
|
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
|
-
|
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
|
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.
|
224
|
-
FileUtils.cp
|
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
|
-
<%-
|
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 {
|
Binary file
|
Binary file
|
@@ -174,9 +174,8 @@ class RDoc::Markdown::Literals
|
|
174
174
|
end
|
175
175
|
|
176
176
|
def scan(reg)
|
177
|
-
if m = reg.match(@string
|
178
|
-
|
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(/\
|
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(/\
|
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(/\
|
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(/\
|
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(/\
|
403
|
+
_tmp = scan(/\G(?-mix:\t|\p{Zs})/)
|
405
404
|
set_failed_rule :_Spacechar unless _tmp
|
406
405
|
return _tmp
|
407
406
|
end
|
data/lib/rdoc/markdown.kpeg
CHANGED
@@ -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 &
|
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 }
|