yard-markdown 0.2.2 → 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: 336637063b30cdb36819afce2e0380f467c1763ebbb022b006317488edebe134
4
- data.tar.gz: 73692c82e184b6e3b7259af0ba1ce74fea209b71a56ed089c611ac0035415bbd
3
+ metadata.gz: f629ca40401c7ee044ca4f7c513ec1e008f84f0a9bb7052ad70f15480d573f3c
4
+ data.tar.gz: 4b599efff7a4c66581aae75cbb0516950c5d444a07d8f6f9ed588f2f5491498d
5
5
  SHA512:
6
- metadata.gz: e9b0c05b3cfef30f77040ea8542091dd99231cece58f912079c0e356042bfe99fbfd4aad80e509bdad0390f07cc23d0a4be133db8d4c67e33981556cea87bbfd
7
- data.tar.gz: c32c66c335f301dcaec541401b7d1276267aa5054b29574f70d8d1697680dddae6d649b044ce934df88ee4372efbbe2cb45e9eb6570aea6b0a465f77c91e57a4
6
+ metadata.gz: 8ef3690daab52e53c0d0c5b12487c5063bcf2b6c168b04814e2ac89fa9848aa85e42a623a83a06abcd94f4051227465362462ccd47bc70b82462f9d9dd6cf139
7
+ data.tar.gz: 9e100dc76d5991c9dd767c4a7a4d04836fb832f29d81269328bfc76cbb9bcc6ae43f16e1b2102e98bcf46a0806c473584b8f052ea92820500c25243976b41e08
@@ -108,24 +108,14 @@ def serialize(object)
108
108
  | **Defined in:** | <%= object.file ? object.file : "(unknown)" %> |
109
109
  <% end %>
110
110
 
111
- <%= object.docstring %>
111
+ <%= rdoc_to_md object.docstring %>
112
112
 
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
113
 
124
114
  <% if (insmeths = public_instance_methods(object)).size > 0 %>
125
115
  # Public Instance Methods
126
116
  <% insmeths.each do |item| %>
127
117
  ## <%= item.name(false) %>(<%= item.parameters.map {|p| p.join("") }.join(", ")%>) [](#<%=aref(item)%>)
128
- <%= item.docstring %>
118
+ <%= rdoc_to_md item.docstring %>
129
119
 
130
120
  <% end %>
131
121
  <% end %>
@@ -134,7 +124,7 @@ def serialize(object)
134
124
  # Public Class Methods
135
125
  <% pubmeths.each do |item| %>
136
126
  ## <%= item.name(false) %>(<%= item.parameters.map {|p| p.join(" ") }.join(", ") %>) [](#<%=aref(item)%>)
137
- <%= item.docstring %>
127
+ <%= rdoc_to_md item.docstring %>
138
128
 
139
129
  <% end %>
140
130
  <% end %>
@@ -142,17 +132,33 @@ def serialize(object)
142
132
  # Attributes
143
133
  <% attrs.each do |item|%>
144
134
  ## <%= item.name %><%= item.reader? ? "[RW]" : "[R]" %> [](#<%=aref(item)%>)
145
- <%= item.docstring %>
135
+ <%= rdoc_to_md item.docstring %>
146
136
 
147
137
  <% end %>
148
138
  <% end %>
149
- '.gsub(/^ /, ""),
150
- trim_mode: "%<>",
151
- )
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: "%<>")
152
152
 
153
153
  template.result(binding)
154
154
  end
155
155
 
156
+ require 'rdoc'
157
+
158
+ def rdoc_to_md(docstring)
159
+ RDoc::Markup::ToMarkdown.new.convert(docstring)
160
+ end
161
+
156
162
  def aref(object)
157
163
  if object.type == :constant
158
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.2
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