haml 3.0.0.rc.5 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of haml might be problematic. Click here for more details.

data/Rakefile CHANGED
@@ -70,11 +70,10 @@ end
70
70
  # We also need to get rid of this file after packaging.
71
71
  at_exit { File.delete(scope('REVISION')) rescue nil }
72
72
 
73
- desc "Install Haml as a gem."
73
+ desc "Install Haml as a gem. Use SUDO=1 to install with sudo."
74
74
  task :install => [:package] do
75
- sudo = RUBY_PLATFORM =~ /win32|mingw/ ? '' : 'sudo'
76
75
  gem = RUBY_PLATFORM =~ /java/ ? 'jgem' : 'gem'
77
- sh %{#{sudo} #{gem} install --no-ri pkg/haml-#{File.read(scope('VERSION')).strip}}
76
+ sh %{#{'sudo ' if ENV["SUDO"]}#{gem} install --no-ri pkg/haml-#{File.read(scope('VERSION')).strip}}
78
77
  end
79
78
 
80
79
  desc "Release a new Haml package to Rubyforge."
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.0.0.rc.5
1
+ 3.0.0
@@ -4,7 +4,7 @@
4
4
 
5
5
  ;; Author: Nathan Weizenbaum
6
6
  ;; URL: http://github.com/nex3/haml/tree/master
7
- ;; Version: 2.2.21
7
+ ;; Version: 3.0.0
8
8
  ;; Created: 2007-03-08
9
9
  ;; By: Nathan Weizenbaum
10
10
  ;; Keywords: markup, language, html
@@ -4,11 +4,11 @@
4
4
 
5
5
  ;; Author: Nathan Weizenbaum
6
6
  ;; URL: http://github.com/nex3/haml/tree/master
7
- ;; Version: 2.2.21
7
+ ;; Version: 3.0.0
8
8
  ;; Created: 2007-03-15
9
9
  ;; By: Nathan Weizenbaum
10
10
  ;; Keywords: markup, language, css
11
- ;; Package-Requires: ((haml-mode "2.2.21"))
11
+ ;; Package-Requires: ((haml-mode "3.0.0"))
12
12
 
13
13
  ;;; Commentary:
14
14
 
@@ -279,6 +279,18 @@ module Haml
279
279
  end
280
280
  end
281
281
 
282
+ if self.next && self.next.text? && self.next.content =~ /\A[^\s]/
283
+ if self.previous.nil? || self.previous.text? &&
284
+ (self.previous.content =~ /[^\s]\Z/ ||
285
+ self.previous.content =~ /\A\s*\Z/ && self.previous.previous.nil?)
286
+ nuke_outer_whitespace = true
287
+ else
288
+ output << "- succeed #{self.next.content.slice!(/\A[^\s]+/).dump} do\n"
289
+ tabs += 1
290
+ output << tabulate(tabs)
291
+ end
292
+ end
293
+
282
294
  output << "%#{name}" unless name == 'div' &&
283
295
  (static_id?(options) ||
284
296
  static_classname?(options) &&
@@ -300,6 +312,7 @@ module Haml
300
312
  output << haml_attributes(options) if attr_hash.length > 0
301
313
  end
302
314
 
315
+ output << ">" if nuke_outer_whitespace
303
316
  output << "/" if empty? && !etag
304
317
 
305
318
  if children && children.size == 1
@@ -217,6 +217,7 @@ module Sass::Script
217
217
  # @param blue [Number]
218
218
  # A number between 0 and 255 inclusive,
219
219
  # or between 0% and 100% inclusive
220
+ # @see #rgba
220
221
  # @return [Color]
221
222
  def rgb(red, green, blue)
222
223
  assert_type red, :Number
@@ -235,6 +236,7 @@ module Sass::Script
235
236
  end)
236
237
  end
237
238
 
239
+ # @see #rgb
238
240
  # @overload rgba(red, green, blue, alpha)
239
241
  # Creates a {Color} object from red, green, and blue values,
240
242
  # as well as an alpha channel indicating opacity.
@@ -291,6 +293,7 @@ module Sass::Script
291
293
  # @param lightness [Number] The lightness of the color.
292
294
  # Must be between `0%` and `100%`, inclusive
293
295
  # @return [Color] The resulting color
296
+ # @see #hsla
294
297
  # @raise [ArgumentError] if `saturation` or `lightness` are out of bounds
295
298
  def hsl(hue, saturation, lightness)
296
299
  hsla(hue, saturation, lightness, Number.new(1))
@@ -309,6 +312,7 @@ module Sass::Script
309
312
  # @param alpha [Number] The opacity of the color.
310
313
  # Must be between 0 and 1, inclusive
311
314
  # @return [Color] The resulting color
315
+ # @see #hsl
312
316
  # @raise [ArgumentError] if `saturation`, `lightness`, or `alpha` are out of bounds
313
317
  def hsla(hue, saturation, lightness, alpha)
314
318
  assert_type hue, :Number
@@ -368,6 +372,7 @@ module Sass::Script
368
372
  #
369
373
  # @param color [Color]
370
374
  # @return [Number] between 0deg and 360deg
375
+ # @see #adjust_hue
371
376
  # @raise [ArgumentError] if `color` isn't a color
372
377
  def hue(color)
373
378
  assert_type color, :Color
@@ -382,6 +387,8 @@ module Sass::Script
382
387
  #
383
388
  # @param color [Color]
384
389
  # @return [Number] between 0% and 100%
390
+ # @see #saturate
391
+ # @see #desaturate
385
392
  # @raise [ArgumentError] if `color` isn't a color
386
393
  def saturation(color)
387
394
  assert_type color, :Color
@@ -396,6 +403,8 @@ module Sass::Script
396
403
  #
397
404
  # @param color [Color]
398
405
  # @return [Number] between 0% and 100%
406
+ # @see #lighten
407
+ # @see #darken
399
408
  # @raise [ArgumentError] if `color` isn't a color
400
409
  def lightness(color)
401
410
  assert_type color, :Color
@@ -411,6 +420,8 @@ module Sass::Script
411
420
  # @overload def alpha(color)
412
421
  # @param color [Color]
413
422
  # @return [Number]
423
+ # @see #opacify
424
+ # @see #transparentize
414
425
  # @raise [ArgumentError] If `color` isn't a color
415
426
  def alpha(*args)
416
427
  if args.all? do |a|
@@ -429,6 +440,8 @@ module Sass::Script
429
440
  #
430
441
  # @param color [Color]
431
442
  # @return [Number]
443
+ # @see #opacify
444
+ # @see #transparentize
432
445
  # @raise [ArgumentError] If `color` isn't a color
433
446
  def opacity(color)
434
447
  assert_type color, :Color
@@ -447,6 +460,7 @@ module Sass::Script
447
460
  # @param color [Color]
448
461
  # @param amount [Number]
449
462
  # @return [Color]
463
+ # @see #transparentize
450
464
  # @raise [ArgumentError] If `color` isn't a color,
451
465
  # or `number` isn't a number between 0 and 1
452
466
  def opacify(color, amount)
@@ -466,6 +480,7 @@ module Sass::Script
466
480
  # @param color [Color]
467
481
  # @param amount [Number]
468
482
  # @return [Color]
483
+ # @see #opacify
469
484
  # @raise [ArgumentError] If `color` isn't a color,
470
485
  # or `number` isn't a number between 0 and 1
471
486
  def transparentize(color, amount)
@@ -485,6 +500,7 @@ module Sass::Script
485
500
  # @param color [Color]
486
501
  # @param amount [Number]
487
502
  # @return [Color]
503
+ # @see #darken
488
504
  # @raise [ArgumentError] If `color` isn't a color,
489
505
  # or `number` isn't a number between 0% and 100%
490
506
  def lighten(color, amount)
@@ -503,6 +519,7 @@ module Sass::Script
503
519
  # @param color [Color]
504
520
  # @param amount [Number]
505
521
  # @return [Color]
522
+ # @see #lighten
506
523
  # @raise [ArgumentError] If `color` isn't a color,
507
524
  # or `number` isn't a number between 0% and 100%
508
525
  def darken(color, amount)
@@ -521,6 +538,7 @@ module Sass::Script
521
538
  # @param color [Color]
522
539
  # @param amount [Number]
523
540
  # @return [Color]
541
+ # @see #desaturate
524
542
  # @raise [ArgumentError] If `color` isn't a color,
525
543
  # or `number` isn't a number between 0% and 100%
526
544
  def saturate(color, amount)
@@ -539,6 +557,7 @@ module Sass::Script
539
557
  # @param color [Color]
540
558
  # @param amount [Number]
541
559
  # @return [Color]
560
+ # @see #saturate
542
561
  # @raise [ArgumentError] If `color` isn't a color,
543
562
  # or `number` isn't a number between 0% and 100%
544
563
  def desaturate(color, amount)
@@ -340,9 +340,11 @@ module Sass
340
340
  @use_property_exception, false
341
341
  begin
342
342
  decl = declaration
343
- # We want an exception if it's not there,
344
- # but we don't want to consume if it is
345
- tok!(/[;}]/) unless tok?(/[;}]/)
343
+ unless decl && decl.has_children
344
+ # We want an exception if it's not there,
345
+ # but we don't want to consume if it is
346
+ tok!(/[;}]/) unless tok?(/[;}]/)
347
+ end
346
348
  return decl
