erector 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,7 +17,7 @@ module ActionView #:nodoc:
17
17
  require_dependency File.expand_path(template.filename)
18
18
 
19
19
  widget_class_parts = relative_path_parts.inject(['Views']) do |class_parts, node|
20
- class_parts << node.gsub(/^_/, "").gsub(/(\.html)?\.rb$/, '').classify
20
+ class_parts << node.gsub(/^_/, "").gsub(/(\.html)?\.rb$/, '').camelize
21
21
  class_parts
22
22
  end
23
23
  widget_class_name = widget_class_parts.join("::")
@@ -17,7 +17,7 @@ module ActionView #:nodoc:
17
17
  require_dependency File.expand_path(template.filename)
18
18
 
19
19
  widget_class_parts = relative_path_parts.inject(['Views']) do |class_parts, node|
20
- class_parts << node.gsub(/^_/, "").gsub(/(\.html)?\.rb$/, '').classify
20
+ class_parts << node.gsub(/^_/, "").gsub(/(\.html)?\.rb$/, '').camelize
21
21
  class_parts
22
22
  end
23
23
  widget_class_name = widget_class_parts.join("::")
@@ -150,7 +150,7 @@ grammar Rhtml
150
150
  end
151
151
 
152
152
  rule space
153
- ' '*
153
+ [ \n\t]*
154
154
  end
155
155
 
156
156
  end
@@ -1,8 +1,8 @@
1
- ##
1
+ ##
2
2
  # Erector view framework
3
3
  module Erector
4
4
  if !Erector.const_defined?(:VERSION)
5
- VERSION = "0.5.0"
5
+ VERSION = "0.5.1"
6
6
  end
7
7
  end
8
8
 
@@ -26,20 +26,27 @@ module Erector
26
26
 
27
27
  # tags which are always self-closing
28
28
  def empty_tags
29
- ['area', 'base', 'br', 'hr', 'img', 'input', 'link', 'meta']
29
+ ['area', 'base', 'br', 'col', 'frame',
30
+ 'hr', 'img', 'input', 'link', 'meta']
30
31
  end
31
32
 
32
33
  # tags which can contain other stuff
33
34
  def full_tags
34
35
  [
35
- 'a', 'abbr', 'acronym', 'address', 'b', 'bdo', 'big', 'blockquote', 'body',
36
- 'button', 'caption', 'center', 'cite', 'code', 'col', 'colgroup',
37
- 'dd', 'del', 'div', 'dl', 'dt', 'em',
38
- 'fieldset', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'html', 'i',
36
+ 'a', 'abbr', 'acronym', 'address',
37
+ 'b', 'bdo', 'big', 'blockquote', 'body', 'button',
38
+ 'caption', 'center', 'cite', 'code', 'colgroup',
39
+ 'dd', 'del', 'dfn', 'div', 'dl', 'dt', 'em',
40
+ 'fieldset', 'form', 'frameset',
41
+ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'html', 'i',
39
42
  'iframe', 'ins', 'kbd', 'label', 'legend', 'li', 'map',
40
- 'noframes', 'noscript', 'ol', 'optgroup', 'option', 'p', 'param', 'pre',
41
- 'samp', 'script', 'select', 'small', 'span', 'strong', 'style', 'sub', 'sup',
42
- 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'tt', 'u', 'ul', 'var'
43
+ 'noframes', 'noscript',
44
+ 'object', 'ol', 'optgroup', 'option', 'p', 'param', 'pre',
45
+ 'q', 's',
46
+ 'samp', 'script', 'select', 'small', 'span', 'strike',
47
+ 'strong', 'style', 'sub', 'sup',
48
+ 'table', 'tbody', 'td', 'textarea', 'tfoot',
49
+ 'th', 'thead', 'title', 'tr', 'tt', 'u', 'ul', 'var'
43
50
  ]
44
51
  end
45
52
 
@@ -121,7 +128,7 @@ module Erector
121
128
  # calls this widget's #render method and returns the string.
122
129
  #
123
130
  # If it's called again later
124
- # then it returns the earlier rendered string, which leads to higher performance, but may have confusing
131
+ # then it returns the earlier rendered string, which may lead to higher performance, but may have confusing
125
132
  # effects if some underlying state has changed. In general we recommend you create a new instance of every
126
133
  # widget for each render, unless you know what you're doing.
127
134
  def to_s(render_method_name=:render, &blk)
@@ -295,9 +302,6 @@ module Erector
295
302
  output.concat "<?xml#{format_sorted(sort_for_xml_declaration(attributes))}?>"
296
303
  end
297
304
 
298
- # Deprecated synonym of instruct
299
- alias_method :instruct!, :instruct
300
-
301
305
  # Creates a whole new output string, executes the block, then converts the output string to a string and
302
306
  # emits it as raw text. If at all possible you should avoid this method since it hurts performance,
303
307
  # and use #render_to instead.
@@ -169,6 +169,14 @@ describe RhtmlParser do
169
169
  @parser.root = :attribute
170
170
  parse("a=\"don't worry\"").convert.should == ":a => 'don\\'t worry'"
171
171
  end
172
+
173
+ it "allows newlines where whitespace is allowed" do
174
+ parse("<img src='foo' \nalt='bar' />").convert.should == "img :src => 'foo', :alt => 'bar'\n"
175
+ end
176
+
177
+ it "treats tab characters the same as spaces" do
178
+ parse("<div \t />").convert.should == "div\n"
179
+ end
172
180
 
173
181
  it "deals with HTML entities in text" do
174
182
  parse("&lt;").convert.should == "text '<'\n"
