yard-markdown 0.2.2 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/example/Bird.md +41 -24
- data/example/Duck.md +68 -33
- data/example/Waterfowl.md +25 -11
- data/templates/default/fulldoc/markdown/setup.rb +28 -26
- 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: '0282033a919774b5cd92979a1291cda4ed834c27cbfc21ca231982475aefa6cf'
|
4
|
+
data.tar.gz: ade62aa4bc7c6091cbdc229bebf16ec77f753bba17e0ab0e0ef0fe28527838a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8604ca85cdc4e6486b00e94a694fa35661dc06c9042882e41afe9e41fa863d582173473b8fbc8e1edb8e08db8908ab26bc887c4773465c8d94c04c6c72992366
|
7
|
+
data.tar.gz: bbf3e68cd55b9ead82fbe0307d106e7e31a284fbb567eadb3bf6ab08c4b2ba1523699629950e7d85124216da3c94f114220e3bf2c0857d5f0d2d088ca39d0074
|
data/example/Bird.md
CHANGED
@@ -1,36 +1,53 @@
|
|
1
1
|
# Class: Bird
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
| **Defined in:** | example.rb |
|
2
|
+
**Inherits:** Object
|
3
|
+
|
4
|
+
**Defined in:** example.rb
|
6
5
|
|
7
6
|
The base class for all birds.
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
## fly(direction, velocity) [](#method-i-fly)
|
18
|
-
Fly somewhere.
|
7
|
+
|
8
|
+
|
9
|
+
# Public Instance Methods
|
10
|
+
|
11
|
+
## _fly_impl(_direction, _velocity) [](#method-i-_fly_impl)
|
12
|
+
:nodoc:
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
## fly(direction, velocity) [](#method-i-fly)
|
17
|
+
Fly somewhere.
|
19
18
|
|
20
19
|
Flying is the most critical feature of birds.
|
21
20
|
|
22
21
|
:args: direction, velocity
|
23
22
|
|
24
23
|
:call-seq:
|
25
|
-
|
26
|
-
|
24
|
+
Bird.fly(symbol, number) -> bool
|
25
|
+
Bird.fly(string, number) -> bool
|
26
|
+
|
27
|
+
# Example
|
28
|
+
|
29
|
+
fly(:south, 70)
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
## speak() [](#method-i-speak)
|
34
|
+
Produce some noise. -- FIXME: maybe extract this to a base class `Animal`? ++
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
# Constants
|
42
|
+
|
43
|
+
## DEFAULT_DUCK_VELOCITY [](#constant-DEFAULT_DUCK_VELOCITY)
|
44
|
+
Default velocity for a flying duck.
|
45
|
+
|
27
46
|
|
28
|
-
|
47
|
+
|
48
|
+
## DEFAULT_SPEED [](#constant-DEFAULT_SPEED)
|
49
|
+
Maximum speed for a swimming duck.
|
29
50
|
|
30
|
-
fly(:south, 70)
|
31
|
-
## speak() [](#method-i-speak)
|
32
|
-
Produce some noise.
|
33
|
-
--
|
34
|
-
FIXME: maybe extract this to a base class +Animal+?
|
35
|
-
++
|
36
51
|
|
52
|
+
|
53
|
+
|
data/example/Duck.md
CHANGED
@@ -1,47 +1,82 @@
|
|
1
1
|
# Class: Duck
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
**Inherits:** Object
|
3
|
+
|
4
|
+
**Extended by:** Animal
|
5
|
+
|
6
|
+
**Includes:** Waterfowl
|
7
|
+
|
8
|
+
**Defined in:** example.rb
|
8
9
|
|
9
10
|
A duck is a Waterfowl Bird.
|
10
11
|
|
11
12
|
Features:
|
12
13
|
|
13
|
-
|
14
|
+
bird::
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
* speak
|
17
|
+
* fly
|
17
18
|
|
18
|
-
|
19
|
+
waterfowl::
|
19
20
|
|
20
|
-
|
21
|
-
# Constants
|
22
|
-
## DEFAULT_DUCK_VELOCITY [](#constant-DEFAULT_DUCK_VELOCITY)
|
23
|
-
Default velocity for a flying duck.
|
24
|
-
## DEFAULT_SPEED [](#constant-DEFAULT_SPEED)
|
25
|
-
Maximum speed for a swimming duck.
|
21
|
+
* swim
|
26
22
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
##
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
23
|
+
|
24
|
+
# Public Instance Methods
|
25
|
+
|
26
|
+
## initialize(domestic, rubber) [](#method-i-initialize)
|
27
|
+
Creates a new duck.
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
## speak() [](#method-i-speak)
|
32
|
+
Duck overrides generic implementation.
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
## swim() [](#method-i-swim)
|
37
|
+
Swimming helper.
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
## useful?() [](#method-i-useful?)
|
42
|
+
Checks if this duck is a useful one.
|
36
43
|
|
37
44
|
:call-seq:
|
38
|
-
|
45
|
+
Bird.useful? -> bool
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
# Public Class Methods
|
51
|
+
|
52
|
+
## rubber_ducks() [](#method-c-rubber_ducks)
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
# Attributes
|
57
|
+
|
58
|
+
## domestic[RW] [](#attribute-i-domestic)
|
59
|
+
True for domestic ducks.
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
## rubber[RW] [](#attribute-i-rubber)
|
64
|
+
True for rubber ducks.
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
# Constants
|
71
|
+
|
72
|
+
## DEFAULT_DUCK_VELOCITY [](#constant-DEFAULT_DUCK_VELOCITY)
|
73
|
+
Default velocity for a flying duck.
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
## DEFAULT_SPEED [](#constant-DEFAULT_SPEED)
|
78
|
+
Maximum speed for a swimming duck.
|
39
79
|
|
40
|
-
# Public Class Methods
|
41
|
-
## rubber_ducks() [](#method-c-rubber_ducks)
|
42
80
|
|
43
|
-
|
44
|
-
|
45
|
-
True for domestic ducks.
|
46
|
-
## rubber[RW] [](#attribute-i-rubber)
|
47
|
-
True for rubber ducks.
|
81
|
+
|
82
|
+
|
data/example/Waterfowl.md
CHANGED
@@ -1,16 +1,30 @@
|
|
1
1
|
# Module: Waterfowl
|
2
|
-
|
3
|
-
|
4
|
-
| **Defined in:** | example.rb |
|
2
|
+
|
3
|
+
**Defined in:** example.rb
|
5
4
|
|
6
5
|
A mixin for waterfowl creatures.
|
7
|
-
# Constants
|
8
|
-
## DEFAULT_DUCK_VELOCITY [](#constant-DEFAULT_DUCK_VELOCITY)
|
9
|
-
Default velocity for a flying duck.
|
10
|
-
## DEFAULT_SPEED [](#constant-DEFAULT_SPEED)
|
11
|
-
Maximum speed for a swimming duck.
|
12
6
|
|
13
|
-
# Public Instance Methods
|
14
|
-
## swim() [](#method-i-swim)
|
15
|
-
Swimming helper.
|
16
7
|
|
8
|
+
# Public Instance Methods
|
9
|
+
|
10
|
+
## swim() [](#method-i-swim)
|
11
|
+
Swimming helper.
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
# Constants
|
19
|
+
|
20
|
+
## DEFAULT_DUCK_VELOCITY [](#constant-DEFAULT_DUCK_VELOCITY)
|
21
|
+
Default velocity for a flying duck.
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
## DEFAULT_SPEED [](#constant-DEFAULT_SPEED)
|
26
|
+
Maximum speed for a swimming duck.
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
|
@@ -94,38 +94,24 @@ def serialize(object)
|
|
94
94
|
template =
|
95
95
|
ERB.new(
|
96
96
|
'# <%= format_object_title object %>
|
97
|
-
| | |
|
98
|
-
| -----------------: | :----- |
|
99
97
|
<% if CodeObjects::ClassObject === object && object.superclass %>
|
100
|
-
|
101
|
-
<% end %>
|
102
|
-
<% [[:class, "Extended by"], [:instance, "Includes"]].each do |scope, name| %>
|
98
|
+
**Inherits:** <%= object.superclass %>
|
99
|
+
<% end %><% [[:class, "Extended by"], [:instance, "Includes"]].each do |scope, name| %>
|
103
100
|
<% if (mix = run_verifier(object.mixins(scope))).size > 0 %>
|
104
|
-
|
105
|
-
<% end %>
|
106
|
-
<% end %>
|
101
|
+
**<%= name %>:** <%= mix.sort_by {|o| o.path }.join(", ") %>
|
102
|
+
<% end %><% end %>
|
107
103
|
<% unless object.root? %>
|
108
|
-
|
104
|
+
**Defined in:** <%= object.file ? object.file : "(unknown)" %>
|
109
105
|
<% end %>
|
110
106
|
|
111
|
-
<%= object.docstring %>
|
107
|
+
<%= rdoc_to_md object.docstring %>
|
112
108
|
|
113
|
-
<% if constant_listing.size > 0 %>
|
114
|
-
<% groups(constant_listing, "Constants") do |list, name| %>
|
115
|
-
# <%= name %>
|
116
|
-
<% list.each do |cnst| %>
|
117
|
-
## <%= cnst.name %> [](#<%=aref(cnst)%>)
|
118
|
-
<%= cnst.docstring %>
|
119
|
-
|
120
|
-
<% end %>
|
121
|
-
<% end %>
|
122
|
-
<% end %>
|
123
109
|
|
124
110
|
<% if (insmeths = public_instance_methods(object)).size > 0 %>
|
125
111
|
# Public Instance Methods
|
126
112
|
<% insmeths.each do |item| %>
|
127
113
|
## <%= item.name(false) %>(<%= item.parameters.map {|p| p.join("") }.join(", ")%>) [](#<%=aref(item)%>)
|
128
|
-
<%= item.docstring %>
|
114
|
+
<%= rdoc_to_md item.docstring %>
|
129
115
|
|
130
116
|
<% end %>
|
131
117
|
<% end %>
|
@@ -134,7 +120,7 @@ def serialize(object)
|
|
134
120
|
# Public Class Methods
|
135
121
|
<% pubmeths.each do |item| %>
|
136
122
|
## <%= item.name(false) %>(<%= item.parameters.map {|p| p.join(" ") }.join(", ") %>) [](#<%=aref(item)%>)
|
137
|
-
<%= item.docstring %>
|
123
|
+
<%= rdoc_to_md item.docstring %>
|
138
124
|
|
139
125
|
<% end %>
|
140
126
|
<% end %>
|
@@ -142,17 +128,33 @@ def serialize(object)
|
|
142
128
|
# Attributes
|
143
129
|
<% attrs.each do |item|%>
|
144
130
|
## <%= item.name %><%= item.reader? ? "[RW]" : "[R]" %> [](#<%=aref(item)%>)
|
145
|
-
<%= item.docstring %>
|
131
|
+
<%= rdoc_to_md item.docstring %>
|
132
|
+
|
133
|
+
<% end %>
|
134
|
+
<% end %>
|
135
|
+
|
136
|
+
|
137
|
+
<% if constant_listing.size > 0 %>
|
138
|
+
<% groups(constant_listing, "Constants") do |list, name| %>
|
139
|
+
# <%= name %>
|
140
|
+
<% list.each do |cnst| %>
|
141
|
+
## <%= cnst.name %> [](#<%=aref(cnst)%>)
|
142
|
+
<%= rdoc_to_md cnst.docstring %>
|
146
143
|
|
147
144
|
<% end %>
|
148
145
|
<% end %>
|
149
|
-
|
150
|
-
|
151
|
-
)
|
146
|
+
<% end %>
|
147
|
+
', trim_mode: "%<>")
|
152
148
|
|
153
149
|
template.result(binding)
|
154
150
|
end
|
155
151
|
|
152
|
+
require 'rdoc'
|
153
|
+
|
154
|
+
def rdoc_to_md(docstring)
|
155
|
+
RDoc::Markup::ToMarkdown.new.convert(docstring)
|
156
|
+
end
|
157
|
+
|
156
158
|
def aref(object)
|
157
159
|
if object.type == :constant
|
158
160
|
"constant-#{object.name(false)}"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yard-markdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stanislav (Stas) Katkov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yard
|
@@ -66,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: '0'
|
68
68
|
requirements: []
|
69
|
-
rubygems_version: 3.5.
|
69
|
+
rubygems_version: 3.5.5
|
70
70
|
signing_key:
|
71
71
|
specification_version: 4
|
72
72
|
summary: yard plugin to generate markdown documentation
|