haml 2.0.10 → 2.2.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.

Files changed (107) hide show
  1. data/.yardopts +5 -0
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +347 -0
  4. data/Rakefile +124 -19
  5. data/VERSION +1 -1
  6. data/VERSION_NAME +1 -0
  7. data/extra/haml-mode.el +397 -78
  8. data/extra/sass-mode.el +148 -36
  9. data/extra/update_watch.rb +13 -0
  10. data/lib/haml.rb +15 -993
  11. data/lib/haml/buffer.rb +131 -84
  12. data/lib/haml/engine.rb +129 -97
  13. data/lib/haml/error.rb +7 -7
  14. data/lib/haml/exec.rb +127 -42
  15. data/lib/haml/filters.rb +107 -42
  16. data/lib/haml/helpers.rb +210 -156
  17. data/lib/haml/helpers/action_view_extensions.rb +34 -39
  18. data/lib/haml/helpers/action_view_mods.rb +132 -139
  19. data/lib/haml/html.rb +77 -65
  20. data/lib/haml/precompiler.rb +404 -213
  21. data/lib/haml/shared.rb +78 -0
  22. data/lib/haml/template.rb +14 -14
  23. data/lib/haml/template/patch.rb +2 -2
  24. data/lib/haml/template/plugin.rb +2 -3
  25. data/lib/haml/util.rb +211 -6
  26. data/lib/haml/version.rb +30 -13
  27. data/lib/sass.rb +7 -856
  28. data/lib/sass/css.rb +169 -161
  29. data/lib/sass/engine.rb +344 -328
  30. data/lib/sass/environment.rb +79 -0
  31. data/lib/sass/error.rb +33 -11
  32. data/lib/sass/files.rb +139 -0
  33. data/lib/sass/plugin.rb +160 -117
  34. data/lib/sass/plugin/merb.rb +7 -6
  35. data/lib/sass/plugin/rails.rb +5 -6
  36. data/lib/sass/repl.rb +58 -0
  37. data/lib/sass/script.rb +59 -0
  38. data/lib/sass/script/bool.rb +17 -0
  39. data/lib/sass/script/color.rb +183 -0
  40. data/lib/sass/script/funcall.rb +50 -0
  41. data/lib/sass/script/functions.rb +198 -0
  42. data/lib/sass/script/lexer.rb +178 -0
  43. data/lib/sass/script/literal.rb +177 -0
  44. data/lib/sass/script/node.rb +14 -0
  45. data/lib/sass/script/number.rb +381 -0
  46. data/lib/sass/script/operation.rb +45 -0
  47. data/lib/sass/script/parser.rb +172 -0
  48. data/lib/sass/script/string.rb +12 -0
  49. data/lib/sass/script/unary_operation.rb +34 -0
  50. data/lib/sass/script/variable.rb +31 -0
  51. data/lib/sass/tree/comment_node.rb +73 -10
  52. data/lib/sass/tree/debug_node.rb +30 -0
  53. data/lib/sass/tree/directive_node.rb +42 -17
  54. data/lib/sass/tree/file_node.rb +41 -0
  55. data/lib/sass/tree/for_node.rb +48 -0
  56. data/lib/sass/tree/if_node.rb +54 -0
  57. data/lib/sass/tree/mixin_def_node.rb +29 -0
  58. data/lib/sass/tree/mixin_node.rb +48 -0
  59. data/lib/sass/tree/node.rb +214 -11
  60. data/lib/sass/tree/prop_node.rb +109 -0
  61. data/lib/sass/tree/rule_node.rb +178 -51
  62. data/lib/sass/tree/variable_node.rb +34 -0
  63. data/lib/sass/tree/while_node.rb +31 -0
  64. data/test/haml/engine_test.rb +331 -36
  65. data/test/haml/helper_test.rb +12 -1
  66. data/test/haml/results/content_for_layout.xhtml +0 -3
  67. data/test/haml/results/filters.xhtml +2 -0
  68. data/test/haml/results/list.xhtml +1 -1
  69. data/test/haml/template_test.rb +7 -2
  70. data/test/haml/templates/content_for_layout.haml +0 -2
  71. data/test/haml/templates/list.haml +1 -1
  72. data/test/haml/util_test.rb +92 -0
  73. data/test/sass/css2sass_test.rb +69 -24
  74. data/test/sass/engine_test.rb +586 -64
  75. data/test/sass/functions_test.rb +125 -0
  76. data/test/sass/more_results/more1.css +9 -0
  77. data/test/sass/more_results/more1_with_line_comments.css +26 -0
  78. data/test/sass/more_results/more_import.css +29 -0
  79. data/test/sass/more_templates/_more_partial.sass +2 -0
  80. data/test/sass/more_templates/more1.sass +23 -0
  81. data/test/sass/more_templates/more_import.sass +11 -0
  82. data/test/sass/plugin_test.rb +81 -28
  83. data/test/sass/results/line_numbers.css +49 -0
  84. data/test/sass/results/{constants.css → script.css} +4 -4
  85. data/test/sass/results/subdir/subdir.css +2 -0
  86. data/test/sass/results/units.css +11 -0
  87. data/test/sass/script_test.rb +258 -0
  88. data/test/sass/templates/import.sass +1 -1
  89. data/test/sass/templates/importee.sass +7 -2
  90. data/test/sass/templates/line_numbers.sass +13 -0
  91. data/test/sass/templates/{constants.sass → script.sass} +11 -10
  92. data/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +2 -0
  93. data/test/sass/templates/subdir/subdir.sass +2 -2
  94. data/test/sass/templates/units.sass +11 -0
  95. data/test/test_helper.rb +14 -0
  96. metadata +77 -19
  97. data/FAQ +0 -138
  98. data/README.rdoc +0 -319
  99. data/lib/sass/constant.rb +0 -216
  100. data/lib/sass/constant/color.rb +0 -101
  101. data/lib/sass/constant/literal.rb +0 -54
  102. data/lib/sass/constant/nil.rb +0 -9
  103. data/lib/sass/constant/number.rb +0 -87
  104. data/lib/sass/constant/operation.rb +0 -30
  105. data/lib/sass/constant/string.rb +0 -22
  106. data/lib/sass/tree/attr_node.rb +0 -57
  107. data/lib/sass/tree/value_node.rb +0 -20
