rdoc 6.2.1 → 6.3.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rdoc might be problematic. Click here for more details.

Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rdoc.rb +21 -0
  3. data/lib/rdoc/any_method.rb +52 -7
  4. data/lib/rdoc/context.rb +10 -2
  5. data/lib/rdoc/context/section.rb +0 -13
  6. data/lib/rdoc/cross_reference.rb +2 -2
  7. data/lib/rdoc/erb_partial.rb +1 -1
  8. data/lib/rdoc/erbio.rb +2 -2
  9. data/lib/rdoc/generator/darkfish.rb +3 -3
  10. data/lib/rdoc/generator/pot.rb +3 -3
  11. data/lib/rdoc/generator/template/darkfish/_head.rhtml +4 -5
  12. data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +2 -2
  13. data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +2 -2
  14. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +7 -7
  15. data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +2 -2
  16. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +7 -7
  17. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +6 -6
  18. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +5 -5
  19. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +5 -5
  20. data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +5 -5
  21. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +4 -4
  22. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +4 -4
  23. data/lib/rdoc/generator/template/darkfish/class.rhtml +44 -44
  24. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +1 -1
  25. data/lib/rdoc/generator/template/darkfish/index.rhtml +3 -4
  26. data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +15 -16
  27. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +16 -16
  28. data/lib/rdoc/i18n.rb +1 -1
  29. data/lib/rdoc/markdown.kpeg +1 -1
  30. data/lib/rdoc/markdown.rb +1 -1
  31. data/lib/rdoc/markup/formatter.rb +1 -1
  32. data/lib/rdoc/markup/pre_process.rb +1 -1
  33. data/lib/rdoc/markup/to_html.rb +19 -6
  34. data/lib/rdoc/markup/to_html_crossref.rb +13 -5
  35. data/lib/rdoc/options.rb +1 -1
  36. data/lib/rdoc/parser.rb +7 -7
  37. data/lib/rdoc/parser/c.rb +24 -58
  38. data/lib/rdoc/rd/block_parser.rb +1 -1
  39. data/lib/rdoc/rd/inline_parser.rb +1 -1
  40. data/lib/rdoc/rdoc.rb +26 -20
  41. data/lib/rdoc/ri/driver.rb +9 -5
  42. data/lib/rdoc/ri/paths.rb +3 -17
  43. data/lib/rdoc/ri/task.rb +1 -1
  44. data/lib/rdoc/rubygems_hook.rb +2 -2
  45. data/lib/rdoc/servlet.rb +6 -1
  46. data/lib/rdoc/store.rb +2 -2
  47. data/lib/rdoc/version.rb +1 -1
  48. data/man/ri.1 +247 -0
  49. data/rdoc.gemspec +1 -1
  50. metadata +7 -6
@@ -25,9 +25,9 @@
25
25
  <%= klass.description %>
26
26
  </section>
27
27
 
28
- <% klass.each_section do |section, constants, attributes| %>
28
+ <%- klass.each_section do |section, constants, attributes| -%>
29
29
  <section id="<%= section.aref %>" class="documentation-section">
30
- <% if section.title then %>
30
+ <%- if section.title then -%>
31
31
  <header class="documentation-section-title">
32
32
  <h2>
33
33
  <%= section.title %>
@@ -36,39 +36,39 @@
36
36
  <a href="#top">&uarr; top</a>
37
37
  </span>
38
38
  </header>
39
- <% end %>
39
+ <%- end -%>
40
40
 
41
- <% if section.comment then %>
41
+ <%- if section.comment then -%>
42
42
  <div>
43
43
  <%= section.description %>
44
44
  </div>
45
- <% end %>
45
+ <%- end -%>
46
46
 
47
- <% unless constants.empty? then %>
47
+ <%- unless constants.empty? then -%>
48
48
  <section class="constants-list">
49
49
  <header>
50
50
  <h3>Constants</h3>
51
51
  </header>
52
52
  <dl>
53
- <% constants.each do |const| %>
53
+ <%- constants.each do |const| -%>
54
54
  <dt id="<%= const.name %>"><%= const.name %>
55
- <% if const.comment then %>
55
+ <%- if const.comment then -%>
56
56
  <dd><%= const.description.strip %>
57
- <% else %>
57
+ <%- else -%>
58
58
  <dd class="missing-docs">(Not documented)
59
- <% end %>
60
- <% end %>
59
+ <%- end -%>
60
+ <%- end -%>
61
61
  </dl>
