rdoc 2.5.6 → 2.5.7
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.
- data.tar.gz.sig +0 -0
- data/History.txt +12 -1
- data/Manifest.txt +2 -0
- data/lib/rdoc.rb +1 -1
- data/lib/rdoc/known_classes.rb +1 -0
- data/lib/rdoc/markup.rb +5 -7
- data/lib/rdoc/markup/formatter_test_case.rb +12 -0
- data/lib/rdoc/markup/paragraph.rb +1 -56
- data/lib/rdoc/markup/parser.rb +1 -0
- data/lib/rdoc/markup/preprocess.rb +52 -6
- data/lib/rdoc/markup/raw.rb +65 -0
- data/lib/rdoc/markup/to_html.rb +4 -0
- data/lib/rdoc/markup/to_rdoc.rb +4 -0
- data/lib/rdoc/markup/verbatim.rb +1 -1
- data/lib/rdoc/options.rb +5 -0
- data/lib/rdoc/parser/c.rb +1 -4
- data/lib/rdoc/parser/ruby.rb +1 -4
- data/lib/rdoc/parser/simple.rb +1 -4
- data/test/test_rdoc_markup_paragraph.rb +0 -18
- data/test/test_rdoc_markup_pre_process.rb +138 -0
- data/test/test_rdoc_markup_raw.rb +27 -0
- data/test/test_rdoc_markup_to_ansi.rb +12 -0
- data/test/test_rdoc_markup_to_bs.rb +12 -0
- data/test/test_rdoc_markup_to_html.rb +12 -0
- data/test/test_rdoc_markup_to_rdoc.rb +12 -0
- data/test/test_rdoc_options.rb +20 -0
- data/test/test_rdoc_parser_ruby.rb +2 -9
- data/test/test_rdoc_parser_simple.rb +3 -4
- data/test/test_rdoc_rdoc.rb +26 -29
- metadata +7 -4
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
=== 2.5.
|
1
|
+
=== 2.5.7 / 2010-04-22
|
2
2
|
|
3
3
|
*NOTE*:
|
4
4
|
|
@@ -19,6 +19,17 @@ To have ri data for you gems you'll also need to run:
|
|
19
19
|
|
20
20
|
If you don't want to rebuild the rdoc for `gem server`, add --no-rdoc.
|
21
21
|
|
22
|
+
* Minor Enhancements
|
23
|
+
* Unrecognized RDoc directives can now be registered by a plugin for
|
24
|
+
handling. See RDoc::Markup::PreProcess.
|
25
|
+
* Added RDoc::Markup::Raw to allow other markup engines to dump raw content
|
26
|
+
into RDoc.
|
27
|
+
* Bug Fixes
|
28
|
+
* rdoc -p no longer means --pipe if files are also given.
|
29
|
+
* RDoc now knows about BasicObject by default. Ruby Bug #1318 by Ambrus Zsbán
|
30
|
+
|
31
|
+
=== 2.5.6 / 2010-04-22
|
32
|
+
|
22
33
|
* Minor Enhancements
|
23
34
|
* Unrecognized RDoc directives are added as metadata to the object they get
|
24
35
|
attached to.
|
data/Manifest.txt
CHANGED
@@ -68,6 +68,7 @@ lib/rdoc/markup/list_item.rb
|
|
68
68
|
lib/rdoc/markup/paragraph.rb
|
69
69
|
lib/rdoc/markup/parser.rb
|
70
70
|
lib/rdoc/markup/preprocess.rb
|
71
|
+
lib/rdoc/markup/raw.rb
|
71
72
|
lib/rdoc/markup/rule.rb
|
72
73
|
lib/rdoc/markup/to_ansi.rb
|
73
74
|
lib/rdoc/markup/to_bs.rb
|
@@ -122,6 +123,7 @@ test/test_rdoc_markup_document.rb
|
|
122
123
|
test/test_rdoc_markup_paragraph.rb
|
123
124
|
test/test_rdoc_markup_parser.rb
|
124
125
|
test/test_rdoc_markup_pre_process.rb
|
126
|
+
test/test_rdoc_markup_raw.rb
|
125
127
|
test/test_rdoc_markup_to_ansi.rb
|
126
128
|
test/test_rdoc_markup_to_bs.rb
|
127
129
|
test/test_rdoc_markup_to_html.rb
|
data/lib/rdoc.rb
CHANGED
data/lib/rdoc/known_classes.rb
CHANGED
data/lib/rdoc/markup.rb
CHANGED
@@ -107,15 +107,13 @@ class RDoc::Markup
|
|
107
107
|
end
|
108
108
|
|
109
109
|
##
|
110
|
-
# We take
|
111
|
-
#
|
112
|
-
# paragraph). We then invoke the output formatter using a Visitor to
|
113
|
-
# display the result.
|
110
|
+
# We take +text+, parse it then invoke the output +formatter+ using a
|
111
|
+
# Visitor to render the result.
|
114
112
|
|
115
|
-
def convert
|
116
|
-
document = RDoc::Markup::Parser.parse
|
113
|
+
def convert text, formatter
|
114
|
+
document = RDoc::Markup::Parser.parse text
|
117
115
|
|
118
|
-
document.accept
|
116
|
+
document.accept formatter
|
119
117
|
end
|
120
118
|
|
121
119
|
end
|
@@ -87,6 +87,18 @@ class RDoc::Markup::FormatterTestCase < MiniTest::Unit::TestCase
|
|
87
87
|
accept_verbatim
|
88
88
|
end
|
89
89
|
|
90
|
+
def test_accept_raw
|
91
|
+
@to.start_accepting
|
92
|
+
|
93
|
+
@to.accept_raw @RM::Raw.new("<table>",
|
94
|
+
"<tr><th>Name<th>Count",
|
95
|
+
"<tr><td>a<td>1",
|
96
|
+
"<tr><td>b<td>2",
|
97
|
+
"</table>")
|
98
|
+
|
99
|
+
accept_raw
|
100
|
+
end
|
101
|
+
|
90
102
|
def test_accept_rule
|
91
103
|
@to.start_accepting
|
92
104
|
|
@@ -1,66 +1,11 @@
|
|
1
1
|
##
|
2
2
|
# A Paragraph of text
|
3
3
|
|
4
|
-
class RDoc::Markup::Paragraph
|
5
|
-
|
6
|
-
##
|
7
|
-
# The component parts of the list
|
8
|
-
|
9
|
-
attr_reader :parts
|
10
|
-
|
11
|
-
##
|
12
|
-
# Creates a new Paragraph containing +parts+
|
13
|
-
|
14
|
-
def initialize *parts
|
15
|
-
@parts = []
|
16
|
-
@parts.push(*parts)
|
17
|
-
end
|
18
|
-
|
19
|
-
##
|
20
|
-
# Appends +text+ to the Paragraph
|
21
|
-
|
22
|
-
def << text
|
23
|
-
@parts << text
|
24
|
-
end
|
25
|
-
|
26
|
-
def == other # :nodoc:
|
27
|
-
self.class == other.class and text == other.text
|
28
|
-
end
|
4
|
+
class RDoc::Markup::Paragraph < RDoc::Markup::Raw
|
29
5
|
|
30
6
|
def accept visitor
|
31
7
|
visitor.accept_paragraph self
|
32
8
|
end
|
33
9
|
|
34
|
-
##
|
35
|
-
# Appends +other+'s parts into this Paragraph
|
36
|
-
|
37
|
-
def merge other
|
38
|
-
@parts.push(*other.parts)
|
39
|
-
end
|
40
|
-
|
41
|
-
def pretty_print q # :nodoc:
|
42
|
-
self.class.name =~ /.*::(\w{4})/i
|
43
|
-
|
44
|
-
q.group 2, "[#{$1.downcase}: ", ']' do
|
45
|
-
q.seplist @parts do |part|
|
46
|
-
q.pp part
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
##
|
52
|
-
# Appends +texts+ onto this Paragraph
|
53
|
-
|
54
|
-
def push *texts
|
55
|
-
self.parts.push(*texts)
|
56
|
-
end
|
57
|
-
|
58
|
-
##
|
59
|
-
# The text of this paragraph
|
60
|
-
|
61
|
-
def text
|
62
|
-
@parts.join ' '
|
63
|
-
end
|
64
|
-
|
65
10
|
end
|
66
11
|
|
data/lib/rdoc/markup/parser.rb
CHANGED
@@ -522,6 +522,7 @@ require 'rdoc/markup/document'
|
|
522
522
|
require 'rdoc/markup/heading'
|
523
523
|
require 'rdoc/markup/list'
|
524
524
|
require 'rdoc/markup/list_item'
|
525
|
+
require 'rdoc/markup/raw'
|
525
526
|
require 'rdoc/markup/paragraph'
|
526
527
|
require 'rdoc/markup/rule'
|
527
528
|
require 'rdoc/markup/verbatim'
|
@@ -4,9 +4,30 @@ require 'rdoc/markup'
|
|
4
4
|
# Handle common directives that can occur in a block of text:
|
5
5
|
#
|
6
6
|
# : include : filename
|
7
|
+
#
|
8
|
+
# RDoc plugin authors can register additional directives to be handled through
|
9
|
+
# RDoc::Markup::PreProcess::register
|
7
10
|
|
8
11
|
class RDoc::Markup::PreProcess
|
9
12
|
|
13
|
+
@registered = {}
|
14
|
+
|
15
|
+
##
|
16
|
+
# Registers +directive+ as one handled by RDoc. If a block is given the
|
17
|
+
# directive will be replaced by the result of the block, otherwise the
|
18
|
+
# directive will be removed from the processed text.
|
19
|
+
|
20
|
+
def self.register directive, &block
|
21
|
+
@registered[directive] = block
|
22
|
+
end
|
23
|
+
|
24
|
+
##
|
25
|
+
# Registered directives
|
26
|
+
|
27
|
+
def self.registered
|
28
|
+
@registered
|
29
|
+
end
|
30
|
+
|
10
31
|
##
|
11
32
|
# Creates a new pre-processor for +input_file_name+ that will look for
|
12
33
|
# included files in +include_path+
|
@@ -17,10 +38,20 @@ class RDoc::Markup::PreProcess
|
|
17
38
|
end
|
18
39
|
|
19
40
|
##
|
20
|
-
# Look for
|
21
|
-
#
|
22
|
-
|
23
|
-
|
41
|
+
# Look for directives in a chunk of +text+.
|
42
|
+
#
|
43
|
+
# Options that we don't handle are yielded. If the block returns false the
|
44
|
+
# directive is restored to the text. If the block returns nil or no block
|
45
|
+
# was given the directive is handled according to the registered directives.
|
46
|
+
# If a String was returned the directive is replaced with the string.
|
47
|
+
#
|
48
|
+
# If no matching directive was registered the directive is restored to the
|
49
|
+
# text.
|
50
|
+
#
|
51
|
+
# If +code_object+ is given and the param is set as metadata on the
|
52
|
+
# +code_object+. See RDoc::CodeObject#metadata
|
53
|
+
|
54
|
+
def handle text, code_object = nil
|
24
55
|
text.gsub!(/^([ \t]*#?[ \t]*):(\w+):([ \t]*)(.+)?\n/) do
|
25
56
|
next $& if $3.empty? and $4 and $4[0, 1] == ':'
|
26
57
|
|
@@ -34,11 +65,26 @@ class RDoc::Markup::PreProcess
|
|
34
65
|
include_file filename, prefix
|
35
66
|
|
36
67
|
else
|
37
|
-
result = yield directive, param
|
38
|
-
|
68
|
+
result = yield directive, param if block_given?
|
69
|
+
|
70
|
+
case result
|
71
|
+
when nil then
|
72
|
+
code_object.metadata[directive] = param if code_object
|
73
|
+
if RDoc::Markup::PreProcess.registered.include? directive then
|
74
|
+
handler = RDoc::Markup::PreProcess.registered[directive]
|
75
|
+
result = handler.call directive, param if handler
|
76
|
+
else
|
77
|
+
result = "#{prefix}:#{directive}: #{param}\n"
|
78
|
+
end
|
79
|
+
when false then
|
80
|
+
result = "#{prefix}:#{directive}: #{param}\n"
|
81
|
+
end
|
82
|
+
|
39
83
|
result
|
40
84
|
end
|
41
85
|
end
|
86
|
+
|
87
|
+
text
|
42
88
|
end
|
43
89
|
|
44
90
|
##
|
@@ -0,0 +1,65 @@
|
|
1
|
+
##
|
2
|
+
# A section of text that is added to the output document as-is
|
3
|
+
|
4
|
+
class RDoc::Markup::Raw
|
5
|
+
|
6
|
+
##
|
7
|
+
# The component parts of the list
|
8
|
+
|
9
|
+
attr_reader :parts
|
10
|
+
|
11
|
+
##
|
12
|
+
# Creates a new Raw containing +parts+
|
13
|
+
|
14
|
+
def initialize *parts
|
15
|
+
@parts = []
|
16
|
+
@parts.push(*parts)
|
17
|
+
end
|
18
|
+
|
19
|
+
##
|
20
|
+
# Appends +text+
|
21
|
+
|
22
|
+
def << text
|
23
|
+
@parts << text
|
24
|
+
end
|
25
|
+
|
26
|
+
def == other # :nodoc:
|
27
|
+
self.class == other.class and text == other.text
|
28
|
+
end
|
29
|
+
|
30
|
+
def accept visitor
|
31
|
+
visitor.accept_raw self
|
32
|
+
end
|
33
|
+
|
34
|
+
##
|
35
|
+
# Appends +other+'s parts
|
36
|
+
|
37
|
+
def merge other
|
38
|
+
@parts.push(*other.parts)
|
39
|
+
end
|
40
|
+
|
41
|
+
def pretty_print q # :nodoc:
|
42
|
+
self.class.name =~ /.*::(\w{4})/i
|
43
|
+
|
44
|
+
q.group 2, "[#{$1.downcase}: ", ']' do
|
45
|
+
q.seplist @parts do |part|
|
46
|
+
q.pp part
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
##
|
52
|
+
# Appends +texts+ onto this Paragraph
|
53
|
+
|
54
|
+
def push *texts
|
55
|
+
self.parts.push(*texts)
|
56
|
+
end
|
57
|
+
|
58
|
+
##
|
59
|
+
# The raw text
|
60
|
+
|
61
|
+
def text
|
62
|
+
@parts.join ' '
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
data/lib/rdoc/markup/to_html.rb
CHANGED
data/lib/rdoc/markup/to_rdoc.rb
CHANGED
@@ -127,6 +127,10 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
|
|
127
127
|
wrap attributes(paragraph.text)
|
128
128
|
end
|
129
129
|
|
130
|
+
def accept_raw raw
|
131
|
+
@res << raw.parts.join("\n")
|
132
|
+
end
|
133
|
+
|
130
134
|
def accept_rule rule
|
131
135
|
use_prefix or @res << ' ' * @indent
|
132
136
|
@res << '-' * (@width - @indent)
|
data/lib/rdoc/markup/verbatim.rb
CHANGED
data/lib/rdoc/options.rb
CHANGED
@@ -366,6 +366,11 @@ Usage: #{opt.program_name} [options] [names...]
|
|
366
366
|
end
|
367
367
|
end
|
368
368
|
|
369
|
+
if @pipe and not argv.empty? then
|
370
|
+
@pipe = false
|
371
|
+
ignored << '-p (with files)'
|
372
|
+
end
|
373
|
+
|
369
374
|
unless ignored.empty? or quiet then
|
370
375
|
$stderr.puts "invalid options: #{ignored.join ', '}"
|
371
376
|
$stderr.puts '(invalid options are ignored)'
|
data/lib/rdoc/parser/c.rb
CHANGED
@@ -661,7 +661,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
661
661
|
def look_for_directives_in(context, comment)
|
662
662
|
preprocess = RDoc::Markup::PreProcess.new @file_name, @options.rdoc_include
|
663
663
|
|
664
|
-
preprocess.handle comment do |directive, param|
|
664
|
+
preprocess.handle comment, context do |directive, param|
|
665
665
|
case directive
|
666
666
|
when 'main' then
|
667
667
|
@options.main_page = param
|
@@ -669,9 +669,6 @@ class RDoc::Parser::C < RDoc::Parser
|
|
669
669
|
when 'title' then
|
670
670
|
@options.title = param
|
671
671
|
''
|
672
|
-
else
|
673
|
-
context.metadata[directive] = param
|
674
|
-
false
|
675
672
|
end
|
676
673
|
end
|
677
674
|
|
data/lib/rdoc/parser/ruby.rb
CHANGED
@@ -379,7 +379,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
379
379
|
def look_for_directives_in(context, comment)
|
380
380
|
preprocess = RDoc::Markup::PreProcess.new @file_name, @options.rdoc_include
|
381
381
|
|
382
|
-
preprocess.handle comment do |directive, param|
|
382
|
+
preprocess.handle comment, context do |directive, param|
|
383
383
|
case directive
|
384
384
|
when 'enddoc' then
|
385
385
|
throw :enddoc
|
@@ -403,9 +403,6 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
403
403
|
when 'title' then
|
404
404
|
@options.title = param
|
405
405
|
''
|
406
|
-
else
|
407
|
-
@top_level.metadata[directive] = param
|
408
|
-
false
|
409
406
|
end
|
410
407
|
end
|
411
408
|
|
data/lib/rdoc/parser/simple.rb
CHANGED
@@ -17,10 +17,7 @@ class RDoc::Parser::Simple < RDoc::Parser
|
|
17
17
|
|
18
18
|
preprocess = RDoc::Markup::PreProcess.new @file_name, @options.rdoc_include
|
19
19
|
|
20
|
-
preprocess.handle @content
|
21
|
-
top_level.metadata[directive] = param
|
22
|
-
false
|
23
|
-
end
|
20
|
+
preprocess.handle @content, @top_level
|
24
21
|
end
|
25
22
|
|
26
23
|
##
|
@@ -5,23 +5,5 @@ require 'rdoc/markup'
|
|
5
5
|
|
6
6
|
class TestRDocMarkupParagraph < MiniTest::Unit::TestCase
|
7
7
|
|
8
|
-
def setup
|
9
|
-
@RM = RDoc::Markup
|
10
|
-
@p = @RM::Paragraph.new
|
11
|
-
end
|
12
|
-
|
13
|
-
def mu_pp obj
|
14
|
-
s = ''
|
15
|
-
s = PP.pp obj, s
|
16
|
-
s.force_encoding Encoding.default_external if defined? Encoding
|
17
|
-
s.chomp
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_push
|
21
|
-
@p.push 'hi', 'there'
|
22
|
-
|
23
|
-
assert_equal @RM::Paragraph.new('hi', 'there'), @p
|
24
|
-
end
|
25
|
-
|
26
8
|
end
|
27
9
|
|
@@ -2,10 +2,13 @@ require 'tempfile'
|
|
2
2
|
require 'rubygems'
|
3
3
|
require 'minitest/autorun'
|
4
4
|
require 'rdoc/markup/preprocess'
|
5
|
+
require 'rdoc/code_objects'
|
5
6
|
|
6
7
|
class TestRDocMarkupPreProcess < MiniTest::Unit::TestCase
|
7
8
|
|
8
9
|
def setup
|
10
|
+
RDoc::Markup::PreProcess.registered.clear
|
11
|
+
|
9
12
|
@tempfile = Tempfile.new 'test_rdoc_markup_pre_process'
|
10
13
|
@name = File.basename @tempfile.path
|
11
14
|
@dir = File.dirname @tempfile.path
|
@@ -38,5 +41,140 @@ contents of a string.
|
|
38
41
|
assert_equal expected, content
|
39
42
|
end
|
40
43
|
|
44
|
+
def test_handle
|
45
|
+
text = "# :x: y\n"
|
46
|
+
out = @pp.handle text
|
47
|
+
|
48
|
+
assert_same out, text
|
49
|
+
assert_equal "# :x: y\n", text
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_handle_block
|
53
|
+
text = "# :x: y\n"
|
54
|
+
|
55
|
+
@pp.handle text do |directive, param|
|
56
|
+
false
|
57
|
+
end
|
58
|
+
|
59
|
+
assert_equal "# :x: y\n", text
|
60
|
+
|
61
|
+
@pp.handle text do |directive, param|
|
62
|
+
''
|
63
|
+
end
|
64
|
+
|
65
|
+
assert_equal "", text
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_handle_code_object
|
69
|
+
cd = RDoc::CodeObject.new
|
70
|
+
text = "# :x: y\n"
|
71
|
+
@pp.handle text, cd
|
72
|
+
|
73
|
+
assert_equal "# :x: y\n", text
|
74
|
+
assert_equal 'y', cd.metadata['x']
|
75
|
+
|
76
|
+
cd.metadata.clear
|
77
|
+
text = "# :x:\n"
|
78
|
+
@pp.handle text, cd
|
79
|
+
|
80
|
+
assert_equal "# :x: \n", text
|
81
|
+
assert_includes cd.metadata, 'x'
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_handle_code_object_block
|
85
|
+
cd = RDoc::CodeObject.new
|
86
|
+
text = "# :x: y\n"
|
87
|
+
@pp.handle text, cd do
|
88
|
+
false
|
89
|
+
end
|
90
|
+
|
91
|
+
assert_equal "# :x: y\n", text
|
92
|
+
assert_empty cd.metadata
|
93
|
+
|
94
|
+
@pp.handle text, cd do
|
95
|
+
nil
|
96
|
+
end
|
97
|
+
|
98
|
+
assert_equal "# :x: y\n", text
|
99
|
+
assert_equal 'y', cd.metadata['x']
|
100
|
+
|
101
|
+
cd.metadata.clear
|
102
|
+
|
103
|
+
@pp.handle text, cd do
|
104
|
+
''
|
105
|
+
end
|
106
|
+
|
107
|
+
assert_equal '', text
|
108
|
+
assert_empty cd.metadata
|
109
|
+
end
|
110
|
+
|
111
|
+
def test_handle_registered
|
112
|
+
RDoc::Markup::PreProcess.register 'x'
|
113
|
+
text = "# :x: y\n"
|
114
|
+
@pp.handle text
|
115
|
+
|
116
|
+
assert_equal '', text
|
117
|
+
|
118
|
+
text = "# :x: y\n"
|
119
|
+
|
120
|
+
@pp.handle text do |directive, param|
|
121
|
+
false
|
122
|
+
end
|
123
|
+
|
124
|
+
assert_equal "# :x: y\n", text
|
125
|
+
|
126
|
+
text = "# :x: y\n"
|
127
|
+
|
128
|
+
@pp.handle text do |directive, param|
|
129
|
+
''
|
130
|
+
end
|
131
|
+
|
132
|
+
assert_equal "", text
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_handle_registered_block
|
136
|
+
called = nil
|
137
|
+
RDoc::Markup::PreProcess.register 'x' do |directive, param|
|
138
|
+
called = [directive, param]
|
139
|
+
'blah'
|
140
|
+
end
|
141
|
+
|
142
|
+
text = "# :x: y\n"
|
143
|
+
@pp.handle text
|
144
|
+
|
145
|
+
assert_equal 'blah', text
|
146
|
+
assert_equal %w[x y], called
|
147
|
+
end
|
148
|
+
|
149
|
+
def test_handle_registered_code_object
|
150
|
+
RDoc::Markup::PreProcess.register 'x'
|
151
|
+
cd = RDoc::CodeObject.new
|
152
|
+
|
153
|
+
text = "# :x: y\n"
|
154
|
+
@pp.handle text, cd
|
155
|
+
|
156
|
+
assert_equal '', text
|
157
|
+
assert_equal 'y', cd.metadata['x']
|
158
|
+
|
159
|
+
cd.metadata.clear
|
160
|
+
text = "# :x: y\n"
|
161
|
+
|
162
|
+
@pp.handle text do |directive, param|
|
163
|
+
false
|
164
|
+
end
|
165
|
+
|
166
|
+
assert_equal "# :x: y\n", text
|
167
|
+
assert_empty cd.metadata
|
168
|
+
|
169
|
+
text = "# :x: y\n"
|
170
|
+
|
171
|
+
@pp.handle text do |directive, param|
|
172
|
+
''
|
173
|
+
end
|
174
|
+
|
175
|
+
assert_equal "", text
|
176
|
+
assert_empty cd.metadata
|
177
|
+
end
|
178
|
+
|
41
179
|
end
|
42
180
|
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'pp'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'minitest/autorun'
|
4
|
+
require 'rdoc/markup'
|
5
|
+
|
6
|
+
class TestRDocMarkupRaw < MiniTest::Unit::TestCase
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@RM = RDoc::Markup
|
10
|
+
@p = @RM::Raw.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def mu_pp obj
|
14
|
+
s = ''
|
15
|
+
s = PP.pp obj, s
|
16
|
+
s.force_encoding Encoding.default_external if defined? Encoding
|
17
|
+
s.chomp
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_push
|
21
|
+
@p.push 'hi', 'there'
|
22
|
+
|
23
|
+
assert_equal @RM::Raw.new('hi', 'there'), @p
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
@@ -175,6 +175,18 @@ class TestRDocMarkupToAnsi < RDoc::Markup::FormatterTestCase
|
|
175
175
|
assert_equal "\e[0mhi\n", @to.res.join
|
176
176
|
end
|
177
177
|
|
178
|
+
def accept_raw
|
179
|
+
raw = <<-RAW.rstrip
|
180
|
+
\e[0m<table>
|
181
|
+
<tr><th>Name<th>Count
|
182
|
+
<tr><td>a<td>1
|
183
|
+
<tr><td>b<td>2
|
184
|
+
</table>
|
185
|
+
RAW
|
186
|
+
|
187
|
+
assert_equal raw, @to.res.join
|
188
|
+
end
|
189
|
+
|
178
190
|
def accept_rule
|
179
191
|
assert_equal "\e[0m#{'-' * 78}\n", @to.res.join
|
180
192
|
end
|
@@ -174,6 +174,18 @@ class TestRDocMarkupToBs < RDoc::Markup::FormatterTestCase
|
|
174
174
|
assert_equal "hi\n", @to.res.join
|
175
175
|
end
|
176
176
|
|
177
|
+
def accept_raw
|
178
|
+
raw = <<-RAW.rstrip
|
179
|
+
<table>
|
180
|
+
<tr><th>Name<th>Count
|
181
|
+
<tr><td>a<td>1
|
182
|
+
<tr><td>b<td>2
|
183
|
+
</table>
|
184
|
+
RAW
|
185
|
+
|
186
|
+
assert_equal raw, @to.res.join
|
187
|
+
end
|
188
|
+
|
177
189
|
def accept_rule
|
178
190
|
assert_equal "#{'-' * 78}\n", @to.res.join
|
179
191
|
end
|
@@ -170,6 +170,18 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
|
|
170
170
|
assert_equal "<p>\nhi\n</p>\n", @to.res.join
|
171
171
|
end
|
172
172
|
|
173
|
+
def accept_raw
|
174
|
+
raw = <<-RAW.rstrip
|
175
|
+
<table>
|
176
|
+
<tr><th>Name<th>Count
|
177
|
+
<tr><td>a<td>1
|
178
|
+
<tr><td>b<td>2
|
179
|
+
</table>
|
180
|
+
RAW
|
181
|
+
|
182
|
+
assert_equal raw, @to.res.join
|
183
|
+
end
|
184
|
+
|
173
185
|
def accept_rule
|
174
186
|
assert_equal '<hr style="height: 4px"></hr>', @to.res.join
|
175
187
|
end
|
@@ -175,6 +175,18 @@ class TestRDocMarkupToRdoc < RDoc::Markup::FormatterTestCase
|
|
175
175
|
assert_equal "hi\n", @to.res.join
|
176
176
|
end
|
177
177
|
|
178
|
+
def accept_raw
|
179
|
+
raw = <<-RAW.rstrip
|
180
|
+
<table>
|
181
|
+
<tr><th>Name<th>Count
|
182
|
+
<tr><td>a<td>1
|
183
|
+
<tr><td>b<td>2
|
184
|
+
</table>
|
185
|
+
RAW
|
186
|
+
|
187
|
+
assert_equal raw, @to.res.join
|
188
|
+
end
|
189
|
+
|
178
190
|
def accept_rule
|
179
191
|
assert_equal "#{'-' * 78}\n", @to.res.join
|
180
192
|
end
|
data/test/test_rdoc_options.rb
CHANGED
@@ -50,5 +50,25 @@ class TestRDocOptions < MiniTest::Unit::TestCase
|
|
50
50
|
assert_equal 'MAIN', @options.main_page
|
51
51
|
end
|
52
52
|
|
53
|
+
def test_parse_dash_p
|
54
|
+
out, err = capture_io do
|
55
|
+
@options.parse %w[-p]
|
56
|
+
end
|
57
|
+
|
58
|
+
assert @options.pipe
|
59
|
+
refute_match %r%^Usage: %, err
|
60
|
+
refute_match %r%^invalid options%, err
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_parse_dash_p_files
|
64
|
+
out, err = capture_io do
|
65
|
+
@options.parse %w[-p README]
|
66
|
+
end
|
67
|
+
|
68
|
+
refute @options.pipe
|
69
|
+
refute_match %r%^Usage: %, err
|
70
|
+
assert_match %r%^invalid options: -p .with files.%, err
|
71
|
+
end
|
72
|
+
|
53
73
|
end
|
54
74
|
|
@@ -151,16 +151,9 @@ class TestRDocParserRuby < MiniTest::Unit::TestCase
|
|
151
151
|
def test_look_for_directives_in_unhandled
|
152
152
|
util_parser ""
|
153
153
|
|
154
|
-
|
154
|
+
@parser.look_for_directives_in @top_level, "# :unhandled: blah\n"
|
155
155
|
|
156
|
-
|
157
|
-
|
158
|
-
assert_equal "# :unhandled: \n# :markup: not rdoc\n", comment
|
159
|
-
|
160
|
-
assert_equal nil, @top_level.metadata['unhandled']
|
161
|
-
assert_equal 'not rdoc', @top_level.metadata['markup']
|
162
|
-
|
163
|
-
assert_equal 'hi', @options.title
|
156
|
+
assert_equal 'blah', @top_level.method['unhandled']
|
164
157
|
end
|
165
158
|
|
166
159
|
def test_parse_alias
|
@@ -23,12 +23,11 @@ class TestRDocParserSimple < MiniTest::Unit::TestCase
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def test_initialize_metadata
|
26
|
-
parser = util_parser ":unhandled: \n
|
26
|
+
parser = util_parser ":unhandled: \n"
|
27
27
|
|
28
|
-
|
29
|
-
assert_equal 'not rdoc', @top_level.metadata['markup']
|
28
|
+
assert_includes @top_level.metadata, 'unhandled'
|
30
29
|
|
31
|
-
assert_equal ":unhandled: \n
|
30
|
+
assert_equal ":unhandled: \n", parser.content
|
32
31
|
end
|
33
32
|
|
34
33
|
def test_remove_coding_comment
|
data/test/test_rdoc_rdoc.rb
CHANGED
@@ -82,50 +82,47 @@ class TestRDocRDoc < MiniTest::Unit::TestCase
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def test_setup_output_dir
|
85
|
-
|
86
|
-
@tempfile.unlink
|
85
|
+
skip "No Dir::mktmpdir, upgrade your ruby" unless Dir.respond_to? :mktmpdir
|
87
86
|
|
88
|
-
|
87
|
+
Dir.mktmpdir {|d|
|
88
|
+
path = File.join(d, 'testdir')
|
89
89
|
|
90
|
-
|
90
|
+
last = @rdoc.setup_output_dir path, false
|
91
91
|
|
92
|
-
|
93
|
-
|
94
|
-
|
92
|
+
assert_empty last
|
93
|
+
|
94
|
+
assert File.directory? path
|
95
|
+
}
|
95
96
|
end
|
96
97
|
|
97
98
|
def test_setup_output_dir_exists
|
98
|
-
|
99
|
-
@tempfile.unlink
|
100
|
-
FileUtils.mkdir_p path
|
99
|
+
skip "No Dir::mktmpdir, upgrade your ruby" unless Dir.respond_to? :mktmpdir
|
101
100
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
101
|
+
Dir.mktmpdir {|path|
|
102
|
+
open @rdoc.output_flag_file(path), 'w' do |io|
|
103
|
+
io.puts Time.at 0
|
104
|
+
io.puts "./lib/rdoc.rb\t#{Time.at 86400}"
|
105
|
+
end
|
106
106
|
|
107
|
-
|
107
|
+
last = @rdoc.setup_output_dir path, false
|
108
108
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
FileUtils.rm_f path
|
109
|
+
assert_equal 1, last.size
|
110
|
+
assert_equal Time.at(86400), last['./lib/rdoc.rb']
|
111
|
+
}
|
113
112
|
end
|
114
113
|
|
115
114
|
def test_setup_output_dir_exists_empty_created_rid
|
116
|
-
|
117
|
-
@tempfile.unlink
|
118
|
-
FileUtils.mkdir_p path
|
115
|
+
skip "No Dir::mktmpdir, upgrade your ruby" unless Dir.respond_to? :mktmpdir
|
119
116
|
|
120
|
-
|
117
|
+
Dir.mktmpdir {|path|
|
118
|
+
open @rdoc.output_flag_file(path), 'w' do end
|
121
119
|
|
122
|
-
|
123
|
-
|
124
|
-
|
120
|
+
e = assert_raises RDoc::Error do
|
121
|
+
@rdoc.setup_output_dir path, false
|
122
|
+
end
|
125
123
|
|
126
|
-
|
127
|
-
|
128
|
-
FileUtils.rm_f path
|
124
|
+
assert_match %r%Directory #{Regexp.escape path} already exists%, e.message
|
125
|
+
}
|
129
126
|
end
|
130
127
|
|
131
128
|
def test_setup_output_dir_exists_file
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 2.5.
|
9
|
+
- 7
|
10
|
+
version: 2.5.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Eric Hodel
|
@@ -39,7 +39,7 @@ cert_chain:
|
|
39
39
|
x52qPcexcYZR7w==
|
40
40
|
-----END CERTIFICATE-----
|
41
41
|
|
42
|
-
date: 2010-04-
|
42
|
+
date: 2010-04-26 00:00:00 -07:00
|
43
43
|
default_executable:
|
44
44
|
dependencies:
|
45
45
|
- !ruby/object:Gem::Dependency
|
@@ -203,6 +203,7 @@ files:
|
|
203
203
|
- lib/rdoc/markup/paragraph.rb
|
204
204
|
- lib/rdoc/markup/parser.rb
|
205
205
|
- lib/rdoc/markup/preprocess.rb
|
206
|
+
- lib/rdoc/markup/raw.rb
|
206
207
|
- lib/rdoc/markup/rule.rb
|
207
208
|
- lib/rdoc/markup/to_ansi.rb
|
208
209
|
- lib/rdoc/markup/to_bs.rb
|
@@ -257,6 +258,7 @@ files:
|
|
257
258
|
- test/test_rdoc_markup_paragraph.rb
|
258
259
|
- test/test_rdoc_markup_parser.rb
|
259
260
|
- test/test_rdoc_markup_pre_process.rb
|
261
|
+
- test/test_rdoc_markup_raw.rb
|
260
262
|
- test/test_rdoc_markup_to_ansi.rb
|
261
263
|
- test/test_rdoc_markup_to_bs.rb
|
262
264
|
- test/test_rdoc_markup_to_html.rb
|
@@ -332,6 +334,7 @@ test_files:
|
|
332
334
|
- test/test_rdoc_markup_paragraph.rb
|
333
335
|
- test/test_rdoc_markup_parser.rb
|
334
336
|
- test/test_rdoc_markup_pre_process.rb
|
337
|
+
- test/test_rdoc_markup_raw.rb
|
335
338
|
- test/test_rdoc_markup_to_ansi.rb
|
336
339
|
- test/test_rdoc_markup_to_bs.rb
|
337
340
|
- test/test_rdoc_markup_to_html.rb
|
metadata.gz.sig
CHANGED
Binary file
|