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.
- data/.yardopts +5 -0
- data/MIT-LICENSE +1 -1
- data/README.md +347 -0
- data/Rakefile +124 -19
- data/VERSION +1 -1
- data/VERSION_NAME +1 -0
- data/extra/haml-mode.el +397 -78
- data/extra/sass-mode.el +148 -36
- data/extra/update_watch.rb +13 -0
- data/lib/haml.rb +15 -993
- data/lib/haml/buffer.rb +131 -84
- data/lib/haml/engine.rb +129 -97
- data/lib/haml/error.rb +7 -7
- data/lib/haml/exec.rb +127 -42
- data/lib/haml/filters.rb +107 -42
- data/lib/haml/helpers.rb +210 -156
- data/lib/haml/helpers/action_view_extensions.rb +34 -39
- data/lib/haml/helpers/action_view_mods.rb +132 -139
- data/lib/haml/html.rb +77 -65
- data/lib/haml/precompiler.rb +404 -213
- data/lib/haml/shared.rb +78 -0
- data/lib/haml/template.rb +14 -14
- data/lib/haml/template/patch.rb +2 -2
- data/lib/haml/template/plugin.rb +2 -3
- data/lib/haml/util.rb +211 -6
- data/lib/haml/version.rb +30 -13
- data/lib/sass.rb +7 -856
- data/lib/sass/css.rb +169 -161
- data/lib/sass/engine.rb +344 -328
- data/lib/sass/environment.rb +79 -0
- data/lib/sass/error.rb +33 -11
- data/lib/sass/files.rb +139 -0
- data/lib/sass/plugin.rb +160 -117
- data/lib/sass/plugin/merb.rb +7 -6
- data/lib/sass/plugin/rails.rb +5 -6
- data/lib/sass/repl.rb +58 -0
- data/lib/sass/script.rb +59 -0
- data/lib/sass/script/bool.rb +17 -0
- data/lib/sass/script/color.rb +183 -0
- data/lib/sass/script/funcall.rb +50 -0
- data/lib/sass/script/functions.rb +198 -0
- data/lib/sass/script/lexer.rb +178 -0
- data/lib/sass/script/literal.rb +177 -0
- data/lib/sass/script/node.rb +14 -0
- data/lib/sass/script/number.rb +381 -0
- data/lib/sass/script/operation.rb +45 -0
- data/lib/sass/script/parser.rb +172 -0
- data/lib/sass/script/string.rb +12 -0
- data/lib/sass/script/unary_operation.rb +34 -0
- data/lib/sass/script/variable.rb +31 -0
- data/lib/sass/tree/comment_node.rb +73 -10
- data/lib/sass/tree/debug_node.rb +30 -0
- data/lib/sass/tree/directive_node.rb +42 -17
- data/lib/sass/tree/file_node.rb +41 -0
- data/lib/sass/tree/for_node.rb +48 -0
- data/lib/sass/tree/if_node.rb +54 -0
- data/lib/sass/tree/mixin_def_node.rb +29 -0
- data/lib/sass/tree/mixin_node.rb +48 -0
- data/lib/sass/tree/node.rb +214 -11
- data/lib/sass/tree/prop_node.rb +109 -0
- data/lib/sass/tree/rule_node.rb +178 -51
- data/lib/sass/tree/variable_node.rb +34 -0
- data/lib/sass/tree/while_node.rb +31 -0
- data/test/haml/engine_test.rb +331 -36
- data/test/haml/helper_test.rb +12 -1
- data/test/haml/results/content_for_layout.xhtml +0 -3
- data/test/haml/results/filters.xhtml +2 -0
- data/test/haml/results/list.xhtml +1 -1
- data/test/haml/template_test.rb +7 -2
- data/test/haml/templates/content_for_layout.haml +0 -2
- data/test/haml/templates/list.haml +1 -1
- data/test/haml/util_test.rb +92 -0
- data/test/sass/css2sass_test.rb +69 -24
- data/test/sass/engine_test.rb +586 -64
- data/test/sass/functions_test.rb +125 -0
- data/test/sass/more_results/more1.css +9 -0
- data/test/sass/more_results/more1_with_line_comments.css +26 -0
- data/test/sass/more_results/more_import.css +29 -0
- data/test/sass/more_templates/_more_partial.sass +2 -0
- data/test/sass/more_templates/more1.sass +23 -0
- data/test/sass/more_templates/more_import.sass +11 -0
- data/test/sass/plugin_test.rb +81 -28
- data/test/sass/results/line_numbers.css +49 -0
- data/test/sass/results/{constants.css → script.css} +4 -4
- data/test/sass/results/subdir/subdir.css +2 -0
- data/test/sass/results/units.css +11 -0
- data/test/sass/script_test.rb +258 -0
- data/test/sass/templates/import.sass +1 -1
- data/test/sass/templates/importee.sass +7 -2
- data/test/sass/templates/line_numbers.sass +13 -0
- data/test/sass/templates/{constants.sass → script.sass} +11 -10
- data/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +2 -0
- data/test/sass/templates/subdir/subdir.sass +2 -2
- data/test/sass/templates/units.sass +11 -0
- data/test/test_helper.rb +14 -0
- metadata +77 -19
- data/FAQ +0 -138
- data/README.rdoc +0 -319
- data/lib/sass/constant.rb +0 -216
- data/lib/sass/constant/color.rb +0 -101
- data/lib/sass/constant/literal.rb +0 -54
- data/lib/sass/constant/nil.rb +0 -9
- data/lib/sass/constant/number.rb +0 -87
- data/lib/sass/constant/operation.rb +0 -30
- data/lib/sass/constant/string.rb +0 -22
- data/lib/sass/tree/attr_node.rb +0 -57
- 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
|
data/lib/sass/constant/string.rb
DELETED
@@ -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
|
data/lib/sass/tree/attr_node.rb
DELETED
@@ -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
|
data/lib/sass/tree/value_node.rb
DELETED
@@ -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
|