rdoc-markdown 0.1.8 → 0.1.10
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/lib/rdoc/generator/markdown.rb +13 -31
- data/lib/rdoc/markdown/version.rb +1 -1
- data/lib/templates/classfile.md.erb +2 -2
- 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: 2d08a05e31cacde411267507404584cf8b83a715e2001290e84f4b0ae3494106
|
4
|
+
data.tar.gz: cf679c7121051ed3c3dfe7615e9ef559d2ec8b023e2b1efd9666d9caa2de5ae7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
128
|
-
|
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
|
-
|
136
|
-
class_name.gsub("::", "/")
|
137
|
-
end
|
120
|
+
# clean up things, to make it look neat.
|
138
121
|
|
139
|
-
|
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
|
|
@@ -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
|
2
|
-
|
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
|
***
|