yard-rustdoc 0.1.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -5
- data/lib/yard-rustdoc/parser.rb +3 -1
- data/lib/yard-rustdoc/statements.rb +4 -2
- data/lib/yard-rustdoc/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19da90b28963c2ad60120d5e2922e78420742b86877e25dc3c97ca65f593b4de
|
4
|
+
data.tar.gz: df6a069c8ccd528a89b6107def280d861ad17e6339d515fc67ab0ac7c397173b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5452d4c276d7c373621020ae0d9055debdfa9c70c1e2137b1cdff156633a11755d550501e66f8bf16914306c05ac50080991a48f7ae842c7f6367b8456f47716
|
7
|
+
data.tar.gz: ac56ea8762ba940ed2b5e83f1da77013585b80fb9e59e448eaee7ebf043c9d6037f0a74509a1b8d417f3fd2949b6f94a80edc22a19b9e75bffe0fe324adb4638
|
data/README.md
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
# YARD::Rustdoc
|
2
2
|
|
3
3
|
YARD plugin for documenting Magnus-based Rust gems. Supports writing class
|
4
|
-
documentation on Struct and method documentation on Struct
|
5
|
-
|
6
|
-
**Note**: WIP, not released.
|
4
|
+
documentation on Struct and Enums, and method documentation on Struct and Enum
|
5
|
+
methods.
|
7
6
|
|
8
7
|
## Installation
|
9
8
|
|
10
9
|
Add this line to your application's Gemfile:
|
11
10
|
|
12
11
|
```ruby
|
13
|
-
gem
|
12
|
+
gem "yard-rustdoc"
|
14
13
|
```
|
15
14
|
|
16
15
|
Load the plugin through `--plugin rustdoc` (e.g. in your project's `.yardopts`).
|
@@ -73,12 +72,16 @@ impl Bar {
|
|
73
72
|
}
|
74
73
|
```
|
75
74
|
|
76
|
-
Defines `Foo::Bar#baz
|
75
|
+
Defines `Foo::Bar#baz` and `#qux` -- instance method because the method's first
|
76
|
+
argument is either `&self` or `rb_self`.
|
77
77
|
|
78
78
|
```rust
|
79
79
|
impl Bar {
|
80
80
|
/// @yard
|
81
81
|
fn baz(&self) {}
|
82
|
+
|
83
|
+
/// @yard
|
84
|
+
fn qux(rb_self: Value) {}
|
82
85
|
}
|
83
86
|
```
|
84
87
|
|
@@ -111,6 +114,7 @@ YARD's syntax differs from what Rustdoc expects. Linters you man want to disable
|
|
111
114
|
```rust
|
112
115
|
#![allow(rustdoc::broken_intra_doc_links)]
|
113
116
|
#![allow(rustdoc::invalid_html_tags)]
|
117
|
+
#![allow(rustdoc::bare_urls)]
|
114
118
|
```
|
115
119
|
|
116
120
|
## Development
|
data/lib/yard-rustdoc/parser.rb
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
module YARD::Parser::Rustdoc
|
4
4
|
class Parser < YARD::Parser::Base
|
5
|
+
TOP_LEVEL_KINDS = ["struct", "enum"].freeze
|
6
|
+
|
5
7
|
# This default constructor does nothing. The subclass is responsible for
|
6
8
|
# storing the source contents and filename if they are required.
|
7
9
|
# @param [String] source the source contents
|
@@ -28,7 +30,7 @@ module YARD::Parser::Rustdoc
|
|
28
30
|
|
29
31
|
@rustdoc_json.each do |id, entry|
|
30
32
|
next unless relevant_entry?(entry)
|
31
|
-
next unless entry["kind"]
|
33
|
+
next unless TOP_LEVEL_KINDS.include?(entry["kind"])
|
32
34
|
|
33
35
|
methods = entry
|
34
36
|
.dig("inner", "impls")
|
@@ -10,7 +10,9 @@ module YARD::Parser::Rustdoc
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def docstring
|
13
|
-
@rustdoc
|
13
|
+
@docstring ||= @rustdoc
|
14
|
+
.fetch("docs")
|
15
|
+
.gsub(/^\s*@yard\s*\n/m, "") # remove @yard line
|
14
16
|
end
|
15
17
|
|
16
18
|
def source
|
@@ -90,7 +92,7 @@ module YARD::Parser::Rustdoc
|
|
90
92
|
|
91
93
|
def scope
|
92
94
|
first_arg = @rustdoc.dig("inner", "decl", "inputs", 0, 0)
|
93
|
-
if first_arg == "self"
|
95
|
+
if first_arg == "self" || first_arg == "rb_self"
|
94
96
|
:instance
|
95
97
|
else
|
96
98
|
:class
|
data/lib/yard-rustdoc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yard-rustdoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jimmy Bourassa
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yard
|
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '0'
|
117
117
|
requirements: []
|
118
|
-
rubygems_version: 3.3.
|
118
|
+
rubygems_version: 3.3.24
|
119
119
|
signing_key:
|
120
120
|
specification_version: 4
|
121
121
|
summary: Generate YARD documentation for Magnus-based Rust gems.
|