From 8aa895294b8d696489b51a5e69b2986f452da905 Mon Sep 17 00:00:00 2001 From: drbrain Date: Sat, 5 Feb 2011 06:20:57 +0000 Subject: Import RDoc 3.5.2 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rdoc/generator/markup.rb | 29 +-- .../generator/template/darkfish/classpage.rhtml | 253 +++++++++++---------- lib/rdoc/generator/template/darkfish/rdoc.css | 51 ++++- 3 files changed, 190 insertions(+), 143 deletions(-) (limited to 'lib/rdoc/generator') diff --git a/lib/rdoc/generator/markup.rb b/lib/rdoc/generator/markup.rb index dd7c73044d..1919a62ec8 100644 --- a/lib/rdoc/generator/markup.rb +++ b/lib/rdoc/generator/markup.rb @@ -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 diff --git a/lib/rdoc/generator/template/darkfish/classpage.rhtml b/lib/rdoc/generator/template/darkfish/classpage.rhtml index 4a1bdcdea9..856321532b 100644 --- a/lib/rdoc/generator/template/darkfish/classpage.rhtml +++ b/lib/rdoc/generator/template/darkfish/classpage.rhtml @@ -9,17 +9,13 @@ - - - - + + + + - +
@@ -45,7 +41,7 @@
- <% if !svninfo.empty? %> + <% if !svninfo.empty? then %>

Subversion Info

@@ -66,9 +62,8 @@
- + <% if klass.type == 'class' then %> - <% if klass.type == 'class' %>

Parent

<% if klass.superclass and not String === klass.superclass then %> @@ -79,8 +74,20 @@
<% end %> + <% unless klass.sections.length == 1 then %> + +
+

Sections

+ +
+ <% end %> + + <% unless klass.classes_and_modules.empty? then %> - <% unless klass.classes_and_modules.empty? %>

Namespace

<% end %> + <% unless klass.method_list.empty? then %> - <% unless klass.method_list.empty? %>

Methods

<% end %> + <% unless klass.includes.empty? then %> - <% unless klass.includes.empty? %>

Included Modules

- <% if $DEBUG_RDOC %> + <% if $DEBUG_RDOC then %>
toggle debugging
<% end %> @@ -164,126 +171,142 @@

<%= klass.full_name %>

-
+
<%= klass.description %> -
+
+ + <% klass.each_section do |section, constants, attributes| %> +
+ <% if section.title then %> +

+ <%= section.title %> + ↑ top +

+ <% end %> - - <% unless klass.constants.empty? %> -
-

Constants

-
- <% klass.each_constant do |const| %> -
<%= const.name %>
- <% if const.comment %> -
<%= const.description.strip %>
- <% else %> -
(Not documented)
- <% end %> + <% if section.comment then %> +
+ <%= section.description %> +
<% end %> -
-
- <% end %> - - - <% unless klass.attributes.empty? %> -
-

Attributes

- - <% klass.each_attribute do |attrib| %> -
- - <% if attrib.rw =~ /w/i %> - - <% end %> -
- <%= h attrib.name %>[<%= attrib.rw %>] -
-
- <% if attrib.comment %> - <%= attrib.description.strip %> - <% else %> -

(Not documented)

+ <% unless constants.empty? then %> + +
+

Constants

+
+ <% constants.each do |const| %> +
<%= const.name %>
+ <% if const.comment then %> +
<%= const.description.strip %>
+ <% else %> +
(Not documented)
+ <% end %> <% end %> -
+
<% end %> -
- <% end %> - - - <% klass.methods_by_type.each do |type, visibilities| - next if visibilities.empty? - visibilities.each do |visibility, methods| - next if methods.empty? %> -
-

<%= visibility.to_s.capitalize %> <%= type.capitalize %> Methods

- - <% methods.each do |method| %> -
"> - - - <% if method.call_seq %> - <% method.call_seq.strip.split("\n").each_with_index do |call_seq, i| %> -
- <%= call_seq.strip.gsub(/->/, '→').gsub( /^\w+\./m, '') %> - <% if i == 0 %> - click to toggle source + + <% unless attributes.empty? then %> + +
+

Attributes

+ + <% attributes.each do |attrib| %> +
+ + <% if attrib.rw =~ /w/i then %> + <% end %> +
+ <%= h attrib.name %>[<%= attrib.rw %>] +
+ +
+ <% if attrib.comment then %> + <%= attrib.description.strip %> + <% else %> +

(Not documented)

+ <% end %> +
<% end %> - <% else %> -
- <%= h method.name %><%= method.params %> - click to toggle source -
- <% end %> +
+ <% end %> -
- <% if method.comment %> - <%= method.description.strip %> + + <% klass.methods_by_type(section).each do |type, visibilities| + next if visibilities.empty? + visibilities.each do |visibility, methods| + next if methods.empty? %> +
+

<%= visibility.to_s.capitalize %> <%= type.capitalize %> Methods

+ + <% methods.each do |method| %> +
"> + + + <% if method.call_seq then %> + <% method.call_seq.strip.split("\n").each_with_index do |call_seq, i| %> +
+ <%= call_seq.strip.gsub(/->/, '→').gsub( /^\w+\./m, '') %> + <% if i == 0 then %> + click to toggle source + <% end %> +
+ <% end %> <% else %> -

(Not documented)

+
+ <%= h method.name %><%= method.params %> + click to toggle source +
<% end %> - <% if method.token_stream %> -
+
+ <% if method.comment then %> + <%= method.description.strip %> + <% else %> +

(Not documented)

+ <% end %> + + <% if method.token_stream then %> +
 <%= method.markup_code %>
 
+
+ <% end %>
- <% end %> -
- <% unless method.aliases.empty? %> -
- Also aliased as: <%= method.aliases.map do |aka| - if aka.parent then # HACK lib/rexml/encodings - %{#{h aka.name}} - else - h aka.name - end - end.join ", " %> -
- <% end %> + <% unless method.aliases.empty? then %> +
+ Also aliased as: <%= method.aliases.map do |aka| + if aka.parent then # HACK lib/rexml/encodings + %{#{h aka.name}} + else + h aka.name + end + end.join ", " %> +
+ <% end %> - <% if method.is_alias_for then %> - - <% end %> -
+ <% if method.is_alias_for then %> + + <% end %> +
- <% end %> -
- <% end - end %> + <% end %> +
+ <% end + end %> +
+ <% end %> -
+

[Validate]

diff --git a/lib/rdoc/generator/template/darkfish/rdoc.css b/lib/rdoc/generator/template/darkfish/rdoc.css index 59f568ae47..c5a93ff150 100644 --- a/lib/rdoc/generator/template/darkfish/rdoc.css +++ b/lib/rdoc/generator/template/darkfish/rdoc.css @@ -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 { -- cgit v1.2.3