mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Import RDoc 3.5.2
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d8ebf3829f
commit
8aa895294b
17 changed files with 564 additions and 290 deletions
|
@ -62,22 +62,6 @@ end
|
|||
|
||||
class RDoc::AnyMethod
|
||||
|
||||
##
|
||||
# Maps RDoc::RubyToken classes to CSS class names
|
||||
|
||||
STYLE_MAP = {
|
||||
RDoc::RubyToken::TkCONSTANT => 'ruby-constant',
|
||||
RDoc::RubyToken::TkKW => 'ruby-keyword',
|
||||
RDoc::RubyToken::TkIVAR => 'ruby-ivar',
|
||||
RDoc::RubyToken::TkOp => 'ruby-operator',
|
||||
RDoc::RubyToken::TkId => 'ruby-identifier',
|
||||
RDoc::RubyToken::TkNode => 'ruby-node',
|
||||
RDoc::RubyToken::TkCOMMENT => 'ruby-comment',
|
||||
RDoc::RubyToken::TkREGEXP => 'ruby-regexp',
|
||||
RDoc::RubyToken::TkSTRING => 'ruby-string',
|
||||
RDoc::RubyToken::TkVal => 'ruby-value',
|
||||
}
|
||||
|
||||
include RDoc::Generator::Markup
|
||||
|
||||
@add_line_numbers = false
|
||||
|
@ -130,7 +114,18 @@ class RDoc::AnyMethod
|
|||
@token_stream.each do |t|
|
||||
next unless t
|
||||
|
||||
style = STYLE_MAP[t.class]
|
||||
style = case t
|
||||
when RDoc::RubyToken::TkCONSTANT then 'ruby-constant'
|
||||
when RDoc::RubyToken::TkKW then 'ruby-keyword'
|
||||
when RDoc::RubyToken::TkIVAR then 'ruby-ivar'
|
||||
when RDoc::RubyToken::TkOp then 'ruby-operator'
|
||||
when RDoc::RubyToken::TkId then 'ruby-identifier'
|
||||
when RDoc::RubyToken::TkNode then 'ruby-node'
|
||||
when RDoc::RubyToken::TkCOMMENT then 'ruby-comment'
|
||||
when RDoc::RubyToken::TkREGEXP then 'ruby-regexp'
|
||||
when RDoc::RubyToken::TkSTRING then 'ruby-string'
|
||||
when RDoc::RubyToken::TkVal then 'ruby-value'
|
||||
end
|
||||
|
||||
text = CGI.escapeHTML t.text
|
||||
|
||||
|
|
|
@ -9,17 +9,13 @@
|
|||
|
||||
<link rel="stylesheet" href="<%= rel_prefix %>/rdoc.css" type="text/css" media="screen" />
|
||||
|
||||
<script src="<%= rel_prefix %>/js/jquery.js" type="text/javascript"
|
||||
charset="utf-8"></script>
|
||||
<script src="<%= rel_prefix %>/js/thickbox-compressed.js" type="text/javascript"
|
||||
charset="utf-8"></script>
|
||||
<script src="<%= rel_prefix %>/js/quicksearch.js" type="text/javascript"
|
||||
charset="utf-8"></script>
|
||||
<script src="<%= rel_prefix %>/js/darkfish.js" type="text/javascript"
|
||||
charset="utf-8"></script>
|
||||
<script src="<%= rel_prefix %>/js/jquery.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="<%= rel_prefix %>/js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="<%= rel_prefix %>/js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="<%= rel_prefix %>/js/darkfish.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
</head>
|
||||
<body class="<%= klass.type %>">
|
||||
<body id="top" class="<%= klass.type %>">
|
||||
|
||||
<div id="metadata">
|
||||
<div id="home-metadata">
|
||||
|
@ -45,7 +41,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<% if !svninfo.empty? %>
|
||||
<% if !svninfo.empty? then %>
|
||||
<div id="file-svninfo-section" class="section">
|
||||
<h3 class="section-header">Subversion Info</h3>
|
||||
<div class="section-body">
|
||||
|
@ -66,9 +62,8 @@
|
|||
</div>
|
||||
|
||||
<div id="class-metadata">
|
||||
|
||||
<% if klass.type == 'class' then %>
|
||||
<!-- Parent Class -->
|
||||
<% if klass.type == 'class' %>
|
||||
<div id="parent-class-section" class="section">
|
||||
<h3 class="section-header">Parent</h3>
|
||||
<% if klass.superclass and not String === klass.superclass then %>
|
||||
|
@ -79,8 +74,20 @@
|
|||
</div>
|
||||
<% end %>
|
||||
|
||||
<% unless klass.sections.length == 1 then %>
|
||||
<!-- Sections -->
|
||||
<div id="sections-section" class="section">
|
||||
<h3 class="section-header">Sections</h3>
|
||||
<ul class="link-list">
|
||||
<% klass.sections.sort_by { |s| s.title.to_s }.each do |section| %>
|
||||
<li><a href="#<%= section.aref %>"><%= h section.title %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% unless klass.classes_and_modules.empty? then %>
|
||||
<!-- Namespace Contents -->
|
||||
<% unless klass.classes_and_modules.empty? %>
|
||||
<div id="namespace-list-section" class="section">
|
||||
<h3 class="section-header">Namespace</h3>
|
||||
<ul class="link-list">
|
||||
|
@ -91,8 +98,8 @@
|
|||
</div>
|
||||
<% end %>
|
||||
|
||||
<% unless klass.method_list.empty? then %>
|
||||
<!-- Method Quickref -->
|
||||
<% unless klass.method_list.empty? %>
|
||||
<div id="method-list-section" class="section">
|
||||
<h3 class="section-header">Methods</h3>
|
||||
<ul class="link-list">
|
||||
|
@ -103,13 +110,13 @@
|
|||
</div>
|
||||
<% end %>
|
||||
|
||||
<% unless klass.includes.empty? then %>
|
||||
<!-- Included Modules -->
|
||||
<% unless klass.includes.empty? %>
|
||||
<div id="includes-section" class="section">
|
||||
<h3 class="section-header">Included Modules</h3>
|
||||
<ul class="link-list">
|
||||
<% klass.each_include do |inc| %>
|
||||
<% unless String === inc.module %>
|
||||
<% unless String === inc.module then %>
|
||||
<li><a class="include" href="<%= klass.aref_to inc.module.path %>"><%= inc.module.full_name %></a></li>
|
||||
<% else %>
|
||||
<li><span class="include"><%= inc.name %></span></li>
|
||||
|
@ -154,7 +161,7 @@
|
|||
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
||||
</div>
|
||||
|
||||
<% if $DEBUG_RDOC %>
|
||||
<% if $DEBUG_RDOC then %>
|
||||
<div id="debugging-toggle"><img src="<%= rel_prefix %>/images/bug.png"
|
||||
alt="toggle debugging" height="16" width="16" /></div>
|
||||
<% end %>
|
||||
|
@ -164,126 +171,142 @@
|
|||
<div id="documentation">
|
||||
<h1 class="<%= klass.type %>"><%= klass.full_name %></h1>
|
||||
|
||||
<div id="description">
|
||||
<div id="description" class="description">
|
||||
<%= klass.description %>
|
||||
</div>
|
||||
</div><!-- description -->
|
||||
|
||||
<!-- Constants -->
|
||||
<% unless klass.constants.empty? %>
|
||||
<div id="constants-list" class="section">
|
||||
<h3 class="section-header">Constants</h3>
|
||||
<dl>
|
||||
<% klass.each_constant do |const| %>
|
||||
<dt><a name="<%= const.name %>"><%= const.name %></a></dt>
|
||||
<% if const.comment %>
|
||||
<dd class="description"><%= const.description.strip %></dd>
|
||||
<% else %>
|
||||
<dd class="description missing-docs">(Not documented)</dd>
|
||||
<% end %>
|
||||
<% klass.each_section do |section, constants, attributes| %>
|
||||
<div id="<%= section.aref %>" class="documentation-section">
|
||||
<% if section.title then %>
|
||||
<h2 class="section-header">
|
||||
<%= section.title %>
|
||||
<a href="#top">↑ top</a>
|
||||
</h2>
|
||||
<% end %>
|
||||
</dl>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<!-- Attributes -->
|
||||
<% unless klass.attributes.empty? %>
|
||||
<div id="attribute-method-details" class="method-section section">
|
||||
<h3 class="section-header">Attributes</h3>
|
||||
|
||||
<% klass.each_attribute do |attrib| %>
|
||||
<div id="<%= attrib.html_name %>-attribute-method" class="method-detail">
|
||||
<a name="<%= h attrib.name %>"></a>
|
||||
<% if attrib.rw =~ /w/i %>
|
||||
<a name="<%= h attrib.name %>="></a>
|
||||
<% end %>
|
||||
<div class="method-heading attribute-method-heading">
|
||||
<span class="method-name"><%= h attrib.name %></span><span
|
||||
class="attribute-access-type">[<%= attrib.rw %>]</span>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<% if attrib.comment %>
|
||||
<%= attrib.description.strip %>
|
||||
<% else %>
|
||||
<p class="missing-docs">(Not documented)</p>
|
||||
<% end %>
|
||||
</div>
|
||||
<% if section.comment then %>
|
||||
<div class="description">
|
||||
<%= section.description %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<!-- Methods -->
|
||||
<% klass.methods_by_type.each do |type, visibilities|
|
||||
next if visibilities.empty?
|
||||
visibilities.each do |visibility, methods|
|
||||
next if methods.empty? %>
|
||||
<div id="<%= visibility %>-<%= type %>-method-details" class="method-section section">
|
||||
<h3 class="section-header"><%= visibility.to_s.capitalize %> <%= type.capitalize %> Methods</h3>
|
||||
|
||||
<% methods.each do |method| %>
|
||||
<div id="<%= method.html_name %>-method" class="method-detail <%= method.is_alias_for ? "method-alias" : '' %>">
|
||||
<a name="<%= h method.aref %>"></a>
|
||||
|
||||
<% if method.call_seq %>
|
||||
<% method.call_seq.strip.split("\n").each_with_index do |call_seq, i| %>
|
||||
<div class="method-heading">
|
||||
<span class="method-callseq"><%= call_seq.strip.gsub(/->/, '→').gsub( /^\w+\./m, '') %></span>
|
||||
<% if i == 0 %>
|
||||
<span class="method-click-advice">click to toggle source</span>
|
||||
<% unless constants.empty? then %>
|
||||
<!-- Constants -->
|
||||
<div id="constants-list" class="section">
|
||||
<h3 class="section-header">Constants</h3>
|
||||
<dl>
|
||||
<% constants.each do |const| %>
|
||||
<dt><a name="<%= const.name %>"><%= const.name %></a></dt>
|
||||
<% if const.comment then %>
|
||||
<dd class="description"><%= const.description.strip %></dd>
|
||||
<% else %>
|
||||
<dd class="description missing-docs">(Not documented)</dd>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="method-heading">
|
||||
<span class="method-name"><%= h method.name %></span><span
|
||||
class="method-args"><%= method.params %></span>
|
||||
<span class="method-click-advice">click to toggle source</span>
|
||||
</div>
|
||||
<% end %>
|
||||
</dl>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="method-description">
|
||||
<% if method.comment %>
|
||||
<%= method.description.strip %>
|
||||
<% unless attributes.empty? then %>
|
||||
<!-- Attributes -->
|
||||
<div id="attribute-method-details" class="method-section section">
|
||||
<h3 class="section-header">Attributes</h3>
|
||||
|
||||
<% attributes.each do |attrib| %>
|
||||
<div id="<%= attrib.html_name %>-attribute-method" class="method-detail">
|
||||
<a name="<%= h attrib.name %>"></a>
|
||||
<% if attrib.rw =~ /w/i then %>
|
||||
<a name="<%= h attrib.name %>="></a>
|
||||
<% end %>
|
||||
<div class="method-heading attribute-method-heading">
|
||||
<span class="method-name"><%= h attrib.name %></span><span
|
||||
class="attribute-access-type">[<%= attrib.rw %>]</span>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<% if attrib.comment then %>
|
||||
<%= attrib.description.strip %>
|
||||
<% else %>
|
||||
<p class="missing-docs">(Not documented)</p>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div><!-- attribute-method-details -->
|
||||
<% end %>
|
||||
|
||||
<% if method.token_stream %>
|
||||
<div class="method-source-code"
|
||||
id="<%= method.html_name %>-source">
|
||||
<!-- Methods -->
|
||||
<% klass.methods_by_type(section).each do |type, visibilities|
|
||||
next if visibilities.empty?
|
||||
visibilities.each do |visibility, methods|
|
||||
next if methods.empty? %>
|
||||
<div id="<%= visibility %>-<%= type %>-method-details" class="method-section section">
|
||||
<h3 class="section-header"><%= visibility.to_s.capitalize %> <%= type.capitalize %> Methods</h3>
|
||||
|
||||
<% methods.each do |method| %>
|
||||
<div id="<%= method.html_name %>-method" class="method-detail <%= method.is_alias_for ? "method-alias" : '' %>">
|
||||
<a name="<%= h method.aref %>"></a>
|
||||
|
||||
<% if method.call_seq then %>
|
||||
<% method.call_seq.strip.split("\n").each_with_index do |call_seq, i| %>
|
||||
<div class="method-heading">
|
||||
<span class="method-callseq"><%= call_seq.strip.gsub(/->/, '→').gsub( /^\w+\./m, '') %></span>
|
||||
<% if i == 0 then %>
|
||||
<span class="method-click-advice">click to toggle source</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="method-heading">
|
||||
<span class="method-name"><%= h method.name %></span><span
|
||||
class="method-args"><%= method.params %></span>
|
||||
<span class="method-click-advice">click to toggle source</span>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="method-description">
|
||||
<% if method.comment then %>
|
||||
<%= method.description.strip %>
|
||||
<% else %>
|
||||
<p class="missing-docs">(Not documented)</p>
|
||||
<% end %>
|
||||
|
||||
<% if method.token_stream then %>
|
||||
<div class="method-source-code" id="<%= method.html_name %>-source">
|
||||
<pre>
|
||||
<%= method.markup_code %>
|
||||
</pre>
|
||||
</div><!-- <%= method.html_name %>-source -->
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% unless method.aliases.empty? then %>
|
||||
<div class="aliases">
|
||||
Also aliased as: <%= method.aliases.map do |aka|
|
||||
if aka.parent then # HACK lib/rexml/encodings
|
||||
%{<a href="#{klass.aref_to aka.path}">#{h aka.name}</a>}
|
||||
else
|
||||
h aka.name
|
||||
end
|
||||
end.join ", " %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% unless method.aliases.empty? %>
|
||||
<div class="aliases">
|
||||
Also aliased as: <%= method.aliases.map do |aka|
|
||||
if aka.parent then # HACK lib/rexml/encodings
|
||||
%{<a href="#{klass.aref_to aka.path}">#{h aka.name}</a>}
|
||||
else
|
||||
h aka.name
|
||||
end
|
||||
end.join ", " %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if method.is_alias_for then %>
|
||||
<div class="aliases">
|
||||
Alias for: <a href="<%= klass.aref_to method.is_alias_for.path %>"><%= h method.is_alias_for.name %></a>
|
||||
</div>
|
||||
<% end %>
|
||||
</div><!-- <%= method.html_name %>-method -->
|
||||
|
||||
<% if method.is_alias_for then %>
|
||||
<div class="aliases">
|
||||
Alias for: <a href="<%= klass.aref_to method.is_alias_for.path %>"><%= h method.is_alias_for.name %></a>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div><!-- <%= visibility %>-<%= type %>-method-details -->
|
||||
<% end
|
||||
end %>
|
||||
</div><!-- <%= section.aref %> -->
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
<% end
|
||||
end %>
|
||||
|
||||
</div>
|
||||
</div><!-- documentation -->
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
|
|
|
@ -278,46 +278,46 @@ ul.link-list .type {
|
|||
|
||||
|
||||
/* @group Documentation Section */
|
||||
#description {
|
||||
.description {
|
||||
font-size: 100%;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
#description p {
|
||||
.description p {
|
||||
margin: 1em 0.4em;
|
||||
}
|
||||
|
||||
#description li p {
|
||||
.description li p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#description ul {
|
||||
.description ul {
|
||||
margin-left: 1.5em;
|
||||
}
|
||||
#description ul li {
|
||||
.description ul li {
|
||||
line-height: 1.4em;
|
||||
}
|
||||
|
||||
#description dl,
|
||||
.description dl,
|
||||
#documentation dl {
|
||||
margin: 8px 1.5em;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
#description dl {
|
||||
.description dl {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
#description dt,
|
||||
.description dt,
|
||||
#documentation dt {
|
||||
padding: 2px 4px;
|
||||
font-weight: bold;
|
||||
background: #ddd;
|
||||
}
|
||||
#description dd,
|
||||
.description dd,
|
||||
#documentation dd {
|
||||
padding: 2px 12px;
|
||||
}
|
||||
#description dd + dt,
|
||||
.description dd + dt,
|
||||
#documentation dd + dt {
|
||||
margin-top: 0.7em;
|
||||
}
|
||||
|
@ -325,9 +325,21 @@ ul.link-list .type {
|
|||
#documentation .section {
|
||||
font-size: 90%;
|
||||
}
|
||||
#documentation h3.section-header {
|
||||
|
||||
#documentation h2.section-header {
|
||||
margin-top: 2em;
|
||||
padding: 0.75em 0.5em;
|
||||
background: #ccc;
|
||||
color: #333;
|
||||
font-size: 175%;
|
||||
border: 1px solid #bbb;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
}
|
||||
|
||||
#documentation h3.section-header {
|
||||
margin-top: 2em;
|
||||
padding: 0.25em 0.5em;
|
||||
background-color: #dedede;
|
||||
color: #333;
|
||||
font-size: 150%;
|
||||
|
@ -359,6 +371,23 @@ ul.link-list .type {
|
|||
color: #666;
|
||||
}
|
||||
|
||||
.documentation-section h2 {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.documentation-section h2 a {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
right: 10px;
|
||||
font-size: 12px;
|
||||
color: #9b9877;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.documentation-section h2:hover a {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
/* @group Method Details */
|
||||
|
||||
#documentation .method-source-code {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue