haml-edge 2.3.186 → 2.3.187

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. data/EDGE_GEM_VERSION +1 -1
  2. data/VERSION +1 -1
  3. data/lib/haml/exec.rb +94 -18
  4. data/lib/haml/helpers.rb +3 -1
  5. data/lib/sass/engine.rb +1 -1
  6. data/lib/sass/script/bool.rb +1 -1
  7. data/lib/sass/script/color.rb +1 -1
  8. data/lib/sass/script/funcall.rb +2 -2
  9. data/lib/sass/script/interpolation.rb +5 -5
  10. data/lib/sass/script/literal.rb +1 -1
  11. data/lib/sass/script/node.rb +10 -1
  12. data/lib/sass/script/number.rb +1 -1
  13. data/lib/sass/script/operation.rb +5 -5
  14. data/lib/sass/script/string.rb +12 -5
  15. data/lib/sass/script/unary_operation.rb +3 -3
  16. data/lib/sass/script/variable.rb +2 -2
  17. data/lib/sass/scss/css_parser.rb +1 -0
  18. data/lib/sass/scss/parser.rb +45 -25
  19. data/lib/sass/scss/rx.rb +1 -0
  20. data/lib/sass/tree/for_node.rb +1 -1
  21. data/lib/sass/tree/if_node.rb +1 -1
  22. data/lib/sass/tree/mixin_def_node.rb +3 -3
  23. data/lib/sass/tree/mixin_node.rb +2 -2
  24. data/lib/sass/tree/node.rb +8 -0
  25. data/lib/sass/tree/prop_node.rb +17 -16
  26. data/lib/sass/tree/rule_node.rb +2 -2
  27. data/lib/sass/tree/variable_node.rb +1 -1
  28. data/lib/sass/tree/while_node.rb +1 -1
  29. data/test/sass/conversion_test.rb +47 -0
  30. data/test/sass/scss/css_test.rb +3 -3
  31. data/test/sass/scss/scss_test.rb +40 -0
  32. metadata +2 -37
  33. data/test/haml/spec/README.md +0 -97
  34. data/test/haml/spec/lua_haml_spec.lua +0 -30
  35. data/test/haml/spec/ruby_haml_test.rb +0 -19
  36. data/test/haml/spec/tests.json +0 -534
  37. data/vendor/fssm/LICENSE +0 -20
  38. data/vendor/fssm/README.markdown +0 -55
  39. data/vendor/fssm/Rakefile +0 -59
  40. data/vendor/fssm/VERSION.yml +0 -5
  41. data/vendor/fssm/example.rb +0 -9
  42. data/vendor/fssm/fssm.gemspec +0 -77
  43. data/vendor/fssm/lib/fssm/backends/fsevents.rb +0 -36
  44. data/vendor/fssm/lib/fssm/backends/inotify.rb +0 -26
  45. data/vendor/fssm/lib/fssm/backends/polling.rb +0 -25
  46. data/vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb +0 -131
  47. data/vendor/fssm/lib/fssm/monitor.rb +0 -26
  48. data/vendor/fssm/lib/fssm/path.rb +0 -91
  49. data/vendor/fssm/lib/fssm/pathname.rb +0 -502
  50. data/vendor/fssm/lib/fssm/state/directory.rb +0 -57
  51. data/vendor/fssm/lib/fssm/state/file.rb +0 -24
  52. data/vendor/fssm/lib/fssm/support.rb +0 -63
  53. data/vendor/fssm/lib/fssm/tree.rb +0 -176
  54. data/vendor/fssm/lib/fssm.rb +0 -33
  55. data/vendor/fssm/profile/prof-cache.rb +0 -40
  56. data/vendor/fssm/profile/prof-fssm-pathname.html +0 -1231
  57. data/vendor/fssm/profile/prof-pathname.rb +0 -68
  58. data/vendor/fssm/profile/prof-plain-pathname.html +0 -988
  59. data/vendor/fssm/profile/prof.html +0 -2379
  60. data/vendor/fssm/spec/path_spec.rb +0 -75
  61. data/vendor/fssm/spec/root/duck/quack.txt +0 -0
  62. data/vendor/fssm/spec/root/file.css +0 -0
  63. data/vendor/fssm/spec/root/file.rb +0 -0
  64. data/vendor/fssm/spec/root/file.yml +0 -0
  65. data/vendor/fssm/spec/root/moo/cow.txt +0 -0
  66. data/vendor/fssm/spec/spec_helper.rb +0 -14
