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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e1c173447530b31b84f161bea68e9aa92bc0c5e1b94f65229fefbda09d45b48
4
- data.tar.gz: 2bbec98f241c146a811584053c36a3d72ee2131f7674436efec06526000a6dfd
3
+ metadata.gz: eb88e163756c49396b718459f7d5dafc96350d4326d6fd1e57a13fc3ac011116
4
+ data.tar.gz: 2a7477e2eb1b98af6cd06933e67f129892a492971b9ce60b64da4d296a42ac18
5
5
  SHA512:
6
- metadata.gz: 0fe1965cccb799277db8292e67c53f55b74a8251927c580e624503cb47f66d7727557c127a99cd836e3033a83f4ed13e52bee056ba0c4665b4e50bbdaf1ac65a
7
- data.tar.gz: 65bdaf324e2bf2748611717e51105bf4b7e1e9303413410f5a1eaca953764cc9cf4d0143898fa75c8a7c08e711c9a3b3bb6e63dc7e6463ab96ea99e455226f4d
6
+ metadata.gz: fa23545b89bfedd7cec08dd8f387727df15fb75c6cc532b35566fcb2ab2e53f85c94c7ec88e364edf59df15c6d2363b8ad3f54ec51627c6b1cac6592c83f2188
7
+ data.tar.gz: ac8f4cd2f344afb9ac357ecd16202e40c60527e2db149fba53cff7ca55682561082c1a8a56958b914b5ba7c09a5d1c66b40b60b89c87bc51c3e8ef1c1d963987
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rdoc-markdown (0.3.2)
4
+ rdoc-markdown (0.3.3)
5
5
  erb (~> 2.0)
6
6
  extralite-bundle (~> 1.0)
7
7
  rdoc (~> 6.0)
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 db file: #{output_dir}/index.db")
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.squeeze("\n"))
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
- md = ReverseMarkdown.convert input
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rdoc
4
4
  module Markdown
5
- VERSION = "0.3.3"
5
+ VERSION = "0.3.5"
6
6
  end
7
7
  end
@@ -1,20 +1,21 @@
1
- # <%= klass.type %> <%= klass.full_name.strip %> [](#<%= klass.aref.strip %>) [](#top)
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
- ### <%= const.name.strip %>[](#<%= const.name.strip %>)
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 attr.description %> <%else%> (Not documented) <% end %>
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.strip %><%= method.param_seq.strip %> [](#<%= method.aref.strip %>)
27
- <% if method.comment %> <%= h method.description %> <% else %> (Not documented) <%end%>
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 %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdoc-markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stanislav (Stas) Katkov