yard-markdown 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 45d1e77bad42779c78eb819361eeef638e1eb6a6b622ef7f850298258a4cbf14
4
- data.tar.gz: 715a1015c9d12f9ccdd13e9afe20f70e3b566dc9996161b8cedfcc7eecbcc9bf
3
+ metadata.gz: f629ca40401c7ee044ca4f7c513ec1e008f84f0a9bb7052ad70f15480d573f3c
4
+ data.tar.gz: 4b599efff7a4c66581aae75cbb0516950c5d444a07d8f6f9ed588f2f5491498d
5
5
  SHA512:
6
- metadata.gz: c813cfeaad842d55c9b4573fa91f025ac07d78b8bb512a45f32af671a25c213d34e4291c6346ab0e43e141fab89dd82ba5ca279760e17b4ac06a1f042c39fd26
7
- data.tar.gz: 4080476f10d33d9d98c39ca2d04e4834c2a1ef8308451ad102022991286f88e4f42bba1fbdf5ddac53a1c16ad3cb40fa53eb656b72d59d5155a6e6ea589db4d6
6
+ metadata.gz: 8ef3690daab52e53c0d0c5b12487c5063bcf2b6c168b04814e2ac89fa9848aa85e42a623a83a06abcd94f4051227465362462ccd47bc70b82462f9d9dd6cf139
7
+ data.tar.gz: 9e100dc76d5991c9dd767c4a7a4d04836fb832f29d81269328bfc76cbb9bcc6ae43f16e1b2102e98bcf46a0806c473584b8f052ea92820500c25243976b41e08
data/example/Bird.md CHANGED
@@ -4,18 +4,17 @@
4
4
  | **Inherits:** | Object |
5
5
  | **Defined in:** | example.rb |
6
6
 
7
-
8
7
  The base class for all birds.
9
-
10
8
  # Constants
11
- ## DEFAULT_DUCK_VELOCITY = [](#constant-DEFAULT_DUCK_VELOCITY)
12
- (70) Default velocity for a flying duck.
13
-
9
+ ## DEFAULT_DUCK_VELOCITY [](#constant-DEFAULT_DUCK_VELOCITY)
10
+ Default velocity for a flying duck.
11
+ ## DEFAULT_SPEED [](#constant-DEFAULT_SPEED)
12
+ Maximum speed for a swimming duck.
14
13
 
15
14
  # Public Instance Methods
16
- ## _fly_impl(_direction , _velocity ) [](#method-i-_fly_impl)
15
+ ## _fly_impl(_direction, _velocity) [](#method-i-_fly_impl)
17
16
  :nodoc:
18
- ## fly(direction , velocity ) [](#method-i-fly)
17
+ ## fly(direction, velocity) [](#method-i-fly)
19
18
  Fly somewhere.
20
19
 
21
20
  Flying is the most critical feature of birds.
data/example/Duck.md CHANGED
@@ -6,7 +6,6 @@
6
6
  | **Includes:** | Waterfowl |
7
7
  | **Defined in:** | example.rb |
8
8
 
9
-
10
9
  A duck is a Waterfowl Bird.
11
10
 
12
11
  Features:
@@ -19,14 +18,14 @@ Features:
19
18
  waterfowl::
20
19
 
21
20
  * swim
22
-
23
21
  # Constants
24
- ## DEFAULT_DUCK_VELOCITY = [](#constant-DEFAULT_DUCK_VELOCITY)
25
- (70) Default velocity for a flying duck.
26
-
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.
27
26
 
28
27
  # Public Instance Methods
29
- ## initialize(domestic , rubber ) [](#method-i-initialize)
28
+ ## initialize(domestic, rubber) [](#method-i-initialize)
30
29
  Creates a new duck.
31
30
  ## speak() [](#method-i-speak)
32
31
  Duck overrides generic implementation.
data/example/Waterfowl.md CHANGED
@@ -3,13 +3,12 @@
3
3
  | -----------------: | :----- |
4
4
  | **Defined in:** | example.rb |
5
5
 
6
-
7
6
  A mixin for waterfowl creatures.
8
-
9
7
  # Constants
10
- ## DEFAULT_DUCK_VELOCITY = [](#constant-DEFAULT_DUCK_VELOCITY)
11
- (70) Default velocity for a flying duck.
12
-
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.
13
12
 
14
13
  # Public Instance Methods
15
14
  ## swim() [](#method-i-swim)
data/example/index.csv CHANGED
@@ -1,14 +1,17 @@
1
1
  name,type,path
2
2
  Waterfowl,Module,Waterfowl.md
3
3
  DEFAULT_DUCK_VELOCITY,Constant,Waterfowl.md#constant-DEFAULT_DUCK_VELOCITY