@@ -114,7 +114,7 @@ module Sass::Tree
114
114
  if r.is_a?(String)
115
115
  r.gsub(/(,[ \t]*)?\n\s*/) {$1 ? $1 + "\n" : " "}
116
116
  else
117
- "\#{#{r.to_sass}}"
117
+ "\#{#{r.to_sass(opts)}}"
118
118
  end
119
119
  end.join
120
120
  name = "\\" + name if name[0] == ?:
@@ -122,7 +122,7 @@ module Sass::Tree
122
122
  end
123
123
 
124
124
  def to_scss(tabs, opts = {})
125
- name = rule.map {|r| r.is_a?(String) ? r : "\#{#{r.to_sass}}"}.
125
+ name = rule.map {|r| r.is_a?(String) ? r : "\#{#{r.to_sass(opts)}}"}.
126
126
  join.gsub(/^[ \t]*/, ' ' * tabs)
127
127
 
128
128
  res = name + children_to_src(tabs, opts, :scss)
@@ -17,7 +17,7 @@ module Sass
17
17
  protected
18
18
 
19
19
  def to_src(tabs, opts, fmt)
20
- "#{' ' * tabs}$#{@name}: #{@expr.to_sass}#{' !default' if @guarded}#{semi fmt}\n"
20
+ "#{' ' * tabs}$#{dasherize(@name, opts)}: #{@expr.to_sass(opts)}#{' !default' if @guarded}#{semi fmt}\n"
21
21
  end
22
22
 
23
23
  # Loads the new variable value into the environment.
@@ -14,7 +14,7 @@ module Sass::Tree
14
14
  protected
15
15
 
16
16
  def to_src(tabs, opts, fmt)
17
- "#{' ' * tabs}@while #{@expr.to_sass}" + children_to_src(tabs, opts, fmt)
17
+ "#{' ' * tabs}@while #{@expr.to_sass(opts)}" + children_to_src(tabs, opts, fmt)
18
18
  end
19
19
 
20
20
  # Runs the child nodes until the continue expression becomes false.
@@ -833,6 +833,53 @@ foo
833
833
  SASS
834
834
  end
835
835
 
