rdoc-markdown 0.2.1 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -12
- data/README.md +1 -1
- data/lib/rdoc/generator/markdown.rb +6 -34
- data/lib/rdoc/markdown/version.rb +1 -1
- data/lib/templates/classfile.md.erb +29 -21
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 022adabd6f2ced45f3d5ff3216b48376914f7ba7b80cc1b87d83e8d7507824d7
|
4
|
+
data.tar.gz: 5d9a514dbbcf570811d0a3f230a2eff9434d61413cf994500bb6fd1f1f49a5d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41604d7644f1e4a437f79c3fcbc868c71189355e4b4ae79be430bd313e7729970d8029af95e2d649c71226079acef183329a1b63c1ce500a00815fa82ef587c1
|
7
|
+
data.tar.gz: f0a44ac4166d92a26b5166c8a290cbcfe16970b8d20c4f8c92ea4f0b5c3a1ae9a23ffe0348f79323c22caad9687eddb0d82346da3a31ba5b7594aeb39dd5e971
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rdoc-markdown (0.
|
5
|
-
activesupport (~> 7.0)
|
4
|
+
rdoc-markdown (0.3)
|
6
5
|
erb (~> 2.0)
|
7
6
|
extralite-bundle (~> 1.0)
|
8
7
|
rdoc (~> 6.0)
|
@@ -12,19 +11,11 @@ PATH
|
|
12
11
|
GEM
|
13
12
|
remote: https://rubygems.org/
|
14
13
|
specs:
|
15
|
-
activesupport (7.0.4)
|
16
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
|
-
i18n (>= 1.6, < 2)
|
18
|
-
minitest (>= 5.1)
|
19
|
-
tzinfo (~> 2.0)
|
20
14
|
ast (2.4.2)
|
21
15
|
cgi (0.3.3)
|
22
|
-
concurrent-ruby (1.1.10)
|
23
16
|
erb (2.2.3)
|
24
17
|
cgi
|
25
18
|
extralite-bundle (1.16)
|
26
|
-
i18n (1.12.0)
|
27
|
-
concurrent-ruby (~> 1.0)
|
28
19
|
json (2.6.2)
|
29
20
|
minitest (5.16.3)
|
30
21
|
nokogiri (1.13.9-arm64-darwin)
|
@@ -66,8 +57,6 @@ GEM
|
|
66
57
|
rubocop (= 1.35.1)
|
67
58
|
rubocop-performance (= 1.14.3)
|
68
59
|
stringio (3.0.2)
|
69
|
-
tzinfo (2.0.5)
|
70
|
-
concurrent-ruby (~> 1.0)
|
71
60
|
unicode-display_width (2.3.0)
|
72
61
|
unindent (1.0)
|
73
62
|
|
data/README.md
CHANGED
@@ -5,9 +5,8 @@ gem "rdoc"
|
|
5
5
|
require "pathname"
|
6
6
|
require "erb"
|
7
7
|
require "reverse_markdown"
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require 'unindent'
|
8
|
+
require "extralite"
|
9
|
+
require "unindent"
|
11
10
|
|
12
11
|
class RDoc::Generator::Markdown
|
13
12
|
RDoc::RDoc.add_generator self
|
@@ -95,7 +94,7 @@ class RDoc::Generator::Markdown
|
|
95
94
|
# This class emits a search index for generated documentation as sqlite database
|
96
95
|
#
|
97
96
|
|
98
|
-
def emit_sqlite(name="index.db")
|
97
|
+
def emit_sqlite(name = "index.db")
|
99
98
|
db = Extralite::Database.new("#{output_dir}/#{name}")
|
100
99
|
|
101
100
|
db.execute <<-SQL
|
@@ -130,7 +129,7 @@ class RDoc::Generator::Markdown
|
|
130
129
|
result << {
|
131
130
|
name: "#{klass.full_name}.#{const.name}",
|
132
131
|
type: "Constant",
|
133
|
-
path: "#{turn_to_path(klass.full_name)}##{
|
132
|
+
path: "#{turn_to_path(klass.full_name)}##{const.name}"
|
134
133
|
}
|
135
134
|
end
|
136
135
|
|
@@ -150,19 +149,6 @@ class RDoc::Generator::Markdown
|
|
150
149
|
|
151
150
|
def emit_classfiles
|
152
151
|
@classes.each do |klass|
|
153
|
-
klass_methods = []
|
154
|
-
instance_methods = []
|
155
|
-
|
156
|
-
klass.method_list.each do |method|
|
157
|
-
next if method.visibility.to_s.eql?("private")
|
158
|
-
|
159
|
-
if method.type == "class"
|
160
|
-
klass_methods << method
|
161
|
-
else
|
162
|
-
instance_methods << method
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
152
|
template = ERB.new File.read(File.join(TEMPLATE_DIR, "classfile.md.erb"))
|
167
153
|
|
168
154
|
out_file = Pathname.new("#{output_dir}/#{turn_to_path klass.full_name}")
|
@@ -185,7 +171,7 @@ class RDoc::Generator::Markdown
|
|
185
171
|
# Converts HTML string into a Markdown string with some cleaning and improvements.
|
186
172
|
|
187
173
|
def markdownify(input)
|
188
|
-
md= ReverseMarkdown.convert input
|
174
|
+
md = ReverseMarkdown.convert input
|
189
175
|
|
190
176
|
# unintent multiline strings
|
191
177
|
md.unindent!
|
@@ -196,14 +182,10 @@ class RDoc::Generator::Markdown
|
|
196
182
|
|
197
183
|
"[#{match[1]}](#{match[2]}.md#{match[3]})"
|
198
184
|
end
|
199
|
-
|
200
|
-
# clean up things, to make it look neat.
|
201
|
-
|
202
|
-
md.gsub("[↑](#top)", "").lstrip
|
203
185
|
end
|
204
186
|
|
205
187
|
# Aliasing a shorter method name for use in templates
|
206
|
-
alias_method
|
188
|
+
alias_method :h, :markdownify
|
207
189
|
|
208
190
|
##
|
209
191
|
# Prepares for document generation, by creating required folders and initializing variables.
|
@@ -219,14 +201,4 @@ class RDoc::Generator::Markdown
|
|
219
201
|
|
220
202
|
@classes = @store.all_classes_and_modules.sort
|
221
203
|
end
|
222
|
-
|
223
|
-
##
|
224
|
-
# Return a list of the documented modules sorted by salience first, then
|
225
|
-
# by name.
|
226
|
-
|
227
|
-
def get_sorted_module_list classes
|
228
|
-
classes.select do |klass|
|
229
|
-
klass.display?
|
230
|
-
end.sort
|
231
|
-
end
|
232
204
|
end
|
@@ -1,23 +1,31 @@
|
|
1
|
-
#
|
1
|
+
# <%= klass.type %> <%= klass.full_name.strip %> [](#<%= klass.aref.strip %>) [](#top)
|
2
2
|
<%= h klass.description %>
|
3
|
-
<%
|
4
|
-
|
5
|
-
|
6
|
-
<% klass.constants.
|
7
|
-
|
8
|
-
<%
|
3
|
+
<% klass.each_section do |section, constants, attributes| %>
|
4
|
+
<% if section.title %>## <%= section.title.strip %> <% end %>
|
5
|
+
<% if section.comment %> <%=h section.description %><% end%>
|
6
|
+
<% unless klass.constants.empty? %>
|
7
|
+
## Constants
|
8
|
+
<% klass.constants.each do |const| %>
|
9
|
+
### <%= const.name.strip %>[](#<%= const.name.strip %>)
|
10
|
+
<% if const.comment %> <%= h const.description %> <%else%> (Not documented) <% end %>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
13
|
+
<% unless attributes&.empty? %>
|
9
14
|
## Attributes
|
10
|
-
<%
|
11
|
-
|
12
|
-
<%
|
13
|
-
<%
|
14
|
-
|
15
|
-
|
16
|
-
<%
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
15
|
+
<% attributes.each do |attr| %>
|
16
|
+
### <%= attr.rw %><%=h attr.name.strip %>[](#<%= attr.aref.strip %>)
|
17
|
+
<% if attr.comment %> <%= h attr.description %> <%else%> (Not documented) <% end %>
|
18
|
+
<% end %>
|
19
|
+
<% end %>
|
20
|
+
<% klass.methods_by_type(section).each do |type, visibilities| %>
|
21
|
+
<% next if visibilities.empty? %>
|
22
|
+
<% visibilities.each do |visibility, methods| %>
|
23
|
+
<% next if methods.empty? %>
|
24
|
+
## <%= visibility.capitalize %> <%= type.capitalize %> Methods
|
25
|
+
<% methods.each do |method|%>
|
26
|
+
### <%= method.name.strip %><%= method.param_seq.strip %> [](#<%= method.aref.strip %>)
|
27
|
+
<% if method.comment %> <%= h method.description %> <% else %> (Not documented) <%end%>
|
28
|
+
<% end %>
|
29
|
+
<% end %>
|
30
|
+
<% end %>
|
31
|
+
<% end %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdoc-markdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.3'
|
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: 2022-10-
|
11
|
+
date: 2022-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|
@@ -66,20 +66,6 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: activesupport
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '7.0'
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '7.0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: unindent
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|