rdoc-markdown 0.1.8 → 0.1.10

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: d00a1ac32eb71f6eff97e6ee46bb1756c5fad8d97125c269ca0a1a5ba69f8061
4
- data.tar.gz: 34ee2b38e839454a19f197466248db8033076d5113fb4da9895a4ed5a9b00e98
3
+ metadata.gz: 2d08a05e31cacde411267507404584cf8b83a715e2001290e84f4b0ae3494106
4
+ data.tar.gz: cf679c7121051ed3c3dfe7615e9ef559d2ec8b023e2b1efd9666d9caa2de5ae7
5
5
  SHA512:
6
- metadata.gz: d0a1f0294c47c08f72134820afc998a5d01dc4a20d7588df73f9dcbde9ce1b778282480ac35d9d95fea3b73b738ba9e30166bbf861f493713e18b8b3c4b2a300
7
- data.tar.gz: 3dc3972ce4e1ef10116c2fa1dcb04ad980e9a73068d79a6399e0abbcca3b49f16f28fe5db1855bc353643cedf92c781853c56e7e9a0bf09b4c55783d539537a8
6
+ metadata.gz: 9cbbf2f3f6fc21e199d426ed08d71c734f09daf155bb5bc9b37a65662094c735047f76cfe8d84e3ee92a3b998e21e3cbbf643b6f0702ab14a67467773b028ead
7
+ data.tar.gz: 4a9e28997fd4cda40d0510f29f9bc04a78a30140e5631dd0be4a38b7bfc9ae4a65d3fbae14de8d4d1853cac2c60b8ddf4a399653a171c757b605397368e193fc
@@ -6,9 +6,6 @@ require "pathname"
6
6
  require "erb"
7
7
  require "reverse_markdown"
8
8
 
9
- # Markdown generator.
10
- # Registers command line options and generates markdown files
11
- # RDoc documentation and options.
12
9
  class RDoc::Generator::Markdown
13
10
  RDoc::RDoc.add_generator self
14
11
 
@@ -33,21 +30,6 @@ class RDoc::Generator::Markdown
33
30
 
34
31
  attr_reader :classes
35
32
 
36
- ##
37
- # Files to be displayed by this generator
38
-
39
- attr_reader :files
40
-
41
- ##
42
- # Methods to be displayed by this generator
43
-
44
- attr_reader :methods
45
-
46
- ##
47
- # Sorted list of classes and modules to be displayed by this generator
48
-
49
- attr_reader :modsort
50
-
51
33
  ##
52
34
  # Directory where generated class HTML files live relative to the output
53
35
  # dir.
@@ -66,9 +48,6 @@ class RDoc::Generator::Markdown
66
48
  @base_dir = Pathname.pwd.expand_path
67
49
 
68
50
  @classes = nil
69
- @files = nil
70
- @methods = nil
71
- @modsort = nil
72
51
  end
73
52
 
74
53
  def generate
@@ -124,22 +103,27 @@ class RDoc::Generator::Markdown
124
103
 
125
104
  private
126
105
 
127
- def replace_extensions_in_links(text)
128
- text.gsub(/\[(.+)\]\((.+).html(.*)\)/) do |_|
106
+ def turn_to_path(class_name)
107
+ class_name.gsub("::", "/")
108
+ end
109
+
110
+ def markdownify(input)
111
+ md= ReverseMarkdown.convert input, github_flavored: true
112
+
113
+ # Replace .html to .md extension in all markdown links
114
+ md = md.gsub(/\[(.+)\]\((.+).html(.*)\)/) do |_|
129
115
  match = Regexp.last_match
130
116
 
131
117
  "[#{match[1]}](#{match[2]}.md#{match[3]})"
132
118
  end
133
- end
134
119
 
135
- def turn_to_path(class_name)
136
- class_name.gsub("::", "/")
137
- end
120
+ # clean up things, to make it look neat.
138
121
 
139
- def h(string)
140
- replace_extensions_in_links ReverseMarkdown.convert string.strip, github_flavored: true
122
+ md.gsub("[↑](#top)", "").lstrip
141
123
  end
142
124
 
125
+ alias_method :h, :markdownify
126
+
143
127
  def setup
144
128
  return if instance_variable_defined?(:@output_dir)
145
129
 
@@ -148,8 +132,6 @@ class RDoc::Generator::Markdown
148
132
  return unless @store
149
133
 
150
134
  @classes = @store.all_classes_and_modules.sort
151
- @files = @store.all_files.sort
152
- @methods = @classes.map(&:method_list).flatten.sort
153
135
  @modsort = get_sorted_module_list @classes
154
136
  end
155
137
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rdoc
4
4
  module Markdown
5
- VERSION = "0.1.8"
5
+ VERSION = "0.1.10"
6
6
  end
7
7
  end
@@ -1,5 +1,5 @@
1
- # <% if klass.type == 'class' %><%= klass.type.capitalize %>: **<%= klass.full_name %>**<% if klass.superclass %> < <% end %><% unless String === klass.superclass %><%= klass.superclass&.name %> <% else %> <%= klass.superclass %> <% end %> <% else %> <%= klass.type.capitalize %><%= klass&.name %> <% end %>
2
- <% if klass.description && !klass.description.empty? %><%= h klass.description %><% end %>
1
+ # <% if klass.type == 'class' %><%= klass.type.capitalize %>: **<%= klass.full_name %>**<% if klass.superclass %> < <% end %><% unless String === klass.superclass %><%= klass.superclass&.name %> <% else %> <%= klass.superclass %> <% end %> <% else %> <%= klass.type.capitalize %>: <%= klass&.name %> <% end %>
2
+ <% if klass.description && !klass.description.empty? %><%= h klass.description %><% end %>
3
3
  <% unless klass.constants.empty? %>
4
4
  ## Constants
5
5
  ***
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.1.8
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stanislav (Stas) Katkov