yard 0.7.5 → 0.8.0
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/.yardopts +10 -2
- data/ChangeLog +1263 -38
- data/LEGAL +5 -5
- data/LICENSE +1 -1
- data/README.md +91 -82
- data/Rakefile +6 -6
- data/benchmarks/builtins_vs_eval.rb +1 -1
- data/benchmarks/erb_vs_erubis.rb +4 -4
- data/benchmarks/generation.rb +5 -5
- data/benchmarks/parsing.rb +2 -2
- data/benchmarks/registry_store_types.rb +48 -0
- data/bin/yard +9 -1
- data/bin/yardoc +9 -1
- data/bin/yri +10 -2
- data/docs/CodeObjects.md +10 -10
- data/docs/GettingStarted.md +85 -83
- data/docs/Handlers.md +21 -21
- data/docs/Overview.md +7 -7
- data/docs/Parser.md +30 -30
- data/docs/Tags.md +250 -554
- data/docs/TagsArch.md +123 -0
- data/docs/Templates.md +58 -80
- data/docs/WhatsNew.md +378 -133
- data/docs/templates/default/fulldoc/html/full_list_tag.erb +7 -0
- data/docs/templates/default/fulldoc/html/setup.rb +6 -0
- data/docs/templates/default/layout/html/setup.rb +8 -0
- data/docs/templates/default/layout/html/tag_list.erb +11 -0
- data/docs/templates/default/yard_tags/html/list.erb +18 -0
- data/docs/templates/default/yard_tags/html/setup.rb +27 -0
- data/docs/templates/plugin.rb +65 -0
- data/lib/yard.rb +1 -10
- data/lib/yard/autoload.rb +75 -27
- data/lib/yard/cli/command.rb +5 -2
- data/lib/yard/cli/command_parser.rb +3 -2
- data/lib/yard/cli/diff.rb +1 -1
- data/lib/yard/cli/i18n.rb +69 -0
- data/lib/yard/cli/list.rb +1 -1
- data/lib/yard/cli/server.rb +30 -7
- data/lib/yard/cli/stats.rb +5 -6
- data/lib/yard/cli/yardoc.rb +95 -45
- data/lib/yard/cli/yri.rb +24 -3
- data/lib/yard/code_objects/base.rb +35 -4
- data/lib/yard/code_objects/extra_file_object.rb +1 -1
- data/lib/yard/code_objects/macro_object.rb +56 -99
- data/lib/yard/code_objects/method_object.rb +44 -6
- data/lib/yard/config.rb +18 -8
- data/lib/yard/core_ext/symbol_hash.rb +1 -1
- data/lib/yard/docstring.rb +45 -85
- data/lib/yard/docstring_parser.rb +269 -0
- data/lib/yard/handlers/base.rb +129 -118
- data/lib/yard/handlers/c/alias_handler.rb +15 -0
- data/lib/yard/handlers/c/attribute_handler.rb +13 -0
- data/lib/yard/handlers/c/base.rb +110 -0
- data/lib/yard/handlers/c/class_handler.rb +26 -0
- data/lib/yard/handlers/c/constant_handler.rb +12 -0
- data/lib/yard/handlers/c/handler_methods.rb +165 -0
- data/lib/yard/handlers/c/init_handler.rb +16 -0
- data/lib/yard/handlers/c/method_handler.rb +35 -0
- data/lib/yard/handlers/c/mixin_handler.rb +13 -0
- data/lib/yard/handlers/c/module_handler.rb +16 -0
- data/lib/yard/handlers/c/override_comment_handler.rb +22 -0
- data/lib/yard/handlers/c/path_handler.rb +10 -0
- data/lib/yard/handlers/c/struct_handler.rb +12 -0
- data/lib/yard/handlers/c/symbol_handler.rb +7 -0
- data/lib/yard/handlers/processor.rb +41 -30
- data/lib/yard/handlers/ruby/alias_handler.rb +0 -2
- data/lib/yard/handlers/ruby/attribute_handler.rb +16 -17
- data/lib/yard/handlers/ruby/base.rb +10 -6
- data/lib/yard/handlers/ruby/comment_handler.rb +9 -0
- data/lib/yard/handlers/ruby/dsl_handler.rb +14 -0
- data/lib/yard/handlers/ruby/dsl_handler_methods.rb +71 -0
- data/lib/yard/handlers/ruby/legacy/alias_handler.rb +0 -3
- data/lib/yard/handlers/ruby/legacy/attribute_handler.rb +16 -17
- data/lib/yard/handlers/ruby/legacy/base.rb +28 -6
- data/lib/yard/handlers/ruby/legacy/comment_handler.rb +9 -0
- data/lib/yard/handlers/ruby/legacy/dsl_handler.rb +16 -0
- data/lib/yard/handlers/ruby/legacy/method_handler.rb +0 -2
- data/lib/yard/handlers/ruby/legacy/mixin_handler.rb +1 -1
- data/lib/yard/handlers/ruby/legacy/module_function_handler.rb +18 -0
- data/lib/yard/handlers/ruby/method_handler.rb +10 -15
- data/lib/yard/handlers/ruby/mixin_handler.rb +1 -1
- data/lib/yard/handlers/ruby/module_function_handler.rb +26 -0
- data/lib/yard/handlers/ruby/struct_handler_methods.rb +3 -2
- data/lib/yard/i18n/pot_generator.rb +281 -0
- data/lib/yard/i18n/text.rb +72 -0
- data/lib/yard/logging.rb +3 -7
- data/lib/yard/options.rb +216 -0
- data/lib/yard/parser/c/c_parser.rb +225 -0
- data/lib/yard/parser/c/comment_parser.rb +131 -0
- data/lib/yard/parser/c/statement.rb +63 -0
- data/lib/yard/parser/ruby/ast_node.rb +91 -1
- data/lib/yard/parser/ruby/legacy/ruby_parser.rb +1 -0
- data/lib/yard/parser/ruby/legacy/statement.rb +7 -2
- data/lib/yard/parser/ruby/legacy/statement_list.rb +13 -22
- data/lib/yard/parser/ruby/ruby_parser.rb +87 -26
- data/lib/yard/parser/source_parser.rb +89 -88
- data/lib/yard/rake/yardoc_task.rb +1 -1
- data/lib/yard/registry.rb +21 -10
- data/lib/yard/registry_store.rb +48 -0
- data/lib/yard/serializers/file_system_serializer.rb +18 -20
- data/lib/yard/serializers/yardoc_serializer.rb +1 -0
- data/lib/yard/server/adapter.rb +2 -2
- data/lib/yard/server/commands/base.rb +1 -1
- data/lib/yard/server/commands/display_object_command.rb +13 -6
- data/lib/yard/server/commands/frames_command.rb +4 -21
- data/lib/yard/server/commands/library_command.rb +57 -11
- data/lib/yard/server/commands/list_command.rb +10 -34
- data/lib/yard/server/commands/search_command.rb +8 -2
- data/lib/yard/server/doc_server_helper.rb +34 -0
- data/lib/yard/server/rack_adapter.rb +5 -1
- data/lib/yard/server/router.rb +4 -10
- data/lib/yard/server/static_caching.rb +2 -2
- data/lib/yard/server/templates/default/fulldoc/html/css/custom.css +2 -2
- data/lib/yard/server/templates/default/fulldoc/html/js/live.js +0 -15
- data/lib/yard/server/templates/default/layout/html/breadcrumb.erb +3 -3
- data/lib/yard/server/templates/default/layout/html/script_setup.erb +8 -0
- data/lib/yard/server/templates/doc_server/processing/html/processing.erb +1 -1
- data/lib/yard/server/templates/doc_server/search/html/setup.rb +1 -1
- data/lib/yard/tags/default_factory.rb +31 -4
- data/lib/yard/tags/directives.rb +593 -0
- data/lib/yard/tags/library.rb +437 -35
- data/lib/yard/templates/engine.rb +17 -12
- data/lib/yard/templates/helpers/base_helper.rb +8 -2
- data/lib/yard/templates/helpers/html_helper.rb +57 -14
- data/lib/yard/templates/helpers/markup/rdoc_markup.rb +1 -1
- data/lib/yard/templates/helpers/markup_helper.rb +9 -9
- data/lib/yard/templates/helpers/text_helper.rb +2 -2
- data/lib/yard/templates/template.rb +42 -13
- data/lib/yard/templates/template_options.rb +81 -0
- data/spec/cli/command_parser_spec.rb +4 -4
- data/spec/cli/command_spec.rb +3 -3
- data/spec/cli/config_spec.rb +13 -13
- data/spec/cli/diff_spec.rb +13 -10
- data/spec/cli/gems_spec.rb +12 -12
- data/spec/cli/help_spec.rb +2 -2
- data/spec/cli/i18n_spec.rb +111 -0
- data/spec/cli/server_spec.rb +66 -18
- data/spec/cli/stats_spec.rb +15 -15
- data/spec/cli/yardoc_spec.rb +124 -97
- data/spec/cli/yri_spec.rb +14 -12
- data/spec/code_objects/base_spec.rb +104 -46
- data/spec/code_objects/class_object_spec.rb +33 -33
- data/spec/code_objects/code_object_list_spec.rb +5 -5
- data/spec/code_objects/constants_spec.rb +4 -3
- data/spec/code_objects/extra_file_object_spec.rb +19 -19
- data/spec/code_objects/macro_object_spec.rb +31 -37
- data/spec/code_objects/method_object_spec.rb +46 -23
- data/spec/code_objects/module_object_spec.rb +16 -16
- data/spec/code_objects/namespace_object_spec.rb +6 -6
- data/spec/code_objects/proxy_spec.rb +19 -19
- data/spec/config_spec.rb +33 -24
- data/spec/core_ext/array_spec.rb +1 -1
- data/spec/core_ext/file_spec.rb +8 -8
- data/spec/core_ext/hash_spec.rb +1 -1
- data/spec/core_ext/insertion_spec.rb +3 -3
- data/spec/core_ext/module_spec.rb +1 -1
- data/spec/core_ext/string_spec.rb +6 -6
- data/spec/core_ext/symbol_hash_spec.rb +11 -11
- data/spec/docstring_parser_spec.rb +207 -0
- data/spec/docstring_spec.rb +33 -146
- data/spec/handlers/alias_handler_spec.rb +14 -14
- data/spec/handlers/attribute_handler_spec.rb +20 -20
- data/spec/handlers/base_spec.rb +16 -16
- data/spec/handlers/c/alias_handler_spec.rb +33 -0
- data/spec/handlers/c/attribute_handler_spec.rb +40 -0
- data/spec/handlers/c/class_handler_spec.rb +64 -0
- data/spec/handlers/c/constant_handler_spec.rb +68 -0
- data/spec/handlers/c/init_handler_spec.rb +36 -0
- data/spec/handlers/c/method_handler_spec.rb +228 -0
- data/spec/handlers/c/mixin_handler_spec.rb +27 -0
- data/spec/handlers/c/module_handler_spec.rb +38 -0
- data/spec/handlers/c/override_comment_handler_spec.rb +43 -0
- data/spec/handlers/c/path_handler_spec.rb +35 -0
- data/spec/handlers/c/spec_helper.rb +11 -0
- data/spec/handlers/c/struct_handler_spec.rb +15 -0
- data/spec/handlers/class_condition_handler_spec.rb +10 -10
- data/spec/handlers/class_handler_spec.rb +38 -38
- data/spec/handlers/class_variable_handler_spec.rb +1 -1
- data/spec/handlers/constant_handler_spec.rb +7 -7
- data/spec/handlers/{macro_handler_spec.rb → dsl_handler_spec.rb} +72 -53
- data/spec/handlers/examples/alias_handler_001.rb.txt +5 -5
- data/spec/handlers/examples/class_condition_handler_001.rb.txt +9 -9
- data/spec/handlers/examples/class_handler_001.rb.txt +1 -1
- data/spec/handlers/examples/dsl_handler_001.rb.txt +110 -0
- data/spec/handlers/examples/exception_handler_001.rb.txt +14 -14
- data/spec/handlers/examples/method_condition_handler_001.rb.txt +2 -2
- data/spec/handlers/examples/method_handler_001.rb.txt +16 -16
- data/spec/handlers/examples/mixin_handler_001.rb.txt +8 -4
- data/spec/handlers/examples/private_constant_handler_001.rb.txt +1 -1
- data/spec/handlers/examples/visibility_handler_001.rb.txt +3 -3
- data/spec/handlers/examples/yield_handler_001.rb.txt +13 -14
- data/spec/handlers/exception_handler_spec.rb +9 -9
- data/spec/handlers/extend_handler_spec.rb +2 -2
- data/spec/handlers/legacy_base_spec.rb +34 -34
- data/spec/handlers/method_condition_handler_spec.rb +2 -2
- data/spec/handlers/method_handler_spec.rb +33 -33
- data/spec/handlers/mixin_handler_spec.rb +13 -9
- data/spec/handlers/module_function_handler_spec.rb +82 -0
- data/spec/handlers/module_handler_spec.rb +6 -6
- data/spec/handlers/private_constant_handler_spec.rb +3 -3
- data/spec/handlers/processor_spec.rb +5 -5
- data/spec/handlers/ruby/base_spec.rb +10 -6
- data/spec/handlers/ruby/legacy/base_spec.rb +11 -7
- data/spec/handlers/spec_helper.rb +2 -3
- data/spec/handlers/visibility_handler_spec.rb +6 -6
- data/spec/handlers/yield_handler_spec.rb +8 -8
- data/spec/i18n/pot_generator_spec.rb +244 -0
- data/spec/i18n/text_spec.rb +69 -0
- data/spec/options_spec.rb +160 -0
- data/spec/parser/base_spec.rb +3 -3
- data/spec/parser/c_parser_spec.rb +31 -257
- data/spec/parser/examples/array.c.txt +187 -187
- data/spec/parser/examples/extrafile.c.txt +1 -1
- data/spec/parser/examples/override.c.txt +1 -1
- data/spec/parser/ruby/ast_node_spec.rb +1 -1
- data/spec/parser/ruby/legacy/statement_list_spec.rb +24 -24
- data/spec/parser/ruby/legacy/token_list_spec.rb +7 -7
- data/spec/parser/ruby/ruby_parser_spec.rb +56 -34
- data/spec/parser/source_parser_spec.rb +125 -65
- data/spec/parser/tag_parsing_spec.rb +4 -4
- data/spec/rake/yardoc_task_spec.rb +10 -8
- data/spec/registry_spec.rb +65 -36
- data/spec/registry_store_spec.rb +90 -40
- data/spec/serializers/file_system_serializer_spec.rb +12 -12
- data/spec/serializers/yardoc_serializer_spec.rb +2 -2
- data/spec/server/adapter_spec.rb +3 -3
- data/spec/server/commands/base_spec.rb +8 -8
- data/spec/server/commands/library_command_spec.rb +3 -3
- data/spec/server/commands/static_file_command_spec.rb +7 -7
- data/spec/server/doc_server_helper_spec.rb +1 -1
- data/spec/server/doc_server_serializer_spec.rb +6 -6
- data/spec/server/rack_adapter_spec.rb +3 -3
- data/spec/server/router_spec.rb +19 -19
- data/spec/server/static_caching_spec.rb +4 -4
- data/spec/spec_helper.rb +7 -7
- data/spec/tags/default_factory_spec.rb +24 -16
- data/spec/tags/directives_spec.rb +422 -0
- data/spec/tags/library_spec.rb +15 -4
- data/spec/tags/overload_tag_spec.rb +6 -6
- data/spec/tags/ref_tag_list_spec.rb +8 -8
- data/spec/templates/class_spec.rb +7 -7
- data/spec/templates/constant_spec.rb +7 -7
- data/spec/templates/engine_spec.rb +28 -36
- data/spec/templates/examples/class001.html +108 -108
- data/spec/templates/examples/class002.html +17 -17
- data/spec/templates/examples/constant001.txt +1 -1
- data/spec/templates/examples/method001.html +45 -45
- data/spec/templates/examples/method002.html +25 -25
- data/spec/templates/examples/method003.html +60 -60
- data/spec/templates/examples/method004.html +7 -7
- data/spec/templates/examples/method005.html +28 -28
- data/spec/templates/examples/module001.html +321 -321
- data/spec/templates/examples/module001.txt +1 -1
- data/spec/templates/examples/module002.html +130 -130
- data/spec/templates/examples/module003.html +74 -74
- data/spec/templates/examples/module004.html +388 -0
- data/spec/templates/helpers/base_helper_spec.rb +32 -32
- data/spec/templates/helpers/html_helper_spec.rb +87 -68
- data/spec/templates/helpers/html_syntax_highlight_helper_spec.rb +9 -9
- data/spec/templates/helpers/markup/rdoc_markup_spec.rb +16 -16
- data/spec/templates/helpers/markup_helper_spec.rb +31 -28
- data/spec/templates/helpers/method_helper_spec.rb +7 -7
- data/spec/templates/helpers/shared_signature_examples.rb +9 -7
- data/spec/templates/helpers/text_helper_spec.rb +3 -3
- data/spec/templates/method_spec.rb +13 -13
- data/spec/templates/module_spec.rb +70 -24
- data/spec/templates/onefile_spec.rb +32 -15
- data/spec/templates/section_spec.rb +23 -23
- data/spec/templates/spec_helper.rb +31 -1
- data/spec/templates/tag_spec.rb +5 -5
- data/spec/templates/template_spec.rb +54 -46
- data/spec/verifier_spec.rb +5 -5
- data/templates/default/class/setup.rb +2 -2
- data/templates/default/docstring/html/abstract.erb +1 -1
- data/templates/default/docstring/html/note.erb +1 -1
- data/templates/default/docstring/html/private.erb +1 -1
- data/templates/default/docstring/html/todo.erb +1 -1
- data/templates/default/docstring/setup.rb +2 -2
- data/templates/default/fulldoc/html/css/full_list.css +4 -2
- data/templates/default/fulldoc/html/css/style.css +50 -44
- data/templates/default/fulldoc/html/frames.erb +21 -6
- data/templates/default/fulldoc/html/full_list.erb +5 -3
- data/templates/default/fulldoc/html/{full_list_files.erb → full_list_file.erb} +0 -0
- data/templates/default/fulldoc/html/js/app.js +29 -26
- data/templates/default/fulldoc/html/js/full_list.js +9 -9
- data/templates/default/fulldoc/html/js/jquery.js +4 -16
- data/templates/default/fulldoc/html/setup.rb +42 -38
- data/templates/default/layout/dot/header.erb +1 -1
- data/templates/default/layout/html/breadcrumb.erb +6 -6
- data/templates/default/layout/html/files.erb +1 -1
- data/templates/default/layout/html/footer.erb +1 -1
- data/templates/default/layout/html/headers.erb +3 -6
- data/templates/default/layout/html/index.erb +1 -1
- data/templates/default/layout/html/layout.erb +3 -7
- data/templates/default/layout/html/objects.erb +1 -1
- data/templates/default/layout/html/script_setup.erb +5 -0
- data/templates/default/layout/html/search.erb +4 -1
- data/templates/default/layout/html/setup.rb +8 -8
- data/templates/default/method_details/html/method_signature.erb +10 -3
- data/templates/default/method_details/setup.rb +1 -0
- data/templates/default/module/dot/info.erb +1 -1
- data/templates/default/module/dot/setup.rb +2 -2
- data/templates/default/module/html/attribute_details.erb +1 -1
- data/templates/default/module/html/children.erb +1 -1
- data/templates/default/module/html/defines.erb +1 -1
- data/templates/default/module/html/inherited_methods.erb +5 -4
- data/templates/default/module/html/item_summary.erb +15 -5
- data/templates/default/module/html/method_details_list.erb +2 -2
- data/templates/default/module/setup.rb +25 -12
- data/templates/default/module/text/setup.rb +1 -1
- data/templates/default/onefile/html/layout.erb +1 -1
- data/templates/default/onefile/html/setup.rb +2 -2
- data/templates/default/tags/html/example.erb +4 -2
- data/templates/default/tags/html/option.erb +1 -1
- data/templates/default/tags/html/overload.erb +1 -1
- data/templates/default/tags/html/see.erb +1 -1
- data/templates/default/tags/html/tag.erb +1 -1
- data/templates/default/tags/setup.rb +4 -3
- data/templates/guide/fulldoc/html/css/style.css +8 -8
- data/templates/guide/fulldoc/html/js/app.js +6 -6
- data/templates/guide/fulldoc/html/setup.rb +12 -12
- data/templates/guide/layout/html/layout.erb +11 -11
- data/templates/guide/layout/html/setup.rb +9 -9
- data/templates/guide/method/html/header.erb +2 -2
- data/templates/guide/method/html/setup.rb +1 -1
- metadata +68 -18
- data/bin/yard-graph +0 -4
- data/bin/yard-server +0 -4
- data/docs/Glossary.md +0 -12
- data/lib/yard/handlers/ruby/legacy/macro_handler.rb +0 -39
- data/lib/yard/handlers/ruby/macro_handler.rb +0 -40
- data/lib/yard/handlers/ruby/macro_handler_methods.rb +0 -131
- data/lib/yard/parser/c_parser.rb +0 -497
- data/lib/yard/server/templates/default/layout/html/headers.erb +0 -16
- data/lib/yard/server/templates/doc_server/frames/html/frames.erb +0 -13
- data/lib/yard/server/templates/doc_server/frames/html/setup.rb +0 -3
- data/lib/yard/server/templates/doc_server/full_list/html/full_list.erb +0 -34
- data/lib/yard/server/templates/doc_server/full_list/html/setup.rb +0 -20
- data/spec/handlers/examples/macro_handler_001.rb.txt +0 -83
@@ -6,22 +6,27 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
6
6
|
include YARD::Templates::Helpers::BaseHelper
|
7
7
|
include YARD::Templates::Helpers::HtmlHelper
|
8
8
|
include YARD::Templates::Helpers::MethodHelper
|
9
|
-
|
10
|
-
def options
|
9
|
+
|
10
|
+
def options
|
11
|
+
Templates::TemplateOptions.new.tap do |o|
|
12
|
+
o.reset_defaults
|
13
|
+
o.default_return = nil
|
14
|
+
end
|
15
|
+
end
|
11
16
|
|
12
17
|
describe '#h' do
|
13
18
|
it "should use #h to escape HTML" do
|
14
19
|
h('Usage: foo "bar" <baz>').should == "Usage: foo "bar" <baz>"
|
15
20
|
end
|
16
21
|
end
|
17
|
-
|
22
|
+
|
18
23
|
describe '#charset' do
|
19
24
|
it "should return foo if LANG=foo" do
|
20
25
|
ENV.should_receive(:[]).with('LANG').and_return('shift_jis') if RUBY18
|
21
26
|
Encoding.default_external.should_receive(:name).and_return('shift_jis') if defined?(Encoding)
|
22
27
|
charset.should == 'shift_jis'
|
23
28
|
end
|
24
|
-
|
29
|
+
|
25
30
|
['US-ASCII', 'ASCII-7BIT', 'ASCII-8BIT'].each do |type|
|
26
31
|
it "should convert #{type} to iso-8859-1" do
|
27
32
|
ENV.should_receive(:[]).with('LANG').and_return(type) if RUBY18
|
@@ -29,14 +34,14 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
29
34
|
charset.should == 'iso-8859-1'
|
30
35
|
end
|
31
36
|
end
|
32
|
-
|
37
|
+
|
33
38
|
it "should support utf8 as an encoding value for utf-8" do
|
34
39
|
type = 'utf8'
|
35
40
|
ENV.should_receive(:[]).with('LANG').and_return(type) if RUBY18
|
36
41
|
Encoding.default_external.should_receive(:name).and_return(type) if defined?(Encoding)
|
37
42
|
charset.should == 'utf-8'
|
38
43
|
end
|
39
|
-
|
44
|
+
|
40
45
|
it "should take file encoding if there is a file" do
|
41
46
|
@file = OpenStruct.new(:contents => 'foo'.force_encoding('sjis'))
|
42
47
|
# not the correct charset name, but good enough
|
@@ -48,7 +53,7 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
48
53
|
@file = OpenStruct.new(:contents => 'foo')
|
49
54
|
charset.should == 'utf-8'
|
50
55
|
end if RUBY18
|
51
|
-
|
56
|
+
|
52
57
|
if RUBY18
|
53
58
|
it "should return utf-8 if no LANG env is set" do
|
54
59
|
ENV.should_receive(:[]).with('LANG').and_return(nil)
|
@@ -61,7 +66,7 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
61
66
|
end
|
62
67
|
end
|
63
68
|
end
|
64
|
-
|
69
|
+
|
65
70
|
describe '#format_types' do
|
66
71
|
it "should include brackets by default" do
|
67
72
|
text = ["String"]
|
@@ -75,16 +80,16 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
75
80
|
should_receive(:linkify).with("Symbol", "Symbol").and_return("Symbol")
|
76
81
|
format_types(["String", "Symbol"], false).should == "<tt>String</tt>, <tt>Symbol</tt>"
|
77
82
|
end
|
78
|
-
|
79
|
-
{ "String" => [["String"],
|
80
|
-
"<tt><a href=''>String</a></tt>"],
|
81
|
-
"A::B::C" => [["A::B::C"],
|
83
|
+
|
84
|
+
{ "String" => [["String"],
|
85
|
+
"<tt><a href=''>String</a></tt>"],
|
86
|
+
"A::B::C" => [["A::B::C"],
|
82
87
|
"<tt><a href=''>A::B::C</a></tt>"],
|
83
|
-
"Array<String>" => [["Array", "String"],
|
84
|
-
"<tt><a href=''>Array</a><<a href=''>String</a>></tt>"],
|
85
|
-
"Array<String, Symbol>" => [["Array", "String", "Symbol"],
|
88
|
+
"Array<String>" => [["Array", "String"],
|
89
|
+
"<tt><a href=''>Array</a><<a href=''>String</a>></tt>"],
|
90
|
+
"Array<String, Symbol>" => [["Array", "String", "Symbol"],
|
86
91
|
"<tt><a href=''>Array</a><<a href=''>String</a>, <a href=''>Symbol</a>></tt>"],
|
87
|
-
"Array<{String => Array<Symbol>}>" => [["Array", "String", "Array", "Symbol"],
|
92
|
+
"Array<{String => Array<Symbol>}>" => [["Array", "String", "Array", "Symbol"],
|
88
93
|
"<tt><a href=''>Array</a><{<a href=''>String</a> => " +
|
89
94
|
"<a href=''>Array</a><<a href=''>Symbol</a>>}></tt>"]
|
90
95
|
}.each do |text, values|
|
@@ -96,13 +101,13 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
96
101
|
end
|
97
102
|
end
|
98
103
|
end
|
99
|
-
|
104
|
+
|
100
105
|
describe '#htmlify' do
|
101
106
|
it "should not use hard breaks for textile markup (RedCloth specific)" do
|
102
107
|
begin; require 'redcloth'; rescue LoadError; pending 'test requires redcloth gem' end
|
103
108
|
htmlify("A\nB", :textile).should_not include("<br")
|
104
109
|
end
|
105
|
-
|
110
|
+
|
106
111
|
it "should use hard breaks for textile_strict markup (RedCloth specific)" do
|
107
112
|
begin; require 'redcloth'; rescue LoadError; pending 'test requires redcloth gem' end
|
108
113
|
htmlify("A\nB", :textile_strict).should include("<br")
|
@@ -118,7 +123,7 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
118
123
|
it "should return pre-formatted text with :pre markup" do
|
119
124
|
htmlify("fo\no\n\nbar<>", :pre).should == "<pre>fo\no\n\nbar<></pre>"
|
120
125
|
end
|
121
|
-
|
126
|
+
|
122
127
|
it "should return regular text with :text markup" do
|
123
128
|
htmlify("fo\no\n\nbar<>", :text).should == "fo<br/>o<br/><br/>bar<>"
|
124
129
|
end
|
@@ -126,18 +131,18 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
126
131
|
it "should return unmodified text with :none markup" do
|
127
132
|
htmlify("fo\no\n\nbar<>", :none).should == "fo\no\n\nbar<>"
|
128
133
|
end
|
129
|
-
|
134
|
+
|
130
135
|
it "should highlight ruby if markup is :ruby" do
|
131
136
|
htmlify("class Foo; end", :ruby).should =~ /\A<pre class="code ruby"><span/
|
132
137
|
end
|
133
|
-
|
138
|
+
|
134
139
|
it "should include file and htmlify it" do
|
135
140
|
load_markup_provider(:rdoc)
|
136
141
|
File.should_receive(:file?).with('foo.rdoc').and_return(true)
|
137
142
|
File.should_receive(:read).with('foo.rdoc').and_return('HI')
|
138
143
|
htmlify("{include:file:foo.rdoc}", :rdoc).gsub(/\s+/, '').should == "<p><p>HI</p></p>"
|
139
144
|
end
|
140
|
-
|
145
|
+
|
141
146
|
it "should autolink URLs (markdown specific)" do
|
142
147
|
log.enter_level(Logger::FATAL) do
|
143
148
|
pending 'This test depends on markdown' unless markup_class(:markdown)
|
@@ -145,7 +150,7 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
145
150
|
htmlify('http://example.com', :markdown).chomp.gsub('/', '/').should ==
|
146
151
|
'<p><a href="http://example.com">http://example.com</a></p>'
|
147
152
|
end
|
148
|
-
|
153
|
+
|
149
154
|
it "should not autolink URLs inside of {} (markdown specific)" do
|
150
155
|
log.enter_level(Logger::FATAL) do
|
151
156
|
pending 'This test depends on markdown' unless markup_class(:markdown)
|
@@ -156,17 +161,17 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
156
161
|
%r{<p><a href="http://example.com".*>http://example.com</a></p>}
|
157
162
|
end
|
158
163
|
end
|
159
|
-
|
164
|
+
|
160
165
|
describe "#link_object" do
|
161
166
|
before do
|
162
167
|
stub!(:object).and_return(CodeObjects::NamespaceObject.new(nil, :YARD))
|
163
168
|
end
|
164
|
-
|
169
|
+
|
165
170
|
it "should return the object path if there's no serializer and no title" do
|
166
171
|
stub!(:serializer).and_return nil
|
167
172
|
link_object(CodeObjects::NamespaceObject.new(nil, :YARD)).should == "YARD"
|
168
173
|
end
|
169
|
-
|
174
|
+
|
170
175
|
it "should return the title if there's a title but no serializer" do
|
171
176
|
stub!(:serializer).and_return nil
|
172
177
|
link_object(CodeObjects::NamespaceObject.new(nil, :YARD), 'title').should == "title"
|
@@ -190,7 +195,7 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
190
195
|
stub!(:object).and_return(obj)
|
191
196
|
link_object("Bar#a").should =~ %r{href="Bar.html#a-instance_method"}
|
192
197
|
end
|
193
|
-
|
198
|
+
|
194
199
|
it "should use relative path in title" do
|
195
200
|
CodeObjects::ModuleObject.new(:root, :YARD)
|
196
201
|
CodeObjects::ClassObject.new(P('YARD'), :Bar)
|
@@ -199,7 +204,7 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
199
204
|
stub!(:serializer).and_return(serializer)
|
200
205
|
link_object("Bar").should =~ %r{>Bar</a>}
|
201
206
|
end
|
202
|
-
|
207
|
+
|
203
208
|
it "should use relative path to parent class in title" do
|
204
209
|
root = CodeObjects::ModuleObject.new(:root, :YARD)
|
205
210
|
obj = CodeObjects::ModuleObject.new(root, :SubModule)
|
@@ -209,6 +214,15 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
209
214
|
link_object("YARD").should =~ %r{>YARD</a>}
|
210
215
|
end
|
211
216
|
|
217
|
+
it "should use Klass.foo when linking to class method in current namespace" do
|
218
|
+
root = CodeObjects::ModuleObject.new(:root, :Klass)
|
219
|
+
obj = CodeObjects::MethodObject.new(root, :foo, :class)
|
220
|
+
stub!(:object).and_return(root)
|
221
|
+
serializer = Serializers::FileSystemSerializer.new
|
222
|
+
stub!(:serializer).and_return(serializer)
|
223
|
+
link_object("foo").should =~ %r{>Klass.foo</a>}
|
224
|
+
end
|
225
|
+
|
212
226
|
it "should escape method name in title" do
|
213
227
|
YARD.parse_string <<-'eof'
|
214
228
|
class Array
|
@@ -226,31 +240,31 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
226
240
|
|
227
241
|
describe '#url_for' do
|
228
242
|
before { Registry.clear }
|
229
|
-
|
243
|
+
|
230
244
|
it "should return nil if serializer is nil" do
|
231
245
|
stub!(:serializer).and_return nil
|
232
246
|
stub!(:object).and_return Registry.root
|
233
247
|
url_for(P("Mod::Class#meth")).should be_nil
|
234
248
|
end
|
235
|
-
|
249
|
+
|
236
250
|
it "should return nil if serializer does not implement #serialized_path" do
|
237
251
|
stub!(:serializer).and_return Serializers::Base.new
|
238
252
|
stub!(:object).and_return Registry.root
|
239
253
|
url_for(P("Mod::Class#meth")).should be_nil
|
240
254
|
end
|
241
|
-
|
255
|
+
|
242
256
|
it "should link to a path/file for a namespace object" do
|
243
257
|
stub!(:serializer).and_return Serializers::FileSystemSerializer.new
|
244
258
|
stub!(:object).and_return Registry.root
|
245
|
-
|
259
|
+
|
246
260
|
yard = CodeObjects::ModuleObject.new(:root, :YARD)
|
247
261
|
url_for(yard).should == 'YARD.html'
|
248
262
|
end
|
249
|
-
|
263
|
+
|
250
264
|
it "should link to the object's namespace path/file and use the object as the anchor" do
|
251
265
|
stub!(:serializer).and_return Serializers::FileSystemSerializer.new
|
252
266
|
stub!(:object).and_return Registry.root
|
253
|
-
|
267
|
+
|
254
268
|
yard = CodeObjects::ModuleObject.new(:root, :YARD)
|
255
269
|
meth = CodeObjects::MethodObject.new(yard, :meth)
|
256
270
|
url_for(meth).should == 'YARD.html#meth-instance_method'
|
@@ -283,7 +297,7 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
283
297
|
end
|
284
298
|
results
|
285
299
|
end
|
286
|
-
|
300
|
+
|
287
301
|
it "should escape {} syntax with backslash (\\{foo bar})" do
|
288
302
|
input = '\{foo bar} \{XYZ} \{file:FOO} $\{N-M}'
|
289
303
|
output = '{foo bar} {XYZ} {file:FOO} ${N-M}'
|
@@ -311,7 +325,7 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
311
325
|
:href => "file.TEST.html"
|
312
326
|
}
|
313
327
|
end
|
314
|
-
|
328
|
+
|
315
329
|
it "should create regular links with http:// or https:// prefixes" do
|
316
330
|
parse_link(resolve_links("{http://example.com}")).should == {
|
317
331
|
:inner_text => "http://example.com",
|
@@ -326,7 +340,7 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
326
340
|
:title => "title"
|
327
341
|
}
|
328
342
|
end
|
329
|
-
|
343
|
+
|
330
344
|
it "should create mailto links with mailto: prefixes" do
|
331
345
|
parse_link(resolve_links('{mailto:joanna@example.com}')).should == {
|
332
346
|
:inner_text => 'mailto:joanna@example.com',
|
@@ -341,16 +355,16 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
341
355
|
:title => 'Steve'
|
342
356
|
}
|
343
357
|
end
|
344
|
-
|
358
|
+
|
345
359
|
it "should ignore {links} that begin with |...|" do
|
346
360
|
resolve_links("{|x|x == 1}").should == "{|x|x == 1}"
|
347
361
|
end
|
348
|
-
|
362
|
+
|
349
363
|
it "should gracefully ignore {} in links" do
|
350
364
|
should_receive(:linkify).with('Foo', 'Foo').and_return('FOO')
|
351
365
|
resolve_links("{} {} {Foo Foo}").should == '{} {} FOO'
|
352
366
|
end
|
353
|
-
|
367
|
+
|
354
368
|
%w(tt code pre).each do |tag|
|
355
369
|
it "should ignore links in <#{tag}>" do
|
356
370
|
text = "<#{tag}>{Foo}</#{tag}>"
|
@@ -367,7 +381,7 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
367
381
|
should_receive(:link_file).with('TEST', nil, nil).and_return('')
|
368
382
|
resolve_links("({file:TEST})")
|
369
383
|
end
|
370
|
-
|
384
|
+
|
371
385
|
it "should resolve link with newline in title-part" do
|
372
386
|
parse_link(resolve_links("{http://example.com foo\nbar}")).should == {
|
373
387
|
:inner_text => "foo bar",
|
@@ -376,7 +390,12 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
376
390
|
:title => "foo bar"
|
377
391
|
}
|
378
392
|
end
|
379
|
-
|
393
|
+
|
394
|
+
it "should resolve links to methods whose names have been escaped" do
|
395
|
+
should_receive(:linkify).with('Object#<<', nil).and_return('')
|
396
|
+
resolve_links("{Object#<<}")
|
397
|
+
end
|
398
|
+
|
380
399
|
it "should warn about missing reference at right file location for object" do
|
381
400
|
YARD.parse_string <<-eof
|
382
401
|
# Comments here
|
@@ -390,7 +409,7 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
390
409
|
stub!(:object).and_return(Registry.at('MyObject'))
|
391
410
|
resolve_links(object.docstring)
|
392
411
|
end
|
393
|
-
|
412
|
+
|
394
413
|
it "should show ellipsis on either side if there is more on the line in a reference warning" do
|
395
414
|
YARD.parse_string <<-eof
|
396
415
|
# {InvalidObject1} beginning of line
|
@@ -412,7 +431,7 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
412
431
|
stub!(:object).and_return(Registry.at('MyObject'))
|
413
432
|
resolve_links(object.docstring)
|
414
433
|
end
|
415
|
-
|
434
|
+
|
416
435
|
it "should warn about missing reference for file template (no object)" do
|
417
436
|
@file = CodeObjects::ExtraFileObject.new('myfile.txt', '')
|
418
437
|
logger = mock(:log)
|
@@ -448,12 +467,12 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
448
467
|
:empty_overload => '- (String) <strong>foobar</strong>'
|
449
468
|
}
|
450
469
|
end
|
451
|
-
|
470
|
+
|
452
471
|
def format_types(types, brackets = false) types.join(", ") end
|
453
472
|
def signature(obj, link = false) super(obj, link).strip end
|
454
|
-
|
473
|
+
|
455
474
|
it_should_behave_like "signature"
|
456
|
-
|
475
|
+
|
457
476
|
it "should link to regular method if overload name does not have the same method name" do
|
458
477
|
YARD.parse_string <<-eof
|
459
478
|
class Foo
|
@@ -465,7 +484,7 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
465
484
|
serializer.stub!(:serialized_path).with(Registry.at('Foo')).and_return('')
|
466
485
|
stub!(:serializer).and_return(serializer)
|
467
486
|
stub!(:object).and_return(Registry.at('Foo'))
|
468
|
-
signature(Registry.at('Foo#foo').tag(:overload), true).should ==
|
487
|
+
signature(Registry.at('Foo#foo').tag(:overload), true).should ==
|
469
488
|
"<a href=\"#foo-instance_method\" title=\"#bar (instance method)\">- <strong>bar</strong>(a, b, c) </a>"
|
470
489
|
end
|
471
490
|
end
|
@@ -473,37 +492,37 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
473
492
|
describe '#html_syntax_highlight' do
|
474
493
|
subject do
|
475
494
|
obj = OpenStruct.new
|
476
|
-
obj.options =
|
495
|
+
obj.options = options
|
477
496
|
obj.object = Registry.root
|
478
497
|
obj.extend(Templates::Helpers::HtmlHelper)
|
479
498
|
obj
|
480
499
|
end
|
481
|
-
|
500
|
+
|
482
501
|
it "should return empty string on nil input" do
|
483
502
|
subject.html_syntax_highlight(nil).should == ''
|
484
503
|
end
|
485
|
-
|
504
|
+
|
486
505
|
it "should call #html_syntax_highlight_ruby by default" do
|
487
506
|
Registry.root.source_type = nil
|
488
507
|
subject.should_receive(:html_syntax_highlight_ruby).with('def x; end')
|
489
508
|
subject.html_syntax_highlight('def x; end')
|
490
509
|
end
|
491
|
-
|
510
|
+
|
492
511
|
it "should call #html_syntax_highlight_NAME if there's an object with a #source_type" do
|
493
512
|
subject.object = OpenStruct.new(:source_type => :NAME)
|
494
513
|
subject.should_receive(:respond_to?).with('html_markup_html').and_return(true)
|
495
514
|
subject.should_receive(:respond_to?).with('html_syntax_highlight_NAME').and_return(true)
|
496
515
|
subject.should_receive(:html_syntax_highlight_NAME).and_return("foobar")
|
497
|
-
subject.htmlify('<pre><code>def x; end</code></pre>', :html).should ==
|
516
|
+
subject.htmlify('<pre><code>def x; end</code></pre>', :html).should ==
|
498
517
|
'<pre class="code NAME"><code>foobar</code></pre>'
|
499
518
|
end
|
500
|
-
|
519
|
+
|
501
520
|
it "should add !!!LANG to className in outputted pre tag" do
|
502
521
|
subject.object = OpenStruct.new(:source_type => :LANG)
|
503
522
|
subject.should_receive(:respond_to?).with('html_markup_html').and_return(true)
|
504
523
|
subject.should_receive(:respond_to?).with('html_syntax_highlight_LANG').and_return(true)
|
505
524
|
subject.should_receive(:html_syntax_highlight_LANG).and_return("foobar")
|
506
|
-
subject.htmlify("<pre><code>!!!LANG\ndef x; end</code></pre>", :html).should ==
|
525
|
+
subject.htmlify("<pre><code>!!!LANG\ndef x; end</code></pre>", :html).should ==
|
507
526
|
'<pre class="code LANG"><code>foobar</code></pre>'
|
508
527
|
end
|
509
528
|
|
@@ -516,46 +535,46 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
516
535
|
eof
|
517
536
|
).should == "foobar"
|
518
537
|
end
|
519
|
-
|
520
|
-
it "should not highlight if
|
521
|
-
subject.options
|
538
|
+
|
539
|
+
it "should not highlight if highlight option is false" do
|
540
|
+
subject.options.highlight = false
|
522
541
|
subject.should_not_receive(:html_syntax_highlight_ruby)
|
523
542
|
subject.html_syntax_highlight('def x; end').should == 'def x; end'
|
524
543
|
end
|
525
|
-
|
544
|
+
|
526
545
|
it "should not highlight if there is no highlight method specified by !!!NAME" do
|
527
546
|
subject.should_receive(:respond_to?).with('html_syntax_highlight_NAME').and_return(false)
|
528
547
|
subject.should_not_receive(:html_syntax_highlight_NAME)
|
529
548
|
subject.html_syntax_highlight("!!!NAME\ndef x; end").should == "def x; end"
|
530
549
|
end
|
531
|
-
|
550
|
+
|
532
551
|
it "should highlight as ruby if htmlify(text, :ruby) is called" do
|
533
552
|
subject.should_receive(:html_syntax_highlight_ruby).with('def x; end').and_return('x')
|
534
553
|
subject.htmlify('def x; end', :ruby).should == '<pre class="code ruby">x</pre>'
|
535
554
|
end
|
536
|
-
|
555
|
+
|
537
556
|
it "should not prioritize object source type when called directly" do
|
538
557
|
subject.should_receive(:html_syntax_highlight_ruby).with('def x; end').and_return('x')
|
539
558
|
subject.object = OpenStruct.new(:source_type => :c)
|
540
559
|
subject.html_syntax_highlight("def x; end").should == "x"
|
541
560
|
end
|
542
|
-
|
561
|
+
|
543
562
|
it "shouldn't escape code snippets twice" do
|
544
|
-
subject.htmlify('<pre lang="foo"><code>{"foo" => 1}</code></pre>', :html).should ==
|
563
|
+
subject.htmlify('<pre lang="foo"><code>{"foo" => 1}</code></pre>', :html).should ==
|
545
564
|
'<pre class="code foo"><code>{"foo" => 1}</code></pre>'
|
546
565
|
end
|
547
|
-
|
566
|
+
|
548
567
|
it "should highlight source when matching a pre lang= tag" do
|
549
|
-
subject.htmlify('<pre lang="foo"><code>x = 1</code></pre>', :html).should ==
|
568
|
+
subject.htmlify('<pre lang="foo"><code>x = 1</code></pre>', :html).should ==
|
550
569
|
'<pre class="code foo"><code>x = 1</code></pre>'
|
551
570
|
end
|
552
|
-
|
571
|
+
|
553
572
|
it "should highlight source when matching a code class= tag" do
|
554
|
-
subject.htmlify('<pre><code class="foo">x = 1</code></pre>', :html).should ==
|
573
|
+
subject.htmlify('<pre><code class="foo">x = 1</code></pre>', :html).should ==
|
555
574
|
'<pre class="code foo"><code>x = 1</code></pre>'
|
556
575
|
end
|
557
576
|
end
|
558
|
-
|
577
|
+
|
559
578
|
describe '#link_url' do
|
560
579
|
it "should add target if scheme is provided" do
|
561
580
|
link_url("http://url.com").should include(" target=\"_parent\"")
|
@@ -3,22 +3,22 @@ require File.dirname(__FILE__) + '/../spec_helper'
|
|
3
3
|
describe YARD::Templates::Helpers::HtmlSyntaxHighlightHelper do
|
4
4
|
include YARD::Templates::Helpers::HtmlHelper
|
5
5
|
include YARD::Templates::Helpers::HtmlSyntaxHighlightHelper
|
6
|
-
|
6
|
+
|
7
7
|
describe '#html_syntax_highlight' do
|
8
8
|
before do
|
9
9
|
stub!(:object).and_return Registry.root
|
10
10
|
Registry.root.source_type = :ruby
|
11
11
|
end
|
12
12
|
|
13
|
-
it "should not highlight source if options
|
14
|
-
should_receive(:options).and_return(:
|
13
|
+
it "should not highlight source if options.highlight is false" do
|
14
|
+
should_receive(:options).and_return(Options.new.update(:highlight => false))
|
15
15
|
html_syntax_highlight("def x\nend").should == "def x\nend"
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
it "should highlight source (legacy)" do
|
19
19
|
type = Parser::SourceParser.parser_type
|
20
20
|
Parser::SourceParser.parser_type = :ruby18
|
21
|
-
should_receive(:options).and_return(:
|
21
|
+
should_receive(:options).and_return(Options.new.update(:highlight => true))
|
22
22
|
expect = "<span class='rubyid_def def kw'>def</span><span class='rubyid_x identifier id'>x</span>
|
23
23
|
<span class='string val'>'x'</span><span class='plus op'>+</span>
|
24
24
|
<span class='regexp val'>/x/i</span><span class='rubyid_end end kw'>end</span>"
|
@@ -28,9 +28,9 @@ describe YARD::Templates::Helpers::HtmlSyntaxHighlightHelper do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
it "should highlight source (ripper)" do
|
31
|
-
should_receive(:options).and_return(:
|
31
|
+
should_receive(:options).and_return(Options.new.update(:highlight => true))
|
32
32
|
Parser::SourceParser.parser_type = :ruby
|
33
|
-
expect = "<span class='kw'>def</span> <span class='id identifier rubyid_x'>x</span>
|
33
|
+
expect = "<span class='kw'>def</span> <span class='id identifier rubyid_x'>x</span>
|
34
34
|
<span class='tstring'><span class='tstring_beg'>'</span>
|
35
35
|
<span class='tstring_content'>x</span><span class='tstring_end'>'</span>
|
36
36
|
</span> <span class='op'>+</span> <span class='tstring'>
|
@@ -39,9 +39,9 @@ describe YARD::Templates::Helpers::HtmlSyntaxHighlightHelper do
|
|
39
39
|
result = html_syntax_highlight("def x\n 'x' + /x/i\nend")
|
40
40
|
html_equals_string(result, expect)
|
41
41
|
end if HAVE_RIPPER
|
42
|
-
|
42
|
+
|
43
43
|
it "should return escaped unhighlighted source if a syntax error is found (ripper)" do
|
44
|
-
should_receive(:options).and_return(:
|
44
|
+
should_receive(:options).and_return(Options.new.update(:highlight => true))
|
45
45
|
html_syntax_highlight("def &x; ... end").should == "def &x; ... end"
|
46
46
|
end if HAVE_RIPPER
|
47
47
|
end
|