rdoc 6.5.0 → 6.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +2 -2
- data/TODO.rdoc +1 -1
- data/lib/rdoc/alias.rb +0 -1
- data/lib/rdoc/anon_class.rb +0 -1
- data/lib/rdoc/any_method.rb +15 -0
- data/lib/rdoc/attr.rb +0 -1
- data/lib/rdoc/class_module.rb +0 -1
- data/lib/rdoc/comment.rb +20 -41
- data/lib/rdoc/constant.rb +0 -1
- data/lib/rdoc/context/section.rb +0 -1
- data/lib/rdoc/cross_reference.rb +0 -1
- data/lib/rdoc/encoding.rb +1 -6
- data/lib/rdoc/erb_partial.rb +0 -1
- data/lib/rdoc/erbio.rb +2 -7
- data/lib/rdoc/extend.rb +0 -1
- data/lib/rdoc/generator/darkfish.rb +2 -6
- data/lib/rdoc/generator/json_index.rb +2 -2
- data/lib/rdoc/generator/markup.rb +0 -1
- data/lib/rdoc/generator/ri.rb +0 -1
- data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/class.rhtml +6 -0
- data/lib/rdoc/generator/template/darkfish/css/rdoc.css +38 -13
- data/lib/rdoc/generator/template/darkfish/js/darkfish.js +13 -0
- data/lib/rdoc/generator/template/darkfish/js/search.js +3 -3
- data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +5 -4
- data/lib/rdoc/generator/template/json_index/js/navigation.js +8 -8
- data/lib/rdoc/ghost_method.rb +0 -1
- data/lib/rdoc/include.rb +0 -1
- data/lib/rdoc/markdown/entities.rb +0 -1
- data/lib/rdoc/markdown/literals.rb +66 -43
- data/lib/rdoc/markdown.kpeg +1 -1
- data/lib/rdoc/markdown.rb +3 -1
- data/lib/rdoc/markup/attr_changer.rb +0 -1
- data/lib/rdoc/markup/attr_span.rb +0 -1
- data/lib/rdoc/markup/attribute_manager.rb +11 -12
- data/lib/rdoc/markup/attributes.rb +0 -1
- data/lib/rdoc/markup/blank_line.rb +0 -1
- data/lib/rdoc/markup/block_quote.rb +0 -1
- data/lib/rdoc/markup/document.rb +0 -1
- data/lib/rdoc/markup/formatter.rb +1 -2
- data/lib/rdoc/markup/hard_break.rb +0 -1
- data/lib/rdoc/markup/heading.rb +0 -1
- data/lib/rdoc/markup/include.rb +0 -1
- data/lib/rdoc/markup/indented_paragraph.rb +0 -1
- data/lib/rdoc/markup/list.rb +0 -1
- data/lib/rdoc/markup/list_item.rb +0 -1
- data/lib/rdoc/markup/paragraph.rb +0 -1
- data/lib/rdoc/markup/parser.rb +1 -1
- data/lib/rdoc/markup/raw.rb +0 -1
- data/lib/rdoc/markup/regexp_handling.rb +0 -1
- data/lib/rdoc/markup/rule.rb +0 -1
- data/lib/rdoc/markup/to_ansi.rb +0 -1
- data/lib/rdoc/markup/to_html.rb +6 -3
- data/lib/rdoc/markup/to_html_crossref.rb +0 -1
- data/lib/rdoc/markup/to_html_snippet.rb +0 -1
- data/lib/rdoc/markup/to_joined_paragraph.rb +2 -3
- data/lib/rdoc/markup/to_label.rb +0 -1
- data/lib/rdoc/markup/to_markdown.rb +0 -1
- data/lib/rdoc/markup/to_rdoc.rb +0 -1
- data/lib/rdoc/markup/to_table_of_contents.rb +0 -1
- data/lib/rdoc/markup/to_test.rb +0 -1
- data/lib/rdoc/markup/to_tt_only.rb +0 -1
- data/lib/rdoc/markup/verbatim.rb +0 -1
- data/lib/rdoc/meta_method.rb +0 -1
- data/lib/rdoc/method_attr.rb +0 -1
- data/lib/rdoc/mixin.rb +0 -1
- data/lib/rdoc/normal_class.rb +0 -1
- data/lib/rdoc/normal_module.rb +0 -1
- data/lib/rdoc/options.rb +3 -2
- data/lib/rdoc/parser/changelog.rb +0 -1
- data/lib/rdoc/parser/markdown.rb +0 -2
- data/lib/rdoc/parser/rd.rb +0 -1
- data/lib/rdoc/parser/ripper_state_lex.rb +1 -1
- data/lib/rdoc/parser/ruby.rb +4 -4
- data/lib/rdoc/parser/ruby_tools.rb +0 -2
- data/lib/rdoc/parser/text.rb +0 -1
- data/lib/rdoc/rd/block_parser.rb +654 -4
- data/lib/rdoc/rd/block_parser.ry +1 -1
- data/lib/rdoc/rd/inline.rb +0 -1
- data/lib/rdoc/rd/inline_parser.rb +653 -3
- data/lib/rdoc/rdoc.rb +2 -4
- data/lib/rdoc/require.rb +0 -1
- data/lib/rdoc/ri/driver.rb +9 -8
- data/lib/rdoc/ri/store.rb +0 -1
- data/lib/rdoc/single_class.rb +0 -1
- data/lib/rdoc/stats/quiet.rb +0 -1
- data/lib/rdoc/stats/verbose.rb +0 -2
- data/lib/rdoc/task.rb +28 -2
- data/lib/rdoc/text.rb +6 -0
- data/lib/rdoc/token_stream.rb +1 -2
- data/lib/rdoc/top_level.rb +0 -1
- data/lib/rdoc/version.rb +1 -1
- metadata +8 -5
@@ -39,45 +39,75 @@ class RDoc::Markdown::Literals
|
|
39
39
|
attr_accessor :result, :pos
|
40
40
|
|
41
41
|
def current_column(target=pos)
|
42
|
-
if c = string.rindex("\n", target-1)
|
43
|
-
return target - c
|
42
|
+
if string[target] == "\n" && (c = string.rindex("\n", target-1) || -1)
|
43
|
+
return target - c
|
44
|
+
elsif c = string.rindex("\n", target)
|
45
|
+
return target - c
|
44
46
|
end
|
45
47
|
|
46
48
|
target + 1
|
47
49
|
end
|
48
50
|
|
51
|
+
def position_line_offsets
|
52
|
+
unless @position_line_offsets
|
53
|
+
@position_line_offsets = []
|
54
|
+
total = 0
|
55
|
+
string.each_line do |line|
|
56
|
+
total += line.size
|
57
|
+
@position_line_offsets << total
|
58
|
+
end
|
59
|
+
end
|
60
|
+
@position_line_offsets
|
61
|
+
end
|
62
|
+
|
49
63
|
if [].respond_to? :bsearch_index
|
50
64
|
def current_line(target=pos)
|
51
|
-
|
52
|
-
|
53
|
-
total = 0
|
54
|
-
string.each_line do |line|
|
55
|
-
total += line.size
|
56
|
-
@line_offsets << total
|
57
|
-
end
|
65
|
+
if line = position_line_offsets.bsearch_index {|x| x > target }
|
66
|
+
return line + 1
|
58
67
|
end
|
59
|
-
|
60
|
-
@line_offsets.bsearch_index {|x| x >= target } + 1 || -1
|
68
|
+
raise "Target position #{target} is outside of string"
|
61
69
|
end
|
62
70
|
else
|
63
71
|
def current_line(target=pos)
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
string.each_line do |line|
|
68
|
-
cur_line += 1
|
69
|
-
cur_offset += line.size
|
70
|
-
return cur_line if cur_offset >= target
|
72
|
+
if line = position_line_offsets.index {|x| x > target }
|
73
|
+
return line + 1
|
71
74
|
end
|
72
75
|
|
73
|
-
|
76
|
+
raise "Target position #{target} is outside of string"
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def current_character(target=pos)
|
81
|
+
if target < 0 || target >= string.size
|
82
|
+
raise "Target position #{target} is outside of string"
|
74
83
|
end
|
84
|
+
string[target, 1]
|
85
|
+
end
|
86
|
+
|
87
|
+
KpegPosInfo = Struct.new(:pos, :lno, :col, :line, :char)
|
88
|
+
|
89
|
+
def current_pos_info(target=pos)
|
90
|
+
l = current_line target
|
91
|
+
c = current_column target
|
92
|
+
ln = get_line(l-1)
|
93
|
+
chr = string[target,1]
|
94
|
+
KpegPosInfo.new(target, l, c, ln, chr)
|
75
95
|
end
|
76
96
|
|
77
97
|
def lines
|
78
|
-
lines
|
79
|
-
|
80
|
-
|
98
|
+
string.lines
|
99
|
+
end
|
100
|
+
|
101
|
+
def get_line(no)
|
102
|
+
loff = position_line_offsets
|
103
|
+
if no < 0
|
104
|
+
raise "Line No is out of range: #{no} < 0"
|
105
|
+
elsif no >= loff.size
|
106
|
+
raise "Line No is out of range: #{no} >= #{loff.size}"
|
107
|
+
end
|
108
|
+
lend = loff[no]-1
|
109
|
+
lstart = no > 0 ? loff[no-1] : 0
|
110
|
+
string[lstart..lend]
|
81
111
|
end
|
82
112
|
|
83
113
|
|
@@ -91,6 +121,7 @@ class RDoc::Markdown::Literals
|
|
91
121
|
@string = string
|
92
122
|
@string_size = string ? string.size : 0
|
93
123
|
@pos = pos
|
124
|
+
@position_line_offsets = nil
|
94
125
|
end
|
95
126
|
|
96
127
|
def show_pos
|
@@ -115,30 +146,22 @@ class RDoc::Markdown::Literals
|
|
115
146
|
end
|
116
147
|
|
117
148
|
def failure_caret
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
line = lines[l-1]
|
122
|
-
"#{line}\n#{' ' * (c - 1)}^"
|
149
|
+
p = current_pos_info @failing_rule_offset
|
150
|
+
"#{p.line.chomp}\n#{' ' * (p.col - 1)}^"
|
123
151
|
end
|
124
152
|
|
125
153
|
def failure_character
|
126
|
-
|
127
|
-
c = current_column @failing_rule_offset
|
128
|
-
lines[l-1][c-1, 1]
|
154
|
+
current_character @failing_rule_offset
|
129
155
|
end
|
130
156
|
|
131
157
|
def failure_oneline
|
132
|
-
|
133
|
-
c = current_column @failing_rule_offset
|
134
|
-
|
135
|
-
char = lines[l-1][c-1, 1]
|
158
|
+
p = current_pos_info @failing_rule_offset
|
136
159
|
|
137
160
|
if @failed_rule.kind_of? Symbol
|
138
161
|
info = self.class::Rules[@failed_rule]
|
139
|
-
"@#{
|
162
|
+
"@#{p.lno}:#{p.col} failed rule '#{info.name}', got '#{p.char}'"
|
140
163
|
else
|
141
|
-
"@#{
|
164
|
+
"@#{p.lno}:#{p.col} failed rule '#{@failed_rule}', got '#{p.char}'"
|
142
165
|
end
|
143
166
|
end
|
144
167
|
|
@@ -151,10 +174,9 @@ class RDoc::Markdown::Literals
|
|
151
174
|
|
152
175
|
def show_error(io=STDOUT)
|
153
176
|
error_pos = @failing_rule_offset
|
154
|
-
|
155
|
-
col_no = current_column(error_pos)
|
177
|
+
p = current_pos_info(error_pos)
|
156
178
|
|
157
|
-
io.puts "On line #{
|
179
|
+
io.puts "On line #{p.lno}, column #{p.col}:"
|
158
180
|
|
159
181
|
if @failed_rule.kind_of? Symbol
|
160
182
|
info = self.class::Rules[@failed_rule]
|
@@ -163,10 +185,9 @@ class RDoc::Markdown::Literals
|
|
163
185
|
io.puts "Failed to match rule '#{@failed_rule}'"
|
164
186
|
end
|
165
187
|
|
166
|
-
io.puts "Got: #{
|
167
|
-
|
168
|
-
io.
|
169
|
-
io.print(" " * (col_no + 3))
|
188
|
+
io.puts "Got: #{p.char.inspect}"
|
189
|
+
io.puts "=> #{p.line}"
|
190
|
+
io.print(" " * (p.col + 2))
|
170
191
|
io.puts "^"
|
171
192
|
end
|
172
193
|
|
@@ -275,6 +296,7 @@ class RDoc::Markdown::Literals
|
|
275
296
|
end
|
276
297
|
|
277
298
|
def apply_with_args(rule, *args)
|
299
|
+
@result = nil
|
278
300
|
memo_key = [rule, args]
|
279
301
|
if m = @memoizations[memo_key][@pos]
|
280
302
|
@pos = m.pos
|
@@ -308,6 +330,7 @@ class RDoc::Markdown::Literals
|
|
308
330
|
end
|
309
331
|
|
310
332
|
def apply(rule)
|
333
|
+
@result = nil
|
311
334
|
if m = @memoizations[rule][@pos]
|
312
335
|
@pos = m.pos
|
313
336
|
if !m.set
|
data/lib/rdoc/markdown.kpeg
CHANGED
@@ -178,7 +178,7 @@
|
|
178
178
|
# [dingus]: http://daringfireball.net/projects/markdown/dingus
|
179
179
|
# [GFM]: https://github.github.com/gfm/
|
180
180
|
# [pegmarkdown]: https://github.com/jgm/peg-markdown
|
181
|
-
# [PHPE]:
|
181
|
+
# [PHPE]: https://michelf.ca/projects/php-markdown/extra/#def-list
|
182
182
|
# [syntax]: http://daringfireball.net/projects/markdown/syntax
|
183
183
|
#--
|
184
184
|
# Last updated to jgm/peg-markdown commit 8f8fc22ef0
|
data/lib/rdoc/markdown.rb
CHANGED
@@ -175,7 +175,7 @@
|
|
175
175
|
# [dingus]: http://daringfireball.net/projects/markdown/dingus
|
176
176
|
# [GFM]: https://github.github.com/gfm/
|
177
177
|
# [pegmarkdown]: https://github.com/jgm/peg-markdown
|
178
|
-
# [PHPE]:
|
178
|
+
# [PHPE]: https://michelf.ca/projects/php-markdown/extra/#def-list
|
179
179
|
# [syntax]: http://daringfireball.net/projects/markdown/syntax
|
180
180
|
#--
|
181
181
|
# Last updated to jgm/peg-markdown commit 8f8fc22ef0
|
@@ -466,6 +466,7 @@ class RDoc::Markdown
|
|
466
466
|
end
|
467
467
|
|
468
468
|
def apply_with_args(rule, *args)
|
469
|
+
@result = nil
|
469
470
|
memo_key = [rule, args]
|
470
471
|
if m = @memoizations[memo_key][@pos]
|
471
472
|
@pos = m.pos
|
@@ -499,6 +500,7 @@ class RDoc::Markdown
|
|
499
500
|
end
|
500
501
|
|
501
502
|
def apply(rule)
|
503
|
+
@result = nil
|
502
504
|
if m = @memoizations[rule][@pos]
|
503
505
|
@pos = m.pos
|
504
506
|
if !m.set
|
@@ -1,19 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
##
|
3
4
|
# Manages changes of attributes in a block of text
|
4
5
|
|
5
|
-
unless MatchData.method_defined?(:match_length)
|
6
|
-
using Module.new {
|
7
|
-
refine(MatchData) {
|
8
|
-
def match_length(nth)
|
9
|
-
b, e = offset(nth)
|
10
|
-
e - b if b
|
11
|
-
end
|
12
|
-
}
|
13
|
-
}
|
14
|
-
end
|
15
|
-
|
16
6
|
class RDoc::Markup::AttributeManager
|
7
|
+
unless ::MatchData.method_defined?(:match_length)
|
8
|
+
using ::Module.new {
|
9
|
+
refine(::MatchData) {
|
10
|
+
def match_length(nth) # :nodoc:
|
11
|
+
b, e = offset(nth)
|
12
|
+
e - b if b
|
13
|
+
end
|
14
|
+
}
|
15
|
+
}
|
16
|
+
end
|
17
17
|
|
18
18
|
##
|
19
19
|
# The NUL character
|
@@ -400,4 +400,3 @@ class RDoc::Markup::AttributeManager
|
|
400
400
|
end
|
401
401
|
|
402
402
|
end
|
403
|
-
|
data/lib/rdoc/markup/document.rb
CHANGED
@@ -90,7 +90,7 @@ class RDoc::Markup::Formatter
|
|
90
90
|
|
91
91
|
def add_regexp_handling_TIDYLINK
|
92
92
|
@markup.add_regexp_handling(/(?:
|
93
|
-
\{
|
93
|
+
\{[^{}]*\} | # multi-word label
|
94
94
|
\b[^\s{}]+? # single-word label
|
95
95
|
)
|
96
96
|
|
@@ -263,4 +263,3 @@ class RDoc::Markup::Formatter
|
|
263
263
|
end
|
264
264
|
|
265
265
|
end
|
266
|
-
|
data/lib/rdoc/markup/heading.rb
CHANGED
data/lib/rdoc/markup/include.rb
CHANGED
data/lib/rdoc/markup/list.rb
CHANGED
data/lib/rdoc/markup/parser.rb
CHANGED
data/lib/rdoc/markup/raw.rb
CHANGED
data/lib/rdoc/markup/rule.rb
CHANGED
data/lib/rdoc/markup/to_ansi.rb
CHANGED
data/lib/rdoc/markup/to_html.rb
CHANGED
@@ -202,7 +202,9 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
|
|
202
202
|
def accept_paragraph paragraph
|
203
203
|
@res << "\n<p>"
|
204
204
|
text = paragraph.text @hard_break
|
205
|
-
text = text.gsub(
|
205
|
+
text = text.gsub(/(#{SPACE_SEPARATED_LETTER_CLASS})?\K\r?\n(?=(?(1)(#{SPACE_SEPARATED_LETTER_CLASS})?))/o) {
|
206
|
+
defined?($2) && ' '
|
207
|
+
}
|
206
208
|
@res << to_html(text)
|
207
209
|
@res << "</p>\n"
|
208
210
|
end
|
@@ -430,7 +432,9 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
|
|
430
432
|
|
431
433
|
def parseable? text
|
432
434
|
verbose, $VERBOSE = $VERBOSE, nil
|
433
|
-
|
435
|
+
catch(:valid) do
|
436
|
+
eval("BEGIN { throw :valid, true }\n#{text}")
|
437
|
+
end
|
434
438
|
rescue SyntaxError
|
435
439
|
false
|
436
440
|
ensure
|
@@ -445,4 +449,3 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
|
|
445
449
|
end
|
446
450
|
|
447
451
|
end
|
448
|
-
|
@@ -25,9 +25,9 @@ class RDoc::Markup::ToJoinedParagraph < RDoc::Markup::Formatter
|
|
25
25
|
def accept_paragraph paragraph
|
26
26
|
parts = paragraph.parts.chunk do |part|
|
27
27
|
String === part
|
28
|
-
end.
|
28
|
+
end.flat_map do |string, chunk|
|
29
29
|
string ? chunk.join.rstrip : chunk
|
30
|
-
end
|
30
|
+
end
|
31
31
|
|
32
32
|
paragraph.parts.replace parts
|
33
33
|
end
|
@@ -44,4 +44,3 @@ class RDoc::Markup::ToJoinedParagraph < RDoc::Markup::Formatter
|
|
44
44
|
alias accept_table ignore
|
45
45
|
|
46
46
|
end
|
47
|
-
|
data/lib/rdoc/markup/to_label.rb
CHANGED
data/lib/rdoc/markup/to_rdoc.rb
CHANGED
data/lib/rdoc/markup/to_test.rb
CHANGED
data/lib/rdoc/markup/verbatim.rb
CHANGED
data/lib/rdoc/meta_method.rb
CHANGED
data/lib/rdoc/method_attr.rb
CHANGED
data/lib/rdoc/mixin.rb
CHANGED
data/lib/rdoc/normal_class.rb
CHANGED
data/lib/rdoc/normal_module.rb
CHANGED
data/lib/rdoc/options.rb
CHANGED
@@ -565,9 +565,10 @@ class RDoc::Options
|
|
565
565
|
|
566
566
|
@op_dir ||= 'doc'
|
567
567
|
|
568
|
-
@rdoc_include << "." if @rdoc_include.empty?
|
569
568
|
root = @root.to_s
|
570
|
-
@rdoc_include
|
569
|
+
if @rdoc_include.empty? || !@rdoc_include.include?(root)
|
570
|
+
@rdoc_include << root
|
571
|
+
end
|
571
572
|
|
572
573
|
@exclude = self.exclude
|
573
574
|
|
data/lib/rdoc/parser/markdown.rb
CHANGED
data/lib/rdoc/parser/rd.rb
CHANGED
@@ -368,7 +368,7 @@ class RDoc::Parser::RipperStateLex
|
|
368
368
|
private def get_symbol_tk(tk)
|
369
369
|
is_symbol = true
|
370
370
|
symbol_tk = Token.new(tk.line_no, tk.char_no, :on_symbol)
|
371
|
-
if ":'" == tk[:text] or ':"' == tk[:text]
|
371
|
+
if ":'" == tk[:text] or ':"' == tk[:text] or tk[:text].start_with?('%s')
|
372
372
|
tk1 = get_string_tk(tk)
|
373
373
|
symbol_tk[:text] = tk1[:text]
|
374
374
|
symbol_tk[:state] = tk1[:state]
|
data/lib/rdoc/parser/ruby.rb
CHANGED
@@ -8,6 +8,9 @@
|
|
8
8
|
# by Keiju ISHITSUKA (Nippon Rational Inc.)
|
9
9
|
#
|
10
10
|
|
11
|
+
require 'ripper'
|
12
|
+
require_relative 'ripper_state_lex'
|
13
|
+
|
11
14
|
##
|
12
15
|
# Extracts code elements from a source file returning a TopLevel object
|
13
16
|
# containing the constituent file elements.
|
@@ -138,9 +141,6 @@
|
|
138
141
|
# Note that by default, the :method: directive will be ignored if there is a
|
139
142
|
# standard rdocable item following it.
|
140
143
|
|
141
|
-
require 'ripper'
|
142
|
-
require_relative 'ripper_state_lex'
|
143
|
-
|
144
144
|
class RDoc::Parser::Ruby < RDoc::Parser
|
145
145
|
|
146
146
|
parse_files_matching(/\.rbw?$/)
|
@@ -2134,7 +2134,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
2134
2134
|
if :on_nl == tk[:kind] or (:on_kw == tk[:kind] && 'def' == tk[:text]) then
|
2135
2135
|
return
|
2136
2136
|
elsif :on_comment == tk[:kind] or :on_embdoc == tk[:kind] then
|
2137
|
-
return unless tk[:text] =~
|
2137
|
+
return unless tk[:text] =~ /:?\b([\w-]+):\s*(.*)/
|
2138
2138
|
|
2139
2139
|
directive = $1.downcase
|
2140
2140
|
|
data/lib/rdoc/parser/text.rb
CHANGED