slim 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,12 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- slim (0.6.0.beta.3)
4
+ slim (0.6.0)
5
5
  escape_utils
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
+ abstract (1.0.0)
11
+ erubis (2.6.6)
12
+ abstract (>= 1.0.0)
10
13
  escape_utils (0.1.8)
11
14
  gemcutter (0.6.1)
12
15
  git (1.2.5)
@@ -16,7 +19,6 @@ GEM
16
19
  git (>= 1.2.5)
17
20
  rubyforge (>= 2.0.0)
18
21
  json_pure (1.4.6)
19
- mustache (0.11.2)
20
22
  rake (0.8.7)
21
23
  rubyforge (2.0.4)
22
24
  json_pure (>= 1.1.7)
@@ -25,9 +27,9 @@ PLATFORMS
25
27
  ruby
26
28
 
27
29
  DEPENDENCIES
30
+ erubis
28
31
  escape_utils
29
32
  haml
30
33
  jeweler
31
- mustache
32
34
  rake
33
35
  slim!
data/README.md CHANGED
@@ -151,6 +151,13 @@ __Please note that all line indicators must be followed by a space__
151
151
  div class="content"
152
152
  = show_content
153
153
 
154
+ ### Wrap attributes with parens
155
+
156
+ # If parens make the syntax more readable for you
157
+
158
+ body
159
+ h1(id="tagline" class="small tagline") = page_tagline
160
+
154
161
  ### Set an attribute's value with a method
155
162
 
156
163
  # Use standard Ruby interpolation.
@@ -222,31 +229,39 @@ __Please note that all line indicators must be followed by a space__
222
229
 
223
230
  ## Benchmarks
224
231
 
225
- # OS X 10.6 + REE 1.8.7
226
-
227
- user system total real
228
- erb 0.500000 0.000000 0.500000 ( 0.516644)
229
- slim 0.550000 0.000000 0.550000 ( 0.579362)
230
- haml 3.390000 0.050000 3.440000 ( 3.669325)
231
- mustache 1.130000 0.040000 1.170000 ( 1.213134)
232
- erb (cached) 0.090000 0.000000 0.090000 ( 0.099274)
233
- slim (cached) 0.080000 0.000000 0.080000 ( 0.079823)
234
- haml (cached) 0.290000 0.000000 0.290000 ( 0.312542)
235
- mustache (cached) 0.080000 0.000000 0.080000 ( 0.079184)
236
-
237
- # OS X 10.6 + Ruby 1.9.2
238
-
239
- user system total real
240
- erb 0.400000 0.000000 0.400000 ( 0.431967)
241
- slim 0.410000 0.010000 0.420000 ( 0.425059)
242
- haml 3.030000 0.030000 3.060000 ( 3.199970)
243
- mustache 1.360000 0.030000 1.390000 ( 1.435129)
244
- erb (cached) 0.150000 0.000000 0.150000 ( 0.157284)
245
- slim (cached) 0.130000 0.010000 0.140000 ( 0.129576)
246
- haml (cached) 0.320000 0.000000 0.320000 ( 0.344316)
247
- mustache (cached) 0.040000 0.000000 0.040000 ( 0.049058)
232
+ # Ubuntu 10.4 + Ruby 1.9.2
233
+
234
+ Rehearsal --------------------------------------------------------
235
+ erb 0.580000 0.010000 0.590000 ( 0.611149)
236
+ erubis 0.480000 0.000000 0.480000 ( 0.506241)
237
+ fast erubis 0.480000 0.010000 0.490000 ( 0.499427)
238
+ slim 0.640000 0.000000 0.640000 ( 0.667160)
239
+ haml 4.140000 0.000000 4.140000 ( 4.221195)
240
+ haml ugly 3.960000 0.000000 3.960000 ( 4.018103)
241
+ erb (cached) 0.200000 0.000000 0.200000 ( 0.208529)
242
+ erubis (cached) 0.160000 0.000000 0.160000 ( 0.167134)
243
+ fast erubis (cached) 0.140000 0.000000 0.140000 ( 0.152149)
244
+ slim (cached) 0.150000 0.000000 0.150000 ( 0.159058)
245
+ haml (cached) 0.450000 0.010000 0.460000 ( 0.462814)
246
+ haml ugly (cached) 0.370000 0.000000 0.370000 ( 0.387312)
247
+ ---------------------------------------------- total: 11.780000sec
248
+
249
+ user system total real
250
+ erb 0.560000 0.010000 0.570000 ( 0.574373)
251
+ erubis 0.480000 0.000000 0.480000 ( 0.501512)
252
+ fast erubis 0.470000 0.000000 0.470000 ( 0.481918)
253
+ slim 0.610000 0.000000 0.610000 ( 0.612794)
254
+ haml 3.930000 0.010000 3.940000 ( 3.939419)
255
+ haml ugly 3.790000 0.010000 3.800000 ( 3.798528)
256
+ erb (cached) 0.190000 0.000000 0.190000 ( 0.188593)
257
+ erubis (cached) 0.160000 0.000000 0.160000 ( 0.159869)
258
+ fast erubis (cached) 0.140000 0.000000 0.140000 ( 0.135476)
259
+ slim (cached) 0.150000 0.000000 0.150000 ( 0.153698)
260
+ haml (cached) 0.430000 0.000000 0.430000 ( 0.436980)
261
+ haml ugly (cached) 0.370000 0.000000 0.370000 ( 0.372770)
262
+
248
263
 
249
264
  ## Authors
250
265
 
