yard 0.2.3.5 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of yard might be problematic. Click here for more details.
- data/.yardopts +12 -10
- data/ChangeLog +5686 -0
- data/{README.markdown → README.md} +65 -11
- data/Rakefile +25 -13
- data/benchmarks/concat_vs_join.rb +12 -0
- data/benchmarks/erb_vs_erubis.rb +14 -14
- data/benchmarks/marshal_vs_dbm.rb +1 -1
- data/benchmarks/pathname_vs_string.rb +50 -0
- data/benchmarks/template_erb.rb +22 -0
- data/benchmarks/template_format.rb +6 -0
- data/benchmarks/template_profile.rb +17 -0
- data/bin/yri +16 -7
- data/docs/{CODE_OBJECTS.markdown → CodeObjects.md} +0 -0
- data/docs/{GETTING_STARTED.markdown → GettingStarted.md} +49 -11
- data/docs/{GLOSSARY.markdown → Glossary.md} +0 -0
- data/docs/{HANDLERS.markdown → Handlers.md} +5 -5
- data/docs/{OVERVIEW.markdown → Overview.md} +9 -13
- data/docs/{PARSER.markdown → Parser.md} +1 -1
- data/docs/{TAGS.markdown → Tags.md} +1 -1
- data/docs/Templates.md +286 -0
- data/docs/{WHATSNEW.markdown → WhatsNew.md} +82 -2
- data/lib/rubygems_plugin.rb +17 -20
- data/lib/yard.rb +47 -1
- data/lib/yard/autoload.rb +38 -47
- data/lib/yard/cli/yard_graph.rb +36 -13
- data/lib/yard/cli/yardoc.rb +74 -12
- data/lib/yard/code_objects/base.rb +182 -14
- data/lib/yard/code_objects/class_object.rb +39 -2
- data/lib/yard/code_objects/class_variable_object.rb +4 -0
- data/lib/yard/code_objects/constant_object.rb +8 -0
- data/lib/yard/code_objects/extended_method_object.rb +14 -0
- data/lib/yard/code_objects/method_object.rb +60 -2
- data/lib/yard/code_objects/module_object.rb +6 -0
- data/lib/yard/code_objects/namespace_object.rb +99 -2
- data/lib/yard/code_objects/proxy.rb +53 -6
- data/lib/yard/code_objects/root_object.rb +2 -0
- data/lib/yard/core_ext/array.rb +61 -0
- data/lib/yard/core_ext/file.rb +21 -4
- data/lib/yard/core_ext/module.rb +11 -1
- data/lib/yard/core_ext/string.rb +13 -2
- data/lib/yard/core_ext/symbol_hash.rb +51 -3
- data/lib/yard/docstring.rb +68 -19
- data/lib/yard/globals.rb +5 -2
- data/lib/yard/handlers/base.rb +13 -3
- data/lib/yard/handlers/processor.rb +64 -2
- data/lib/yard/handlers/ruby/class_handler.rb +1 -1
- data/lib/yard/handlers/ruby/class_variable_handler.rb +5 -1
- data/lib/yard/handlers/ruby/constant_handler.rb +38 -4
- data/lib/yard/handlers/ruby/exception_handler.rb +1 -0
- data/lib/yard/handlers/ruby/legacy/base.rb +2 -2
- data/lib/yard/handlers/ruby/legacy/class_variable_handler.rb +6 -3
- data/lib/yard/handlers/ruby/legacy/constant_handler.rb +21 -2
- data/lib/yard/handlers/ruby/legacy/method_handler.rb +10 -0
- data/lib/yard/handlers/ruby/legacy/yield_handler.rb +2 -1
- data/lib/yard/handlers/ruby/method_handler.rb +10 -0
- data/lib/yard/handlers/ruby/yield_handler.rb +2 -1
- data/lib/yard/logging.rb +17 -0
- data/lib/yard/parser/ruby/ast_node.rb +101 -0
- data/lib/yard/parser/ruby/legacy/ruby_lex.rb +2 -2
- data/lib/yard/parser/ruby/legacy/statement_list.rb +10 -9
- data/lib/yard/parser/ruby/ruby_parser.rb +32 -3
- data/lib/yard/parser/source_parser.rb +82 -5
- data/lib/yard/rake/yardoc_task.rb +38 -3
- data/lib/yard/registry.rb +112 -2
- data/lib/yard/serializers/base.rb +48 -1
- data/lib/yard/serializers/file_system_serializer.rb +23 -2
- data/lib/yard/serializers/process_serializer.rb +10 -0
- data/lib/yard/serializers/stdout_serializer.rb +11 -0
- data/lib/yard/tags/library.rb +4 -1
- data/lib/yard/tags/overload_tag.rb +3 -12
- data/lib/yard/templates/engine.rb +162 -0
- data/lib/yard/{generators → templates}/helpers/base_helper.rb +14 -13
- data/lib/yard/{generators → templates}/helpers/filter_helper.rb +1 -1
- data/lib/yard/templates/helpers/html_helper.rb +287 -0
- data/lib/yard/templates/helpers/html_syntax_highlight_helper.rb +29 -0
- data/lib/yard/templates/helpers/html_syntax_highlight_helper18.rb +27 -0
- data/lib/yard/{generators → templates}/helpers/markup_helper.rb +15 -11
- data/lib/yard/{generators → templates}/helpers/method_helper.rb +8 -1
- data/lib/yard/templates/helpers/module_helper.rb +15 -0
- data/lib/yard/templates/helpers/text_helper.rb +60 -0
- data/lib/yard/templates/helpers/uml_helper.rb +33 -0
- data/lib/yard/templates/template.rb +355 -0
- data/lib/yard/verifier.rb +110 -0
- data/spec/cli/yardoc_spec.rb +23 -1
- data/spec/code_objects/base_spec.rb +8 -0
- data/spec/code_objects/class_object_spec.rb +166 -156
- data/spec/code_objects/method_object_spec.rb +2 -2
- data/spec/code_objects/module_object_spec.rb +112 -110
- data/spec/code_objects/proxy_spec.rb +9 -0
- data/spec/core_ext/array_spec.rb +33 -0
- data/spec/core_ext/file_spec.rb +40 -12
- data/spec/core_ext/module_spec.rb +15 -0
- data/spec/core_ext/string_spec.rb +10 -2
- data/spec/docstring_spec.rb +157 -135
- data/spec/handlers/class_handler_spec.rb +3 -0
- data/spec/handlers/class_variable_handler_spec.rb +3 -1
- data/spec/handlers/constant_handler_spec.rb +38 -0
- data/spec/handlers/examples/class_handler_001.rb.txt +14 -1
- data/spec/handlers/examples/class_variable_handler_001.rb.txt +1 -0
- data/spec/handlers/examples/constant_handler_001.rb.txt +10 -1
- data/spec/handlers/examples/exception_handler_001.rb.txt +5 -0
- data/spec/handlers/examples/method_handler_001.rb.txt +15 -0
- data/spec/handlers/examples/mixin_handler_001.rb.txt +13 -0
- data/spec/handlers/exception_handler_spec.rb +4 -0
- data/spec/handlers/method_handler_spec.rb +22 -0
- data/spec/handlers/mixin_handler_spec.rb +5 -3
- data/spec/handlers/yield_handler_spec.rb +1 -1
- data/spec/parser/ruby/ast_node_spec.rb +16 -0
- data/spec/parser/ruby/legacy/statement_list_spec.rb +36 -0
- data/spec/parser/ruby/ruby_parser_spec.rb +80 -0
- data/spec/parser/source_parser_spec.rb +48 -2
- data/spec/rake/yardoc_task_spec.rb +62 -25
- data/spec/serializers/file_system_serializer_spec.rb +1 -1
- data/spec/templates/class_spec.rb +34 -0
- data/spec/templates/engine_spec.rb +121 -0
- data/spec/templates/examples/class001.html +271 -0
- data/spec/templates/examples/class001.txt +31 -0
- data/spec/templates/examples/method001.html +96 -0
- data/spec/templates/examples/method001.txt +28 -0
- data/spec/templates/examples/method002.html +81 -0
- data/spec/templates/examples/method002.txt +20 -0
- data/spec/templates/examples/method003.html +137 -0
- data/spec/templates/examples/method003.txt +45 -0
- data/spec/templates/examples/module001.dot +31 -0
- data/spec/templates/examples/module001.html +294 -0
- data/spec/templates/examples/module001.txt +33 -0
- data/spec/templates/examples/tag001.txt +82 -0
- data/spec/templates/helpers/base_helper_spec.rb +129 -0
- data/spec/{generators → templates}/helpers/html_helper_spec.rb +73 -16
- data/spec/templates/helpers/html_syntax_highlight_helper_spec.rb +39 -0
- data/spec/{generators → templates}/helpers/markup_helper_spec.rb +6 -7
- data/spec/templates/method_spec.rb +75 -0
- data/spec/templates/module_spec.rb +50 -0
- data/spec/templates/spec_helper.rb +33 -0
- data/spec/templates/tag_spec.rb +39 -0
- data/spec/templates/template_spec.rb +398 -0
- data/spec/verifier_spec.rb +51 -0
- data/spec/yard_spec.rb +46 -0
- data/templates/default/class/dot/setup.rb +6 -0
- data/templates/default/class/dot/superklass.erb +3 -0
- data/templates/default/class/html/constructor_details.erb +8 -0
- data/templates/default/class/html/setup.rb +1 -0
- data/templates/default/class/html/subclasses.erb +4 -0
- data/templates/default/class/setup.rb +29 -0
- data/templates/default/class/text/setup.rb +11 -0
- data/templates/default/class/text/subclasses.erb +5 -0
- data/templates/default/docstring/html/abstract.erb +4 -0
- data/templates/default/docstring/html/deprecated.erb +1 -0
- data/templates/default/docstring/html/index.erb +5 -0
- data/templates/default/docstring/html/note.erb +6 -0
- data/templates/default/docstring/html/text.erb +1 -0
- data/templates/default/docstring/html/todo.erb +6 -0
- data/templates/default/docstring/setup.rb +39 -0
- data/templates/default/docstring/text/abstract.erb +2 -0
- data/templates/default/docstring/text/deprecated.erb +2 -0
- data/templates/default/docstring/text/index.erb +2 -0
- data/templates/default/docstring/text/note.erb +4 -0
- data/templates/default/docstring/text/text.erb +1 -0
- data/templates/default/docstring/text/todo.erb +4 -0
- data/templates/default/fulldoc/html/css/common.css +1 -0
- data/templates/default/fulldoc/html/css/full_list.css +23 -0
- data/templates/default/fulldoc/html/css/style.css +261 -0
- data/templates/default/fulldoc/html/full_list.erb +36 -0
- data/templates/default/fulldoc/html/js/app.js +91 -0
- data/templates/default/fulldoc/html/js/full_list.js +39 -0
- data/templates/default/fulldoc/html/js/jquery.js +19 -0
- data/templates/default/fulldoc/html/setup.rb +86 -0
- data/templates/default/{uml → layout}/dot/header.erb +2 -2
- data/templates/default/layout/dot/setup.rb +14 -0
- data/templates/default/layout/html/breadcrumb.erb +11 -0
- data/templates/default/layout/html/footer.erb +5 -0
- data/templates/default/layout/html/headers.erb +13 -0
- data/templates/default/layout/html/index.erb +49 -0
- data/templates/default/layout/html/layout.erb +20 -0
- data/templates/default/layout/html/search.erb +5 -0
- data/templates/default/layout/html/setup.rb +58 -0
- data/templates/default/method/html/header.erb +14 -3
- data/templates/default/method/setup.rb +3 -0
- data/templates/default/method/text/header.erb +1 -1
- data/templates/default/method_details/html/header.erb +3 -0
- data/templates/default/method_details/html/method_signature.erb +17 -0
- data/templates/default/method_details/html/source.erb +10 -0
- data/templates/default/method_details/setup.rb +8 -0
- data/templates/default/method_details/text/header.erb +10 -0
- data/templates/default/method_details/text/method_signature.erb +12 -0
- data/templates/default/method_details/text/setup.rb +10 -0
- data/templates/default/module/dot/child.erb +1 -0
- data/templates/default/module/dot/dependencies.erb +3 -0
- data/templates/default/{uml/dot/subgraph.erb → module/dot/header.erb} +3 -3
- data/templates/default/{uml → module}/dot/info.erb +4 -4
- data/templates/default/module/dot/setup.rb +14 -0
- data/templates/default/module/html/attribute_details.erb +11 -0
- data/templates/default/module/html/attribute_summary.erb +8 -0
- data/templates/default/module/html/box_info.erb +32 -0
- data/templates/default/module/html/children.erb +8 -0
- data/templates/default/module/html/constant_summary.erb +13 -0
- data/templates/default/module/html/defines.erb +3 -0
- data/templates/default/module/html/header.erb +4 -4
- data/templates/default/module/html/inherited_constants.erb +8 -0
- data/templates/default/module/html/inherited_methods.erb +9 -0
- data/templates/default/module/html/item_summary.erb +20 -0
- data/templates/default/module/html/method_details_list.erb +8 -0
- data/templates/default/module/html/method_summary.erb +8 -0
- data/templates/default/module/html/methodmissing.erb +12 -0
- data/templates/default/module/html/pre_docstring.erb +1 -0
- data/templates/default/module/setup.rb +83 -0
- data/templates/default/module/text/children.erb +10 -0
- data/templates/default/module/text/class_meths_list.erb +8 -0
- data/templates/default/module/text/extends.erb +8 -0
- data/templates/default/module/text/header.erb +7 -0
- data/templates/default/module/text/includes.erb +8 -0
- data/templates/default/module/text/instance_meths_list.erb +8 -0
- data/templates/default/module/text/setup.rb +12 -0
- data/templates/default/root/dot/child.erb +3 -0
- data/templates/default/root/dot/setup.rb +5 -0
- data/templates/default/tags/html/example.erb +5 -16
- data/templates/default/tags/html/index.erb +3 -0
- data/templates/default/tags/html/option.erb +17 -20
- data/templates/default/tags/html/overload.erb +13 -0
- data/templates/default/tags/html/see.erb +5 -10
- data/templates/default/tags/html/tag.erb +20 -0
- data/templates/default/tags/setup.rb +50 -0
- data/templates/default/tags/text/example.erb +8 -10
- data/templates/default/tags/text/index.erb +1 -0
- data/templates/default/tags/text/option.erb +18 -3
- data/templates/default/tags/text/overload.erb +19 -0
- data/templates/default/tags/text/see.erb +8 -2
- data/templates/default/tags/text/tag.erb +13 -0
- metadata +142 -158
- data/bin/view_generator +0 -17
- data/docs/FAQ.markdown +0 -34
- data/docs/GENERATORS.markdown +0 -211
- data/lib/yard/generators/attributes_generator.rb +0 -22
- data/lib/yard/generators/base.rb +0 -305
- data/lib/yard/generators/class_generator.rb +0 -27
- data/lib/yard/generators/constants_generator.rb +0 -74
- data/lib/yard/generators/constructor_generator.rb +0 -25
- data/lib/yard/generators/deprecated_generator.rb +0 -15
- data/lib/yard/generators/docstring_generator.rb +0 -15
- data/lib/yard/generators/full_doc_generator.rb +0 -127
- data/lib/yard/generators/helpers/html_helper.rb +0 -196
- data/lib/yard/generators/helpers/html_syntax_highlight_helper.rb +0 -49
- data/lib/yard/generators/helpers/uml_helper.rb +0 -16
- data/lib/yard/generators/inheritance_generator.rb +0 -16
- data/lib/yard/generators/method_details_generator.rb +0 -18
- data/lib/yard/generators/method_generator.rb +0 -43
- data/lib/yard/generators/method_listing_generator.rb +0 -105
- data/lib/yard/generators/method_missing_generator.rb +0 -25
- data/lib/yard/generators/method_signature_generator.rb +0 -19
- data/lib/yard/generators/method_summary_generator.rb +0 -21
- data/lib/yard/generators/mixins_generator.rb +0 -21
- data/lib/yard/generators/module_generator.rb +0 -23
- data/lib/yard/generators/overloads_generator.rb +0 -20
- data/lib/yard/generators/quick_doc_generator.rb +0 -25
- data/lib/yard/generators/root_generator.rb +0 -32
- data/lib/yard/generators/source_generator.rb +0 -11
- data/lib/yard/generators/tags_generator.rb +0 -99
- data/lib/yard/generators/uml_generator.rb +0 -102
- data/lib/yard/generators/visibility_group_generator.rb +0 -26
- data/spec/generators/base_spec.rb +0 -64
- data/spec/generators/full_doc_generator_spec.rb +0 -29
- data/spec/generators/helpers/base_helper_spec.rb +0 -15
- data/spec/generators/quick_doc_generator_spec.rb +0 -13
- data/templates/default/attributes/html/header.erb +0 -47
- data/templates/default/attributes/text/header.erb +0 -10
- data/templates/default/class/html/header.erb +0 -4
- data/templates/default/constants/html/constants.erb +0 -9
- data/templates/default/constants/html/header.erb +0 -3
- data/templates/default/constants/html/included.erb +0 -9
- data/templates/default/constants/html/inherited.erb +0 -9
- data/templates/default/constructor/html/header.erb +0 -10
- data/templates/default/deprecated/html/main.erb +0 -6
- data/templates/default/deprecated/text/main.erb +0 -3
- data/templates/default/docstring/html/main.erb +0 -3
- data/templates/default/docstring/text/main.erb +0 -3
- data/templates/default/fulldoc/html/all_files.erb +0 -19
- data/templates/default/fulldoc/html/all_methods.erb +0 -26
- data/templates/default/fulldoc/html/all_namespaces.erb +0 -22
- data/templates/default/fulldoc/html/app.js +0 -18
- data/templates/default/fulldoc/html/custom.css +0 -1
- data/templates/default/fulldoc/html/file.erb +0 -16
- data/templates/default/fulldoc/html/footer.erb +0 -5
- data/templates/default/fulldoc/html/header.erb +0 -16
- data/templates/default/fulldoc/html/html_head.erb +0 -4
- data/templates/default/fulldoc/html/index.erb +0 -19
- data/templates/default/fulldoc/html/jquery.js +0 -11
- data/templates/default/fulldoc/html/style.css +0 -81
- data/templates/default/fulldoc/html/syntax_highlight.css +0 -24
- data/templates/default/inheritance/html/header.erb +0 -8
- data/templates/default/inheritance/text/header.erb +0 -3
- data/templates/default/method/html/aliases.erb +0 -6
- data/templates/default/method/html/title.erb +0 -3
- data/templates/default/method/text/title.erb +0 -1
- data/templates/default/methoddetails/html/header.erb +0 -8
- data/templates/default/methoddetails/html/method_header.erb +0 -3
- data/templates/default/methodmissing/html/header.erb +0 -12
- data/templates/default/methodsignature/html/main.erb +0 -10
- data/templates/default/methodsignature/text/main.erb +0 -8
- data/templates/default/methodsummary/html/header.erb +0 -5
- data/templates/default/methodsummary/html/included.erb +0 -9
- data/templates/default/methodsummary/html/inherited.erb +0 -9
- data/templates/default/methodsummary/html/summary.erb +0 -29
- data/templates/default/methodsummary/text/header.erb +0 -5
- data/templates/default/methodsummary/text/included.erb +0 -0
- data/templates/default/methodsummary/text/inherited.erb +0 -0
- data/templates/default/methodsummary/text/summary.erb +0 -6
- data/templates/default/mixins/html/header.erb +0 -4
- data/templates/default/overloads/html/header.erb +0 -8
- data/templates/default/overloads/text/header.erb +0 -8
- data/templates/default/quickdoc/html/header.erb +0 -15
- data/templates/default/quickdoc/text/header.erb +0 -12
- data/templates/default/root/html/header.erb +0 -4
- data/templates/default/source/html/main.erb +0 -15
- data/templates/default/source/text/main.erb +0 -4
- data/templates/default/tags/html/header.erb +0 -4
- data/templates/default/tags/html/param.erb +0 -21
- data/templates/default/tags/html/tags.erb +0 -23
- data/templates/default/tags/html/todo.erb +0 -8
- data/templates/default/tags/text/header.erb +0 -3
- data/templates/default/tags/text/param.erb +0 -9
- data/templates/default/tags/text/tags.erb +0 -7
- data/templates/default/uml/dot/child.erb +0 -1
- data/templates/default/uml/dot/dependencies.erb +0 -10
- data/templates/default/uml/dot/superclasses.erb +0 -9
- data/templates/default/uml/dot/unknown.erb +0 -3
- data/templates/default/uml/dot/unknown_child.erb +0 -1
- data/templates/default/visibilitygroup/html/header.erb +0 -6
- data/templates/javadoc/attributes/html/header.erb +0 -16
- data/templates/javadoc/class/html/header.erb +0 -4
- data/templates/javadoc/constants/html/constants.erb +0 -9
- data/templates/javadoc/constants/html/header.erb +0 -3
- data/templates/javadoc/constants/html/included.erb +0 -12
- data/templates/javadoc/constants/html/inherited.erb +0 -12
- data/templates/javadoc/constructor/html/header.erb +0 -10
- data/templates/javadoc/deprecated/html/main.erb +0 -0
- data/templates/javadoc/docstring/html/main.erb +0 -6
- data/templates/javadoc/fulldoc/html/all_methods.erb +0 -25
- data/templates/javadoc/fulldoc/html/all_namespaces.erb +0 -19
- data/templates/javadoc/fulldoc/html/app.js +0 -18
- data/templates/javadoc/fulldoc/html/header.erb +0 -15
- data/templates/javadoc/fulldoc/html/html_head.erb +0 -3
- data/templates/javadoc/fulldoc/html/index.erb +0 -18
- data/templates/javadoc/fulldoc/html/jquery.js +0 -11
- data/templates/javadoc/fulldoc/html/readme.erb +0 -15
- data/templates/javadoc/fulldoc/html/style.css +0 -22
- data/templates/javadoc/fulldoc/html/syntax_highlight.css +0 -21
- data/templates/javadoc/inheritance/html/header.erb +0 -6
- data/templates/javadoc/method/html/aliases.erb +0 -6
- data/templates/javadoc/method/html/header.erb +0 -4
- data/templates/javadoc/method/html/title.erb +0 -4
- data/templates/javadoc/methoddetails/html/header.erb +0 -8
- data/templates/javadoc/methoddetails/html/method_header.erb +0 -0
- data/templates/javadoc/methodmissing/html/header.erb +0 -12
- data/templates/javadoc/methodsignature/html/main.erb +0 -8
- data/templates/javadoc/methodsummary/html/header.erb +0 -5
- data/templates/javadoc/methodsummary/html/included.erb +0 -12
- data/templates/javadoc/methodsummary/html/inherited.erb +0 -12
- data/templates/javadoc/methodsummary/html/summary.erb +0 -25
- data/templates/javadoc/mixins/html/header.erb +0 -5
- data/templates/javadoc/module/html/header.erb +0 -4
- data/templates/javadoc/source/html/main.erb +0 -15
- data/templates/javadoc/tags/html/header.erb +0 -5
- data/templates/javadoc/tags/html/see.erb +0 -8
- data/templates/javadoc/tags/html/tags.erb +0 -19
- data/templates/javadoc/visibilitygroup/html/header.erb +0 -5
@@ -1,27 +0,0 @@
|
|
1
|
-
module YARD
|
2
|
-
module Generators
|
3
|
-
class ClassGenerator < Base
|
4
|
-
before_generate :is_class?
|
5
|
-
|
6
|
-
def sections_for(object)
|
7
|
-
[
|
8
|
-
:header,
|
9
|
-
[
|
10
|
-
G(InheritanceGenerator),
|
11
|
-
G(MixinsGenerator, :scope => :class),
|
12
|
-
G(MixinsGenerator, :scope => :instance),
|
13
|
-
G(DocstringGenerator),
|
14
|
-
G(TagsGenerator),
|
15
|
-
G(AttributesGenerator),
|
16
|
-
G(ConstantsGenerator),
|
17
|
-
G(ConstructorGenerator),
|
18
|
-
G(MethodMissingGenerator),
|
19
|
-
G(VisibilityGroupGenerator, :visibility => :public),
|
20
|
-
G(VisibilityGroupGenerator, :visibility => :protected),
|
21
|
-
G(VisibilityGroupGenerator, :visibility => :private)
|
22
|
-
]
|
23
|
-
]
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,74 +0,0 @@
|
|
1
|
-
module YARD
|
2
|
-
module Generators
|
3
|
-
class ConstantsGenerator < Base
|
4
|
-
before_generate :is_namespace?
|
5
|
-
before_section :constants, :has_constants?
|
6
|
-
before_section :inherited, :has_inherited_constants?
|
7
|
-
before_section :included, :has_included_constants?
|
8
|
-
|
9
|
-
def sections_for(object)
|
10
|
-
if object.is_a?(CodeObjects::ClassObject)
|
11
|
-
[:header, [:constants, :inherited, :included]]
|
12
|
-
elsif object.is_a?(CodeObjects::ModuleObject)
|
13
|
-
[:header, [:constants]]
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
protected
|
18
|
-
|
19
|
-
def has_constants?(object)
|
20
|
-
object.constants(:included => false, :inherited => false).size > 0
|
21
|
-
end
|
22
|
-
|
23
|
-
def has_inherited_constants?(object)
|
24
|
-
return false unless object.is_a?(CodeObjects::ClassObject)
|
25
|
-
object.inherited_constants.size > 0
|
26
|
-
end
|
27
|
-
|
28
|
-
def has_included_constants?(object)
|
29
|
-
object.included_constants.size > 0
|
30
|
-
end
|
31
|
-
|
32
|
-
# @yield a the list of methods pertaining to a superclass
|
33
|
-
# in the inheritance order.
|
34
|
-
#
|
35
|
-
# @yieldparam [CodeObjects::ClassObject] superclass
|
36
|
-
# The superclass the constants belong to
|
37
|
-
#
|
38
|
-
# @yieldparam [Array<CodeObjects::ConstantObject>] consts
|
39
|
-
# The list of constants inherited from the superclass
|
40
|
-
#
|
41
|
-
def inherited_constants_by_class
|
42
|
-
all_consts = current_object.inherited_constants
|
43
|
-
current_object.inheritance_tree[1..-1].each do |superclass|
|
44
|
-
next if superclass.is_a?(CodeObjects::Proxy)
|
45
|
-
opts = { :included => false, :inherited => false }
|
46
|
-
consts = superclass.constants(opts).select {|c| all_consts.include?(c) }
|
47
|
-
next if consts.empty?
|
48
|
-
yield(superclass, consts)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
# @yield [module, constlist]
|
53
|
-
# Yields a the list of methods pertaining to a module
|
54
|
-
# in the module order.
|
55
|
-
#
|
56
|
-
# @yieldparam [CodeObjects::ModuleObject] module
|
57
|
-
# The module the constants belong to
|
58
|
-
#
|
59
|
-
# @yieldparam [Array<CodeObjects::ConstantObject>] consts
|
60
|
-
# The list of constants included from the module
|
61
|
-
#
|
62
|
-
def included_constants_by_module
|
63
|
-
all_consts = current_object.included_constants
|
64
|
-
current_object.instance_mixins.each do |superclass|
|
65
|
-
next if superclass.is_a?(CodeObjects::Proxy)
|
66
|
-
opts = { :included => false, :inherited => false }
|
67
|
-
consts = superclass.constants(opts).select {|c| all_consts.include?(c) }
|
68
|
-
next if consts.empty?
|
69
|
-
yield(superclass, consts)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
module YARD
|
2
|
-
module Generators
|
3
|
-
class ConstructorGenerator < Base
|
4
|
-
before_generate :has_constructor?
|
5
|
-
|
6
|
-
def sections_for(object)
|
7
|
-
[:header, [G(MethodGenerator)]]
|
8
|
-
end
|
9
|
-
|
10
|
-
protected
|
11
|
-
|
12
|
-
def has_constructor?
|
13
|
-
constructor_method ? true : false
|
14
|
-
end
|
15
|
-
|
16
|
-
def constructor_method
|
17
|
-
current_object.meths.find {|o| o.name == :initialize && o.scope == :instance }
|
18
|
-
end
|
19
|
-
|
20
|
-
def constructor_method_inherited?
|
21
|
-
constructor_method.namespace != current_object
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module YARD
|
2
|
-
module Generators
|
3
|
-
class DeprecatedGenerator < Base
|
4
|
-
before_generate :is_deprecated?
|
5
|
-
|
6
|
-
def sections_for(object) [:main] end
|
7
|
-
|
8
|
-
protected
|
9
|
-
|
10
|
-
def is_deprecated?(object)
|
11
|
-
object.tag(:deprecated) ? true : false
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,127 +0,0 @@
|
|
1
|
-
module YARD
|
2
|
-
module Generators
|
3
|
-
class FullDocGenerator < Base
|
4
|
-
before_generate :is_namespace?
|
5
|
-
before_list :setup_options
|
6
|
-
before_list :generate_assets
|
7
|
-
before_list :generate_index
|
8
|
-
before_list :generate_files
|
9
|
-
|
10
|
-
def sections_for(object)
|
11
|
-
case object
|
12
|
-
when CodeObjects::RootObject
|
13
|
-
[:header, [G(RootGenerator)]]
|
14
|
-
when CodeObjects::ClassObject
|
15
|
-
[:header, [G(ClassGenerator)]]
|
16
|
-
when CodeObjects::ModuleObject
|
17
|
-
[:header, [G(ModuleGenerator)]]
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
protected
|
22
|
-
|
23
|
-
def setup_options
|
24
|
-
options[:readme] ||= Dir['{README,README.*}']
|
25
|
-
options[:files] ||= []
|
26
|
-
end
|
27
|
-
|
28
|
-
def css_file; 'style.css' end
|
29
|
-
def css_custom_file; 'custom.css' end
|
30
|
-
def css_syntax_file; 'syntax_highlight.css' end
|
31
|
-
def js_file; 'jquery.js' end
|
32
|
-
def js_app_file; 'app.js' end
|
33
|
-
|
34
|
-
def readme_file
|
35
|
-
@readme_file ||= [options[:readme]].flatten.compact.find do |readme|
|
36
|
-
File.exists?(readme.to_s)
|
37
|
-
end.to_s
|
38
|
-
end
|
39
|
-
|
40
|
-
def readme_file_exists?; not readme_file.empty?; end
|
41
|
-
|
42
|
-
def extra_files
|
43
|
-
[readme_file] + options[:files]
|
44
|
-
end
|
45
|
-
|
46
|
-
def generate_assets
|
47
|
-
if format == :html && serializer
|
48
|
-
[css_file, css_custom_file, css_syntax_file, js_file, js_app_file].each do |filename|
|
49
|
-
template_file = find_template template_path(filename)
|
50
|
-
serializer.serialize(filename, File.read(template_file))
|
51
|
-
end
|
52
|
-
end
|
53
|
-
true
|
54
|
-
end
|
55
|
-
|
56
|
-
def generate_index(all_objects)
|
57
|
-
if format == :html && serializer
|
58
|
-
ns = all_objects.select {|o| o.type == :module || o.type == :class }
|
59
|
-
all_namespaces = {
|
60
|
-
:objects => ns.sort_by {|o| o.path },
|
61
|
-
:root => all_objects.find {|o| o.type == :root && (!o.meths.empty? || !o.constants.empty?) }
|
62
|
-
}
|
63
|
-
all_methods = { :objects => methods_to_show(all_objects) }
|
64
|
-
|
65
|
-
serializer.serialize 'index.html', render(:index)
|
66
|
-
serializer.serialize 'all-files.html', render(:all_files)
|
67
|
-
serializer.serialize 'all-namespaces.html', render(:all_namespaces, all_namespaces)
|
68
|
-
serializer.serialize 'all-methods.html', render(:all_methods, all_methods)
|
69
|
-
end
|
70
|
-
true
|
71
|
-
end
|
72
|
-
|
73
|
-
def generate_files
|
74
|
-
if format == :html && serializer
|
75
|
-
extra_files.each do |file|
|
76
|
-
next unless File.exists?(file)
|
77
|
-
@contents = File.read(file)
|
78
|
-
file = File.basename(file)
|
79
|
-
serializer.serialize file + '.html', render(:file, :filename => file)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
true
|
83
|
-
end
|
84
|
-
|
85
|
-
def markup_for(filename)
|
86
|
-
case File.extname(filename).downcase
|
87
|
-
when /^\.(?:mdown|markdown|mkdn|markdn|md)$/
|
88
|
-
:markdown
|
89
|
-
when ".textile"
|
90
|
-
:textile
|
91
|
-
when /^\.html?$/
|
92
|
-
if format == :html
|
93
|
-
nil # no markup, use raw data
|
94
|
-
else
|
95
|
-
# TODO implement some html->plaintext markup
|
96
|
-
:rdoc
|
97
|
-
end
|
98
|
-
else
|
99
|
-
if @contents =~ /\A#!(\S+)\s*$/ # Shebang support
|
100
|
-
markup = $1
|
101
|
-
@contents.gsub!(/\A.+?\r?\n/, '')
|
102
|
-
markup.to_sym
|
103
|
-
else
|
104
|
-
:rdoc
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
def methods_to_show(namespaces)
|
110
|
-
meths = namespaces.inject([]) do |arr, namespace|
|
111
|
-
next(arr) unless namespace.is_a?(CodeObjects::NamespaceObject)
|
112
|
-
more_meths = namespace.meths(:included => false, :inherited => false)
|
113
|
-
more_meths = more_meths.select {|object| object.is_explicit? }
|
114
|
-
arr += more_meths
|
115
|
-
end
|
116
|
-
if options[:verifier]
|
117
|
-
meths.reject! do |object|
|
118
|
-
# FIXME we should be using call_verifier here, but visibility
|
119
|
-
# is checked on the generator, not the object
|
120
|
-
options[:verifier].call(object, object).is_a?(FalseClass)
|
121
|
-
end
|
122
|
-
end
|
123
|
-
meths.sort_by {|object| object.path }
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
@@ -1,196 +0,0 @@
|
|
1
|
-
require 'cgi'
|
2
|
-
|
3
|
-
module YARD
|
4
|
-
module Generators::Helpers
|
5
|
-
module HtmlHelper
|
6
|
-
include MarkupHelper
|
7
|
-
include HtmlSyntaxHighlightHelper
|
8
|
-
|
9
|
-
SimpleMarkupHtml = RUBY19 ? RDoc::Markup::ToHtml.new : SM::ToHtml.new
|
10
|
-
|
11
|
-
def h(text)
|
12
|
-
CGI.escapeHTML(text.to_s)
|
13
|
-
end
|
14
|
-
|
15
|
-
def urlencode(text)
|
16
|
-
CGI.escape(text.to_s)
|
17
|
-
end
|
18
|
-
|
19
|
-
def htmlify(text, markup = options[:markup])
|
20
|
-
return text unless markup
|
21
|
-
load_markup_provider(markup)
|
22
|
-
|
23
|
-
# TODO: other libraries might be more complex
|
24
|
-
case markup
|
25
|
-
when :markdown
|
26
|
-
html = markup_class(markup).new(text).to_html
|
27
|
-
when :textile
|
28
|
-
doc = markup_class(markup).new(text)
|
29
|
-
doc.hard_breaks = false if doc.respond_to?(:hard_breaks=)
|
30
|
-
html = doc.to_html
|
31
|
-
when :rdoc
|
32
|
-
html = MarkupHelper::SimpleMarkup.convert(text, SimpleMarkupHtml)
|
33
|
-
html = fix_dash_dash(html)
|
34
|
-
html = fix_typewriter(html)
|
35
|
-
end
|
36
|
-
|
37
|
-
html = resolve_links(html)
|
38
|
-
html = html.gsub(/<pre>(?:\s*<code>)?(.+?)(?:<\/code>\s*)?<\/pre>/m) do
|
39
|
-
str = $1
|
40
|
-
str = html_syntax_highlight(CGI.unescapeHTML(str)) unless options[:no_highlight]
|
41
|
-
%Q{<pre class="code">#{str}</pre>}
|
42
|
-
end
|
43
|
-
html
|
44
|
-
end
|
45
|
-
|
46
|
-
# @todo Refactor into own SimpleMarkup subclass
|
47
|
-
def fix_typewriter(text)
|
48
|
-
text.gsub(/\+(?! )([^\+]{1,900})(?! )\+/, '<tt>\1</tt>')
|
49
|
-
end
|
50
|
-
|
51
|
-
# Don't allow -- to turn into — element. The chances of this being
|
52
|
-
# some --option is far more likely than the typographical meaning.
|
53
|
-
#
|
54
|
-
# @todo Refactor into own SimpleMarkup subclass
|
55
|
-
def fix_dash_dash(text)
|
56
|
-
text.gsub(/—(?=\S)/, '--')
|
57
|
-
end
|
58
|
-
|
59
|
-
def resolve_links(text)
|
60
|
-
code_tags = 0
|
61
|
-
text.gsub(/<(\/)?(pre|code)|(\s|>|^)\{(\S+?)(?:\s(.*?\S))?\}(?=[\W<]|.+<\/|$)/) do |str|
|
62
|
-
tag = $2
|
63
|
-
closed = $1
|
64
|
-
if tag
|
65
|
-
code_tags += (closed ? -1 : 1)
|
66
|
-
next str
|
67
|
-
end
|
68
|
-
next str unless code_tags == 0
|
69
|
-
|
70
|
-
sp, name = $3, $4
|
71
|
-
title = $5 || name
|
72
|
-
|
73
|
-
if name.include?("://")
|
74
|
-
sp + link_url(name, title, :target => '_parent')
|
75
|
-
elsif name =~ /^file:(\S+?)(?:#(\S+))?$/
|
76
|
-
sp + link_file($1, title == name ? $1 : title, $2)
|
77
|
-
else
|
78
|
-
obj = Registry.resolve(current_object, name, true, true)
|
79
|
-
if obj.is_a?(CodeObjects::Proxy)
|
80
|
-
match = text[/(.{0,20}\{.*?#{Regexp.quote name}.*?\}.{0,20})/, 1]
|
81
|
-
log.warn "In file `#{current_object.file}':#{current_object.line}: Cannot resolve link to #{obj.path} from text" + (match ? ":" : ".")
|
82
|
-
log.warn '...' + match.gsub(/\n/,"\n\t") + '...' if match
|
83
|
-
end
|
84
|
-
|
85
|
-
"#{sp}<tt>" + linkify(obj, title) + "</tt>"
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
def format_object_name_list(objects)
|
91
|
-
objects.sort_by {|o| o.name.to_s.downcase }.map do |o|
|
92
|
-
"<span class='name'>" + linkify(o, o.name) + "</span>"
|
93
|
-
end.join(", ")
|
94
|
-
end
|
95
|
-
|
96
|
-
# Formats a list of types from a tag.
|
97
|
-
#
|
98
|
-
# @param [Array<String>, FalseClass] typelist
|
99
|
-
# the list of types to be formatted.
|
100
|
-
#
|
101
|
-
# @param [Boolean] brackets omits the surrounding
|
102
|
-
# brackets if +brackets+ is set to +false+.
|
103
|
-
#
|
104
|
-
# @return [String] the list of types formatted
|
105
|
-
# as [Type1, Type2, ...] with the types linked
|
106
|
-
# to their respective descriptions.
|
107
|
-
#
|
108
|
-
def format_types(typelist, brackets = true)
|
109
|
-
return unless typelist.is_a?(Array)
|
110
|
-
list = typelist.map do |type|
|
111
|
-
"<tt>" + type.gsub(/(^|[<>])\s*([^<>#]+)\s*(?=[<>]|$)/) {|m| h($1) + linkify($2, $2) } + "</tt>"
|
112
|
-
end
|
113
|
-
list.empty? ? "" : (brackets ? "[#{list.join(", ")}]" : list.join(", "))
|
114
|
-
end
|
115
|
-
|
116
|
-
def link_file(filename, title = nil, anchor = nil)
|
117
|
-
link_url(url_for_file(filename, anchor), title)
|
118
|
-
end
|
119
|
-
|
120
|
-
def link_object(object, otitle = nil, anchor = nil, relative = true)
|
121
|
-
object = Registry.resolve(current_object, object, true, true) if object.is_a?(String)
|
122
|
-
title = h(otitle ? otitle.to_s : object.path)
|
123
|
-
return title unless serializer
|
124
|
-
|
125
|
-
return title if object.is_a?(CodeObjects::Proxy)
|
126
|
-
|
127
|
-
link = url_for(object, anchor, relative)
|
128
|
-
link ? link_url(link, title) : title
|
129
|
-
end
|
130
|
-
|
131
|
-
def link_url(url, title = nil, params = {})
|
132
|
-
params = SymbolHash.new(false).update(
|
133
|
-
:href => url,
|
134
|
-
:title => title || url
|
135
|
-
).update(params)
|
136
|
-
"<a #{tag_attrs(params)}>#{title}</a>"
|
137
|
-
end
|
138
|
-
|
139
|
-
def tag_attrs(opts = {})
|
140
|
-
opts.map {|k,v| "#{k}=#{v.to_s.inspect}" if v }.join(" ")
|
141
|
-
end
|
142
|
-
|
143
|
-
def anchor_for(object)
|
144
|
-
case object
|
145
|
-
when CodeObjects::MethodObject
|
146
|
-
"#{object.name}-#{object.scope}_#{object.type}"
|
147
|
-
when CodeObjects::Base
|
148
|
-
"#{object.name}-#{object.type}"
|
149
|
-
when CodeObjects::Proxy
|
150
|
-
object.path
|
151
|
-
else
|
152
|
-
object.to_s
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
def url_for(object, anchor = nil, relative = true)
|
157
|
-
link = nil
|
158
|
-
return link unless serializer
|
159
|
-
|
160
|
-
if object.is_a?(CodeObjects::Base) && !object.is_a?(CodeObjects::NamespaceObject)
|
161
|
-
# If the object is not a namespace object make it the anchor.
|
162
|
-
anchor, object = object, object.namespace
|
163
|
-
end
|
164
|
-
|
165
|
-
objpath = serializer.serialized_path(object)
|
166
|
-
return link unless objpath
|
167
|
-
|
168
|
-
if relative
|
169
|
-
fromobj = current_object
|
170
|
-
if current_object.is_a?(CodeObjects::Base) &&
|
171
|
-
!current_object.is_a?(CodeObjects::NamespaceObject)
|
172
|
-
fromobj = fromobj.namespace
|
173
|
-
end
|
174
|
-
|
175
|
-
from = serializer.serialized_path(fromobj)
|
176
|
-
link = File.relative_path(from, objpath)
|
177
|
-
else
|
178
|
-
link = objpath
|
179
|
-
end
|
180
|
-
|
181
|
-
link + (anchor ? '#' + urlencode(anchor_for(anchor)) : '')
|
182
|
-
end
|
183
|
-
|
184
|
-
def url_for_file(filename, anchor = nil)
|
185
|
-
fromobj = current_object
|
186
|
-
if CodeObjects::Base === fromobj && !fromobj.is_a?(CodeObjects::NamespaceObject)
|
187
|
-
fromobj = fromobj.namespace
|
188
|
-
end
|
189
|
-
from = serializer.serialized_path(fromobj)
|
190
|
-
link = File.relative_path(from, filename)
|
191
|
-
link + '.html' + (anchor ? '#' + urlencode(anchor) : '')
|
192
|
-
end
|
193
|
-
end
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|