347
349
  rescue Sass::SyntaxError => decl_err
348
350
  end
@@ -246,6 +246,39 @@ HTML
246
246
  assert_equal("%p # foo bar #", render("<p># foo bar #</p>"))
247
247
  end
248
248
 
249
+ def test_comma_post_tag
250
+ assert_equal(<<HAML.rstrip, render(<<HTML))
251
+ #foo
252
+ %span> Foo
253
+ ,
254
+ %span bar
255
+ Foo
256
+ %span> bar
257
+ ,
258
+ %span baz
259
+ HAML
260
+ <div id="foo">
261
+ <span>Foo</span>, <span>bar</span>
262
+ Foo<span>bar</span>, <span>baz</span>
263
+ </div>
264
+ HTML
265
+ end
266
+
267
+ def test_comma_post_tag_with_text_before
268
+ assert_equal(<<HAML.rstrip, render(<<HTML))
269
+ #foo
270
+ Batch
271
+ - succeed "," do
272
+ %span Foo
273
+ %span Bar
274
+ HAML
275
+ <div id="foo">
276
+ Batch
277
+ <span>Foo</span>, <span>Bar</span>
278
+ </div>
279
+ HTML
280
+ end
281
+
249
282
  begin
250
283
  require 'haml/html/erb'
251
284
  include ErbTests