836
+ def test_nested_properties
837
+ assert_renders <<SASS, <<SCSS
838
+ div
839
+ before: before
840
+ background:
841
+ color: blue
842
+ repeat: no-repeat
843
+ after: after
844
+ SASS
845
+ div {
846
+ before: before;
847
+ background: {
848
+ color: blue;
849
+ repeat: no-repeat; };
850
+ after: after; }
851
+
852
+ SCSS
853
+ end
854
+
855
+ def test_dasherize
856
+ assert_sass_to_scss(<<SCSS,<<SASS, :dasherize => true)
857
+ @mixin under-scored-mixin($under-scored-arg: $under-scored-default) {
858
+ bar: $under-scored-arg; }
859
+
860
+ div {
861
+ foo: under-scored-fn($under-scored-var + "before" + $another-under-scored-var + "after");
862
+ @include under-scored-mixin($passed-arg);
863
+ selector-\#{$under-scored-interp}: bold; }
864
+
865
+ @if $under-scored {
866
+ @for $for-var from $from-var to $to-var {
867
+ @while $while-var == true {
868
+ $while-var: false; } } }
869
+ SCSS
870
+ =under_scored_mixin($under_scored_arg: $under_scored_default)
871
+ bar: $under_scored_arg
872
+ div
873
+ foo: under_scored_fn($under_scored_var + "before\#{$another_under_scored_var}after")
874
+ +under_scored_mixin($passed_arg)
875
+ selector-\#{$under_scored_interp}: bold
876
+ @if $under_scored
877
+ @for $for_var from $from_var to $to_var
878
+ @while $while_var == true
879
+ $while_var : false
880
+ SASS
881
+ end
882
+
836
883
  private
837
884
 
838
885
  def assert_sass_to_sass(sass, options = {})
@@ -726,12 +726,12 @@ SCSS
726
726
  end
727
727
 
728
728
  def test_invalid_classes
729
- assert_not_parses("identifier", 'p.<err> foo {a: b}')
730
- assert_not_parses("identifier", 'p.<err>1foo {a: b}')
729
+ assert_not_parses("class name", 'p.<err> foo {a: b}')
730
+ assert_not_parses("class name", 'p.<err>1foo {a: b}')
731
731
  end
732
732
 
733
733
  def test_invalid_ids
734
- assert_not_parses('"{"', 'p<err># foo {a: b}')
734
+ assert_not_parses("id name", 'p#<err> foo {a: b}')
735
735
  end
736
736
 
737
737
  def test_no_properties_at_toplevel
@@ -631,6 +631,46 @@ foo:nth-child(\#{5 + "n"}) {a: b}
631
631
  SCSS
632
632
  end
633
633
 
634
+ def test_selector_interpolation_at_class_begininng
635
+ assert_equal <<CSS, render(<<SCSS)
636
+ .zzz {
637
+ a: b; }
638
+ CSS
639
+ $zzz: zzz;
640
+ .\#{$zzz} { a: b; }
641
+ SCSS
642
+ end
643
+
644
+ def test_selector_interpolation_at_id_begininng
645
+ assert_equal <<CSS, render(<<SCSS)
646
+ #zzz {
647
+ a: b; }
648
+ CSS
649
+ $zzz: zzz;
650
+ #\#{$zzz} { a: b; }
651
+ SCSS
652
+ end
653
+
654
+ def test_selector_interpolation_at_pseudo_begininng
655
+ assert_equal <<CSS, render(<<SCSS)
656
+ :zzz::zzz {
657
+ a: b; }
658
+ CSS
659
+ $zzz: zzz;
660
+ :\#{$zzz}::\#{$zzz} { a: b; }
661
+ SCSS
662
+ end
663
+
664
+ def test_selector_interpolation_at_attr_beginning
665
+ assert_equal <<CSS, render(<<SCSS)
666
+ [zzz=foo] {
667
+ a: b; }
668
+ CSS
669
+ $zzz: zzz;
670
+ [\#{$zzz}=foo] { a: b; }
671
+ SCSS
672
+ end
673
+
634
674
  def test_basic_prop_val_interpolation
635
675
  assert_equal <<CSS, render(<<SCSS)
636
676
  foo {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml-edge
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.186
4
+ version: 2.3.187
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Weizenbaum
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2010-04-01 00:00:00 -04:00
13
+ date: 2010-04-04 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -123,36 +123,6 @@ files:
123
123
  - lib/sass/scss/rx.rb
124
124
  - lib/sass/scss/script_lexer.rb
125
125
  - lib/sass/scss/script_parser.rb
126
- - vendor/fssm/LICENSE
127
- - vendor/fssm/README.markdown
128
- - vendor/fssm/Rakefile
129
- - vendor/fssm/VERSION.yml
130
- - vendor/fssm/example.rb
131
- - vendor/fssm/fssm.gemspec
132
- - vendor/fssm/lib/fssm.rb
133
- - vendor/fssm/lib/fssm/backends/fsevents.rb
134
- - vendor/fssm/lib/fssm/backends/inotify.rb
135
- - vendor/fssm/lib/fssm/backends/polling.rb
136
- - vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb
137
- - vendor/fssm/lib/fssm/monitor.rb
138
- - vendor/fssm/lib/fssm/path.rb
139
- - vendor/fssm/lib/fssm/pathname.rb
140
- - vendor/fssm/lib/fssm/state/directory.rb
141
- - vendor/fssm/lib/fssm/state/file.rb
142
- - vendor/fssm/lib/fssm/support.rb
143
- - vendor/fssm/lib/fssm/tree.rb
144
- - vendor/fssm/profile/prof-cache.rb
145
- - vendor/fssm/profile/prof-fssm-pathname.html
146
- - vendor/fssm/profile/prof-pathname.rb
147
- - vendor/fssm/profile/prof-plain-pathname.html
148
- - vendor/fssm/profile/prof.html
149
- - vendor/fssm/spec/path_spec.rb
150
- - vendor/fssm/spec/root/duck/quack.txt
151
- - vendor/fssm/spec/root/file.css
152
- - vendor/fssm/spec/root/file.rb
153
- - vendor/fssm/spec/root/file.yml
154
- - vendor/fssm/spec/root/moo/cow.txt
155
- - vendor/fssm/spec/spec_helper.rb
156
126
  - bin/css2sass
157
127
  - bin/haml
158
128
  - bin/html2haml
@@ -187,10 +157,6 @@ files:
187
157
  - test/haml/results/tag_parsing.xhtml
188
158
  - test/haml/results/very_basic.xhtml
189
159
  - test/haml/results/whitespace_handling.xhtml
190
- - test/haml/spec/README.md
191
- - test/haml/spec/lua_haml_spec.lua
192
- - test/haml/spec/ruby_haml_test.rb
193
- - test/haml/spec/tests.json
194
160
  - test/haml/template_test.rb
195
161
  - test/haml/util_test.rb
196
162
  - test/haml/templates/_av_partial_1.haml
@@ -349,7 +315,6 @@ test_files:
349
315
  - test/haml/engine_test.rb
350
316
  - test/haml/helper_test.rb
351
317
  - test/haml/html2haml_test.rb
352
- - test/haml/spec/ruby_haml_test.rb
353
318
  - test/haml/template_test.rb
354
319
  - test/haml/util_test.rb
355
320
  - test/haml/spec_test.rb
@@ -1,97 +0,0 @@
1
- # Haml Spec #
2
-
3
- Haml Spec provides a basic suite of tests for Haml interpreters.
4
-
5
- It is intented for developers who are creating or maintaining an implementation
6
- of the [Haml](http://haml-lang.com) markup language.
7
-
8
- At the moment, there are test runners for the [original Haml](http://github.com/nex3/haml)
9
- in Ruby, and for [Lua Haml](http://github.com/norman/lua-haml). Support for
10
- other versions of Haml will be added if their developers/maintainers
11
- are interested in using it.
12
-
13
- ## The Tests ##
14
-
15
- The tests are kept in JSON format for portability across languages. Each test
16
- is a JSON object with expected input, output, local variables and configuration
17
- parameters (see below). The test suite only provides tests for features which
18
- are portable, therefore no tests for script are provided, nor for external
19
- filters such as :markdown or :textile.
20
-
21
- The one major exception to this are the tests for interpolation, which you may
22
- need to modify with a regular expression to run under PHP or Perl, which
23
- require a symbol before variable names. These tests are included despite being
24
- less than 100% portable because interpolation is an important part of Haml and
25
- can be tricky to implement.
26
-
27
- ## Running the Tests ##
28
-
29
- ### Ruby ###
30
-
31
- In order to make it as easy as possible for non-Ruby programmers to run the
32
- Ruby Haml tests, the Ruby test runner uses test/unit, rather than something
33
- fancier like Rspec. To run them you probably only need to install `haml`, and
34
- possibly `ruby` if your platform doesn't come with it by default. If you're
35
- using Ruby 1.8.x, you'll also need to install `json`:
36
-
37
- sudo gem install haml
38
- # for Ruby 1.8.x; check using "ruby --version" if unsure
39
- sudo gem install json
40
-
41
- Then, running the Ruby test suite is easy:
42
-
43
- ruby ruby_haml_test.rb
44
-
45
- ### Lua ###
46
-
47
- The Lua test depends on [Telescope](http://telescope.luaforge.net/),
48
- [jason4lua](http://json.luaforge.net/), and
49
- [Lua Haml](http://github.com/norman/lua-haml). Install and
50
- run `tsc lua_haml_spec.lua`.
51
-
52
- ## Contributing ##
53
-
54
- ### Getting it ###
55
-
56
- You can access the [Git repository](http://github.com/norman/haml-spec) at:
57
-
58
- git://github.com/norman/haml-spec.git
59
-
60
- Patches are *very* welcome, as are test runners for your Haml implementation.
61
-
62
- As long as any test you add run against Ruby Haml and are not redundant, I'll
63
- be very happy to add them.
64
-
65
- ### Test JSON format ###
66
-
67
- "test name" : {
68
- "haml" : "haml input",
69
- "html" : "expected html output",
70
- "result" : "expected test result",
71
- "locals" : "local vars",
72
- "config" : "config params"
73
- }
74
-
75
- * test name: This should be a *very* brief description of what's being tested. It can
76
- be used by the test runners to name test methods, or to exclude certain tests from being
77
- run.
78
- * haml: The Haml code to be evaluated. Always required.
79
- * html: The HTML output that should be generated. Required unless "result" is "error".
80
- * result: Can be "pass" or "error". If it's absent, then "pass" is assumed. If it's "error",
81
- then the goal of the test is to make sure that malformed Haml code generates an error.
82
- * locals: An object containing local variables needed for the test.
83
- * config: An object containing configuration parameters used to run the test.
84
- The configuration parameters should be usable directly by Ruby's Haml with no
85
- modification. If your implementation uses config parameters with different
86
- names, you may need to process them to make them match your implementation.
87
- If your implementation has options that do not exist in Ruby's Haml, then you
88
- should add tests for this in your implementation's test rather than here.
89
-
90
- ## License ##
91
-
92
- This project is released under the [WTFPL](http://sam.zoy.org/wtfpl/) in order
93
- to be as usable as possible in any project, commercial or free.
94
-
95
- ## Author ##
96
-
97
- [Norman Clarke](mailto:norman@njclarke.com)
@@ -1,30 +0,0 @@
1
- require 'luarocks.require'
2
- require 'json'
3
- require 'telescope'
4
- require 'haml'
5
-
6
- local function get_tests(filename)
7
- local self = debug.getinfo(1).short_src
8
- if self:match("/") then return "./" .. self:gsub("[^/]*%.lua$", "/" .. filename)
9
- elseif self:match("\\") then return self:gsub("[^\\]*%.lua$", "\\" .. filename)
10
- else return filename
11
- end
12
- end
13
-
14
- local fh = assert(io.open(get_tests("tests.json")))
15
- local input = fh:read '*a'
16
- fh:close()
17
-
18
- local contexts = json.decode(input)
19
-
20
- describe("LuaHaml", function()
21
- for context, expectations in pairs(contexts) do
22
- describe("When handling " .. context, function()
23
- for name, exp in pairs(expectations) do
24
- it(string.format("should correctly render %s", name), function()
25
- assert_equal(haml.render(exp.haml, exp.config or {}, exp.locals or {}), exp.html)
26
- end)
27
- end
28
- end)
29
- end
30
- end)
@@ -1,19 +0,0 @@
1
- require "test/unit"
2
- require "json"
3
- require "haml"
4
-
5
- class HamlTest < Test::Unit::TestCase
6
- contexts = JSON.parse(File.read(File.dirname(__FILE__) + "/tests.json"))
7
- contexts.each do |context|
8
- context[1].each do |name, test|
9
- class_eval(<<-EOTEST)
10
- def test_#{name.gsub(/\s+|[^a-zA-Z0-9_]/, "_")}
11
- locals = Hash[*(#{test}["locals"] || {}).collect {|k, v| [k.to_sym, v] }.flatten]
12
- options = Hash[*(#{test}["config"] || {}).collect {|k, v| [k.to_sym, v.to_sym] }.flatten]
13
- engine = Haml::Engine.new(#{test}["haml"], options)
14
- assert_equal(engine.render(Object.new, locals).chomp, #{test}["html"])
15
- end
16
- EOTEST
17
- end
18
- end
19
- end