62
62
  </section>
63
- <% end %>
63
+ <%- end -%>
64
64
 
65
- <% unless attributes.empty? then %>
65
+ <%- unless attributes.empty? then -%>
66
66
  <section class="attribute-method-details" class="method-section">
67
67
  <header>
68
68
  <h3>Attributes</h3>
69
69
  </header>
70
70
 
71
- <% attributes.each do |attrib| %>
71
+ <%- attributes.each do |attrib| -%>
72
72
  <div id="<%= attrib.aref %>" class="method-detail">
73
73
  <div class="method-heading attribute-method-heading">
74
74
  <span class="method-name"><%= h attrib.name %></span><span
@@ -76,18 +76,18 @@
76
76
  </div>
77
77
 
78
78
  <div class="method-description">
79
- <% if attrib.comment then %>
79
+ <%- if attrib.comment then -%>
80
80
  <%= attrib.description.strip %>
81
- <% else %>
81
+ <%- else -%>
82
82
  <p class="missing-docs">(Not documented)
83
- <% end %>
83
+ <%- end -%>
84
84
  </div>
85
85
  </div>
86
- <% end %>
86
+ <%- end -%>
87
87
  </section>
88
- <% end %>
88
+ <%- end -%>
89
89
 
90
- <% klass.methods_by_type(section).each do |type, visibilities|
90
+ <%- klass.methods_by_type(section).each do |type, visibilities|
91
91
  next if visibilities.empty?
92
92
  visibilities.each do |visibility, methods|
93
93
  next if methods.empty? %>
@@ -96,38 +96,38 @@
96
96
  <h3><%= visibility.to_s.capitalize %> <%= type.capitalize %> Methods</h3>
97
97
  </header>
98
98
 
99
- <% methods.each do |method| %>
99
+ <%- methods.each do |method| -%>
100
100
  <div id="<%= method.aref %>" class="method-detail <%= method.is_alias_for ? "method-alias" : '' %>">
101
- <% if method.call_seq then %>
102
- <% method.call_seq.strip.split("\n").each_with_index do |call_seq, i| %>
101
+ <%- if (call_seq = method.call_seq) then -%>
102
+ <%- call_seq.strip.split("\n").each_with_index do |call_seq, i| -%>
103
103
  <div class="method-heading">
104
104
  <span class="method-callseq">
105
105
  <%= h(call_seq.strip.
106
106
  gsub( /^\w+\./m, '')).
107
107
  gsub(/(.*)[-=]&gt;/, '\1&rarr;') %>
108
108
  </span>
109
- <% if i == 0 and method.token_stream then %>
109
+ <%- if i == 0 and method.token_stream then -%>
110
110
  <span class="method-click-advice">click to toggle source</span>
111
- <% end %>
111
+ <%- end -%>
112
112
  </div>
113
- <% end %>
114
- <% else %>
113
+ <%- end -%>
114
+ <%- else -%>
115
115
  <div class="method-heading">
116
116
  <span class="method-name"><%= h method.name %></span><span
117
117
  class="method-args"><%= h method.param_seq %></span>
118
- <% if method.token_stream then %>
118
+ <%- if method.token_stream then -%>
119
119
  <span class="method-click-advice">click to toggle source</span>
120
- <% end %>
120
+ <%- end -%>
121
121
  </div>
122
- <% end %>
122
+ <%- end -%>
123
123
 
124
124
  <div class="method-description">
125
- <% if method.comment then %>
125
+ <%- if method.comment then -%>
126
126
  <%= method.description.strip %>
127
- <% else %>
127
+ <%- else -%>
128
128
  <p class="missing-docs">(Not documented)
129
- <% end %>
130
- <% if method.calls_super then %>
129
+ <%- end -%>
130
+ <%- if method.calls_super then -%>
131
131
  <div class="method-calls-super">
132
132
  Calls superclass method
133
133
  <%=
@@ -135,16 +135,16 @@
135
135
  method.formatter.link(method.superclass_method.full_name, method.superclass_method.full_name) : nil
136
136
  %>
137
137
  </div>
138
- <% end %>
138
+ <%- end -%>
139
139
 
140
- <% if method.token_stream then %>
140
+ <%- if method.token_stream then -%>
141
141
  <div class="method-source-code" id="<%= method.html_name %>-source">
142
142
  <pre><%= method.markup_code %></pre>
143
143
  </div>
144
- <% end %>
144
+ <%- end -%>
145
145
  </div>