@@ -319,7 +319,7 @@ module WidgetSpec
319
319
  end
320
320
 
321
321
  it "renders the proper empty-element tags" do
322
- ['area', 'base', 'br', 'hr', 'img', 'input', 'link', 'meta'].each do |tag_name|
322
+ Erector::Widget.empty_tags.each do |tag_name|
323
323
  expected = "<#{tag_name} />"
324
324
  actual = Erector::Widget.new do
325
325
  send(tag_name)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: erector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pivotal Labs
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-14 00:00:00 -05:00
12
+ date: 2008-12-16 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -52,62 +52,62 @@ extensions: []
52
52
  extra_rdoc_files:
53
53
  - README.txt
54
54
  files:
55
+ - spec/core_spec_suite.rb
56
+ - spec/erect
57
+ - spec/erect/erect_spec.rb
58
+ - spec/erect/erected_spec.rb
59
+ - spec/erect/rhtml_parser_spec.rb
55
60
  - spec/erector
56
- - spec/erector/widgets
57
- - spec/erector/widgets/table_spec.rb
61
+ - spec/erector/indentation_spec.rb
58
62
  - spec/erector/unicode_builder_spec.rb
59
63
  - spec/erector/widget_spec.rb
60
- - spec/erector/indentation_spec.rb
64
+ - spec/erector/widgets
65
+ - spec/erector/widgets/table_spec.rb
61
66
  - spec/rails_spec_suite.rb
62
- - spec/spec_suite.rb
63
- - spec/core_spec_suite.rb
64
67
  - spec/spec_helper.rb
65
- - spec/erect
66
- - spec/erect/erected_spec.rb
67
- - spec/erect/erect_spec.rb
68
- - spec/erect/rhtml_parser_spec.rb
68
+ - spec/spec_suite.rb
69
69
  - lib/erector
70
+ - lib/erector/erect.rb
71
+ - lib/erector/erected.rb
72
+ - lib/erector/extensions
73
+ - lib/erector/extensions/object.rb
74
+ - lib/erector/indenting.rb
70
75
  - lib/erector/rails
71
76
  - lib/erector/rails/extensions
72
- - lib/erector/rails/extensions/action_controller.rb
73
77
  - lib/erector/rails/extensions/action_controller
74
78
  - lib/erector/rails/extensions/action_controller/1.2.5
75
79
  - lib/erector/rails/extensions/action_controller/1.2.5/action_controller.rb
76
80
  - lib/erector/rails/extensions/action_controller/2.2.0
77
81
  - lib/erector/rails/extensions/action_controller/2.2.0/action_controller.rb
82
+ - lib/erector/rails/extensions/action_controller.rb
83
+ - lib/erector/rails/extensions/action_view.rb
78
84
  - lib/erector/rails/extensions/widget
79
85
  - lib/erector/rails/extensions/widget/1.2.5
80
86
  - lib/erector/rails/extensions/widget/1.2.5/widget.rb
81
87
  - lib/erector/rails/extensions/widget/2.2.0
82
88
  - lib/erector/rails/extensions/widget/2.2.0/widget.rb
83
- - lib/erector/rails/extensions/action_view.rb
84
89
  - lib/erector/rails/extensions/widget.rb
90
+ - lib/erector/rails/supported_rails_versions.rb
85
91
  - lib/erector/rails/template_handlers
86
- - lib/erector/rails/template_handlers/action_view_template_handler.rb
92
+ - lib/erector/rails/template_handlers/1.2.5
93
+ - lib/erector/rails/template_handlers/1.2.5/action_view_template_handler.rb
87
94
  - lib/erector/rails/template_handlers/2.0.0
88
95
  - lib/erector/rails/template_handlers/2.0.0/action_view_template_handler.rb
89
96
  - lib/erector/rails/template_handlers/2.1.0
90
97
  - lib/erector/rails/template_handlers/2.1.0/action_view_template_handler.rb
91
- - lib/erector/rails/template_handlers/1.2.5
92
- - lib/erector/rails/template_handlers/1.2.5/action_view_template_handler.rb
93
98
  - lib/erector/rails/template_handlers/2.2.0
94
99
  - lib/erector/rails/template_handlers/2.2.0/action_view_template_handler.rb
95
- - lib/erector/rails/supported_rails_versions.rb
96
- - lib/erector/widgets
97
- - lib/erector/widgets/table.rb
100
+ - lib/erector/rails/template_handlers/action_view_template_handler.rb
98
101
  - lib/erector/rails.rb
99
- - lib/erector/extensions
100
- - lib/erector/extensions/object.rb
101
- - lib/erector/erect.rb
102
- - lib/erector/indenting.rb
103
- - lib/erector/rhtml.treetop
104
102
  - lib/erector/raw_string.rb
105
- - lib/erector/version.rb
106
- - lib/erector/widgets.rb
103
+ - lib/erector/rhtml.treetop
107
104
  - lib/erector/unicode.rb
108
105
  - lib/erector/unicode_builder.rb
106
+ - lib/erector/version.rb
109
107
  - lib/erector/widget.rb
110
- - lib/erector/erected.rb
108
+ - lib/erector/widgets
109
+ - lib/erector/widgets/table.rb
110
+ - lib/erector/widgets.rb
111
111
  - lib/erector.rb
112
112
  - README.txt
113
113
  - bin/erect
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  requirements: []
135
135
 
136
136
  rubyforge_project: erector
137
- rubygems_version: 1.3.1
137
+ rubygems_version: 1.3.0
138
138
  signing_key:
139
139
  specification_version: 2
140
140
  summary: Erector is a Builder-like view framework, inspired by Markaby but overcoming some of its flaws