@@ -430,6 +430,28 @@ foo {
430
430
  SCSS
431
431
  end
432
432
 
433
+ def test_several_namespace_properties
434
+ assert_equal <<CSS, render(<<SCSS)
435
+ foo {
436
+ bar: baz;
437
+ bang-bip: 1px;
438
+ bang-bop: bar;
439
+ buzz-fram: "foo";
440
+ buzz-frum: moo; }
441
+ CSS
442
+ foo {
443
+ bar: baz;
444
+ bang: {
445
+ bip: 1px;
446
+ bop: bar;}
447
+ buzz: {
448
+ fram: "foo";
449
+ frum: moo;
450
+ }
451
+ }
452
+ SCSS
453
+ end
454
+
433
455
  def test_nested_namespace_properties
434
456
  assert_equal <<CSS, render(<<SCSS)
435
457
  foo {
metadata CHANGED
@@ -1,14 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: true
4
+ prerelease: false
5
5
  segments:
6
6
  - 3
7
7
  - 0
8
8
  - 0
9
- - rc
10
- - 5
11
- version: 3.0.0.rc.5
9
+ version: 3.0.0
12
10
  platform: ruby
13
11
  authors:
14
12
  - Nathan Weizenbaum
@@ -17,7 +15,7 @@ autorequire:
17
15
  bindir: bin
18
16
  cert_chain: []
19
17
 
20
- date: 2010-05-07 00:00:00 -07:00
18
+ date: 2010-05-10 00:00:00 -07:00
21
19
  default_executable:
22
20
  dependencies:
23
21
  - !ruby/object:Gem::Dependency
@@ -371,13 +369,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
371
369
  version: "0"
372
370
  required_rubygems_version: !ruby/object:Gem::Requirement
373
371
  requirements:
374
- - - ">"
372
+ - - ">="
375
373
  - !ruby/object:Gem::Version
376
374
  segments:
377
- - 1
378
- - 3
379
- - 1
380
- version: 1.3.1
375
+ - 0
376
+ version: "0"
381
377
  requirements: []
382
378
 
383
379
  rubyforge_project: haml