146
146
 
147
- <% unless method.aliases.empty? then %>
147
+ <%- unless method.aliases.empty? then -%>
148
148
  <div class="aliases">
149
149
  Also aliased as: <%= method.aliases.map do |aka|
150
150
  if aka.parent then # HACK lib/rexml/encodings
@@ -154,19 +154,19 @@
154
154
  end
155
155
  end.join ", " %>
156
156
  </div>
157
- <% end %>
157
+ <%- end -%>
158
158
 
159
- <% if method.is_alias_for then %>
159
+ <%- if method.is_alias_for then -%>
160
160
  <div class="aliases">
161
161
  Alias for: <a href="<%= klass.aref_to method.is_alias_for.path %>"><%= h method.is_alias_for.name %></a>
162
162
  </div>
163
- <% end %>
163
+ <%- end -%>
164
164
  </div>
165
165
 
166
- <% end %>
166
+ <%- end -%>
167
167
  </section>
168
- <% end
168
+ <%- end
169
169
  end %>
170
170
  </section>
171
- <% end %>
171
+ <%- end -%>
172
172
  </main>
@@ -276,7 +276,7 @@ ul.link-list .type {
276
276
  -webkit-border-radius: 5px;
277
277
  }
278
278
 
279
- dl.label-list dt {
279
+ dl.note-list dt {
280
280
  float: left;
281
281
  margin-right: 1em;
282
282
  }
@@ -13,11 +13,10 @@
13
13
  </nav>
14
14
 
15
15
  <main role="main">
16
- <% if @options.main_page and
16
+ <%- if @options.main_page and
17
17
  main_page = @files.find { |f| f.full_name == @options.main_page } then %>
18
18
  <%= main_page.description %>
19
- <% else %>
19
+ <%- else -%>
20
20
  <p>This is the API documentation for <%= @title %>.
21
- <% end %>
21
+ <%- end -%>
22
22
  </main>
23
-
@@ -19,28 +19,28 @@
19
19
  <p>Here you can browse local documentation from the ruby standard library and
20
20
  your installed gems.
21
21
 
22
- <% extra_dirs = installed.select { |_, _, _, type,| type == :extra } %>
23
- <% unless extra_dirs.empty? %>
22
+ <%- extra_dirs = installed.select { |_, _, _, type,| type == :extra } -%>
23
+ <%- unless extra_dirs.empty? -%>
24
24
  <h2>Extra Documentation Directories</h2>
25
25
 
26
26
  <p>The following additional documentation directories are available:</p>
27
27
 
28
28
  <ol>
29
- <% extra_dirs.each do |name, href, exists, _, path| %>
29
+ <%- extra_dirs.each do |name, href, exists, _, path| -%>
30
30
  <li>
31
- <% if exists %>
31
+ <%- if exists -%>
32
32
  <a href="<%= href %>"><%= h name %></a> (<%= h path %>)
33
- <% else %>
33
+ <%- else -%>
34
34
  <%= h name %> (<%= h path %>; <i>not available</i>)
35
- <% end %>
35
+ <%- end -%>
36
36
  </li>
37
- <% end %>
37
+ <%- end -%>
38
38
  </ol>
39
- <% end %>
39
+ <%- end -%>
40
40
 
41
- <% gems = installed.select { |_, _, _, type,| type == :gem } %>
42
- <% missing = gems.reject { |_, _, exists,| exists } %>
43
- <% unless missing.empty? then %>
41
+ <%- gems = installed.select { |_, _, _, type,| type == :gem } -%>
42
+ <%- missing = gems.reject { |_, _, exists,| exists } -%>
43
+ <%- unless missing.empty? then -%>
44
44
  <h2>Missing Gem Documentation</h2>
45
45
 
46
46
  <p>You are missing documentation for some of your installed gems.
@@ -53,11 +53,10 @@
53
53
  the following commands.
54
54
 
55
55
  <ul>
56
- <% names = missing.map { |name,| name.sub(/-([^-]*)$/, '') }.uniq %>
57
- <% names.each do |name| %>
56
+ <%- names = missing.map { |name,| name.sub(/-([^-]*)$/, '') }.uniq -%>
57
+ <%- names.each do |name| -%>
58
58
  <li><kbd>gem rdoc <%=h name %></kbd>
59
- <% end %>
59
+ <%- end -%>
60
60
  </ul>
61
- <% end %>
61
+ <%- end -%>
62
62
  </main>
63
-
@@ -2,11 +2,11 @@
2
2
  <main role="main">
3
3
  <h1 class="class"><%= h @title %></h1>
4
4
 
5
- <% simple_files = @files.select { |f| f.text? } %>
6
- <% unless simple_files.empty? then %>
5
+ <%- simple_files = @files.select { |f| f.text? } -%>
6
+ <%- unless simple_files.empty? then -%>
7
7
  <h2 id="pages">Pages</h2>
8
8
  <ul>
9
- <% simple_files.sort.each do |file| %>
9
+ <%- simple_files.sort.each do |file| -%>
10
10
  <li class="file">
11
11
  <a href="<%= file.path %>"><%= h file.page_name %></a>
12
12
  <%
@@ -14,45 +14,45 @@
14
14
  table = file.parse(file.comment).table_of_contents
15
15
  unless table.empty? then %>
16
16
  <ul>
17
- <% table.each do |heading| %>
17
+ <%- table.each do |heading| -%>
18
18
  <li><a href="<%= file.path %>#<%= heading.aref %>"><%= heading.plain_html %></a>
19
- <% end %>
19
+ <%- end -%>
20
20
  </ul>
21
- <% end %>
21
+ <%- end -%>
22
22
  </li>
23
- <% end %>
23
+ <%- end -%>
24
24
  </ul>
25
- <% end %>
25
+ <%- end -%>
26
26
 
27
27
  <h2 id="classes">Classes and Modules</h2>
28
28
  <ul>
29
- <% @modsort.each do |klass| %>
29
+ <%- @modsort.each do |klass| -%>
30
30
  <li class="<%= klass.type %>">
31
31
  <a href="<%= klass.path %>"><%= klass.full_name %></a>
32
- <% table = []
32
+ <%- table = []
33
33
  table.concat klass.parse(klass.comment_location).table_of_contents
34
34
  table.concat klass.section_contents
35
35
 
36
36
  unless table.empty? then %>
37
37
  <ul>
38
- <% table.each do |item| %>
38
+ <%- table.each do |item| -%>
39
39
  <li><a href="<%= klass.path %>#<%= item.aref %>"><%= item.plain_html %></a>
40
- <% end %>
40
+ <%- end -%>
41
41
  </ul>
42
- <% end %>
42
+ <%- end -%>
43
43
  </li>
44
- <% end %>
44
+ <%- end -%>
45
45
  </ul>
46
46
 
47
47
  <h2 id="methods">Methods</h2>
48
48
  <ul>
49
- <% @store.all_classes_and_modules.map do |mod|
49
+ <%- @store.all_classes_and_modules.map do |mod|
50
50
  mod.method_list
51
51
  end.flatten.sort.each do |method| %>
52
52
  <li class="method">
53
53
  <a href="<%= method.path %>"><%= h method.pretty_name %></a>
54
54
  &mdash;
55
55
  <span class="container"><%= method.parent.full_name %></span>
56
- <% end %>
56
+ <%- end -%>
57
57
  </ul>
58
58
  </main>
@@ -5,6 +5,6 @@
5
5
  module RDoc::I18n
6
6
 
7
7
  autoload :Locale, 'rdoc/i18n/locale'
8
- require 'rdoc/i18n/text'
8
+ require_relative 'i18n/text'
9
9
 
10
10
  end
@@ -176,7 +176,7 @@
176
176
  # The port to kpeg was performed by Eric Hodel and Evan Phoenix
177
177
  #
178
178
  # [dingus]: http://daringfireball.net/projects/markdown/dingus
179
- # [GFM]: http://github.github.com/github-flavored-markdown/
179
+ # [GFM]: https://github.github.com/gfm/
180
180
  # [pegmarkdown]: https://github.com/jgm/peg-markdown
181
181
  # [PHPE]: http://michelf.com/projects/php-markdown/extra/#def-list
182
182
  # [syntax]: http://daringfireball.net/projects/markdown/syntax
@@ -173,7 +173,7 @@
173
173
  # The port to kpeg was performed by Eric Hodel and Evan Phoenix
174
174
  #
175
175
  # [dingus]: http://daringfireball.net/projects/markdown/dingus
176
- # [GFM]: http://github.github.com/github-flavored-markdown/
176
+ # [GFM]: https://github.github.com/gfm/
177
177
  # [pegmarkdown]: https://github.com/jgm/peg-markdown
178
178
  # [PHPE]: http://michelf.com/projects/php-markdown/extra/#def-list
179
179
  # [syntax]: http://daringfireball.net/projects/markdown/syntax
@@ -156,7 +156,7 @@ class RDoc::Markup::Formatter
156
156
  method_name = "handle_regexp_#{name}"
157
157
 
158
158
  if respond_to? method_name then
159
- target.text = send method_name, target
159
+ target.text = public_send method_name, target
160
160
  handled = true
161
161
  end
162
162
  end
@@ -178,7 +178,7 @@ class RDoc::Markup::PreProcess
178
178
 
179
179
  blankline
180
180
  when 'include' then
181
- filename = param.split.first
181
+ filename = param.split(' ', 2).first
182
182
  include_file filename, prefix, encoding
183
183
  when 'main' then
184
184
  @options.main_page = param if @options.respond_to? :main_page
@@ -52,12 +52,7 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
52
52
  @th = nil
53
53
  @hard_break = "<br>\n"
54
54
 
55
- # external links
56
- @markup.add_regexp_handling(/(?:link:|https?:|mailto:|ftp:|irc:|www\.)\S+\w/,
57
- :HYPERLINK)
58
-
59
- add_regexp_handling_RDOCLINK
60
- add_regexp_handling_TIDYLINK
55
+ init_regexp_handlings
61
56
 
62
57
  init_tags
63
58
  end
@@ -66,6 +61,24 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
66
61
  #
67
62
  # These methods are used by regexp handling markup added by RDoc::Markup#add_regexp_handling.
68
63
 
64
+ ##
65
+ # Adds regexp handlings.
66
+
67
+ def init_regexp_handlings
68
+ # external links
69
+ @markup.add_regexp_handling(/(?:link:|https?:|mailto:|ftp:|irc:|www\.)\S+\w/,
70
+ :HYPERLINK)
71
+ init_link_notation_regexp_handlings
72
+ end
73
+
74
+ ##
75
+ # Adds regexp handlings about link notations.
76
+
77
+ def init_link_notation_regexp_handlings
78
+ add_regexp_handling_RDOCLINK
79
+ add_regexp_handling_TIDYLINK
80
+ end
81
+
69
82
  def handle_RDOCLINK url # :nodoc:
70
83
  case url
71
84
  when /^rdoc-ref:/
@@ -39,10 +39,18 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
39
39
  @hyperlink_all = @options.hyperlink_all
40
40
  @show_hash = @options.show_hash
41
41
 
42
- crossref_re = @hyperlink_all ? ALL_CROSSREF_REGEXP : CROSSREF_REGEXP
42
+ @cross_reference = RDoc::CrossReference.new @context
43
+ end
44
+
45
+ def init_link_notation_regexp_handlings
46
+ add_regexp_handling_RDOCLINK
47
+
48
+ # The crossref must be linked before tidylink because Klass.method[:sym]
49
+ # will be processed as a tidylink first and will be broken.
50
+ crossref_re = @options.hyperlink_all ? ALL_CROSSREF_REGEXP : CROSSREF_REGEXP
43
51
  @markup.add_regexp_handling crossref_re, :CROSSREF
44
52
 
45
- @cross_reference = RDoc::CrossReference.new @context
53
+ add_regexp_handling_TIDYLINK
46
54
  end
47
55
 
48
56
  ##
@@ -54,7 +62,7 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
54
62
 
55
63
  name = name[1..-1] unless @show_hash if name[0, 1] == '#'
56
64
 
57
- if name =~ /(.*[^#:])@/
65
+ if !(name.end_with?('+@', '-@')) and name =~ /(.*[^#:])@/
58
66
  text ||= "#{CGI.unescape $'} at <code>#{$1}</code>"
59
67
  code = false
60
68
  else
@@ -130,7 +138,7 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
130
138
  # Creates an HTML link to +name+ with the given +text+.
131
139
 
132
140
  def link name, text, code = true
133
- if name =~ /(.*[^#:])@/ then
141
+ if !(name.end_with?('+@', '-@')) and name =~ /(.*[^#:])@/
134
142
  name = $1
135
143
  label = $'
136
144
  end
@@ -144,7 +152,7 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
144
152
  path = ref.as_href @from_path
145
153
 
146
154
  if code and RDoc::CodeObject === ref and !(RDoc::TopLevel === ref)
147
- text = "<code>#{text}</code>"
155
+ text = "<code>#{CGI.escapeHTML text}</code>"
148
156
  end
149
157
 
150
158
  if path =~ /#/ then