mislav-hanna 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest CHANGED
@@ -7,6 +7,7 @@ lib/hanna/template_files/class_index.haml
7
7
  lib/hanna/template_files/file_index.haml
8
8
  lib/hanna/template_files/index.haml
9
9
  lib/hanna/template_files/layout.haml
10
+ lib/hanna/template_files/method_index.haml
10
11
  lib/hanna/template_files/method_list.haml
11
12
  lib/hanna/template_files/page.haml
12
13
  lib/hanna/template_files/sections.haml
data/README.markdown CHANGED
@@ -19,9 +19,9 @@ The template was created by [Mislav][] and since then has seen contributions fro
19
19
  The most basic usage is to specify Hanna as a template when invoking RDoc on the
20
20
  command-line:
21
21
 
22
- rdoc -o doc --inline-sorce -T hanna lib/*.rb
22
+ rdoc -o doc --inline-source -T hanna lib/*.rb
23
23
 
24
- Hanna requires the `--inline-sorce` (or `-S`) flag.
24
+ Hanna requires the `--inline-source` (or `-S`) flag.
25
25
 
26
26
  An alternative is to set the `RDOCOPT` environment variable:
27
27
 
data/Rakefile CHANGED
@@ -2,18 +2,18 @@ require 'echoe'
2
2
  require 'lib/hanna/rdoc_version'
3
3
 
4
4
  Echoe.new('hanna') do |p|
5
- p.version = '0.1.5'
5
+ p.version = '0.1.6'
6
6
 
7
- p.summary = "An RDoc template that rocks"
8
- p.description = "Hanna is an RDoc template that scales. It's implemented in Haml, making its source clean and maintainable. It's built with simplicity, beauty and ease of browsing in mind."
7
+ p.summary = "An RDoc template that scales"
8
+ p.description = "Hanna is an RDoc implemented in Haml, making its source clean and maintainable. It's built with simplicity, beauty and ease of browsing in mind."
9
9
 
10
10
  p.author = 'Mislav Marohnić'
11
11
  p.email = 'mislav.marohnic@gmail.com'
12
12
  p.url = 'http://github.com/mislav/hanna'
13
13
 
14
- p.executable_pattern = ['bin/hanna']
14
+ p.project = nil
15
15
  p.has_rdoc = false
16
- p.runtime_dependencies = []
16
+
17
17
  p.runtime_dependencies << ['rdoc', Hanna::RDOC_VERSION_REQUIREMENT]
18
18
  p.runtime_dependencies << ['haml', '~> 2.0.4']
19
19
  p.runtime_dependencies << ['rake', '~> 0.8.2']
data/hanna.gemspec CHANGED
@@ -2,23 +2,20 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{hanna}
5
- s.version = "0.1.5"
5
+ s.version = "0.1.6"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Mislav Marohni\304\207"]
9
- s.date = %q{2008-11-24}
9
+ s.date = %q{2008-12-03}
10
10
  s.default_executable = %q{hanna}
11
- s.description = %q{Hanna is an RDoc template that scales. It's implemented in Haml, making its source clean and maintainable. It's built with simplicity, beauty and ease of browsing in mind.}
11
+ s.description = %q{Hanna is an RDoc implemented in Haml, making its source clean and maintainable. It's built with simplicity, beauty and ease of browsing in mind.}
12
12
  s.email = %q{mislav.marohnic@gmail.com}
13
13
  s.executables = ["hanna"]
14
- s.extra_rdoc_files = ["bin/hanna", "lib/hanna/hanna.rb", "lib/hanna/rdoc_version.rb", "lib/hanna/rdoctask.rb", "lib/hanna/template_files/class_index.haml", "lib/hanna/template_files/file_index.haml", "lib/hanna/template_files/index.haml", "lib/hanna/template_files/layout.haml", "lib/hanna/template_files/method_list.haml", "lib/hanna/template_files/page.haml", "lib/hanna/template_files/sections.haml", "lib/hanna/template_files/styles.sass", "lib/hanna/template_files/prototype-1.6.0.3.js", "lib/hanna/template_files/method_search.js", "lib/hanna/template_helpers.rb", "lib/hanna/template_page_patch.rb", "lib/hanna.rb", "README.markdown"]
15
- s.files = ["bin/hanna", "hanna.gemspec", "lib/hanna/hanna.rb", "lib/hanna/rdoc_version.rb", "lib/hanna/rdoctask.rb", "lib/hanna/template_files/class_index.haml", "lib/hanna/template_files/file_index.haml", "lib/hanna/template_files/index.haml", "lib/hanna/template_files/layout.haml", "lib/hanna/template_files/method_list.haml", "lib/hanna/template_files/page.haml", "lib/hanna/template_files/sections.haml", "lib/hanna/template_files/styles.sass", "lib/hanna/template_files/prototype-1.6.0.3.js", "lib/hanna/template_files/method_search.js", "lib/hanna/template_helpers.rb", "lib/hanna/template_page_patch.rb", "lib/hanna.rb", "Manifest", "Rakefile", "README.markdown"]
14
+ s.files = ["bin/hanna", "hanna.gemspec", "lib/hanna/hanna.rb", "lib/hanna/rdoc_version.rb", "lib/hanna/rdoctask.rb", "lib/hanna/template_files/class_index.haml", "lib/hanna/template_files/file_index.haml", "lib/hanna/template_files/index.haml", "lib/hanna/template_files/layout.haml", "lib/hanna/template_files/method_index.haml", "lib/hanna/template_files/method_list.haml", "lib/hanna/template_files/page.haml", "lib/hanna/template_files/sections.haml", "lib/hanna/template_files/styles.sass", "lib/hanna/template_files/prototype-1.6.0.3.js", "lib/hanna/template_files/method_search.js", "lib/hanna/template_helpers.rb", "lib/hanna/template_page_patch.rb", "lib/hanna.rb", "Manifest", "Rakefile", "README.markdown"]
16
15
  s.homepage = %q{http://github.com/mislav/hanna}
17
- s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Hanna", "--main", "README.markdown"]
18
16
  s.require_paths = ["lib"]
19
- s.rubyforge_project = %q{hanna}
20
17
  s.rubygems_version = %q{1.3.1}
21
- s.summary = %q{An RDoc template that rocks}
18
+ s.summary = %q{An RDoc template that scales}
22
19
 
23
20
  if s.respond_to? :specification_version then
24
21
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
data/lib/hanna/hanna.rb CHANGED
@@ -42,7 +42,7 @@ module RDoc::Generator::HTML::HANNA
42
42
 
43
43
  FILE_INDEX = read('file_index.haml')
44
44
  CLASS_INDEX = read('class_index.haml')
45
- METHOD_INDEX = FILE_INDEX
45
+ METHOD_INDEX = read('method_index.haml')
46
46
 
47
47
  INDEX = read('index.haml')
48
48
  end
@@ -1,24 +1,11 @@
1
1
  %h1= values["list_title"]
2
- - type = values["list_title"].downcase
3
2
  - any_hidden = false
4
3
 
5
- - if type == 'methods'
6
- %script{:type => 'text/javascript'}
7
- = read("prototype-1.6.0.3.js")
8
- = build_javascript_search_index(values["entries"])
9
- = read("method_search.js")
10
- %form{:onsubmit => 'return performSearch()'}
11
- %input{:type => 'text', :id => 'search', :class => 'untouched', :value => 'Enter search terms...'}
12
- %ol#search-results{ :class => type, :style => 'display: none' }
13
-
14
- %ol#index-entries{ :class => type }
4
+ %ol#index-entries{ :class => 'files' }
15
5
  - for entry in values["entries"]
16
- - hide = type == 'files' && entry['name'] =~ /\.rb$/
6
+ - hide = entry['name'] =~ /\.rb$/
17
7
  - any_hidden = true if hide
18
- - if type == 'methods'
19
- %li{ :class => hide ? 'other' : nil }= link_to_method entry['name'], entry['href']
20
- - else
21
- %li{ :class => hide ? 'other' : nil }= link_to entry['name'], entry['href']
8
+ %li{ :class => hide ? 'other' : nil }= link_to entry['name'], entry['href']
22
9
 
23
10
  - if any_hidden
24
11
  %li
@@ -3,7 +3,7 @@
3
3
  %head
4
4
  %title= values["title"]
5
5
  %meta{ :content => "text/html; charset=#{values['charset']}", "http-equiv" => "Content-Type" }
6
- %frameset{ :cols => "20%, *" }
6
+ %frameset{ :cols => "20%, *", :border => "1", :frameborder => "1", :bordercolor => "gray" }
7
7
  %frameset{ :rows => "15%, 35%, 50%" }
8
8
  %frame{ :name => "Files", :title => "Files", :src => "fr_file_index.html" }
9
9
  %frame{ :name => "Classes", :src => "fr_class_index.html" }
@@ -31,6 +31,4 @@
31
31
  = yield
32
32
  #footer-push
33
33
  #footer
34
- = link_to '<strong>Hanna</strong> RDoc template', 'http://github.com/mislav/hanna'
35
- hand-crafted by
36
- %strong= link_to 'Mislav', 'http://mislav.uniqpath.com/'
34
+ = link_to '<strong>Hanna</strong> RDoc template', 'http://github.com/mislav/hanna/tree/master'
@@ -0,0 +1,13 @@
1
+ %h1= values["list_title"]
2
+
3
+ %script{:type => 'text/javascript'}
4
+ = read("prototype-1.6.0.3.js")
5
+ = build_javascript_search_index(values["entries"])
6
+ = read("method_search.js")
7
+ %form{:onsubmit => 'return performSearch()'}
8
+ %input{:type => 'text', :id => 'search', :class => 'untouched', :value => 'Enter search terms...'}
9
+ %ol#search-results{ :class => 'methods', :style => 'display: none' }
10
+
11
+ %ol#index-entries{ :class => 'methods' }
12
+ - for entry in values["entries"]
13
+ %li= link_to_method entry['name'], entry['href']
@@ -45,6 +45,6 @@
45
45
 
46
46
  #text
47
47
  - if values["description"]
48
- #description~ values["description"]
48
+ #description~ sanitize_code_blocks values["description"]
49
49
 
50
50
  = yield
@@ -4,72 +4,58 @@
4
4
  %h2= link_to section["sectitle"], section["secsequence"]
5
5
  - if section["seccomment"]
6
6
  .section-comment= section["seccomment"]
7
+
7
8
  - if section["classlist"]
8
9
  #class-list
9
- %h3 Classes and Modules
10
+ %h2 Classes and Modules
10
11
  = section["classlist"]
11
12
 
12
13
  - if section["constants"]
13
14
  #constants-list
14
- %h3.section-bar Constants
15
+ %h2 Constants
15
16
  .name-list
16
17
  %table{ :summary => "Constants" }
17
18
  - for const in section["constants"]
18
19
  %tr.top-aligned-row.context-row
19
- %td.context-item-name
20
- = const["name"]
21
- %td
22
- \=
23
- %td.context-item-value
24
- = const["value"]
20
+ %td.context-item-name= const["name"]
21
+ %td =
22
+ %td.context-item-value= const["value"]
25
23
  - if const["desc"] then
26
- %td
27
- &nbsp;
28
- %td.context-item-desc
29
- = const["desc"]
24
+ %td &nbsp;
25
+ %td.context-item-desc= const["desc"]
30
26
 
31
27
  - if section["aliases"]
32
28
  #aliases-list
33
- %h3.section-bar External Aliases
29
+ %h2 External Aliases
34
30
  .name-list
35
- %table{ :summary => "aliases" }
31
+ %table{ :summary => "External aliases" }
36
32
  - for alia in section["aliases"]
37
33
  %tr.top-aligned-row.context-row
38
- %td.context-item-name
39
- = alia["old_name"]
40
- %td
41
- \-&gt;
42
- %td.context-item-value
43
- = alia["new_name"]
34
+ %td.context-item-name= alia["old_name"]
35
+ %td -&gt;
36
+ %td.context-item-value= alia["new_name"]
44
37
  - if alia["desc"] then
45
38
  %tr.top-aligned-row.context-row
46
- %td
47
- &nbsp;
39
+ %td &nbsp;
48
40
  %td.context-item-desc{ :colspan => "2" }
49
41
  = alia["desc"]
50
42
 
51
43
  - if section["attributes"]
52
44
  #attribute-list
53
- %h3.section-bar Attributes
45
+ %h2.section-bar Attributes
54
46
  .name-list
55
47
  %table
56
48
  - for attr in section["attributes"]
57
49
  %tr.top-aligned-row.context-row
58
- %td.context-item-name
59
- = attr["name"]
60
- - if attr["rw"] then
61
- %td.context-item-value
62
- = "[#{attr['rw']}]"
63
- - else
64
- %td.context-item-value &nbsp;
65
- %td.context-item-desc
66
- = attr["a_desc"]
50
+ %td.context-item-name= attr["name"]
51
+ %td.context-item-value= attr["rw"] ? "[#{attr['rw']}]" : '&nbsp;'
52
+ %td.context-item-desc= attr["a_desc"]
67
53
 
68
54
  - if section["method_list"]
69
55
  #methods
70
56
  - for list in section["method_list"]
71
57
  - if list["methods"] then
72
- %h3== #{list["type"]} #{list["category"].downcase} methods
58
+ %h2== #{list["type"]} #{list["category"].downcase} methods
73
59
 
74
60
  - for method in list["methods"]
75
61
  .method{ :id => "method-#{method['aref']}", :class => "#{list['type']}-#{list['category']}".downcase }
@@ -88,7 +74,7 @@
88
74
  = method_html
89
75
  - if method["m_desc"]
90
76
  .description
91
- ~ method["m_desc"]
77
+ ~ sanitize_code_blocks method["m_desc"]
92
78
  - if method["sourcecode"]
93
79
  .source
94
80
  - name = "#{method['aref']}-source"
@@ -1,4 +1,5 @@
1
1
  !title_font = Georgia, serif
2
+ !body_font = "Lucida Grande", Verdana, Arial, Helvetica, "sans-serif"
2
3
  !code_font_family = Monaco, "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace
3
4
  !code_font_size = 14px
4
5
  !code_font = !code_font_size !code_font_family
@@ -11,7 +12,7 @@
11
12
  html, body
12
13
  :height 100%
13
14
  body
14
- :font-family Verdana, Arial, Helvetica, sans-serif
15
+ :font-family = !body_font
15
16
  :font-size 90%
16
17
  :margin 0
17
18
  :padding 0
@@ -133,6 +134,8 @@ table
133
134
  :padding .4em .5em
134
135
  li
135
136
  :white-space nowrap
137
+ #index-entries li a
138
+ :padding 1px 2px
136
139
  #index-entries.classes
137
140
  :font-size 1.1em
138
141
  ol
@@ -151,6 +154,8 @@ table
151
154
  :margin-right 0.25em
152
155
  .module_name
153
156
  :color #666666
157
+ &:hover .module_name
158
+ :color #ddd
154
159
 
155
160
  div.header
156
161
  :font-size 80%
@@ -188,7 +193,7 @@ div.header
188
193
  :color black
189
194
  :background #eee
190
195
  :border 1px solid silver
191
- :padding 0 .5em .8em .5em
196
+ :padding .5em .8em
192
197
  :overflow auto
193
198
  p, li, dl
194
199
  code, tt
@@ -267,25 +272,14 @@ div.header
267
272
  :border-top 1px dashed silver
268
273
  :margin-top 1em
269
274
  :margin-bottom 1em
270
- h2
271
- :color #333
272
- :font = "bold small-caps 1.3em" !title_font
273
- :margin .5em 0 .1em 0
274
-
275
- #section
276
- h3
277
- :margin-top 1em
278
275
 
279
- #methods
280
- h3
276
+ #context, #section
277
+ h2
281
278
  :font = "small-caps 1.2em" !title_font
282
279
  :color #444
283
280
  :margin 1em 0 .2em 0
284
- h4
285
- :font = "1.1em" !title_font
286
- :color = !dark_blue_text
287
- :margin 1em 0 .2em 0
288
-
281
+
282
+ #methods
289
283
  .method
290
284
  :border 1px solid silver
291
285
  :margin-top .5em
@@ -104,5 +104,16 @@ module Hanna
104
104
  out
105
105
  end
106
106
  end
107
+
108
+ # primarily for removing leading whitespace in <pre> tags
109
+ def sanitize_code_blocks(text)
110
+ text.gsub(/<pre>(.+?)<\/pre>/m) do
111
+ code = $1.sub(/^\s*\n/, '')
112
+ indent = code.gsub(/\n[ \t]*\n/, "\n").scan(/^ */).map{ |i| i.size }.min
113
+ code.gsub!(/^#{' ' * indent}/, '') if indent > 0
114
+
115
+ "<pre>#{code}</pre>"
116
+ end
117
+ end
107
118
  end
108
119
  end
@@ -11,7 +11,7 @@ RDoc::TemplatePage.class_eval do
11
11
  case template
12
12
  when Haml::Engine
13
13
  silence_warnings do
14
- template.to_html(get_binding, :values => values) { previous }
14
+ template.to_html(binding, :values => values) { previous }
15
15
  end
16
16
  when Sass::Engine
17
17
  silence_warnings { template.to_css }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mislav-hanna
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Mislav Marohni\xC4\x87"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-24 00:00:00 -08:00
12
+ date: 2008-12-03 00:00:00 -08:00
13
13
  default_executable: hanna
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -48,31 +48,14 @@ dependencies:
48
48
  - !ruby/object:Gem::Version
49
49
  version: "0"
50
50
  version:
51
- description: Hanna is an RDoc template that scales. It's implemented in Haml, making its source clean and maintainable. It's built with simplicity, beauty and ease of browsing in mind.
51
+ description: Hanna is an RDoc implemented in Haml, making its source clean and maintainable. It's built with simplicity, beauty and ease of browsing in mind.
52
52
  email: mislav.marohnic@gmail.com
53
53
  executables:
54
54
  - hanna
55
55
  extensions: []
56
56
 
57
- extra_rdoc_files:
58
- - bin/hanna
59
- - lib/hanna/hanna.rb
60
- - lib/hanna/rdoc_version.rb
61
- - lib/hanna/rdoctask.rb
62
- - lib/hanna/template_files/class_index.haml
63
- - lib/hanna/template_files/file_index.haml
64
- - lib/hanna/template_files/index.haml
65
- - lib/hanna/template_files/layout.haml
66
- - lib/hanna/template_files/method_list.haml
67
- - lib/hanna/template_files/page.haml
68
- - lib/hanna/template_files/sections.haml
69
- - lib/hanna/template_files/styles.sass
70
- - lib/hanna/template_files/prototype-1.6.0.3.js
71
- - lib/hanna/template_files/method_search.js
72
- - lib/hanna/template_helpers.rb
73
- - lib/hanna/template_page_patch.rb
74
- - lib/hanna.rb
75
- - README.markdown
57
+ extra_rdoc_files: []
58
+
76
59
  files:
77
60
  - bin/hanna
78
61
  - hanna.gemspec
@@ -83,6 +66,7 @@ files:
83
66
  - lib/hanna/template_files/file_index.haml
84
67
  - lib/hanna/template_files/index.haml
85
68
  - lib/hanna/template_files/layout.haml
69
+ - lib/hanna/template_files/method_index.haml
86
70
  - lib/hanna/template_files/method_list.haml
87
71
  - lib/hanna/template_files/page.haml
88
72
  - lib/hanna/template_files/sections.haml
@@ -98,13 +82,8 @@ files:
98
82
  has_rdoc: false
99
83
  homepage: http://github.com/mislav/hanna
100
84
  post_install_message:
101
- rdoc_options:
102
- - --line-numbers
103
- - --inline-source
104
- - --title
105
- - Hanna
106
- - --main
107
- - README.markdown
85
+ rdoc_options: []
86
+
108
87
  require_paths:
109
88
  - lib
110
89
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -121,10 +100,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
100
  version:
122
101
  requirements: []
123
102
 
124
- rubyforge_project: hanna
103
+ rubyforge_project:
125
104
  rubygems_version: 1.2.0
126
105
  signing_key:
127
106
  specification_version: 2
128
- summary: An RDoc template that rocks
107
+ summary: An RDoc template that scales
129
108
  test_files: []
130
109