4
+ DEFAULT_SPEED,Constant,Waterfowl.md#constant-DEFAULT_SPEED
4
5
  swim,Method,Waterfowl.md#method-i-swim
5
6
  Bird,Class,Bird.md
6
7
  DEFAULT_DUCK_VELOCITY,Constant,Bird.md#constant-DEFAULT_DUCK_VELOCITY
8
+ DEFAULT_SPEED,Constant,Bird.md#constant-DEFAULT_SPEED
7
9
  _fly_impl,Method,Bird.md#method-i-_fly_impl
8
10
  fly,Method,Bird.md#method-i-fly
9
11
  speak,Method,Bird.md#method-i-speak
10
12
  Duck,Class,Duck.md
11
13
  DEFAULT_DUCK_VELOCITY,Constant,Duck.md#constant-DEFAULT_DUCK_VELOCITY
14
+ DEFAULT_SPEED,Constant,Duck.md#constant-DEFAULT_SPEED
12
15
  initialize,Method,Duck.md#method-i-initialize
13
16
  speak,Method,Duck.md#method-i-speak
14
17
  swim,Method,Duck.md#method-i-swim
data/example.rb CHANGED
@@ -131,6 +131,8 @@ end
131
131
 
132
132
  # Default velocity for a flying duck.
133
133
  DEFAULT_DUCK_VELOCITY = 70
134
+ DEFAULT_SPEED = 10 # Maximum speed for a swimming duck.
135
+
134
136
 
135
137
  # Default rubber duck.
136
138
  #
@@ -108,26 +108,14 @@ def serialize(object)
108
108
  | **Defined in:** | <%= object.file ? object.file : "(unknown)" %> |
109
109
  <% end %>
110
110
 
111
+ <%= rdoc_to_md object.docstring %>
111
112
 
112
- <%= object.docstring %>
113
-
114
-
115
- <% if constant_listing.size > 0 %>
116
- <% groups(constant_listing, "Constants") do |list, name| %>
117
- # <%= name %>
118
- <% list.each do |cnst| %>
119
- ## <%= cnst.name %> = [](#<%=aref(cnst)%>)
120
- <%= cnst.docstring %>
121
- <% end %>
122
- <% end %>
123
-
124
- <% end %>
125
113
 
126
114
  <% if (insmeths = public_instance_methods(object)).size > 0 %>
127
115
  # Public Instance Methods
128
116
  <% insmeths.each do |item| %>
129
- ## <%= item.name(false) %>(<%= item.parameters.map {|p| p.join(" ") }.join(", ")%>) [](#<%=aref(item)%>)
130
- <%= item.docstring %>
117
+ ## <%= item.name(false) %>(<%= item.parameters.map {|p| p.join("") }.join(", ")%>) [](#<%=aref(item)%>)
118
+ <%= rdoc_to_md item.docstring %>
131
119
 
132
120
  <% end %>
133
121
  <% end %>
@@ -136,7 +124,7 @@ def serialize(object)
136
124
  # Public Class Methods
137
125
  <% pubmeths.each do |item| %>
138
126
  ## <%= item.name(false) %>(<%= item.parameters.map {|p| p.join(" ") }.join(", ") %>) [](#<%=aref(item)%>)
139
- <%= item.docstring %>
127
+ <%= rdoc_to_md item.docstring %>
140
128
 
141
129
  <% end %>
142
130
  <% end %>
@@ -144,17 +132,33 @@ def serialize(object)
144
132
  # Attributes
145
133
  <% attrs.each do |item|%>
146
134
  ## <%= item.name %><%= item.reader? ? "[RW]" : "[R]" %> [](#<%=aref(item)%>)
147
- <%= item.docstring %>
135
+ <%= rdoc_to_md item.docstring %>
148
136
 
149
137
  <% end %>
150
138
  <% end %>
151
- '.gsub(/^ /, ""),
152
- trim_mode: "%<>",
153
- )
139
+
140
+
141
+ <% if constant_listing.size > 0 %>
142
+ <% groups(constant_listing, "Constants") do |list, name| %>
143
+ # <%= name %>
144
+ <% list.each do |cnst| %>
145
+ ## <%= cnst.name %> [](#<%=aref(cnst)%>)
146
+ <%= rdoc_to_md cnst.docstring %>
147
+
148
+ <% end %>
149
+ <% end %>
150
+ <% end %>
151
+ ', trim_mode: "%<>")
154
152
 
155
153
  template.result(binding)
156
154
  end
157
155
 
156
+ require 'rdoc'
157
+
158
+ def rdoc_to_md(docstring)
159
+ RDoc::Markup::ToMarkdown.new.convert(docstring)
160
+ end
161
+
158
162
  def aref(object)
159
163
  if object.type == :constant
160
164
  "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.2.1
4
+ version: 0.3.0
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 00:00:00.000000000 Z
11
+ date: 2024-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yard