@@ -1,30 +0,0 @@
1
- require 'sass/constant/string'
2
- require 'sass/constant/number'
3
- require 'sass/constant/color'
4
-
5
- module Sass::Constant # :nodoc:
6
- class Operation # :nodoc:
7
- def initialize(operand1, operand2, operator)
8
- @operand1 = operand1
9
- @operand2 = operand2
10
- @operator = operator
11
- end
12
-
13
- def to_s
14
- self.perform.to_s
15
- end
16
-
17
- protected
18
-
19
- def perform
20
- literal1 = @operand1.perform
21
- literal2 = @operand2.perform
22
- begin
23
- literal1.send(@operator, literal2)
24
- rescue NoMethodError => e
25
- raise e unless e.name.to_s == @operator.to_s
26
- raise Sass::SyntaxError.new("Undefined operation: \"#{literal1} #{@operator} #{literal2}\".")
27
- end
28
- end
29
- end
30
- end
@@ -1,22 +0,0 @@
1
- require 'sass/constant/literal'
2
-
3
- module Sass::Constant # :nodoc:
4
- class String < Literal # :nodoc:
5
-
6
- def parse(value)
7
- @value = value
8
- end
9
-
10
- def plus(other)
11
- Sass::Constant::String.from_value(self.to_s + other.to_s)
12
- end
13
-
14
- def funcall(other)
15
- Sass::Constant::String.from_value("#{self.to_s}(#{other.to_s})")
16
- end
17
-
18
- def to_s
19
- @value
20
- end
21
- end
22
- end
@@ -1,57 +0,0 @@
1
- require 'sass/tree/node'
2
-
3
- module Sass::Tree
4
- class AttrNode < ValueNode
5
- attr_accessor :name
6
-
7
- def initialize(name, value, style)
8
- @name = name
9
- super(value, style)
10
- end
11
-
12
- def ==(other)
13
- self.class == other.class && name == other.name && super
14
- end
15
-
16
- def to_s(tabs, parent_name = nil)
17
- if value[-1] == ?;
18
- raise Sass::SyntaxError.new("Invalid attribute: #{declaration.dump} (This isn't CSS!).", @line)
19
- end
20
- real_name = name
21
- real_name = "#{parent_name}-#{real_name}" if parent_name
22
-
23
- if value.empty? && children.empty?
24
- raise Sass::SyntaxError.new("Invalid attribute: #{declaration.dump}.", @line)
25
- end
26
-
27
- join_string = case @style
28
- when :compact; ' '
29
- when :compressed; ''
30
- else "\n"
31
- end
32
- spaces = ' ' * (tabs - 1)
33
- to_return = ''
34
- if !value.empty?
35
- to_return << "#{spaces}#{real_name}:#{@style == :compressed ? '' : ' '}#{value};#{join_string}"
36
- end
37
-
38
- children.each do |kid|
39
- to_return << "#{kid.to_s(tabs, real_name)}" << join_string
40
- end
41
-
42
- (@style == :compressed && parent_name) ? to_return : to_return[0...-1]
43
- end
44
-
45
- private
46
-
47
- def declaration
48
- ":#{name} #{value}"
49
- end
50
-
51
- def invalid_child?(child)
52
- if !child.is_a?(AttrNode) && !child.is_a?(CommentNode)
53
- "Illegal nesting: Only attributes may be nested beneath attributes."
54
- end
55
- end
56
- end
57
- end
@@ -1,20 +0,0 @@
1
- require 'sass/tree/node'
2
-
3
- module Sass::Tree
4
- class ValueNode < Node
5
- attr_accessor :value
6
-
7
- def initialize(value, style)
8
- @value = value
9
- super(style)
10
- end
11
-
12
- def ==(other)
13
- self.class == other.class && value == other.value && super
14
- end
15
-
16
- def to_s(tabs = 0)
17
- value
18
- end
19
- end
20
- end