rdoc-markdown 0.3.3 → 0.3.5
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 -1
- data/README.md +1 -1
- data/lib/rdoc/generator/markdown.rb +15 -4
- data/lib/rdoc/markdown/version.rb +1 -1
- data/lib/templates/classfile.md.erb +7 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb88e163756c49396b718459f7d5dafc96350d4326d6fd1e57a13fc3ac011116
|
4
|
+
data.tar.gz: 2a7477e2eb1b98af6cd06933e67f129892a492971b9ce60b64da4d296a42ac18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa23545b89bfedd7cec08dd8f387727df15fb75c6cc532b35566fcb2ab2e53f85c94c7ec88e364edf59df15c6d2363b8ad3f54ec51627c6b1cac6592c83f2188
|
7
|
+
data.tar.gz: ac8f4cd2f344afb9ac357ecd16202e40c60527e2db149fba53cff7ca55682561082c1a8a56958b914b5ba7c09a5d1c66b40b60b89c87bc51c3e8ef1c1d963987
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -19,7 +19,7 @@ RDoc will auto-detect rdoc-markdown plugin if it was installed. You just need to
|
|
19
19
|
|
20
20
|
Run following command in directory with ruby source code:
|
21
21
|
|
22
|
-
`rdoc --format=markdown`
|
22
|
+
`rdoc --format=markdown --markup=markdown`
|
23
23
|
|
24
24
|
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
25
|
|
@@ -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
|
@@ -154,9 +156,9 @@ class RDoc::Generator::Markdown
|
|
154
156
|
out_file = Pathname.new("#{output_dir}/#{turn_to_path klass.full_name}")
|
155
157
|
out_file.dirname.mkpath
|
156
158
|
|
157
|
-
result = template.result(binding)
|
159
|
+
result = template.result(binding).squeeze(" ").gsub("\n ", "\n").squeeze("\n\n")
|
158
160
|
|
159
|
-
File.write(out_file, result
|
161
|
+
File.write(out_file, result)
|
160
162
|
end
|
161
163
|
end
|
162
164
|
|
@@ -171,7 +173,14 @@ class RDoc::Generator::Markdown
|
|
171
173
|
# Converts HTML string into a Markdown string with some cleaning and improvements.
|
172
174
|
|
173
175
|
def markdownify(input)
|
174
|
-
|
176
|
+
# TODO: I should be able to set unknown_tags to "raise" for debugging purposes. Probably through rdoc parameters?
|
177
|
+
# Allowed parameters:
|
178
|
+
# - pass_through - (default) Include the unknown tag completely into the result
|
179
|
+
# - drop - Drop the unknown tag and its content
|
180
|
+
# - bypass - Ignore the unknown tag but try to convert its content
|
181
|
+
# - raise - Raise an error to let you know
|
182
|
+
|
183
|
+
md = ReverseMarkdown.convert input, unknown_tags: :pass_through, github_flavored: true
|
175
184
|
|
176
185
|
# unintent multiline strings
|
177
186
|
md.unindent!
|
@@ -182,6 +191,8 @@ class RDoc::Generator::Markdown
|
|
182
191
|
|
183
192
|
"[#{match[1]}](#{match[2]}.md#{match[3]})"
|
184
193
|
end
|
194
|
+
|
195
|
+
md.gsub("=== ", "### ").gsub("== ", "## ")
|
185
196
|
end
|
186
197
|
|
187
198
|
# Aliasing a shorter method name for use in templates
|
@@ -1,20 +1,21 @@
|
|
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
|
+
| Name | Description |
|
9
|
+
| ---- | ----------- |
|
8
10
|
<% klass.constants.each do |const| %>
|
9
|
-
|
10
|
-
<% if const.comment %> <%= h const.description %> <%else%> (Not documented) <% end %>
|
11
|
+
| **<%= const.name %>[](#<%= const.name %>)** | <% unless const.description.empty? %> <%= h const.description %> <%else%> Not documented <% end %> |
|
11
12
|
<% end %>
|
12
13
|
<% end %>
|
13
14
|
<% unless attributes&.empty? %>
|
14
15
|
## Attributes
|
15
16
|
<% attributes.each do |attr| %>
|
16
17
|
### <%= attr.name %>[<%= attr.rw %>] [](#<%= attr.aref.strip %>)
|
17
|
-
<% if attr.comment %> <%= h
|
18
|
+
<% if attr.comment %> <%= h(attr.description) %> <%else%> Not documented <% end %>
|
18
19
|
<% end %>
|
19
20
|
<% end %>
|
20
21
|
<% klass.methods_by_type(section).each do |type, visibilities| %>
|
@@ -23,8 +24,8 @@
|
|
23
24
|
<% next if methods.empty? %>
|
24
25
|
## <%= visibility.capitalize %> <%= type.capitalize %> Methods
|
25
26
|
<% methods.each do |method|%>
|
26
|
-
### <%= method.name
|
27
|
-
<% if method.comment %> <%= h
|
27
|
+
### <%= method.name %><%= method.param_seq %> [](#<%= method.aref %>)
|
28
|
+
<% if method.comment %> <%= h(method.description) %> <% else %> Not documented <%end%>
|
28
29
|
<% end %>
|
29
30
|
<% end %>
|
30
31
|
<% end %>
|