rdoc-markdown 0.1.13 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +17 -4
- data/lib/rdoc/generator/markdown.rb +36 -7
- data/lib/rdoc/markdown/version.rb +1 -1
- data/lib/templates/classfile.md.erb +4 -4
- metadata +30 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 761747d3a9b32015fca088a58b871d0dbd1ab62b6239d2a4e6f6b3065a0e655e
|
4
|
+
data.tar.gz: e8948dfc980ee3a316699579d254fcb43c8f43549c07fd67ea7d4232bf16ae58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b7cce412555f74e6bb4798cdc1fe03d304f694144608ba20c71e8ea77e4b1caa2d791001ee3b58824d740bc55fe5634f8174a4b54be33a64d12f971ce55da7f
|
7
|
+
data.tar.gz: efea582acb0a4012734c1cdd974987c52df2cac297ca4c773cf268e84f6af325ae95e9391a10c0f89bd31e25a990cd64f1c990ba02c35c5d2dc23573c12ed7e9
|
data/Gemfile.lock
CHANGED
@@ -1,25 +1,35 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rdoc-markdown (0.1.
|
4
|
+
rdoc-markdown (0.1.14)
|
5
|
+
activesupport (~> 7.0)
|
5
6
|
erb (~> 2.0)
|
6
7
|
extralite-bundle (~> 1.0)
|
7
8
|
rdoc (~> 6.0)
|
8
9
|
reverse_markdown (~> 2.0)
|
10
|
+
unindent (~> 1.0)
|
9
11
|
|
10
12
|
GEM
|
11
13
|
remote: https://rubygems.org/
|
12
14
|
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)
|
13
20
|
ast (2.4.2)
|
14
21
|
cgi (0.3.3)
|
22
|
+
concurrent-ruby (1.1.10)
|
15
23
|
erb (2.2.3)
|
16
24
|
cgi
|
17
25
|
extralite-bundle (1.16)
|
26
|
+
i18n (1.12.0)
|
27
|
+
concurrent-ruby (~> 1.0)
|
18
28
|
json (2.6.2)
|
19
29
|
minitest (5.16.3)
|
20
|
-
nokogiri (1.13.
|
30
|
+
nokogiri (1.13.9-arm64-darwin)
|
21
31
|
racc (~> 1.4)
|
22
|
-
nokogiri (1.13.
|
32
|
+
nokogiri (1.13.9-x86_64-linux)
|
23
33
|
racc (~> 1.4)
|
24
34
|
parallel (1.22.1)
|
25
35
|
parser (3.1.2.1)
|
@@ -46,7 +56,7 @@ GEM
|
|
46
56
|
rubocop-ast (>= 1.20.1, < 2.0)
|
47
57
|
ruby-progressbar (~> 1.7)
|
48
58
|
unicode-display_width (>= 1.4.0, < 3.0)
|
49
|
-
rubocop-ast (1.
|
59
|
+
rubocop-ast (1.22.0)
|
50
60
|
parser (>= 3.1.1.0)
|
51
61
|
rubocop-performance (1.14.3)
|
52
62
|
rubocop (>= 1.7.0, < 2.0)
|
@@ -56,7 +66,10 @@ GEM
|
|
56
66
|
rubocop (= 1.35.1)
|
57
67
|
rubocop-performance (= 1.14.3)
|
58
68
|
stringio (3.0.2)
|
69
|
+
tzinfo (2.0.5)
|
70
|
+
concurrent-ruby (~> 1.0)
|
59
71
|
unicode-display_width (2.3.0)
|
72
|
+
unindent (1.0)
|
60
73
|
|
61
74
|
PLATFORMS
|
62
75
|
arm64-darwin-21
|
@@ -6,10 +6,15 @@ require "pathname"
|
|
6
6
|
require "erb"
|
7
7
|
require "reverse_markdown"
|
8
8
|
require 'extralite'
|
9
|
+
require 'active_support/core_ext/string/inflections'
|
10
|
+
require 'unindent'
|
9
11
|
|
10
12
|
class RDoc::Generator::Markdown
|
11
13
|
RDoc::RDoc.add_generator self
|
12
14
|
|
15
|
+
##
|
16
|
+
# Defines a constant for directory where templates could be found
|
17
|
+
|
13
18
|
TEMPLATE_DIR = File.expand_path(
|
14
19
|
File.join(File.dirname(__FILE__), "..", "..", "templates")
|
15
20
|
)
|
@@ -42,6 +47,9 @@ class RDoc::Generator::Markdown
|
|
42
47
|
# this alias is required for rdoc to work
|
43
48
|
alias_method :file_dir, :class_dir
|
44
49
|
|
50
|
+
##
|
51
|
+
# Initializer method for Rdoc::Generator::Markdown
|
52
|
+
|
45
53
|
def initialize(store, options)
|
46
54
|
@store = store
|
47
55
|
@options = options
|
@@ -51,6 +59,9 @@ class RDoc::Generator::Markdown
|
|
51
59
|
@classes = nil
|
52
60
|
end
|
53
61
|
|
62
|
+
##
|
63
|
+
# Generates markdown files and search index file
|
64
|
+
|
54
65
|
def generate
|
55
66
|
setup
|
56
67
|
|
@@ -72,6 +83,9 @@ class RDoc::Generator::Markdown
|
|
72
83
|
attr_reader :options
|
73
84
|
attr_reader :output_dir
|
74
85
|
|
86
|
+
##
|
87
|
+
# This method is used to output debugging information in case rdoc is run with --debug parameter
|
88
|
+
|
75
89
|
def debug(str = nil)
|
76
90
|
if $DEBUG_RDOC
|
77
91
|
puts "[rdoc-markdown] #{str}" if str
|
@@ -79,8 +93,12 @@ class RDoc::Generator::Markdown
|
|
79
93
|
end
|
80
94
|
end
|
81
95
|
|
82
|
-
|
83
|
-
|
96
|
+
##
|
97
|
+
# This class emits a search index for generated documentation as sqlite database
|
98
|
+
#
|
99
|
+
|
100
|
+
def emit_sqlite(name="index.db")
|
101
|
+
db = Extralite::Database.new("#{output_dir}/#{name}")
|
84
102
|
|
85
103
|
db.execute <<-SQL
|
86
104
|
create table contentIndex (
|
@@ -106,7 +124,7 @@ class RDoc::Generator::Markdown
|
|
106
124
|
result << {
|
107
125
|
name: "#{klass.full_name}.#{method.name}",
|
108
126
|
type: "Method",
|
109
|
-
path: turn_to_path(klass.full_name)
|
127
|
+
path: "#{turn_to_path(klass.full_name)}#meth-#{ActiveSupport::Inflector.parameterize method.name}"
|
110
128
|
}
|
111
129
|
end
|
112
130
|
|
@@ -114,7 +132,7 @@ class RDoc::Generator::Markdown
|
|
114
132
|
result << {
|
115
133
|
name: "#{klass.full_name}.#{const.name}",
|
116
134
|
type: "Constant",
|
117
|
-
path: turn_to_path(klass.full_name)
|
135
|
+
path: "#{turn_to_path(klass.full_name)}#const-#{ActiveSupport::Inflector.parameterize const.name}"
|
118
136
|
}
|
119
137
|
end
|
120
138
|
|
@@ -122,7 +140,7 @@ class RDoc::Generator::Markdown
|
|
122
140
|
result << {
|
123
141
|
name: "#{klass.full_name}.#{attr.name}",
|
124
142
|
type: "Attribute",
|
125
|
-
path: turn_to_path(klass.full_name)
|
143
|
+
path: "#{turn_to_path(klass.full_name)}#attr-#{ActiveSupport::Inflector.parameterize attr.name}"
|
126
144
|
}
|
127
145
|
end
|
128
146
|
end
|
@@ -158,16 +176,22 @@ class RDoc::Generator::Markdown
|
|
158
176
|
end
|
159
177
|
end
|
160
178
|
|
161
|
-
|
162
|
-
|
179
|
+
##
|
180
|
+
# Takes a class name and converts it into a Pathname
|
163
181
|
|
164
182
|
def turn_to_path(class_name)
|
165
183
|
"#{class_name.gsub("::", "/")}.md"
|
166
184
|
end
|
167
185
|
|
186
|
+
##
|
187
|
+
# Converts HTML string into a Markdown string with some cleaning and improvements.
|
188
|
+
|
168
189
|
def markdownify(input)
|
169
190
|
md= ReverseMarkdown.convert input, github_flavored: true
|
170
191
|
|
192
|
+
# unintent multiline strings
|
193
|
+
md.unindent!
|
194
|
+
|
171
195
|
# Replace .html to .md extension in all markdown links
|
172
196
|
md = md.gsub(/\[(.+)\]\((.+).html(.*)\)/) do |_|
|
173
197
|
match = Regexp.last_match
|
@@ -180,8 +204,13 @@ class RDoc::Generator::Markdown
|
|
180
204
|
md.gsub("[↑](#top)", "").lstrip
|
181
205
|
end
|
182
206
|
|
207
|
+
# Aliasing a shorter method name for use in templates
|
183
208
|
alias_method :h, :markdownify
|
184
209
|
|
210
|
+
##
|
211
|
+
# Prepares for document generation, by creating required folders and initializing variables.
|
212
|
+
# Could be called multiple times.
|
213
|
+
|
185
214
|
def setup
|
186
215
|
return if instance_variable_defined?(:@output_dir)
|
187
216
|
|
@@ -3,22 +3,22 @@
|
|
3
3
|
<% unless klass.constants.empty? %>
|
4
4
|
## Constants
|
5
5
|
***
|
6
|
-
<% klass.constants.sort_by { |x| x.name }.each do |const| %> **<%= const.name %>**
|
6
|
+
<% klass.constants.sort_by { |x| x.name }.each do |const| %> **<%= const.name %>** [[⚓]](#const-<%= ActiveSupport::Inflector.parameterize const.name%>)
|
7
7
|
<%= h const.description %>
|
8
8
|
<% end %><% end %>
|
9
9
|
<% unless klass.attributes.empty? %>
|
10
10
|
## Attributes
|
11
11
|
<% klass.attributes.sort_by { |x| x.name }.each do |attr| %>
|
12
|
-
**[<%= attr.rw %>]** <%= attr.name %>
|
12
|
+
**[<%= attr.rw %>]** <%= attr.name %> [[⚓]](#attr-<%= ActiveSupport::Inflector.parameterize attr.name %>)
|
13
13
|
<% end %><% end %>
|
14
14
|
<% unless klass_methods.empty? %>
|
15
15
|
## Public Class Methods
|
16
16
|
***
|
17
|
-
<% klass_methods.each do |method| %>### <%= method.name %><%= method.params %>
|
17
|
+
<% klass_methods.each do |method| %>### <%= method.name %><%= method.params %> [[⚓]](#meth-<%= ActiveSupport::Inflector.parameterize method.name %>)
|
18
18
|
|
19
19
|
<%= h method.description %><% end %><% end %>
|
20
20
|
<% unless instance_methods.empty? %>
|
21
21
|
## Public Instance Methods
|
22
|
-
<% instance_methods.each do |method| %>### <%= method.name %><%= method.params %>
|
22
|
+
<% instance_methods.each do |method| %>### <%= method.name %><%= method.params %> [[⚓]](#meth-<%= ActiveSupport::Inflector.parameterize method.name %>)
|
23
23
|
|
24
24
|
<%= h method.description %><% end %><% 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.2'
|
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-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|
@@ -66,6 +66,34 @@ 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
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: unindent
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.0'
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
98
|
name: minitest
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|