rdoc-markdown 0.3.4 → 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: f34bf7fc9e0588740713d04925521cfc098ce43b057c16e55ed9bcfb5b16030f
4
- data.tar.gz: 2180ab33878a7aa893dd9daded24048319a0670d7c7530789493d41f0fccdd6b
3
+ metadata.gz: eb88e163756c49396b718459f7d5dafc96350d4326d6fd1e57a13fc3ac011116
4
+ data.tar.gz: 2a7477e2eb1b98af6cd06933e67f129892a492971b9ce60b64da4d296a42ac18
5
5
  SHA512:
6
- metadata.gz: 7de709a0032575a1720aa6c99be7ed712471dc02c9c99c5bdcfc2bc8035691d7b633a5431b3575767c648d36b74cf6380e0162085578a59d7367629de902232b
7
- data.tar.gz: 4c8ff9eef4209d99aa9034ccf0e7ebaca5cc097316127ff24d4875d327595c28731e1dd44f39bb1f4e5367eead1c1348653d8f2cf5bae80d6d94afd093cf6ded
6
+ metadata.gz: fa23545b89bfedd7cec08dd8f387727df15fb75c6cc532b35566fcb2ab2e53f85c94c7ec88e364edf59df15c6d2363b8ad3f54ec51627c6b1cac6592c83f2188
7
+ data.tar.gz: ac8f4cd2f344afb9ac357ecd16202e40c60527e2db149fba53cff7ca55682561082c1a8a56958b914b5ba7c09a5d1c66b40b60b89c87bc51c3e8ef1c1d963987
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,7 +156,7 @@ 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).squeeze.gsub("\n ", "\n").squeeze("\n")
159
+ result = template.result(binding).squeeze(" ").gsub("\n ", "\n").squeeze("\n\n")
158
160
 
159
161
  File.write(out_file, result)
160
162
  end
@@ -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.4"
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.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stanislav (Stas) Katkov