yard 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of yard might be problematic. Click here for more details.
- data/ChangeLog +205 -0
- data/README.md +52 -73
- data/Rakefile +17 -2
- data/docs/GettingStarted.md +6 -2
- data/lib/yard.rb +1 -1
- data/lib/yard/cli/yri.rb +1 -1
- data/lib/yard/code_objects/macro_object.rb +1 -1
- data/lib/yard/handlers/base.rb +1 -1
- data/lib/yard/handlers/ruby/attribute_handler.rb +1 -1
- data/lib/yard/handlers/ruby/base.rb +2 -2
- data/lib/yard/handlers/ruby/exception_handler.rb +9 -7
- data/lib/yard/handlers/ruby/legacy/exception_handler.rb +3 -4
- data/lib/yard/handlers/ruby/visibility_handler.rb +1 -1
- data/lib/yard/parser/c_parser.rb +40 -5
- data/lib/yard/parser/ruby/ast_node.rb +2 -1
- data/lib/yard/parser/ruby/ruby_parser.rb +47 -7
- data/lib/yard/parser/source_parser.rb +13 -2
- data/lib/yard/rubygems/specification.rb +2 -2
- data/lib/yard/templates/helpers/html_helper.rb +13 -8
- data/lib/yard/templates/helpers/markup_helper.rb +1 -1
- data/lib/yard/verifier.rb +2 -2
- data/spec/cli/server_spec.rb +7 -6
- data/spec/cli/yri_spec.rb +1 -1
- data/spec/code_objects/extra_file_object_spec.rb +1 -1
- data/spec/config_spec.rb +0 -1
- data/spec/handlers/base_spec.rb +2 -2
- data/spec/handlers/constant_handler_spec.rb +1 -1
- data/spec/handlers/examples/exception_handler_001.rb.txt +4 -0
- data/spec/handlers/exception_handler_spec.rb +4 -0
- data/spec/handlers/ruby/base_spec.rb +3 -3
- data/spec/parser/c_parser_spec.rb +100 -11
- data/spec/parser/ruby/ast_node_spec.rb +2 -1
- data/spec/parser/ruby/ruby_parser_spec.rb +43 -2
- data/spec/parser/source_parser_spec.rb +2 -1
- data/spec/templates/examples/method001.html +3 -2
- data/spec/templates/helpers/html_helper_spec.rb +26 -5
- data/templates/default/fulldoc/html/css/full_list.css +2 -0
- data/templates/default/fulldoc/html/css/style.css +2 -0
- data/templates/default/fulldoc/html/full_list_methods.erb +1 -1
- data/templates/default/fulldoc/html/js/full_list.js +23 -6
- data/templates/default/tags/html/option.erb +2 -2
- data/templates/guide/fulldoc/html/css/style.css +2 -0
- metadata +23 -28
@@ -96,7 +96,7 @@ module YARD
|
|
96
96
|
|
97
97
|
# Show error message telling user to install first potential provider
|
98
98
|
name, lib = *[providers.first[:const], providers.first[:lib] || type]
|
99
|
-
log.error "Missing '#{lib}' gem for #{
|
99
|
+
log.error "Missing '#{lib}' gem for #{type.to_s.capitalize} formatting. Install it with `gem install #{lib}`"
|
100
100
|
false
|
101
101
|
end
|
102
102
|
|
data/lib/yard/verifier.rb
CHANGED
@@ -118,7 +118,7 @@ module YARD
|
|
118
118
|
# @return [void]
|
119
119
|
def unmodify_nilclass
|
120
120
|
NILCLASS_METHODS.each do |meth|
|
121
|
-
NilClass.send(:
|
121
|
+
NilClass.send(:remove_method, meth)
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
@@ -145,4 +145,4 @@ module YARD
|
|
145
145
|
expr
|
146
146
|
end
|
147
147
|
end
|
148
|
-
end
|
148
|
+
end
|
data/spec/cli/server_spec.rb
CHANGED
@@ -87,8 +87,8 @@ describe YARD::CLI::Server do
|
|
87
87
|
end
|
88
88
|
|
89
89
|
it "should accept --docroot" do
|
90
|
-
@server_options[:DocumentRoot] = '/
|
91
|
-
run '--docroot', '/
|
90
|
+
@server_options[:DocumentRoot] = Dir.pwd + '/__foo/bar'
|
91
|
+
run '--docroot', '__foo/bar'
|
92
92
|
end
|
93
93
|
|
94
94
|
it "should accept -a webrick to create WEBrick adapter" do
|
@@ -156,15 +156,16 @@ describe YARD::CLI::Server do
|
|
156
156
|
it "should load ruby code (-e) after adapter" do
|
157
157
|
unstub_adapter
|
158
158
|
@cli.adapter = Server::WebrickAdapter
|
159
|
-
File.
|
160
|
-
|
159
|
+
path = File.dirname(__FILE__) + '/tmp.adapterscript.rb'
|
160
|
+
begin
|
161
|
+
File.open(path, 'w') do |f|
|
161
162
|
f.puts "YARD::Templates::Engine.register_template_path 'foo'"
|
162
163
|
f.flush
|
163
164
|
run '-e', f.path
|
164
165
|
Templates::Engine.template_paths.last.should == 'foo'
|
165
|
-
ensure
|
166
|
-
File.unlink(f.path)
|
167
166
|
end
|
167
|
+
ensure
|
168
|
+
File.unlink(path)
|
168
169
|
end
|
169
170
|
end
|
170
171
|
end
|
data/spec/cli/yri_spec.rb
CHANGED
@@ -70,7 +70,7 @@ describe YARD::CLI::Yardoc do
|
|
70
70
|
@yri.should_receive(:print_object).with(obj)
|
71
71
|
@yri.run('Foo')
|
72
72
|
Registry.clear
|
73
|
-
end
|
73
|
+
end unless ENV['CI'] # FIXME make this work on Travis CI
|
74
74
|
|
75
75
|
it "should print usage if no object is provided" do
|
76
76
|
@yri.should_receive(:print_usage)
|
@@ -70,7 +70,7 @@ describe YARD::CodeObjects::ExtraFileObject do
|
|
70
70
|
data = "# @encoding sjis\nFOO"
|
71
71
|
data.force_encoding('binary')
|
72
72
|
file = ExtraFileObject.new('file.txt', data)
|
73
|
-
file.contents.encoding.to_s
|
73
|
+
['Shift_JIS', 'Windows-31J'].should include(file.contents.encoding.to_s)
|
74
74
|
end if RUBY19
|
75
75
|
|
76
76
|
it "should warn if @encoding is invalid" do
|
data/spec/config_spec.rb
CHANGED
@@ -90,7 +90,6 @@ describe YARD::Config do
|
|
90
90
|
|
91
91
|
describe '.load_plugins' do
|
92
92
|
it "should load gem plugins if :load_plugins is true" do
|
93
|
-
File.should_receive(:file?).with(CLI::Yardoc::DEFAULT_YARDOPTS_FILE).and_return(false)
|
94
93
|
YARD::Config.stub!(:options).and_return(:load_plugins => true, :ignored_plugins => [], :autoload_plugins => [])
|
95
94
|
YARD::Config.stub!(:load_plugin)
|
96
95
|
YARD::Config.should_receive(:require).with('rubygems')
|
data/spec/handlers/base_spec.rb
CHANGED
@@ -140,10 +140,10 @@ describe YARD::Handlers::Base do
|
|
140
140
|
end
|
141
141
|
|
142
142
|
def create_handler(stmts, parser_type)
|
143
|
-
|
143
|
+
$handler_counter ||= 0
|
144
144
|
sklass = parser_type == :ruby ? "Base" : "Legacy::Base"
|
145
145
|
instance_eval(<<-eof)
|
146
|
-
class ::InFileHandler#{
|
146
|
+
class ::InFileHandler#{$handler_counter += 1} < Handlers::Ruby::#{sklass}
|
147
147
|
handles /^class/
|
148
148
|
#{stmts}
|
149
149
|
def process; MethodObject.new(:root, :FOO) end
|
@@ -12,7 +12,7 @@ describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}ConstantHandle
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it "should maintain newlines" do
|
15
|
-
Registry.at("A::B::MYCONSTANT").value.should == "A +\nB +\nC +\nD"
|
15
|
+
Registry.at("A::B::MYCONSTANT").value.gsub("\r", "").should == "A +\nB +\nC +\nD"
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should turn Const = Struct.new(:sym) into class Const with attr :sym" do
|
@@ -41,4 +41,8 @@ describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}ExceptionHandl
|
|
41
41
|
P('Testing#mymethod10').tag(:raise).should be_nil
|
42
42
|
P('Testing#mymethod11').tag(:raise).should be_nil
|
43
43
|
end
|
44
|
+
|
45
|
+
it "should ignore empty raise call" do
|
46
|
+
P('Testing#mymethod12').tag(:raise).should be_nil
|
47
|
+
end
|
44
48
|
end
|
@@ -58,11 +58,11 @@ describe YARD::Handlers::Ruby::Base, '#valid_handler?' do
|
|
58
58
|
|
59
59
|
it "should handle AstNode input (matches AST literally)" do
|
60
60
|
class ASTHandler < Handlers::Ruby::Base
|
61
|
-
handles s(:
|
61
|
+
handles s(:vcall, s(:ident, "hello_world"))
|
62
62
|
end
|
63
63
|
Handlers::Base.stub!(:subclasses).and_return [ASTHandler]
|
64
|
-
valid ASTHandler, s(:
|
65
|
-
invalid ASTHandler, s(:
|
64
|
+
valid ASTHandler, s(:vcall, s(:ident, "hello_world"))
|
65
|
+
invalid ASTHandler, s(:vcall, s(:ident, "NOTHELLOWORLD"))
|
66
66
|
end
|
67
67
|
|
68
68
|
it "should handle #method_call(:methname) on a valid AST" do
|
@@ -11,6 +11,11 @@ describe YARD::Parser::CParser do
|
|
11
11
|
@parser.parse
|
12
12
|
end
|
13
13
|
|
14
|
+
def parse
|
15
|
+
Registry.clear
|
16
|
+
Parser::CParser.new(@contents).parse
|
17
|
+
end
|
18
|
+
|
14
19
|
describe 'Array class' do
|
15
20
|
it "should parse Array class" do
|
16
21
|
obj = YARD::Registry.at('Array')
|
@@ -32,11 +37,6 @@ describe YARD::Parser::CParser do
|
|
32
37
|
@contents = File.read(@multifile)
|
33
38
|
end
|
34
39
|
|
35
|
-
def parse
|
36
|
-
Registry.clear
|
37
|
-
Parser::CParser.new(@contents).parse
|
38
|
-
end
|
39
|
-
|
40
40
|
it "should look for methods in extra files (if 'in' comment is found)" do
|
41
41
|
extra_contents = File.read(@extrafile)
|
42
42
|
File.should_receive(:read).with('extra.c').and_return(extra_contents)
|
@@ -52,12 +52,7 @@ describe YARD::Parser::CParser do
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
describe 'Foo' do
|
56
|
-
def parse
|
57
|
-
Registry.clear
|
58
|
-
Parser::CParser.new(@contents).parse
|
59
|
-
end
|
60
|
-
|
55
|
+
describe 'Foo class' do
|
61
56
|
it 'should not include comments in docstring source' do
|
62
57
|
@contents = <<-eof
|
63
58
|
/*
|
@@ -76,6 +71,100 @@ describe YARD::Parser::CParser do
|
|
76
71
|
"VALUE foo(VALUE x) { int value = x;\n}"
|
77
72
|
end
|
78
73
|
end
|
74
|
+
|
75
|
+
describe 'Defining methods with source in other files' do
|
76
|
+
it "should look in another file for method" do
|
77
|
+
File.should_receive(:read).at_least(1).times.with('file.c').and_return(<<-eof)
|
78
|
+
/* FOO
|
79
|
+
*/
|
80
|
+
VALUE foo(VALUE x)
|
81
|
+
{ }
|
82
|
+
|
83
|
+
/* BAR
|
84
|
+
*/
|
85
|
+
VALUE bar(VALUE x)
|
86
|
+
{ }
|
87
|
+
eof
|
88
|
+
@contents = <<-eof
|
89
|
+
void Init_Foo() {
|
90
|
+
rb_define_method(rb_cFoo, "foo", foo, 1); /* in file.c */
|
91
|
+
rb_define_global_function("bar", bar, 1); /* in file.c */
|
92
|
+
}
|
93
|
+
eof
|
94
|
+
parse
|
95
|
+
Registry.at('Foo#foo').docstring.should == 'FOO'
|
96
|
+
Registry.at('Kernel#bar').docstring.should == 'BAR'
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should allow extra file to include /'s and other filename characters" do
|
100
|
+
File.should_receive(:read).at_least(1).times.with('ext/a-file.c').and_return(<<-eof)
|
101
|
+
/* FOO
|
102
|
+
*/
|
103
|
+
VALUE foo(VALUE x) {
|
104
|
+
int value = x;
|
105
|
+
}
|
106
|
+
|
107
|
+
/* BAR
|
108
|
+
*/
|
109
|
+
VALUE bar(VALUE x) {
|
110
|
+
int value = x;
|
111
|
+
}
|
112
|
+
eof
|
113
|
+
@contents = <<-eof
|
114
|
+
void Init_Foo() {
|
115
|
+
rb_define_method(rb_cFoo, "foo", foo, 1); /* in ext/a-file.c */
|
116
|
+
rb_define_global_function("bar", bar, 1); /* in ext/a-file.c */
|
117
|
+
}
|
118
|
+
eof
|
119
|
+
parse
|
120
|
+
Registry.at('Foo#foo').docstring.should == 'FOO'
|
121
|
+
Registry.at('Kernel#bar').docstring.should == 'BAR'
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
describe 'Defining attributes' do
|
126
|
+
before do
|
127
|
+
Registry.clear
|
128
|
+
end
|
129
|
+
|
130
|
+
def run(read, write, commented = nil)
|
131
|
+
@contents = <<-eof
|
132
|
+
/* FOO */
|
133
|
+
VALUE foo(VALUE x) { int value = x; }
|
134
|
+
void Init_Foo() {
|
135
|
+
rb_cFoo = rb_define_class("Foo", rb_cObject);
|
136
|
+
#{commented ? '/*' : ''}
|
137
|
+
rb_define_attr(rb_cFoo, "foo", foo, #{read}, #{write});
|
138
|
+
#{commented ? '*/' : ''}
|
139
|
+
}
|
140
|
+
eof
|
141
|
+
parse
|
142
|
+
end
|
143
|
+
|
144
|
+
it "should handle readonly attribute (rb_define_attr)" do
|
145
|
+
run(1, 0)
|
146
|
+
Registry.at('Foo#foo').should be_reader
|
147
|
+
Registry.at('Foo#foo=').should be_nil
|
148
|
+
end
|
149
|
+
|
150
|
+
it "should handle writeonly attribute (rb_define_attr)" do
|
151
|
+
run(0, 1)
|
152
|
+
Registry.at('Foo#foo').should be_nil
|
153
|
+
Registry.at('Foo#foo=').should be_writer
|
154
|
+
end
|
155
|
+
|
156
|
+
it "should handle readwrite attribute (rb_define_attr)" do
|
157
|
+
run(1, 1)
|
158
|
+
Registry.at('Foo#foo').should be_reader
|
159
|
+
Registry.at('Foo#foo=').should be_writer
|
160
|
+
end
|
161
|
+
|
162
|
+
it "should handle commented writeonly attribute (/* rb_define_attr */)" do
|
163
|
+
run(1, 1, true)
|
164
|
+
Registry.at('Foo#foo').should be_reader
|
165
|
+
Registry.at('Foo#foo=').should be_writer
|
166
|
+
end
|
167
|
+
end
|
79
168
|
end
|
80
169
|
|
81
170
|
describe '#find_override_comment' do
|
@@ -22,7 +22,8 @@ describe YARD::Parser::Ruby::AstNode do
|
|
22
22
|
obj = YARD::Parser::Ruby::RubyParser.parse("# x\nbye", "x").ast
|
23
23
|
out = StringIO.new
|
24
24
|
PP.pp(obj, out)
|
25
|
-
|
25
|
+
vcall = RUBY_VERSION >= '1.9.3' ? 'vcall' : 'var_ref'
|
26
|
+
out.string.should == "s(s(:#{vcall},\n" +
|
26
27
|
" s(:ident, \"bye\", line: 2..2, source: 4..6),\n" +
|
27
28
|
" docstring: \"x\",\n" +
|
28
29
|
" line: 2..2,\n" +
|
@@ -179,7 +179,7 @@ describe YARD::Parser::Ruby::RubyParser do
|
|
179
179
|
s.line_range.to_a.should == [1, 2]
|
180
180
|
end
|
181
181
|
|
182
|
-
it "should show proper source for heredoc" do
|
182
|
+
it "should show proper source for inline heredoc" do
|
183
183
|
src = "def foo\n foo(<<-XML, 1, 2)\n bar\n\n XML\nend"
|
184
184
|
s = stmt(src)
|
185
185
|
t = tokenize(src)
|
@@ -187,11 +187,27 @@ describe YARD::Parser::Ruby::RubyParser do
|
|
187
187
|
t.map {|x| x[1] }.join.should == src
|
188
188
|
end
|
189
189
|
|
190
|
+
it "should show proper source for regular heredoc" do
|
191
|
+
src = "def foo\n x = <<-XML\n Hello \#{name}!\n Bye!\n XML\nend"
|
192
|
+
s = stmt(src)
|
193
|
+
t = tokenize(src)
|
194
|
+
s.source.should == src
|
195
|
+
t.map {|x| x[1] }.join.should == src
|
196
|
+
end
|
197
|
+
|
198
|
+
it "should show proper source for heredoc with comment" do
|
199
|
+
src = "def foo\n x = <<-XML # HI!\n Hello \#{name}!\n Bye!\n XML\nend"
|
200
|
+
s = stmt(src)
|
201
|
+
t = tokenize(src)
|
202
|
+
s.source.should == src
|
203
|
+
t.map {|x| x[1] }.join.should == src
|
204
|
+
end
|
205
|
+
|
190
206
|
it "should show proper source for string" do
|
191
207
|
["'", '"'].each do |q|
|
192
208
|
src = "#{q}hello\n\nworld#{q}"
|
193
209
|
s = stmt(src)
|
194
|
-
s.jump(:string_content)
|
210
|
+
s.jump(:string_content).source.should == "hello\n\nworld"
|
195
211
|
s.source.should == src
|
196
212
|
end
|
197
213
|
|
@@ -204,6 +220,11 @@ describe YARD::Parser::Ruby::RubyParser do
|
|
204
220
|
stmt(src).jump(:qwords_literal).source.should == src
|
205
221
|
end
|
206
222
|
|
223
|
+
it "should show proper source for %w{} array" do
|
224
|
+
src = "%w{\na b c\n d e f\n}"
|
225
|
+
stmt(src).jump(:array).source.should == src
|
226
|
+
end
|
227
|
+
|
207
228
|
it "should parse %w() array in constant declaration" do
|
208
229
|
s = stmt(<<-eof)
|
209
230
|
class Foo
|
@@ -211,6 +232,26 @@ describe YARD::Parser::Ruby::RubyParser do
|
|
211
232
|
end
|
212
233
|
eof
|
213
234
|
s.jump(:qwords_literal).source.should == '%w( foo bar )'
|
235
|
+
if RUBY_VERSION >= '1.9.3' # ripper fix: array node encapsulates qwords
|
236
|
+
s.jump(:array).source.should == '%w( foo bar )'
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
it "should parse [] as array" do
|
241
|
+
s = stmt(<<-eof)
|
242
|
+
class Foo
|
243
|
+
FOO = ['foo', 'bar']
|
244
|
+
end
|
245
|
+
eof
|
246
|
+
s.jump(:array).source.should == "['foo', 'bar']"
|
247
|
+
end
|
248
|
+
|
249
|
+
it "should show source for unary minus" do
|
250
|
+
stmt("X = - 1").jump(:unary).source.should == '- 1'
|
251
|
+
end
|
252
|
+
|
253
|
+
it "should show source for unary exclamation" do
|
254
|
+
stmt("X = !1").jump(:unary).source.should == '!1'
|
214
255
|
end
|
215
256
|
end
|
216
257
|
end if HAVE_RIPPER
|
@@ -487,7 +487,8 @@ describe YARD::Parser::SourceParser do
|
|
487
487
|
File.should_receive(:read_binary).with('tmpfile').and_return(src)
|
488
488
|
result = parser.parse("tmpfile")
|
489
489
|
if HAVE_RIPPER && RUBY19
|
490
|
-
|
490
|
+
['Shift_JIS', 'Windows-31J'].send(msg, include(
|
491
|
+
result.enumerator[0].source.encoding.to_s))
|
491
492
|
end
|
492
493
|
result.encoding_line.send(msg) == src.split("\n").last
|
493
494
|
end
|
@@ -63,7 +63,7 @@ Comments
|
|
63
63
|
|
64
64
|
</span>
|
65
65
|
— <div class='inline'>first key</div>
|
66
|
-
</
|
66
|
+
</li>
|
67
67
|
|
68
68
|
<li>
|
69
69
|
<span class="name">:key2</span>
|
@@ -72,10 +72,11 @@ Comments
|
|
72
72
|
|
73
73
|
</span>
|
74
74
|
— <div class='inline'>second key</div>
|
75
|
-
</
|
75
|
+
</li>
|
76
76
|
|
77
77
|
</ul>
|
78
78
|
|
79
|
+
|
79
80
|
<h3>Returns:</h3>
|
80
81
|
<ul class="return">
|
81
82
|
|
@@ -39,7 +39,8 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
39
39
|
|
40
40
|
it "should take file encoding if there is a file" do
|
41
41
|
@file = OpenStruct.new(:contents => 'foo'.force_encoding('sjis'))
|
42
|
-
|
42
|
+
# not the correct charset name, but good enough
|
43
|
+
['Shift_JIS', 'Windows-31J'].should include(charset)
|
43
44
|
end if RUBY19
|
44
45
|
|
45
46
|
it "should take file encoding if there is a file" do
|
@@ -114,7 +115,7 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
114
115
|
end
|
115
116
|
|
116
117
|
it "should highlight ruby if markup is :ruby" do
|
117
|
-
htmlify("class Foo; end", :ruby).should =~ /\A<pre class="code"><span/
|
118
|
+
htmlify("class Foo; end", :ruby).should =~ /\A<pre class="code ruby"><span/
|
118
119
|
end
|
119
120
|
|
120
121
|
it "should include file and htmlify it" do
|
@@ -194,6 +195,20 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
194
195
|
stub!(:serializer).and_return(serializer)
|
195
196
|
link_object("YARD").should =~ %r{>YARD</a>}
|
196
197
|
end
|
198
|
+
|
199
|
+
it "should escape method name in title" do
|
200
|
+
YARD.parse_string <<-'eof'
|
201
|
+
class Array
|
202
|
+
def &(other)
|
203
|
+
end
|
204
|
+
end
|
205
|
+
eof
|
206
|
+
obj = Registry.at('Array#&')
|
207
|
+
serializer = Serializers::FileSystemSerializer.new
|
208
|
+
stub!(:serializer).and_return(serializer)
|
209
|
+
stub!(:object).and_return(obj)
|
210
|
+
link_object("Array#&").should =~ %r{title="Array#& \(method\)"}
|
211
|
+
end
|
197
212
|
end
|
198
213
|
|
199
214
|
describe '#url_for' do
|
@@ -257,8 +272,14 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
257
272
|
end
|
258
273
|
|
259
274
|
it "should escape {} syntax with backslash (\\{foo bar})" do
|
260
|
-
input = '\{foo bar} \{XYZ} \{file:FOO}'
|
261
|
-
output = '{foo bar} {XYZ} {file:FOO}'
|
275
|
+
input = '\{foo bar} \{XYZ} \{file:FOO} $\{N-M}'
|
276
|
+
output = '{foo bar} {XYZ} {file:FOO} ${N-M}'
|
277
|
+
resolve_links(input).should == output
|
278
|
+
end
|
279
|
+
|
280
|
+
it "should escape {} syntax with ! (!{foo bar})" do
|
281
|
+
input = '!{foo bar} !{XYZ} !{file:FOO} $!{N-M}'
|
282
|
+
output = '{foo bar} {XYZ} {file:FOO} ${N-M}'
|
262
283
|
resolve_links(input).should == output
|
263
284
|
end
|
264
285
|
|
@@ -492,7 +513,7 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
492
513
|
|
493
514
|
it "should highlight as ruby if htmlify(text, :ruby) is called" do
|
494
515
|
should_receive(:html_syntax_highlight_ruby).with('def x; end').and_return('x')
|
495
|
-
htmlify('def x; end', :ruby).should == '<pre class="code">x</pre>'
|
516
|
+
htmlify('def x; end', :ruby).should == '<pre class="code ruby">x</pre>'
|
496
517
|
end
|
497
518
|
end
|
498
519
|
|