yard 0.6.8 → 0.7.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 +1 -0
- data/ChangeLog +723 -0
- data/README.md +16 -6
- data/docs/CodeObjects.md +10 -16
- data/docs/GettingStarted.md +232 -32
- data/docs/Glossary.md +1 -2
- data/docs/Handlers.md +10 -16
- data/docs/Overview.md +14 -13
- data/docs/Parser.md +13 -22
- data/docs/Tags.md +209 -16
- data/docs/Templates.md +237 -26
- data/docs/WhatsNew.md +178 -2
- data/lib/yard.rb +13 -10
- data/lib/yard/autoload.rb +22 -18
- data/lib/yard/cli/command.rb +13 -12
- data/lib/yard/cli/command_parser.rb +20 -19
- data/lib/yard/cli/config.rb +19 -19
- data/lib/yard/cli/diff.rb +46 -21
- data/lib/yard/cli/gems.rb +11 -11
- data/lib/yard/cli/graph.rb +13 -13
- data/lib/yard/cli/help.rb +1 -1
- data/lib/yard/cli/list.rb +22 -0
- data/lib/yard/cli/server.rb +17 -17
- data/lib/yard/cli/stats.rb +32 -32
- data/lib/yard/cli/yardoc.rb +181 -135
- data/lib/yard/cli/yri.rb +29 -29
- data/lib/yard/code_objects/base.rb +101 -101
- data/lib/yard/code_objects/class_object.rb +20 -20
- data/lib/yard/code_objects/constant_object.rb +1 -1
- data/lib/yard/code_objects/extended_method_object.rb +5 -5
- data/lib/yard/code_objects/extra_file_object.rb +89 -0
- data/lib/yard/code_objects/macro_object.rb +215 -0
- data/lib/yard/code_objects/method_object.rb +30 -30
- data/lib/yard/code_objects/module_object.rb +1 -1
- data/lib/yard/code_objects/namespace_object.rb +39 -39
- data/lib/yard/code_objects/proxy.rb +38 -38
- data/lib/yard/code_objects/root_object.rb +1 -1
- data/lib/yard/config.rb +40 -40
- data/lib/yard/core_ext/array.rb +2 -2
- data/lib/yard/core_ext/file.rb +11 -11
- data/lib/yard/core_ext/insertion.rb +10 -10
- data/lib/yard/core_ext/module.rb +2 -2
- data/lib/yard/core_ext/string.rb +2 -2
- data/lib/yard/core_ext/symbol_hash.rb +14 -14
- data/lib/yard/docstring.rb +122 -54
- data/lib/yard/globals.rb +2 -2
- data/lib/yard/handlers/base.rb +216 -127
- data/lib/yard/handlers/processor.rb +65 -27
- data/lib/yard/handlers/ruby/alias_handler.rb +6 -3
- data/lib/yard/handlers/ruby/attribute_handler.rb +7 -6
- data/lib/yard/handlers/ruby/base.rb +50 -31
- data/lib/yard/handlers/ruby/class_condition_handler.rb +11 -11
- data/lib/yard/handlers/ruby/class_handler.rb +10 -10
- data/lib/yard/handlers/ruby/class_variable_handler.rb +3 -3
- data/lib/yard/handlers/ruby/constant_handler.rb +7 -7
- data/lib/yard/handlers/ruby/exception_handler.rb +2 -2
- data/lib/yard/handlers/ruby/extend_handler.rb +1 -1
- data/lib/yard/handlers/ruby/legacy/alias_handler.rb +8 -5
- data/lib/yard/handlers/ruby/legacy/attribute_handler.rb +6 -5
- data/lib/yard/handlers/ruby/legacy/base.rb +42 -27
- data/lib/yard/handlers/ruby/legacy/class_condition_handler.rb +9 -9
- data/lib/yard/handlers/ruby/legacy/class_handler.rb +13 -12
- data/lib/yard/handlers/ruby/legacy/class_variable_handler.rb +3 -6
- data/lib/yard/handlers/ruby/legacy/constant_handler.rb +5 -8
- data/lib/yard/handlers/ruby/legacy/exception_handler.rb +1 -1
- data/lib/yard/handlers/ruby/legacy/extend_handler.rb +1 -0
- data/lib/yard/handlers/ruby/legacy/macro_handler.rb +40 -0
- data/lib/yard/handlers/ruby/legacy/method_handler.rb +10 -10
- data/lib/yard/handlers/ruby/legacy/mixin_handler.rb +4 -3
- data/lib/yard/handlers/ruby/legacy/module_handler.rb +2 -1
- data/lib/yard/handlers/ruby/legacy/private_constant_handler.rb +4 -4
- data/lib/yard/handlers/ruby/legacy/visibility_handler.rb +2 -1
- data/lib/yard/handlers/ruby/legacy/yield_handler.rb +3 -3
- data/lib/yard/handlers/ruby/macro_handler.rb +41 -0
- data/lib/yard/handlers/ruby/macro_handler_methods.rb +130 -0
- data/lib/yard/handlers/ruby/method_condition_handler.rb +1 -1
- data/lib/yard/handlers/ruby/method_handler.rb +13 -13
- data/lib/yard/handlers/ruby/mixin_handler.rb +4 -4
- data/lib/yard/handlers/ruby/module_handler.rb +2 -1
- data/lib/yard/handlers/ruby/private_constant_handler.rb +4 -4
- data/lib/yard/handlers/ruby/struct_handler_methods.rb +11 -11
- data/lib/yard/handlers/ruby/visibility_handler.rb +1 -1
- data/lib/yard/handlers/ruby/yield_handler.rb +5 -5
- data/lib/yard/logging.rb +11 -11
- data/lib/yard/parser/base.rb +8 -8
- data/lib/yard/parser/c_parser.rb +42 -33
- data/lib/yard/parser/ruby/ast_node.rb +62 -61
- data/lib/yard/parser/ruby/legacy/ruby_lex.rb +66 -66
- data/lib/yard/parser/ruby/legacy/ruby_parser.rb +4 -4
- data/lib/yard/parser/ruby/legacy/statement.rb +11 -11
- data/lib/yard/parser/ruby/legacy/statement_list.rb +15 -15
- data/lib/yard/parser/ruby/legacy/token_list.rb +9 -9
- data/lib/yard/parser/ruby/ruby_parser.rb +51 -37
- data/lib/yard/parser/source_parser.rb +271 -46
- data/lib/yard/rake/yardoc_task.rb +18 -17
- data/lib/yard/registry.rb +64 -64
- data/lib/yard/registry_store.rb +34 -34
- data/lib/yard/rubygems/backports.rb +8 -0
- data/lib/yard/rubygems/backports/LICENSE.txt +57 -0
- data/lib/yard/rubygems/backports/MIT.txt +20 -0
- data/lib/yard/rubygems/backports/gem.rb +8 -0
- data/lib/yard/rubygems/backports/source_index.rb +353 -0
- data/lib/yard/rubygems/specification.rb +2 -2
- data/lib/yard/serializers/base.rb +20 -20
- data/lib/yard/serializers/file_system_serializer.rb +28 -24
- data/lib/yard/serializers/process_serializer.rb +3 -3
- data/lib/yard/serializers/stdout_serializer.rb +6 -6
- data/lib/yard/serializers/yardoc_serializer.rb +17 -17
- data/lib/yard/server/adapter.rb +12 -12
- data/lib/yard/server/commands/base.rb +26 -26
- data/lib/yard/server/commands/display_file_command.rb +3 -2
- data/lib/yard/server/commands/display_object_command.rb +5 -5
- data/lib/yard/server/commands/frames_command.rb +1 -1
- data/lib/yard/server/commands/library_command.rb +7 -7
- data/lib/yard/server/commands/library_index_command.rb +2 -2
- data/lib/yard/server/commands/list_command.rb +8 -8
- data/lib/yard/server/commands/search_command.rb +8 -8
- data/lib/yard/server/commands/static_file_command.rb +3 -3
- data/lib/yard/server/doc_server_helper.rb +6 -3
- data/lib/yard/server/doc_server_serializer.rb +1 -1
- data/lib/yard/server/library_version.rb +45 -45
- data/lib/yard/server/rack_adapter.rb +10 -10
- data/lib/yard/server/router.rb +28 -28
- data/lib/yard/server/static_caching.rb +5 -5
- data/lib/yard/server/templates/default/fulldoc/html/css/custom.css +3 -3
- data/lib/yard/server/templates/default/fulldoc/html/js/live.js +1 -1
- data/lib/yard/server/templates/default/layout/html/breadcrumb.erb +2 -2
- data/lib/yard/server/templates/default/layout/html/headers.erb +13 -8
- data/lib/yard/server/templates/default/layout/html/setup.rb +7 -0
- data/lib/yard/server/templates/doc_server/full_list/html/full_list.erb +2 -2
- data/lib/yard/server/templates/doc_server/full_list/html/setup.rb +14 -4
- data/lib/yard/server/templates/doc_server/library_list/html/contents.erb +2 -2
- data/lib/yard/server/templates/doc_server/library_list/html/headers.erb +2 -2
- data/lib/yard/server/templates/doc_server/processing/html/processing.erb +1 -1
- data/lib/yard/server/templates/doc_server/search/html/search.erb +1 -1
- data/lib/yard/server/webrick_adapter.rb +2 -2
- data/lib/yard/tags/default_factory.rb +19 -19
- data/lib/yard/tags/default_tag.rb +1 -1
- data/lib/yard/tags/library.rb +68 -63
- data/lib/yard/tags/option_tag.rb +1 -1
- data/lib/yard/tags/overload_tag.rb +9 -9
- data/lib/yard/tags/ref_tag_list.rb +2 -2
- data/lib/yard/tags/tag.rb +7 -7
- data/lib/yard/templates/engine.rb +31 -31
- data/lib/yard/templates/erb_cache.rb +1 -1
- data/lib/yard/templates/helpers/base_helper.rb +46 -32
- data/lib/yard/templates/helpers/filter_helper.rb +2 -2
- data/lib/yard/templates/helpers/html_helper.rb +120 -81
- data/lib/yard/templates/helpers/html_syntax_highlight_helper.rb +4 -4
- data/lib/yard/templates/helpers/markup/rdoc_markup.rb +9 -9
- data/lib/yard/templates/helpers/markup_helper.rb +37 -30
- data/lib/yard/templates/helpers/method_helper.rb +7 -7
- data/lib/yard/templates/helpers/text_helper.rb +7 -7
- data/lib/yard/templates/helpers/uml_helper.rb +3 -3
- data/lib/yard/templates/section.rb +14 -14
- data/lib/yard/templates/template.rb +54 -54
- data/lib/yard/verifier.rb +27 -27
- data/spec/cli/list_spec.rb +8 -0
- data/spec/cli/yardoc_spec.rb +58 -10
- data/spec/code_objects/extra_file_object_spec.rb +132 -0
- data/spec/code_objects/macro_object_spec.rb +154 -0
- data/spec/docstring_spec.rb +90 -0
- data/spec/handlers/base_spec.rb +22 -0
- data/spec/handlers/examples/macro_handler_001.rb.txt +73 -0
- data/spec/handlers/examples/method_handler_001.rb.txt +17 -0
- data/spec/handlers/macro_handler_spec.rb +140 -0
- data/spec/handlers/method_handler_spec.rb +28 -0
- data/spec/handlers/processor_spec.rb +4 -0
- data/spec/handlers/spec_helper.rb +1 -1
- data/spec/parser/c_parser_spec.rb +47 -16
- data/spec/parser/examples/extrafile.c.txt +8 -0
- data/spec/parser/examples/multifile.c.txt +6 -0
- data/spec/parser/ruby/ruby_parser_spec.rb +5 -0
- data/spec/parser/source_parser_spec.rb +235 -0
- data/spec/rake/yardoc_task_spec.rb +22 -17
- data/spec/serializers/file_system_serializer_spec.rb +6 -0
- data/spec/server/commands/library_command_spec.rb +39 -0
- data/spec/spec_helper.rb +14 -0
- data/spec/templates/examples/method001.html +6 -6
- data/spec/templates/examples/method002.html +4 -4
- data/spec/templates/examples/method003.html +10 -10
- data/spec/templates/examples/method005.html +2 -2
- data/spec/templates/examples/module001.dot +2 -0
- data/spec/templates/examples/module001.html +76 -37
- data/spec/templates/examples/module001.txt +1 -1
- data/spec/templates/helpers/base_helper_spec.rb +7 -2
- data/spec/templates/helpers/html_helper_spec.rb +49 -5
- data/spec/templates/helpers/markup_helper_spec.rb +9 -8
- data/spec/templates/module_spec.rb +7 -0
- data/spec/templates/onefile_spec.rb +47 -0
- data/templates/default/fulldoc/html/css/style.css +7 -5
- data/templates/default/fulldoc/html/full_list.erb +13 -10
- data/templates/default/fulldoc/html/full_list_files.erb +1 -1
- data/templates/default/fulldoc/html/js/app.js +16 -14
- data/templates/default/fulldoc/html/js/full_list.js +7 -6
- data/templates/default/fulldoc/html/setup.rb +78 -17
- data/templates/default/layout/html/files.erb +1 -1
- data/templates/default/layout/html/headers.erb +11 -7
- data/templates/default/layout/html/search.erb +4 -4
- data/templates/default/layout/html/setup.rb +28 -8
- data/templates/default/module/html/inherited_attributes.erb +17 -0
- data/templates/default/module/setup.rb +1 -1
- data/templates/default/onefile/html/files.erb +2 -2
- data/templates/default/onefile/html/layout.erb +1 -1
- data/templates/default/onefile/html/setup.rb +7 -5
- data/templates/default/tags/html/option.erb +1 -1
- data/templates/default/tags/html/tag.erb +3 -3
- data/templates/guide/class/html/setup.rb +1 -0
- data/templates/guide/docstring/html/setup.rb +1 -0
- data/templates/guide/fulldoc/html/css/style.css +91 -0
- data/templates/guide/fulldoc/html/js/app.js +33 -0
- data/templates/guide/fulldoc/html/setup.rb +54 -0
- data/templates/guide/layout/html/layout.erb +81 -0
- data/templates/guide/layout/html/setup.rb +24 -0
- data/templates/guide/method/html/header.erb +18 -0
- data/templates/guide/method/html/setup.rb +21 -0
- data/templates/guide/module/html/header.erb +7 -0
- data/templates/guide/module/html/method_list.erb +5 -0
- data/templates/guide/module/html/setup.rb +26 -0
- data/templates/guide/tags/html/setup.rb +8 -0
- metadata +40 -7
- data/lib/yard/handlers/ruby/legacy/process_handler.rb +0 -13
- data/lib/yard/handlers/ruby/process_handler.rb +0 -18
- data/spec/handlers/process_handler_spec.rb +0 -17
@@ -2,15 +2,14 @@ include Helpers::ModuleHelper
|
|
2
2
|
|
3
3
|
def init
|
4
4
|
options[:objects] = objects = run_verifier(options[:objects])
|
5
|
-
options[:files] = ([options[:readme]] + options[:files]).compact
|
5
|
+
options[:files] = ([options[:readme]] + options[:files]).uniq.compact
|
6
6
|
options[:readme] = options[:files].first
|
7
|
-
options[:title] ||= "Documentation by YARD #{YARD::VERSION}"
|
8
7
|
|
9
8
|
return serialize_onefile if options[:onefile]
|
10
9
|
generate_assets
|
11
10
|
serialize('_index.html')
|
12
11
|
options[:files].each_with_index do |file, i|
|
13
|
-
serialize_file(file,
|
12
|
+
serialize_file(file, file.title)
|
14
13
|
end
|
15
14
|
|
16
15
|
options.delete(:objects)
|
@@ -27,6 +26,9 @@ def init
|
|
27
26
|
end
|
28
27
|
end
|
29
28
|
|
29
|
+
# Generate an HTML document for the specified object. This method is used by
|
30
|
+
# most of the objects found in the Registry.
|
31
|
+
# @param [CodeObject] object to be saved to HTML
|
30
32
|
def serialize(object)
|
31
33
|
options[:object] = object
|
32
34
|
serialize_index(options) if object == '_index.html' && options[:files].empty?
|
@@ -35,52 +37,104 @@ def serialize(object)
|
|
35
37
|
end
|
36
38
|
end
|
37
39
|
|
40
|
+
# Generate the documentation output in one file (--one-file) which will load the
|
41
|
+
# contents of all the javascript and css and output the entire contents without
|
42
|
+
# depending on any additional files
|
38
43
|
def serialize_onefile
|
39
|
-
|
40
|
-
options[:
|
44
|
+
layout = Object.new.extend(T('layout'))
|
45
|
+
options[:css_data] = layout.stylesheets.map {|sheet| file(sheet,true) }.join("\n")
|
46
|
+
options[:js_data] = layout.javascripts.map {|script| file(script,true) }.join("")
|
41
47
|
Templates::Engine.with_serializer('index.html', options[:serializer]) do
|
42
48
|
T('onefile').run(options)
|
43
49
|
end
|
44
50
|
end
|
45
51
|
|
52
|
+
# Generate the index document for the output
|
53
|
+
# @params [Hash] options contains data and flags that influence the output
|
46
54
|
def serialize_index(options)
|
47
55
|
Templates::Engine.with_serializer('index.html', options[:serializer]) do
|
48
56
|
T('layout').run(options)
|
49
57
|
end
|
50
58
|
end
|
51
59
|
|
60
|
+
# Generate a single HTML file with the layout template applied. This is generally
|
61
|
+
# the README file or files specified on the command-line.
|
62
|
+
#
|
63
|
+
# @param [File] file object to be saved to the output
|
64
|
+
# @param [String] title currently unused
|
65
|
+
#
|
66
|
+
# @see layout#diskfile
|
52
67
|
def serialize_file(file, title = nil)
|
53
68
|
options[:object] = Registry.root
|
54
69
|
options[:file] = file
|
55
|
-
|
56
|
-
options[:serialized_path] = 'file.' + File.basename(file.gsub(/\.[^.]+$/, '')) + '.html'
|
70
|
+
outfile = 'file.' + file.name + '.html'
|
57
71
|
|
58
72
|
serialize_index(options) if file == options[:readme]
|
59
|
-
Templates::Engine.with_serializer(
|
73
|
+
Templates::Engine.with_serializer(outfile, options[:serializer]) do
|
60
74
|
T('layout').run(options)
|
61
75
|
end
|
62
76
|
options.delete(:file)
|
63
|
-
options.delete(:serialized_path)
|
64
|
-
options.delete(:page_title)
|
65
77
|
end
|
66
78
|
|
79
|
+
#
|
80
|
+
# Generates a file to the output with the specified contents.
|
81
|
+
#
|
82
|
+
# @example saving a custom html file to the documenation root
|
83
|
+
#
|
84
|
+
# asset('my_custom.html','<html><body>Custom File</body></html>')
|
85
|
+
#
|
86
|
+
# @param [String] path relative to the document output where the file will be
|
87
|
+
# created.
|
88
|
+
# @param [String] content the contents that are saved to the file.
|
67
89
|
def asset(path, content)
|
68
90
|
options[:serializer].serialize(path, content) if options[:serializer]
|
69
91
|
end
|
70
92
|
|
93
|
+
# @return [Array<String>] Stylesheet files that are additionally loaded for the
|
94
|
+
# searchable full lists, e.g., Class List, Method List, File List
|
95
|
+
# @since 0.7.0
|
96
|
+
def stylesheets_full_list
|
97
|
+
%w(css/full_list.css css/common.css)
|
98
|
+
end
|
99
|
+
|
100
|
+
# @return [Array<String>] Javascript files that are additionally loaded for the
|
101
|
+
# searchable full lists, e.g., Class List, Method List, File List.
|
102
|
+
# @since 0.7.0
|
103
|
+
def javascripts_full_list
|
104
|
+
%w(js/jquery.js js/full_list.js)
|
105
|
+
end
|
106
|
+
|
107
|
+
def menu_lists
|
108
|
+
Object.new.extend(T('layout')).menu_lists
|
109
|
+
end
|
110
|
+
|
111
|
+
# Generates all the javascript files, stylesheet files, menu lists
|
112
|
+
# (i.e. class, method, and file) based on the the values returned from the
|
113
|
+
# layout's menu_list method, and the frameset in the documentation output
|
114
|
+
#
|
71
115
|
def generate_assets
|
72
|
-
|
73
|
-
|
116
|
+
@object = Registry.root
|
117
|
+
|
118
|
+
layout = Object.new.extend(T('layout'))
|
119
|
+
(layout.javascripts + javascripts_full_list +
|
120
|
+
layout.stylesheets + stylesheets_full_list).uniq.each do |file|
|
74
121
|
asset(file, file(file, true))
|
75
122
|
end
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
123
|
+
layout.menu_lists.each do |list|
|
124
|
+
list_generator_method = "generate_#{list[:type]}_list"
|
125
|
+
if respond_to?(list_generator_method)
|
126
|
+
send(list_generator_method)
|
127
|
+
else
|
128
|
+
log.error "Unable to generate '#{list[:title]}' list because no method " +
|
129
|
+
"'#{list_generator_method}' exists"
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
81
133
|
generate_frameset
|
82
134
|
end
|
83
135
|
|
136
|
+
# Generate a searchable method list in the output
|
137
|
+
# @see ModuleHelper#prune_method_listing
|
84
138
|
def generate_method_list
|
85
139
|
@items = prune_method_listing(Registry.all(:method), false)
|
86
140
|
@items = @items.reject {|m| m.name.to_s =~ /=$/ && m.is_attribute? }
|
@@ -90,6 +144,7 @@ def generate_method_list
|
|
90
144
|
asset('method_list.html', erb(:full_list))
|
91
145
|
end
|
92
146
|
|
147
|
+
# Generate a searchable class list in the output
|
93
148
|
def generate_class_list
|
94
149
|
@items = options[:objects]
|
95
150
|
@list_title = "Class List"
|
@@ -97,6 +152,7 @@ def generate_class_list
|
|
97
152
|
asset('class_list.html', erb(:full_list))
|
98
153
|
end
|
99
154
|
|
155
|
+
# Generate a searchable file list in the output
|
100
156
|
def generate_file_list
|
101
157
|
@file_list = true
|
102
158
|
@items = options[:files]
|
@@ -106,10 +162,15 @@ def generate_file_list
|
|
106
162
|
@file_list = nil
|
107
163
|
end
|
108
164
|
|
165
|
+
# Generate the frame documentation in the output
|
109
166
|
def generate_frameset
|
167
|
+
@javascripts = javascripts_full_list
|
168
|
+
@stylesheets = stylesheets_full_list
|
110
169
|
asset('frames.html', erb(:frames))
|
111
170
|
end
|
112
171
|
|
172
|
+
# @return [String] HTML output of the classes to be displayed in the
|
173
|
+
# full_list_class template.
|
113
174
|
def class_list(root = Registry.root)
|
114
175
|
out = ""
|
115
176
|
children = run_verifier(root.children)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<ul id="files">
|
4
4
|
<% n = 1 %>
|
5
5
|
<% @files.each_with_index do |file, i| %>
|
6
|
-
<li class="r<%= n %>"><%= link_file(file
|
6
|
+
<li class="r<%= n %>"><%= link_file(file) %></li>
|
7
7
|
<% n = n == 2 ? 1 : 2 %>
|
8
8
|
<% end %>
|
9
9
|
</ul>
|
@@ -1,13 +1,17 @@
|
|
1
1
|
<meta http-equiv="Content-Type" content="text/html; charset=<%= charset %>" />
|
2
|
-
<title
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
<title>
|
3
|
+
<%= h @page_title %>
|
4
|
+
<% if options[:title] && @page_title != options[:title] %>
|
5
|
+
— <%= h options[:title] %>
|
6
|
+
<% end %>
|
7
|
+
</title>
|
8
|
+
<% stylesheets.each do |stylesheet| %>
|
9
|
+
<link rel="stylesheet" href="<%= url_for(stylesheet) %>" type="text/css" media="screen" charset="utf-8" />
|
7
10
|
<% end %>
|
8
11
|
<script type="text/javascript" charset="utf-8">
|
9
12
|
relpath = '<%= url_for('') %>';
|
10
13
|
if (relpath != '') relpath += '/';
|
11
14
|
</script>
|
12
|
-
|
13
|
-
<script type="text/javascript" charset="utf-8" src="<%= url_for(
|
15
|
+
<% javascripts.each do |javascript| %>
|
16
|
+
<script type="text/javascript" charset="utf-8" src="<%= url_for(javascript) %>"></script>
|
17
|
+
<% end %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<div id="search">
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
</div>
|
2
|
+
<% menu_lists.each do |field| %>
|
3
|
+
<a id="<%= field[:type] %>_list_link" href="#"><%= field[:search_title] %></a>
|
4
|
+
<% end %>
|
5
|
+
</div>
|
@@ -1,14 +1,13 @@
|
|
1
1
|
def init
|
2
|
-
@breadcrumb = []
|
3
|
-
|
2
|
+
@breadcrumb = []
|
4
3
|
if @onefile
|
5
4
|
sections :layout
|
6
5
|
elsif @file
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
@breadcrumb_title = "File: " + @
|
11
|
-
@page_title
|
6
|
+
if @file.attributes[:namespace]
|
7
|
+
@object = options[:object] = Registry.at(@file.attributes[:namespace]) || Registry.root
|
8
|
+
end
|
9
|
+
@breadcrumb_title = "File: " + @file.title
|
10
|
+
@page_title = @breadcrumb_title
|
12
11
|
sections :layout, [:diskfile]
|
13
12
|
elsif object
|
14
13
|
case object
|
@@ -46,6 +45,27 @@ def index
|
|
46
45
|
end
|
47
46
|
|
48
47
|
def diskfile
|
49
|
-
|
48
|
+
@file.attributes[:markup] ||= markup_for_file('', @file.filename)
|
49
|
+
data = htmlify(@file.contents, @file.attributes[:markup])
|
50
50
|
"<div id='filecontents'>" + data + "</div>"
|
51
51
|
end
|
52
|
+
|
53
|
+
# @return [Array<String>] core javascript files for layout
|
54
|
+
# @since 0.7.0
|
55
|
+
def javascripts
|
56
|
+
%w(js/jquery.js js/app.js)
|
57
|
+
end
|
58
|
+
|
59
|
+
# @return [Array<String>] core stylesheets for the layout
|
60
|
+
# @since 0.7.0
|
61
|
+
def stylesheets
|
62
|
+
%w(css/style.css css/common.css)
|
63
|
+
end
|
64
|
+
|
65
|
+
# @return [Array<Hash{Symbol=>String}>] the list of search links and drop-down menus
|
66
|
+
# @since 0.7.0
|
67
|
+
def menu_lists
|
68
|
+
[ { :type => 'class', :title => 'Classes', :search_title => 'Class List' },
|
69
|
+
{ :type => 'method', :title => 'Methods', :search_title => 'Method List' },
|
70
|
+
{ :type => 'file', :title => 'Files', :search_title => 'File List' } ]
|
71
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<% found_method = false %>
|
2
|
+
<% object.inheritance_tree(true)[1..-1].each do |superclass| %>
|
3
|
+
<% next if superclass.is_a?(YARD::CodeObjects::Proxy) %>
|
4
|
+
<% attribs = superclass.attributes[:instance] %>
|
5
|
+
<% next if attribs.size == 0 %>
|
6
|
+
<% if attr_listing.size == 0 && !found_method %><h2>Instance Attribute Summary</h2><% end %>
|
7
|
+
<% found_method = true %>
|
8
|
+
<h3 class="inherited">Attributes <%= superclass.type == :class ? 'inherited' : 'included' %> from <%= linkify superclass %></h3>
|
9
|
+
<p class="inherited"><%=
|
10
|
+
attribs.sort_by {|args| args.first.to_s }.collect do |args|
|
11
|
+
name, methods = args
|
12
|
+
method = methods[:read] || methods[:write]
|
13
|
+
name = method.name.to_s.gsub(/^#/,'') if superclass.type == :module && object.class_mixins.include?(superclass)
|
14
|
+
linkify(method, name)
|
15
|
+
end.join(", ")
|
16
|
+
%></p>
|
17
|
+
<% end %>
|
@@ -3,7 +3,7 @@ include Helpers::ModuleHelper
|
|
3
3
|
def init
|
4
4
|
sections :header, :box_info, :pre_docstring, T('docstring'), :children,
|
5
5
|
:constant_summary, [T('docstring')], :inherited_constants,
|
6
|
-
:attribute_summary, [:item_summary],
|
6
|
+
:attribute_summary, [:item_summary], :inherited_attributes,
|
7
7
|
:method_summary, [:item_summary], :inherited_methods,
|
8
8
|
:methodmissing, [T('method_details')],
|
9
9
|
:attribute_details, [T('method_details')],
|
@@ -2,7 +2,7 @@
|
|
2
2
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
3
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
4
|
<head>
|
5
|
-
<meta
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=<%= charset %>" />
|
6
6
|
<title><%= @title %></title>
|
7
7
|
<style type="text/css" media="screen">
|
8
8
|
<%= @css_data %>
|
@@ -16,13 +16,9 @@ end
|
|
16
16
|
|
17
17
|
private
|
18
18
|
|
19
|
-
def read_file(file)
|
20
|
-
File.read(file).force_encoding(charset)
|
21
|
-
end
|
22
|
-
|
23
19
|
def parse_top_comments_from_file
|
24
20
|
data = ""
|
25
|
-
tokens = TokenList.new(
|
21
|
+
tokens = TokenList.new(@readme.contents)
|
26
22
|
tokens.each do |token|
|
27
23
|
break unless token.is_a?(RubyToken::TkCOMMENT) || token.is_a?(RubyToken::TkNL)
|
28
24
|
data << (token.text[/\A#\s{0,1}(.*)/, 1] || "\n")
|
@@ -31,7 +27,13 @@ def parse_top_comments_from_file
|
|
31
27
|
end
|
32
28
|
|
33
29
|
def override_serializer
|
30
|
+
return if @serializer.nil?
|
34
31
|
class << @serializer
|
32
|
+
def serialize(object, data)
|
33
|
+
return unless object == 'index.html'
|
34
|
+
super
|
35
|
+
end
|
36
|
+
|
35
37
|
def serialized_path(object)
|
36
38
|
return object if object.is_a?(String)
|
37
39
|
return 'index.html'
|
@@ -6,8 +6,8 @@
|
|
6
6
|
<ul class="option">
|
7
7
|
<% for tag in tags %>
|
8
8
|
<li>
|
9
|
-
<span class="type"><%= format_types(tag.pair.types || ['Object']) %></span>
|
10
9
|
<span class="name"><%= tag.pair.name %></span>
|
10
|
+
<span class="type"><%= format_types(tag.pair.types || ['Object']) %></span>
|
11
11
|
<span class="default">
|
12
12
|
<% if tag.pair.defaults %>
|
13
13
|
— default:
|
@@ -2,12 +2,12 @@
|
|
2
2
|
<ul class="<%= @name %>">
|
3
3
|
<% object.tags(@name).each do |tag| %>
|
4
4
|
<li>
|
5
|
-
<% unless @no_types %>
|
6
|
-
<span class='type'><%= format_types(tag.types) %></span>
|
7
|
-
<% end %>
|
8
5
|
<% unless @no_names %>
|
9
6
|
<span class='name'><%= h tag.name %></span>
|
10
7
|
<% end %>
|
8
|
+
<% unless @no_types %>
|
9
|
+
<span class='type'><%= format_types(tag.types) %></span>
|
10
|
+
<% end %>
|
11
11
|
<% if @name == :param && (o=object.parameters.assoc(tag.name.to_s)) && o[1] %>
|
12
12
|
<em class="default">(defaults to: <tt><%= h o[1] %></tt>)</em>
|
13
13
|
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
include T('guide/module/html')
|
@@ -0,0 +1 @@
|
|
1
|
+
include T('default/docstring/html')
|
@@ -0,0 +1,91 @@
|
|
1
|
+
body { color: #3e4349; font-family: Georgia, serif; font-size: 17px; margin: 0; }
|
2
|
+
h1, h2, h3, h4, h5, h6 { font-weight: normal; color: #000; font-family: Georgia, serif; }
|
3
|
+
h1 { color: #040; }
|
4
|
+
h2 { color: #060; }
|
5
|
+
#sidebar h2 { color: #2f2; }
|
6
|
+
strong { color: #000; }
|
7
|
+
.object_link, tt, code { font-family: 'Consolas', 'BitStream Vera Sans Mono', monospace; font-size: 14px; }
|
8
|
+
.method_header .path, .module_header .path { font-family: 'Consolas', 'BitStream Vera Sans Mono', monospace; }
|
9
|
+
.method_header .path.space, .module_header .path.space { padding-left: 5px; }
|
10
|
+
.method_header { font-size: 0.95em; }
|
11
|
+
.method_body { margin-left: 2em; }
|
12
|
+
.tags h3, .tags h4 { font-size: 0.9em; font-weight: bold; color: #3e4349; }
|
13
|
+
.tags .param .name { font-style: italic; }
|
14
|
+
.tags .option .name { font-family: monospace; color: #000; font-size: 0.8em; }
|
15
|
+
.tags .option .type, .tags .param .type { font-size: 10px; vertical-align: super; }
|
16
|
+
.tags .option .type tt, .tags .param .type tt,
|
17
|
+
.tags .option .type tt .object_link, .tags .param .type tt .object_link { font-size: 10px; }
|
18
|
+
.module_methods { margin-left: 2em; }
|
19
|
+
.method_header .since, .module_header .since { font-size: 0.75em; color: #888; vertical-align: super; }
|
20
|
+
ul { list-style: square; }
|
21
|
+
.inline { display: inline; }
|
22
|
+
.inline p:first-child { display: inline; }
|
23
|
+
.inline p { font-family: Georgia, serif; font-size: 16px; color: #3e4349; }
|
24
|
+
.docstring .note { margin: 1em 0; }
|
25
|
+
.docstring h1, .docstring h2, .docstring h3, .docstring h4 { padding: 0; border: 0; border-bottom: 1px dotted #bbb; }
|
26
|
+
.docstring h1 { font-size: 1.2em; }
|
27
|
+
.docstring h2 { font-size: 1.1em; }
|
28
|
+
.docstring h3 { font-size: 1.1em; }
|
29
|
+
#filecontents strong { font-weight: normal; color: #000; }
|
30
|
+
.readonly { font-size: 0.75em; color: #888; vertical-align: super; }
|
31
|
+
|
32
|
+
#page { width: 940px; margin: 0px auto; }
|
33
|
+
#top_nav { background: #8e0; padding: 4px 8px; }
|
34
|
+
#inner_nav { width: 940px; margin: 0px auto; }
|
35
|
+
#inner_nav a { border: 0; text-decoration: none; color: #777; }
|
36
|
+
#inner_nav a:hover { color: #eee; }
|
37
|
+
#top_nav .links { display: block; float: right; }
|
38
|
+
#content { margin-left: 30px; width: 660px; float: left; }
|
39
|
+
#sidebar { float: left; width: 200px; float: left; padding: 18px 10px; padding-top: 0; }
|
40
|
+
#sidebar h2 { font-weight: 100; color: #3e4349; font-size: 1.45em; }
|
41
|
+
#sidebar ol { padding-left: 19px; margin-left: 0; list-style: square; }
|
42
|
+
#sidebar a { color: #777; }
|
43
|
+
#sidebar ol.top { padding-left: 0; margin-left: 0; list-style: none; }
|
44
|
+
#sidebar a { font-size: 0.9em; }
|
45
|
+
#footer { margin: 0 auto; width: 940px; text-align: center; margin-top: 30px; padding: 20px 0; color: #888; font-size: 0.8em; border-top: 1px dotted #bbb; }
|
46
|
+
#footer a { color: #444; }
|
47
|
+
#links strong { font-size: 0.95em; font-weight: normal; color: #000; }
|
48
|
+
|
49
|
+
a { color: #268; text-decoration: none; }
|
50
|
+
a:hover { color: #060; background: #8e0; }
|
51
|
+
|
52
|
+
/* syntax highlighting */
|
53
|
+
.source_code { display: none; padding: 3px 8px; border-left: 8px solid #ddd; margin-top: 5px; }
|
54
|
+
#filecontents pre.code, .docstring pre.code, .source_code pre { font-family: monospace; }
|
55
|
+
#filecontents pre.code, .docstring pre.code { display: block; }
|
56
|
+
.source_code .lines { padding-right: 12px; color: #555; text-align: right; }
|
57
|
+
#filecontents pre.code, .docstring pre.code,
|
58
|
+
.tags .example {
|
59
|
+
font-size: 0.9em;
|
60
|
+
padding: 7px 30px;
|
61
|
+
margin: 15px -30px;
|
62
|
+
margin-left: -30px;
|
63
|
+
background: #eee;
|
64
|
+
line-height: 1.3em;
|
65
|
+
font-family: 'Consolas', 'BitStream Vera Sans Mono', monospace;
|
66
|
+
}
|
67
|
+
pre.code { color: #3e4349; }
|
68
|
+
pre.code .info.file { color: #555; }
|
69
|
+
pre.code .val { color: #036A07; }
|
70
|
+
pre.code .tstring_content,
|
71
|
+
pre.code .heredoc_beg, pre.code .heredoc_end,
|
72
|
+
pre.code .qwords_beg, pre.code .qwords_end,
|
73
|
+
pre.code .tstring, pre.code .dstring { color: #036A07; }
|
74
|
+
pre.code .fid, pre.code .id.new, pre.code .id.to_s,
|
75
|
+
pre.code .id.to_sym, pre.code .id.to_f,
|
76
|
+
pre.code .dot + pre.code .id,
|
77
|
+
pre.code .id.to_i pre.code .id.each { color: #0085FF; }
|
78
|
+
pre.code .comment { color: #0066FF; }
|
79
|
+
pre.code .const, pre.code .constant { color: #585CF6; }
|
80
|
+
pre.code .symbol { color: #C5060B; }
|
81
|
+
pre.code .kw,
|
82
|
+
pre.code .label,
|
83
|
+
pre.code .id.require,
|
84
|
+
pre.code .id.extend,
|
85
|
+
pre.code .id.include { color: #0000FF; }
|
86
|
+
pre.code .ivar { color: #318495; }
|
87
|
+
pre.code .gvar,
|
88
|
+
pre.code .id.backref,
|
89
|
+
pre.code .id.nth_ref { color: #6D79DE; }
|
90
|
+
pre.code .regexp, .dregexp { color: #036A07; }
|
91
|
+
pre.code a { border-bottom: 1px dotted #bbf; }
|