251
266
  * [Andrew Stone](http://github.com/stonean)
252
- * [Fred Wu](http://github.com/fredwu)
267
+ * [Fred Wu](http://github.com/fredwu)
data/Rakefile CHANGED
@@ -19,7 +19,7 @@ begin
19
19
  gem.add_development_dependency 'rake'
20
20
  gem.add_development_dependency 'jeweler'
21
21
  gem.add_development_dependency 'haml'
22
- gem.add_development_dependency 'mustache'
22
+ gem.add_development_dependency 'erubis'
23
23
  end
24
24
  Jeweler::GemcutterTasks.new
25
25
  rescue LoadError
@@ -10,7 +10,7 @@ require 'slim/engine'
10
10
  module Slim
11
11
  class << self
12
12
  def version
13
- '0.6.0'
13
+ '0.6.1'
14
14
  end
15
15
 
16
16
  def escape_html(html)
@@ -10,7 +10,7 @@ module Slim
10
10
  CONTROL_WORDS = %w{if unless do}
11
11
  ELSE_CONTROL_WORDS = %w{else elsif}
12
12
 
13
- REGEX_LINE_PARSER = /^(\s*)(!?`?\|?-?=?\/?\w*)((\S*[#.]\S+)?(?:\s*(?:\w|-)*="[^=]+")*)?(.*)/
13
+ REGEX_LINE_PARSER = /^(\s*)(!?`?\|?-?=?\/?\w*)\(?((\S*[#.]\S+)?(?:\s*(?:\w|-)*="[^=]+")*)?\)?(.*)/
14
14
 
15
15
  REGEX_LINE_CONTAINS_OUTPUT_CODE = /^\s*=(.*)/
16
16
  REGEX_LINE_CONTAINS_METHOD_DETECTED = /^((?:(?!#{CONTROL_WORDS * '\b|'}\b).)*)/
@@ -63,9 +63,10 @@ module Slim
63
63
  else :markup
64
64
  end
65
65
 
66
- if attrs
66
+ unless attrs.empty?
67
67
  normalize_attributes!(attrs) if shortcut_attrs
68
68
  attrs.gsub!('"', '\"')
69
+ attrs = " #{attrs}" unless attrs =~ /^\s/
69
70
  end
70
71
 
71
72
  unless indent > last_indent
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{slim}
8
- s.version = "0.6.0"
8
+ s.version = "0.6.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andrew Stone", "Fred Wu"]
@@ -54,20 +54,20 @@ Gem::Specification.new do |s|
54
54
  s.add_development_dependency(%q<rake>, [">= 0"])
55
55
  s.add_development_dependency(%q<jeweler>, [">= 0"])
56
56
  s.add_development_dependency(%q<haml>, [">= 0"])
57
- s.add_development_dependency(%q<mustache>, [">= 0"])
57
+ s.add_development_dependency(%q<erubis>, [">= 0"])
58
58
  else
59
59
  s.add_dependency(%q<escape_utils>, [">= 0"])
60
60
  s.add_dependency(%q<rake>, [">= 0"])
61
61
  s.add_dependency(%q<jeweler>, [">= 0"])
62
62
  s.add_dependency(%q<haml>, [">= 0"])
63
- s.add_dependency(%q<mustache>, [">= 0"])
63
+ s.add_dependency(%q<erubis>, [">= 0"])
64
64
  end
65
65
  else
66
66
  s.add_dependency(%q<escape_utils>, [">= 0"])
67
67
  s.add_dependency(%q<rake>, [">= 0"])
68
68
  s.add_dependency(%q<jeweler>, [">= 0"])
69
69
  s.add_dependency(%q<haml>, [">= 0"])
70
- s.add_dependency(%q<mustache>, [">= 0"])
70
+ s.add_dependency(%q<erubis>, [">= 0"])
71
71
  end
72
72
  end
73
73
 
@@ -435,4 +435,24 @@ HTML
435
435
 
436
436
  assert_equal expected, Slim::Engine.new(string).render(@env)
437
437
  end
438
+
439
+ def test_parens_around_attributes
440
+ string = <<HTML
441
+ p(id="marvin" class="martian" data-info="Illudium Q-36") = output_number
442
+ HTML
443
+
444
+ expected = %(<p id="marvin" class="martian" data-info="Illudium Q-36">1337</p>)
445
+
446
+ assert_equal expected, Slim::Engine.new(string).render(@env)
447
+ end
448
+
449
+ def test_parens_around_attributes_with_equal_sign_snug_to_right_paren
450
+ string = <<HTML
451
+ p(id="marvin" class="martian" data-info="Illudium Q-36")= output_number
452
+ HTML
453
+
454
+ expected = %(<p id="marvin" class="martian" data-info="Illudium Q-36">1337</p>)
455
+
456
+ assert_equal expected, Slim::Engine.new(string).render(@env)
457
+ end
438
458
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 6
8
- - 0
9
- version: 0.6.0
8
+ - 1
9
+ version: 0.6.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Andrew Stone
@@ -71,7 +71,7 @@ dependencies:
71
71
  prerelease: false
72
72
  version_requirements: *id004
73
73
  - !ruby/object:Gem::Dependency
74
- name: mustache
74
+ name: erubis
75
75
  requirement: &id005 !ruby/object:Gem::Requirement
76
76
  none: false
77
77
  requirements:
@@ -123,7 +123,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
123
  requirements:
124
124
  - - ">="
125
125
  - !ruby/object:Gem::Version
126
- hash: 686036806339254494
126
+ hash: -160104932492896005
127
127
  segments:
128
128
  - 0
129
129
  version: "0"