rdoc-markdown 0.3.4 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +8 -8
- data/README.md +4 -1
- data/example/Bird.md +17 -0
- data/example/Duck.md +50 -0
- data/example/Object.md +8 -0
- data/example/RDoc/Generator/Markdown.md +32 -0
- data/example/RDoc/Generator.md +2 -0
- data/example/RDoc/Markdown.md +2 -0
- data/example/RDoc.md +2 -0
- data/example/Rdoc/Markdown.md +6 -0
- data/example/Rdoc.md +2 -0
- data/example/TestGenerator.md +10 -0
- data/example/Waterfowl.md +8 -0
- data/example/index.db +0 -0
- data/lib/rdoc/generator/markdown.rb +17 -4
- data/lib/rdoc/markdown/version.rb +1 -1
- data/lib/templates/classfile.md.erb +7 -7
- metadata +14 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc9298f0cd81d54367d58d68aa1cacead0c80be2e43ea591f5fe4bbf29e44ca5
|
4
|
+
data.tar.gz: 15b4e889626b4b06fe2cd98e910f26d974d849690cb11a351e6fcceae55aeae1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 779545ebd9dfdb19e8c474ff3ae851586ac9bddf069e74a828fe9cc2c482e4c1ca22fd11330065c35419099612d8977001b63940d4f583d3f6de838ccdbde25d
|
7
|
+
data.tar.gz: 2f2306bff2ca81fd87487db0f771ce24ecd4fbe4ceb8dfe379b538ea2d11689c7d7133dd91f380ce9248bafd51d3ac09bb1477f18e7adde4731444092b296415
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rdoc-markdown (0.3.
|
4
|
+
rdoc-markdown (0.3.7)
|
5
5
|
erb (~> 2.0)
|
6
6
|
extralite-bundle (~> 1.0)
|
7
7
|
rdoc (~> 6.0)
|
@@ -33,29 +33,29 @@ GEM
|
|
33
33
|
rdiscount (2.2.7)
|
34
34
|
rdoc (6.4.0)
|
35
35
|
psych (>= 4.0.0)
|
36
|
-
regexp_parser (2.6.
|
36
|
+
regexp_parser (2.6.1)
|
37
37
|
reverse_markdown (2.1.1)
|
38
38
|
nokogiri
|
39
39
|
rexml (3.2.5)
|
40
|
-
rubocop (1.
|
40
|
+
rubocop (1.39.0)
|
41
41
|
json (~> 2.3)
|
42
42
|
parallel (~> 1.10)
|
43
43
|
parser (>= 3.1.2.1)
|
44
44
|
rainbow (>= 2.2.2, < 4.0)
|
45
45
|
regexp_parser (>= 1.8, < 3.0)
|
46
46
|
rexml (>= 3.2.5, < 4.0)
|
47
|
-
rubocop-ast (>= 1.
|
47
|
+
rubocop-ast (>= 1.23.0, < 2.0)
|
48
48
|
ruby-progressbar (~> 1.7)
|
49
49
|
unicode-display_width (>= 1.4.0, < 3.0)
|
50
50
|
rubocop-ast (1.23.0)
|
51
51
|
parser (>= 3.1.1.0)
|
52
|
-
rubocop-performance (1.
|
52
|
+
rubocop-performance (1.15.0)
|
53
53
|
rubocop (>= 1.7.0, < 2.0)
|
54
54
|
rubocop-ast (>= 0.4.0)
|
55
55
|
ruby-progressbar (1.11.0)
|
56
|
-
standard (1.
|
57
|
-
rubocop (= 1.
|
58
|
-
rubocop-performance (= 1.
|
56
|
+
standard (1.18.0)
|
57
|
+
rubocop (= 1.39.0)
|
58
|
+
rubocop-performance (= 1.15.0)
|
59
59
|
stringio (3.0.2)
|
60
60
|
unicode-display_width (2.3.0)
|
61
61
|
unindent (1.0)
|
data/README.md
CHANGED
@@ -13,13 +13,16 @@ Install gem and add to application's Gemfile by executing:
|
|
13
13
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
14
14
|
|
15
15
|
$ gem install rdoc-markdown
|
16
|
+
## Examples
|
17
|
+
Find examples in [/examples](/example/) folder. You can regenerate examples by running `./bin/generate.sh`, it will produce examples based on file in `test/data/*` folder.
|
18
|
+
|
16
19
|
|
17
20
|
## Usage
|
18
21
|
RDoc will auto-detect rdoc-markdown plugin if it was installed. You just need to instruct RDoc to produce markdown output instead of standard HTML through `format` parameter.
|
19
22
|
|
20
23
|
Run following command in directory with ruby source code:
|
21
24
|
|
22
|
-
`rdoc --format=markdown`
|
25
|
+
`rdoc --format=markdown --markup=markdown`
|
23
26
|
|
24
27
|
This will produce a tree of markdown documents and search index in `/doc` folder. Every class in library will have it's own markdown file.
|
25
28
|
|
data/example/Bird.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# class Bird [](#class-Bird) [](#top)
|
2
|
+
The base class for all birds.
|
3
|
+
|
4
|
+
## Public Instance Methods
|
5
|
+
### fly(string, number) -> bool [](#method-i-fly)
|
6
|
+
Fly somewhere.
|
7
|
+
|
8
|
+
Flying is the most critical feature of birds.
|
9
|
+
|
10
|
+
= Example
|
11
|
+
|
12
|
+
fly(:south, 70)
|
13
|
+
|
14
|
+
### speak() { |text| ... } [](#method-i-speak)
|
15
|
+
Produce some noise.
|
16
|
+
|
17
|
+
|
data/example/Duck.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# class Duck [](#class-Duck) [](#top)
|
2
|
+
A duck is a [`Waterfowl`](Waterfowl.html) [`Bird`](Bird.html).
|
3
|
+
|
4
|
+
Features:
|
5
|
+
|
6
|
+
bird::
|
7
|
+
|
8
|
+
- speak
|
9
|
+
|
10
|
+
- fly
|
11
|
+
|
12
|
+
waterfowl::
|
13
|
+
|
14
|
+
- swim
|
15
|
+
|
16
|
+
## Constants
|
17
|
+
| Name | Description |
|
18
|
+
| ---- | ----------- |
|
19
|
+
| **MAX_VELOCITY[](#MAX_VELOCITY)** | Not documented |
|
20
|
+
## Bird overrides ## Constants
|
21
|
+
| Name | Description |
|
22
|
+
| ---- | ----------- |
|
23
|
+
| **MAX_VELOCITY[](#MAX_VELOCITY)** | Not documented |
|
24
|
+
## Public Instance Methods
|
25
|
+
### speak() { |speech| ... } [](#method-i-speak)
|
26
|
+
[`Duck`](Duck.html) overrides generic implementation.
|
27
|
+
|
28
|
+
## Duck extensions ## Constants
|
29
|
+
| Name | Description |
|
30
|
+
| ---- | ----------- |
|
31
|
+
| **MAX_VELOCITY[](#MAX_VELOCITY)** | Not documented |
|
32
|
+
## Attributes
|
33
|
+
### domestic[RW] [](#attribute-i-domestic)
|
34
|
+
True for domestic ducks.
|
35
|
+
|
36
|
+
### rubber[R] [](#attribute-i-rubber)
|
37
|
+
True for rubber ducks.
|
38
|
+
|
39
|
+
## Public Class Methods
|
40
|
+
### new(domestic, rubber) [](#method-c-new)
|
41
|
+
Creates a new duck.
|
42
|
+
|
43
|
+
### rubber_ducks() [](#method-c-rubber_ducks)
|
44
|
+
Returns list of all rubber ducks.
|
45
|
+
|
46
|
+
## Public Instance Methods
|
47
|
+
### useful? -> bool [](#method-i-useful-3F)
|
48
|
+
Checks if this duck is a useful one.
|
49
|
+
|
50
|
+
|
data/example/Object.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# class RDoc::Generator::Markdown [](#class-RDoc::Generator::Markdown) [](#top)
|
2
|
+
## Constants
|
3
|
+
| Name | Description |
|
4
|
+
| ---- | ----------- |
|
5
|
+
| **TEMPLATE_DIR[](#TEMPLATE_DIR)** | Defines a constant for directory where templates could be found
|
6
|
+
|
7
|
+
|
|
8
|
+
## Attributes
|
9
|
+
### base_dir[R] [](#attribute-i-base_dir)
|
10
|
+
The path to generate files into, combined with `--op` from the options for a full path.
|
11
|
+
|
12
|
+
### classes[R] [](#attribute-i-classes)
|
13
|
+
Classes and modules to be used by this generator, not necessarily displayed.
|
14
|
+
|
15
|
+
### store[R] [](#attribute-i-store)
|
16
|
+
The RDoc::Store that is the source of the generated content
|
17
|
+
|
18
|
+
## Public Class Methods
|
19
|
+
### new(store, options) [](#method-c-new)
|
20
|
+
Initializer method for Rdoc::Generator::Markdown
|
21
|
+
|
22
|
+
## Public Instance Methods
|
23
|
+
### class_dir() [](#method-i-class_dir)
|
24
|
+
Directory where generated class HTML files live relative to the output dir.
|
25
|
+
|
26
|
+
### file_dir() [](#method-i-file_dir)
|
27
|
+
this alias is required for rdoc to work
|
28
|
+
|
29
|
+
### generate() [](#method-i-generate)
|
30
|
+
Generates markdown files and search index file
|
31
|
+
|
32
|
+
|
data/example/RDoc.md
ADDED
data/example/Rdoc.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# class TestGenerator [](#class-TestGenerator) [](#top)
|
2
|
+
## Constants
|
3
|
+
| Name | Description |
|
4
|
+
| ---- | ----------- |
|
5
|
+
| **CLASSES[](#CLASSES)** | Not documented |
|
6
|
+
## Public Instance Methods
|
7
|
+
### run_generator(file, title) { |options| ... } [](#method-i-run_generator)
|
8
|
+
### source_file() [](#method-i-source_file)
|
9
|
+
### test_generator() [](#method-i-test_generator)
|
10
|
+
|
data/example/index.db
ADDED
Binary file
|
@@ -62,6 +62,8 @@ class RDoc::Generator::Markdown
|
|
62
62
|
# Generates markdown files and search index file
|
63
63
|
|
64
64
|
def generate
|
65
|
+
# TODO: Make sure to set --markup parameter to 'markdown'.
|
66
|
+
|
65
67
|
debug("Setting things up #{@output_dir}")
|
66
68
|
|
67
69
|
setup
|
@@ -70,7 +72,7 @@ class RDoc::Generator::Markdown
|
|
70
72
|
|
71
73
|
emit_classfiles
|
72
74
|
|
73
|
-
debug("Generate index
|
75
|
+
debug("Generate search index in #{output_dir}/index.db")
|
74
76
|
|
75
77
|
emit_sqlite
|
76
78
|
end
|
@@ -149,12 +151,14 @@ class RDoc::Generator::Markdown
|
|
149
151
|
|
150
152
|
def emit_classfiles
|
151
153
|
@classes.each do |klass|
|
152
|
-
|
154
|
+
template_content = File.read(File.join(TEMPLATE_DIR, "classfile.md.erb"))
|
155
|
+
|
156
|
+
template = ERB.new template_content, trim_mode: ">"
|
153
157
|
|
154
158
|
out_file = Pathname.new("#{output_dir}/#{turn_to_path klass.full_name}")
|
155
159
|
out_file.dirname.mkpath
|
156
160
|
|
157
|
-
result = template.result(binding).squeeze
|
161
|
+
result = template.result(binding).squeeze(" ")
|
158
162
|
|
159
163
|
File.write(out_file, result)
|
160
164
|
end
|
@@ -171,7 +175,14 @@ class RDoc::Generator::Markdown
|
|
171
175
|
# Converts HTML string into a Markdown string with some cleaning and improvements.
|
172
176
|
|
173
177
|
def markdownify(input)
|
174
|
-
|
178
|
+
# TODO: I should be able to set unknown_tags to "raise" for debugging purposes. Probably through rdoc parameters?
|
179
|
+
# Allowed parameters:
|
180
|
+
# - pass_through - (default) Include the unknown tag completely into the result
|
181
|
+
# - drop - Drop the unknown tag and its content
|
182
|
+
# - bypass - Ignore the unknown tag but try to convert its content
|
183
|
+
# - raise - Raise an error to let you know
|
184
|
+
|
185
|
+
md = ReverseMarkdown.convert input, unknown_tags: :pass_through, github_flavored: true
|
175
186
|
|
176
187
|
# unintent multiline strings
|
177
188
|
md.unindent!
|
@@ -182,6 +193,8 @@ class RDoc::Generator::Markdown
|
|
182
193
|
|
183
194
|
"[#{match[1]}](#{match[2]}.md#{match[3]})"
|
184
195
|
end
|
196
|
+
|
197
|
+
md.gsub("=== ", "### ").gsub("== ", "## ")
|
185
198
|
end
|
186
199
|
|
187
200
|
# Aliasing a shorter method name for use in templates
|
@@ -1,20 +1,20 @@
|
|
1
|
-
# <%= klass.type %> <%= klass.full_name
|
1
|
+
# <%= klass.type %> <%= klass.full_name %> [](#<%= klass.aref.strip %>) [](#top)
|
2
2
|
<%= h klass.description %>
|
3
3
|
<% klass.each_section do |section, constants, attributes| %>
|
4
4
|
<% if section.title %>## <%= section.title.strip %> <% end %>
|
5
5
|
<% if section.comment %> <%=h section.description %><% end%>
|
6
6
|
<% unless klass.constants.empty? %>
|
7
7
|
## Constants
|
8
|
-
|
9
|
-
|
10
|
-
<%
|
8
|
+
| Name | Description |
|
9
|
+
| ---- | ----------- |
|
10
|
+
<% klass.constants.each do |const| %> | **<%= const.name %>[](#<%= const.name %>)** | <% unless const.description.empty? %> <%= h const.description %> <%else%> Not documented <% end %> |
|
11
11
|
<% end %>
|
12
12
|
<% end %>
|
13
13
|
<% unless attributes&.empty? %>
|
14
14
|
## Attributes
|
15
15
|
<% attributes.each do |attr| %>
|
16
16
|
### <%= attr.name %>[<%= attr.rw %>] [](#<%= attr.aref.strip %>)
|
17
|
-
<% if attr.comment %> <%= h
|
17
|
+
<% if attr.comment %> <%= h(attr.description) %> <%else%> Not documented <% end %>
|
18
18
|
<% end %>
|
19
19
|
<% end %>
|
20
20
|
<% klass.methods_by_type(section).each do |type, visibilities| %>
|
@@ -23,8 +23,8 @@
|
|
23
23
|
<% next if methods.empty? %>
|
24
24
|
## <%= visibility.capitalize %> <%= type.capitalize %> Methods
|
25
25
|
<% methods.each do |method|%>
|
26
|
-
### <%= method.name
|
27
|
-
<% if method.comment %> <%= h
|
26
|
+
### <%= method.name %><%= method.param_seq %> [](#<%= method.aref %>)
|
27
|
+
<% if method.comment %> <%= h(method.description) %> <% else %> Not documented <%end%>
|
28
28
|
<% end %>
|
29
29
|
<% end %>
|
30
30
|
<% 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.3.
|
4
|
+
version: 0.3.6
|
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-11-
|
11
|
+
date: 2022-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|
@@ -166,6 +166,18 @@ files:
|
|
166
166
|
- LICENSE
|
167
167
|
- README.md
|
168
168
|
- Rakefile
|
169
|
+
- example/Bird.md
|
170
|
+
- example/Duck.md
|
171
|
+
- example/Object.md
|
172
|
+
- example/RDoc.md
|
173
|
+
- example/RDoc/Generator.md
|
174
|
+
- example/RDoc/Generator/Markdown.md
|
175
|
+
- example/RDoc/Markdown.md
|
176
|
+
- example/Rdoc.md
|
177
|
+
- example/Rdoc/Markdown.md
|
178
|
+
- example/TestGenerator.md
|
179
|
+
- example/Waterfowl.md
|
180
|
+
- example/index.db
|
169
181
|
- lib/markdown.rb
|
170
182
|
- lib/rdoc/discover.rb
|
171
183
|
- lib/rdoc/generator/markdown.rb
|