yard 0.9.16 → 0.9.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.yardopts +0 -0
- data/CHANGELOG.md +15 -1
- data/README.md +1 -1
- data/Rakefile +10 -15
- data/bin/yard +0 -0
- data/bin/yardoc +0 -0
- data/bin/yri +0 -0
- data/docs/GettingStarted.md +1 -1
- data/lib/yard/autoload.rb +5 -0
- data/lib/yard/cli/i18n.rb +1 -1
- data/lib/yard/cli/stats.rb +1 -1
- data/lib/yard/cli/yardoc.rb +4 -3
- data/lib/yard/code_objects/base.rb +6 -1
- data/lib/yard/code_objects/extra_file_object.rb +7 -4
- data/lib/yard/core_ext/module.rb +0 -9
- data/lib/yard/docstring.rb +10 -2
- data/lib/yard/handlers/c/handler_methods.rb +2 -1
- data/lib/yard/handlers/c/method_handler.rb +9 -0
- data/lib/yard/handlers/common/method_handler.rb +19 -0
- data/lib/yard/handlers/ruby/dsl_handler_methods.rb +3 -2
- data/lib/yard/handlers/ruby/method_handler.rb +3 -7
- data/lib/yard/parser/source_parser.rb +1 -1
- data/lib/yard/server/commands/display_file_command.rb +1 -1
- data/lib/yard/templates/helpers/html_helper.rb +5 -1
- data/lib/yard/version.rb +6 -4
- data/spec/cli/yardoc_spec.rb +48 -1
- data/spec/code_objects/base_spec.rb +10 -0
- data/spec/core_ext/module_spec.rb +0 -6
- data/spec/docstring_parser_spec.rb +18 -0
- data/spec/docstring_spec.rb +9 -0
- data/spec/examples.txt +1883 -1874
- data/spec/handlers/c/method_handler_spec.rb +2 -0
- data/spec/parser/c_parser_spec.rb +13 -0
- data/spec/parser/examples/file.c.txt +28 -0
- data/spec/templates/helpers/html_helper_spec.rb +34 -0
- data/spec/templates/method_spec.rb +2 -2
- data/templates/default/fulldoc/html/js/app.js +11 -0
- data/templates/default/onefile/html/setup.rb +1 -1
- metadata +5 -4
|
@@ -213,6 +213,7 @@ RSpec.describe YARD::Handlers::C::MethodHandler do
|
|
|
213
213
|
foo = Registry.at('Foo#foo?')
|
|
214
214
|
expect(foo.docstring).to eq 'DOCSTRING'
|
|
215
215
|
expect(foo.tag(:return).types).to eq ['Boolean']
|
|
216
|
+
expect(foo.tags(:return).size).to eq 1
|
|
216
217
|
end
|
|
217
218
|
|
|
218
219
|
it "does not add return tag if return tags exist" do
|
|
@@ -226,6 +227,7 @@ RSpec.describe YARD::Handlers::C::MethodHandler do
|
|
|
226
227
|
eof
|
|
227
228
|
foo = Registry.at('Foo#foo?')
|
|
228
229
|
expect(foo.tag(:return).types).to eq ['String']
|
|
230
|
+
expect(foo.tags(:return).size).to eq 1
|
|
229
231
|
end
|
|
230
232
|
|
|
231
233
|
it "handles casted method names" do
|
|
@@ -178,6 +178,19 @@ RSpec.describe YARD::Parser::C::CParser do
|
|
|
178
178
|
expect(Registry.at('Foo#func').docstring).to eq "docstring"
|
|
179
179
|
end
|
|
180
180
|
end
|
|
181
|
+
|
|
182
|
+
describe "File singleton methods" do
|
|
183
|
+
before(:all) do
|
|
184
|
+
file = File.join(File.dirname(__FILE__), 'examples', 'file.c.txt')
|
|
185
|
+
parse(File.read(file))
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
it "parses methods from define_filetest_function" do
|
|
189
|
+
obj = YARD::Registry.at('File.exist?')
|
|
190
|
+
expect(obj).not_to be nil
|
|
191
|
+
expect(obj.docstring).not_to be_blank
|
|
192
|
+
end
|
|
193
|
+
end
|
|
181
194
|
end
|
|
182
195
|
|
|
183
196
|
describe "Override comments" do
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
VALUE rb_cFile;
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* call-seq:
|
|
5
|
+
* File.exist?(file_name) -> true or false
|
|
6
|
+
*
|
|
7
|
+
* Return <code>true</code> if the named file exists.
|
|
8
|
+
*
|
|
9
|
+
* _file_name_ can be an IO object.
|
|
10
|
+
*
|
|
11
|
+
* "file exists" means that stat() or fstat() system call is successful.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
static VALUE
|
|
15
|
+
rb_file_exist_p(VALUE obj, VALUE fname)
|
|
16
|
+
{
|
|
17
|
+
struct stat st;
|
|
18
|
+
|
|
19
|
+
if (rb_stat(fname, &st) < 0) return Qfalse;
|
|
20
|
+
return Qtrue;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
void
|
|
24
|
+
Init_File(void)
|
|
25
|
+
{
|
|
26
|
+
rb_cFile = rb_define_class("File", rb_cIO);
|
|
27
|
+
define_filetest_function("exist?", rb_file_exist_p, 1);
|
|
28
|
+
}
|
|
@@ -214,6 +214,40 @@ RSpec.describe YARD::Templates::Helpers::HtmlHelper do
|
|
|
214
214
|
html = htmlify(markdown, :markdown)
|
|
215
215
|
expect(html).to match %r{^<p>Introduction:</p>.*<code class="ruby">}m
|
|
216
216
|
end
|
|
217
|
+
|
|
218
|
+
it "sets env and env-yard attributes (AsciiDoc specific)" do
|
|
219
|
+
adoc = <<-EOF.strip.gsub(/^ +/, "") # strip and unindent
|
|
220
|
+
ifdef::env[]
|
|
221
|
+
Attribute "env" is set, and its value is "{env}".
|
|
222
|
+
endif::[]
|
|
223
|
+
|
|
224
|
+
ifdef::env-yard[]
|
|
225
|
+
Attribute "env-yard" is set, and its value is "{env-yard}".
|
|
226
|
+
endif::[]
|
|
227
|
+
EOF
|
|
228
|
+
html = htmlify(adoc, :asciidoc)
|
|
229
|
+
expect(html).to match(/"env" is set, and its value is "yard"./)
|
|
230
|
+
expect(html).to match(/"env-yard" is set, and its value is ""./)
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
it "should not include the document title from the AsciiDoc header" do
|
|
234
|
+
adoc = <<-EOF.strip.gsub(/^ +/, "") # strip and unindent
|
|
235
|
+
= Project Name
|
|
236
|
+
|
|
237
|
+
Introduction.
|
|
238
|
+
|
|
239
|
+
== Installation
|
|
240
|
+
|
|
241
|
+
Installation instructions.
|
|
242
|
+
|
|
243
|
+
== Usage
|
|
244
|
+
|
|
245
|
+
Usage instructions.
|
|
246
|
+
EOF
|
|
247
|
+
html = htmlify(adoc, :asciidoc)
|
|
248
|
+
expect(html).to_not match(/Project Name/)
|
|
249
|
+
expect(html).to include(%(<h2 id="_installation">Installation</h2>))
|
|
250
|
+
end
|
|
217
251
|
end
|
|
218
252
|
|
|
219
253
|
describe "#link_object" do
|
|
@@ -101,7 +101,7 @@ RSpec.describe YARD::Templates::Engine.template(:default, :method) do
|
|
|
101
101
|
it_should_behave_like "all formats"
|
|
102
102
|
end
|
|
103
103
|
|
|
104
|
-
describe "method with keyword arguments
|
|
104
|
+
describe "method with keyword arguments" do
|
|
105
105
|
before do
|
|
106
106
|
@template = :method006
|
|
107
107
|
YARD.parse_string <<-'eof'
|
|
@@ -114,5 +114,5 @@ RSpec.describe YARD::Templates::Engine.template(:default, :method) do
|
|
|
114
114
|
end
|
|
115
115
|
|
|
116
116
|
it_should_behave_like "all formats"
|
|
117
|
-
end
|
|
117
|
+
end if RUBY_VERSION >= "2.1"
|
|
118
118
|
end
|
|
@@ -275,6 +275,16 @@ function mainFocus() {
|
|
|
275
275
|
setTimeout(function() { $('#main').focus(); }, 10);
|
|
276
276
|
}
|
|
277
277
|
|
|
278
|
+
function navigationChange() {
|
|
279
|
+
// This works around the broken anchor navigation with the YARD template.
|
|
280
|
+
window.onpopstate = function() {
|
|
281
|
+
var hash = window.location.hash;
|
|
282
|
+
if (hash !== '' && $(hash)[0]) {
|
|
283
|
+
$(hash)[0].scrollIntoView();
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
|
|
278
288
|
$(document).ready(function() {
|
|
279
289
|
navResizer();
|
|
280
290
|
navExpander();
|
|
@@ -287,6 +297,7 @@ $(document).ready(function() {
|
|
|
287
297
|
constantSummaryToggle();
|
|
288
298
|
generateTOC();
|
|
289
299
|
mainFocus();
|
|
300
|
+
navigationChange();
|
|
290
301
|
});
|
|
291
302
|
|
|
292
303
|
})();
|
|
@@ -41,7 +41,7 @@ def parse_top_comments_from_file
|
|
|
41
41
|
tokens = TokenList.new(@readme.contents)
|
|
42
42
|
tokens.each do |token|
|
|
43
43
|
break unless token.is_a?(RubyToken::TkCOMMENT) || token.is_a?(RubyToken::TkNL)
|
|
44
|
-
data
|
|
44
|
+
data += (token.text[/\A#\s{0,1}(.*)/, 1] || "\n")
|
|
45
45
|
end
|
|
46
46
|
YARD::Docstring.new(data)
|
|
47
47
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: yard
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
4
|
+
version: 0.9.19
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Loren Segal
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2019-04-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: |2
|
|
14
14
|
YARD is a documentation generation tool for the Ruby programming language.
|
|
@@ -129,6 +129,7 @@ files:
|
|
|
129
129
|
- lib/yard/handlers/c/path_handler.rb
|
|
130
130
|
- lib/yard/handlers/c/struct_handler.rb
|
|
131
131
|
- lib/yard/handlers/c/symbol_handler.rb
|
|
132
|
+
- lib/yard/handlers/common/method_handler.rb
|
|
132
133
|
- lib/yard/handlers/processor.rb
|
|
133
134
|
- lib/yard/handlers/ruby/alias_handler.rb
|
|
134
135
|
- lib/yard/handlers/ruby/attribute_handler.rb
|
|
@@ -383,6 +384,7 @@ files:
|
|
|
383
384
|
- spec/parser/examples/array.c.txt
|
|
384
385
|
- spec/parser/examples/example1.rb.txt
|
|
385
386
|
- spec/parser/examples/extrafile.c.txt
|
|
387
|
+
- spec/parser/examples/file.c.txt
|
|
386
388
|
- spec/parser/examples/multifile.c.txt
|
|
387
389
|
- spec/parser/examples/namespace.cpp.txt
|
|
388
390
|
- spec/parser/examples/override.c.txt
|
|
@@ -638,8 +640,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
638
640
|
- !ruby/object:Gem::Version
|
|
639
641
|
version: '0'
|
|
640
642
|
requirements: []
|
|
641
|
-
|
|
642
|
-
rubygems_version: 2.6.12
|
|
643
|
+
rubygems_version: 3.0.3
|
|
643
644
|
signing_key:
|
|
644
645
|
specification_version: 4
|
|
645
646
|
summary: Documentation tool for consistent and usable documentation in Ruby.
|