hanna-nouveau 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.3
1
+ 0.2.4
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{hanna-nouveau}
8
- s.version = "0.2.3"
8
+ s.version = "0.2.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Erik Hollensbe", "James Tucker", "Mislav Marohnic"]
12
- s.date = %q{2011-05-12}
12
+ s.date = %q{2011-07-24}
13
13
  s.description = %q{}
14
14
  s.email = %q{erik@hollensbe.org}
15
15
  s.extra_rdoc_files = [
@@ -41,7 +41,7 @@ Gem::Specification.new do |s|
41
41
  s.homepage = %q{http://github.com/erikh/hanna-nouveau}
42
42
  s.licenses = ["MIT"]
43
43
  s.require_paths = ["lib"]
44
- s.rubygems_version = %q{1.7.2}
44
+ s.rubygems_version = %q{1.6.2}
45
45
  s.summary = %q{A rework of the Hanna generator for RDoc 2.5 and 3.x}
46
46
 
47
47
  if s.respond_to? :specification_version then
data/lib/hanna-nouveau.rb CHANGED
@@ -160,6 +160,19 @@ class RDoc::Generator::Hanna
160
160
  @classes.each do |klass|
161
161
  outfile = classfile(klass)
162
162
  stylesheet = Pathname.new(STYLE_OUT).relative_path_from(outfile.dirname)
163
+ sections = {}
164
+ klass.each_section do |section, constants, attributes|
165
+ method_types = []
166
+ alias_types = []
167
+ klass.methods_by_type(section).each do |type, visibilities|
168
+ visibilities.each do |visibility, methods|
169
+ aliases, methods = methods.partition{|x| x.is_alias_for}
170
+ method_types << ["#{visibility.to_s.capitalize} #{type.to_s.capitalize}", methods.sort] unless methods.empty?
171
+ alias_types << ["#{visibility.to_s.capitalize} #{type.to_s.capitalize}", aliases.sort] unless aliases.empty?
172
+ end
173
+ end
174
+ sections[section] = {:constants=>constants, :attributes=>attributes, :method_types=>method_types, :alias_types=>alias_types}
175
+ end
163
176
 
164
177
  values = {
165
178
  :file => klass.path,
@@ -169,20 +182,13 @@ class RDoc::Generator::Hanna
169
182
  :title => klass.full_name,
170
183
  :list_title => nil,
171
184
  :description => klass.description,
172
- :section => {
173
- # FIXME linkify
174
- :classlist => '<ol>' + klass.classes_and_modules.inject('') { |x,y| x << '<li>' + y.name + '</li>' } + '</ol>',
175
- :constants => klass.constants,
176
- :aliases => klass.method_list.select { |x| x.is_alias_for }.sort,
177
- :attributes => klass.attributes.sort,
178
- :method_list => klass.method_list.select { |x| !x.is_alias_for }.sort
179
- }
185
+ :sections => sections
180
186
  }
181
187
 
182
188
  result = with_layout(values) do
183
- class_page.to_html(binding, :values => values) do
184
- method_list_page.to_html(binding, :values => values) +
185
- sections_page.to_html(binding, :values => values)
189
+ h = {:values => values}
190
+ class_page.to_html(binding, h) do
191
+ method_list_page.to_html(binding, h) + sections_page.to_html(binding, h)
186
192
  end
187
193
  end
188
194
 
@@ -1,4 +1,6 @@
1
- - methods = values[:entry].method_list + values[:entry].attributes
1
+ - entry = values[:entry]
2
+ - sections = values[:sections].keys if values.has_key?(:sections)
3
+ - methods = entry.method_list + entry.attributes
2
4
  - unless methods.empty?
3
5
  #method-list
4
6
  %h2 Methods
@@ -26,27 +28,29 @@
26
28
  - else
27
29
  %li= method.name
28
30
 
29
- - if values[:entry].requires or values[:entry].sections or values[:entry].includes
31
+ - if entry.requires or sections or entry.includes
30
32
  #context
31
- - unless values[:entry].requires.empty?
33
+ - unless entry.requires.empty?
32
34
  #requires
33
35
  %h2 Required files
34
36
  %ol
35
- - values[:entry].requires.each do |req|
37
+ - entry.requires.each do |req|
36
38
  %li= req.name
37
39
 
38
- -# FIXME reenable
39
- -#- if values[:entry].sections
40
- -##contents
41
- -#%h2 Contents
42
- -#%ol
43
- -#- values[:entry].sections.each do |item|
44
- -#%li= link_to values[:secname], values[:href]
40
+ - if sections && (sections.length > 1 || sections.first.title.to_s != '')
41
+ #contents
42
+ %h2 Contents
43
+ %ol
44
+ - sections.sort_by{|s| s.title.to_s}.each do |section|
45
+ %li= link_to section.title, "##{section.aref}"
45
46
 
46
- - unless values[:entry].includes.empty?
47
+ - unless entry.includes.empty?
47
48
  #includes
48
49
  %h2 Included modules
49
50
  %ol
50
- - values[:entry].includes.each do |inc|
51
- %li= inc.name
51
+ - entry.includes.each do |inc|
52
+ - if (mod = inc.module).is_a?(String)
53
+ %li= inc.name
54
+ - else
55
+ %li= link_to inc.name, entry.aref_to(mod.path)
52
56
 
@@ -1,86 +1,88 @@
1
- - section = values[:section]
2
- #section
3
- - if section[:sectitle]
4
- %h2= link_to section[:sectitle], section[:secsequence]
5
- - if section[:seccomment]
6
- .section-comment= section[:seccomment]
7
-
8
- - if section[:classlist] =~ /<li>/
9
- #class-list
10
- %h2 Classes and Modules
11
- = section[:classlist]
12
-
13
- - unless section[:constants].empty?
14
- #constants-list
15
- %h2 Constants
16
- .name-list
17
- %table{ :summary => "Constants" }
18
- - section[:constants].each do |const|
19
- %tr.top-aligned-row.context-row
20
- %td.context-item-name= const.name
21
- %td =
22
- %td.context-item-value= const.value
23
- - if const.description then
24
- %td &nbsp;
25
- %td.context-item-desc= const.description
26
-
27
- - unless section[:aliases].empty?
28
- #aliases-list
29
- %h2 External Aliases
30
- .name-list
31
- %table{ :summary => "Aliases" }
32
- - section[:aliases].each do |alia|
33
- %tr.top-aligned-row.context-row
34
- %td.context-item-name= alia.name
35
- %td -&gt;
36
- %td.context-item-value= link_to alia.is_alias_for.name, "##{alia.is_alias_for.aref}"
37
- - unless alia.description.empty?
1
+ - unless values[:entry].classes_and_modules.empty?
2
+ #class-list
3
+ %h2 Classes and Modules
4
+ %ol
5
+ - (values[:entry].modules.sort + values[:entry].classes.sort).each do |mod|
6
+ %li= link_to mod.full_name, values[:entry].aref_to(mod.path)
7
+
8
+ - values[:sections].sort_by{|s, h| s.title.to_s}.each do |section, h|
9
+ - constants, attributes, alias_types, method_types = h.values_at(:constants, :attributes, :alias_types, :method_types)
10
+ #section
11
+ - if section.title.to_s != ''
12
+ %h2
13
+ %a{ :name =>section.aref }= section.title
14
+ - if section.comment
15
+ .section-comment= section.description
16
+
17
+ - unless constants.empty?
18
+ #constants-list
19
+ %h2 Constants
20
+ .name-list
21
+ %table{ :summary => "Constants" }
22
+ - constants.each do |const|
38
23
  %tr.top-aligned-row.context-row
39
- %td &nbsp;
40
- %td.context-item-desc{ :colspan => "2" }
41
- = alia.description
42
-
43
- - unless section[:attributes].empty?
44
- #attribute-list
45
- %h2.section-bar Attributes
46
- .name-list
47
- %table
48
- - section[:attributes].each do |attrib|
49
- %tr.top-aligned-row.context-row
50
- %td.context-item-name
51
- %a{:name => "method-#{attrib.html_name}"}=attrib.name
52
- %td.context-item-value= attrib.rw ? "[#{attrib.rw}]" : '&nbsp;'
53
- %td.context-item-desc~ sanitize_code_blocks(attrib.description)
54
-
55
- - unless section[:method_list].empty?
56
- #methods
57
- - section[:method_list].group_by { |x| [x.visibility, x.type].map(&:to_s).map(&:capitalize).join(" ") }.each do |type, list|
58
- - unless list.empty?
59
- %h2== #{type} methods
60
-
61
- - list.each do |method|
62
- .method{ :id => "method-#{method.aref}", :class => "#{type.gsub(/\s+/, '-')}".downcase }
63
- %a{ :name => method.aref }
64
- .synopsis
65
- - method_html = capture_haml do
66
- - if method.call_seq
67
- %span.name
68
- - method.call_seq.split(/\r?\n/).each do |seq|
69
- %div=seq
70
- - else
71
- %span.name= method.name
72
- %span.arguments= method.params
73
- -#- if method[:codeurl]
74
- -#%a.method-signature{ :href => method[:codeurl], :onclick => "popupCode(this.href); return false", :target => "Code" }
75
- -#= method_html
76
- -#- else
77
- = method_html
78
- - if method.description
79
- .description
80
- ~ sanitize_code_blocks method.description
81
- - if method.markup_code
82
- .source
83
- - name = "#{method.aref}-source"
84
- %a.source-toggle{ :href => "#", :onclick => "toggleCode('#{name}'); return false" }
85
- [show source]
86
- ~ "<pre id='#{name}'>#{method.markup_code}</pre>"
24
+ %td.context-item-name= const.name
25
+ %td =
26
+ %td.context-item-value= const.value
27
+ - if const.description then
28
+ %td &nbsp;
29
+ %td.context-item-desc= const.description
30
+
31
+ - unless alias_types.empty?
32
+ - alias_types.each do |type, aliases|
33
+ #aliases-list
34
+ %h2 #{type} Aliases
35
+ .name-list
36
+ %table{ :summary => "#{type} Aliases" }
37
+ - aliases.each do |alia|
38
+ %tr.top-aligned-row.context-row
39
+ %td.context-item-name= alia.name
40
+ %td -&gt;
41
+ %td.context-item-value= link_to alia.is_alias_for.name, "##{alia.is_alias_for.aref}"
42
+ - unless alia.description.empty?
43
+ %td.context-item-desc= alia.description
44
+
45
+ - unless attributes.empty?
46
+ #attribute-list
47
+ %h2.section-bar Attributes
48
+ .name-list
49
+ %table
50
+ - attributes.each do |attrib|
51
+ %tr.top-aligned-row.context-row
52
+ %td.context-item-name
53
+ %a{:name => attrib.aref}=attrib.name
54
+ %td.context-item-value= attrib.rw ? "[#{attrib.rw}]" : '&nbsp;'
55
+ %td.context-item-desc~ sanitize_code_blocks(attrib.description)
56
+
57
+ - unless method_types.empty?
58
+ #methods
59
+ - method_types.each do |type, list|
60
+ - unless list.empty?
61
+ %h2== #{type} methods
62
+
63
+ - list.each do |method|
64
+ .method{ :id => "method-#{method.aref}", :class => "#{type.gsub(/\s+/, '-')}".downcase }
65
+ %a{ :name => method.aref }
66
+ .synopsis
67
+ - method_html = capture_haml do
68
+ - if method.call_seq
69
+ %span.name
70
+ - method.call_seq.split(/\r?\n/).each do |seq|
71
+ %div=seq
72
+ - else
73
+ %span.name= method.name
74
+ %span.arguments= method.params
75
+ -#- if method[:codeurl]
76
+ -#%a.method-signature{ :href => method[:codeurl], :onclick => "popupCode(this.href); return false", :target => "Code" }
77
+ -#= method_html
78
+ -#- else
79
+ = method_html
80
+ - if method.description
81
+ .description
82
+ ~ sanitize_code_blocks method.description
83
+ - if method.markup_code
84
+ .source
85
+ - name = "#{method.aref}-source"
86
+ %a.source-toggle{ :href => "#", :onclick => "toggleCode('#{name}'); return false" }
87
+ [show source]
88
+ ~ "<pre id='#{name}'>#{method.markup_code}</pre>"
metadata CHANGED
@@ -1,117 +1,115 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: hanna-nouveau
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.4
4
5
  prerelease:
5
- version: 0.2.3
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Erik Hollensbe
9
9
  - James Tucker
10
10
  - Mislav Marohnic
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
-
15
- date: 2011-05-12 00:00:00 Z
16
- dependencies:
17
- - !ruby/object:Gem::Dependency
14
+ date: 2011-07-24 00:00:00.000000000 -07:00
15
+ default_executable:
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
18
18
  name: bundler
19
- requirement: &id001 !ruby/object:Gem::Requirement
19
+ requirement: &2169109780 !ruby/object:Gem::Requirement
20
20
  none: false
21
- requirements:
21
+ requirements:
22
22
  - - ~>
23
- - !ruby/object:Gem::Version
23
+ - !ruby/object:Gem::Version
24
24
  version: 1.0.0
25
25
  type: :development
26
26
  prerelease: false
27
- version_requirements: *id001
28
- - !ruby/object:Gem::Dependency
27
+ version_requirements: *2169109780
28
+ - !ruby/object:Gem::Dependency
29
29
  name: jeweler
30
- requirement: &id002 !ruby/object:Gem::Requirement
30
+ requirement: &2169108780 !ruby/object:Gem::Requirement
31
31
  none: false
32
- requirements:
32
+ requirements:
33
33
  - - ~>
34
- - !ruby/object:Gem::Version
34
+ - !ruby/object:Gem::Version
35
35
  version: 1.5.1
36
36
  type: :development
37
37
  prerelease: false
38
- version_requirements: *id002
39
- - !ruby/object:Gem::Dependency
38
+ version_requirements: *2169108780
39
+ - !ruby/object:Gem::Dependency
40
40
  name: rcov
41
- requirement: &id003 !ruby/object:Gem::Requirement
41
+ requirement: &2169107780 !ruby/object:Gem::Requirement
42
42
  none: false
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: "0"
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
47
  type: :development
48
48
  prerelease: false
49
- version_requirements: *id003
50
- - !ruby/object:Gem::Dependency
49
+ version_requirements: *2169107780
50
+ - !ruby/object:Gem::Dependency
51
51
  name: rdoc
52
- requirement: &id004 !ruby/object:Gem::Requirement
52
+ requirement: &2169106560 !ruby/object:Gem::Requirement
53
53
  none: false
54
- requirements:
54
+ requirements:
55
55
  - - ~>
56
- - !ruby/object:Gem::Version
57
- version: "3.1"
56
+ - !ruby/object:Gem::Version
57
+ version: '3.1'
58
58
  type: :development
59
59
  prerelease: false
60
- version_requirements: *id004
61
- - !ruby/object:Gem::Dependency
60
+ version_requirements: *2169106560
61
+ - !ruby/object:Gem::Dependency
62
62
  name: haml
63
- requirement: &id005 !ruby/object:Gem::Requirement
63
+ requirement: &2169104440 !ruby/object:Gem::Requirement
64
64
  none: false
65
- requirements:
66
- - - "="
67
- - !ruby/object:Gem::Version
65
+ requirements:
66
+ - - =
67
+ - !ruby/object:Gem::Version
68
68
  version: 3.0.25
69
69
  type: :runtime
70
70
  prerelease: false
71
- version_requirements: *id005
72
- - !ruby/object:Gem::Dependency
71
+ version_requirements: *2169104440
72
+ - !ruby/object:Gem::Dependency
73
73
  name: rdoc
74
- requirement: &id006 !ruby/object:Gem::Requirement
74
+ requirement: &2169103100 !ruby/object:Gem::Requirement
75
75
  none: false
76
- requirements:
77
- - - ">="
78
- - !ruby/object:Gem::Version
79
- version: "0"
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
80
  type: :runtime
81
81
  prerelease: false
82
- version_requirements: *id006
83
- - !ruby/object:Gem::Dependency
82
+ version_requirements: *2169103100
83
+ - !ruby/object:Gem::Dependency
84
84
  name: jeweler
85
- requirement: &id007 !ruby/object:Gem::Requirement
85
+ requirement: &2169101720 !ruby/object:Gem::Requirement
86
86
  none: false
87
- requirements:
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- version: "0"
87
+ requirements:
88
+ - - ! '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
91
  type: :development
92
92
  prerelease: false
93
- version_requirements: *id007
94
- - !ruby/object:Gem::Dependency
93
+ version_requirements: *2169101720
94
+ - !ruby/object:Gem::Dependency
95
95
  name: rake
96
- requirement: &id008 !ruby/object:Gem::Requirement
96
+ requirement: &2169097040 !ruby/object:Gem::Requirement
97
97
  none: false
98
- requirements:
99
- - - ">="
100
- - !ruby/object:Gem::Version
101
- version: "0"
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
102
  type: :development
103
103
  prerelease: false
104
- version_requirements: *id008
105
- description: ""
104
+ version_requirements: *2169097040
105
+ description: ''
106
106
  email: erik@hollensbe.org
107
107
  executables: []
108
-
109
108
  extensions: []
110
-
111
- extra_rdoc_files:
109
+ extra_rdoc_files:
112
110
  - LICENSE
113
111
  - README.rdoc
114
- files:
112
+ files:
115
113
  - Gemfile
116
114
  - Gemfile.lock
117
115
  - LICENSE
@@ -132,35 +130,33 @@ files:
132
130
  - lib/hanna-nouveau/template_files/sections.haml
133
131
  - lib/hanna-nouveau/template_files/styles.sass
134
132
  - lib/rdoc/discover.rb
133
+ has_rdoc: true
135
134
  homepage: http://github.com/erikh/hanna-nouveau
136
- licenses:
135
+ licenses:
137
136
  - MIT
138
137
  post_install_message:
139
138
  rdoc_options: []
140
-
141
- require_paths:
139
+ require_paths:
142
140
  - lib
143
- required_ruby_version: !ruby/object:Gem::Requirement
141
+ required_ruby_version: !ruby/object:Gem::Requirement
144
142
  none: false
145
- requirements:
146
- - - ">="
147
- - !ruby/object:Gem::Version
148
- hash: -2056902760337974259
149
- segments:
143
+ requirements:
144
+ - - ! '>='
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ segments:
150
148
  - 0
151
- version: "0"
152
- required_rubygems_version: !ruby/object:Gem::Requirement
149
+ hash: -711451441932497723
150
+ required_rubygems_version: !ruby/object:Gem::Requirement
153
151
  none: false
154
- requirements:
155
- - - ">="
156
- - !ruby/object:Gem::Version
157
- version: "0"
152
+ requirements:
153
+ - - ! '>='
154
+ - !ruby/object:Gem::Version
155
+ version: '0'
158
156
  requirements: []
159
-
160
157
  rubyforge_project:
161
- rubygems_version: 1.7.2
158
+ rubygems_version: 1.6.2
162
159
  signing_key:
163
160
  specification_version: 3
164
161
  summary: A rework of the Hanna generator for RDoc 2.5 and 3.x
165
162
  test_files: []
166
-