haml-edge 2.1.34 → 2.1.35

Sign up to get free protection for your applications and to get access to all the features.
data/EDGE_GEM_VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.34
1
+ 2.1.35
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2006-2008 Hampton Catlin
1
+ Copyright (c) 2006-2009 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -11,24 +11,34 @@ and providing elegant, easily understandable, and powerful syntax.
11
11
 
12
12
  ## Using
13
13
 
14
- There are several ways to use Haml and Sass.
15
- They can be used as a plugin for Rails or Merb,
16
- or embedded on their own in other applications.
17
- The first step of all of these is to install the Haml gem:
14
+ Haml and Sass can be used from the command line
15
+ or as part of a Ruby web framework.
16
+ The first step is to install the gem:
18
17
 
19
18
  gem install haml
20
19
 
20
+ After you convert some HTML to Haml or some CSS to Sass,
21
+ you can run
22
+
23
+ haml document.haml
24
+ sass style.sass
25
+
26
+ to compile them.
27
+ For more information on these commands, check out
28
+
29
+ haml --help
30
+ sass --help
31
+
21
32
  To install Haml and Sass as a Rails plugin,
22
33
  just run `haml --rails path/to/rails/app`
23
34
  and both Haml and Sass will be installed.
24
- Views with the `.haml` (or `.html.haml` for edge)
25
- extension will automatically use Haml.
35
+ Views with the `.html.haml` extension will automatically use Haml.
26
36
  Sass is a little more complicated;
27
- `.sass` files should be placed in public/stylesheets/sass,
37
+ `.sass` files should be placed in `public/stylesheets/sass`,
28
38
  where they'll be automatically compiled
29
- to corresponding CSS files in public/stylesheets when needed
39
+ to corresponding CSS files in `public/stylesheets` when needed
30
40
  (the Sass template directory is customizable...
31
- see the Sass module docs for details).
41
+ see [the Sass reference](http://sass-lang.com/docs/yardoc/SASS_REFERENCE.md.html#template_location-option) for details).
32
42
 
33
43
  For Merb, `.html.haml` views will work without any further modification.
34
44
  To enable Sass, you also need to add a dependency.
@@ -36,11 +46,11 @@ To do so, just add
36
46
 
37
47
  dependency "merb-haml"
38
48
 
39
- to config/dependencies.rb (or config/init.rb in a flat/very flat Merb application).
49
+ to `config/dependencies.rb` (or `config/init.rb` in a flat/very flat Merb application).
40
50
  Then it'll work just like it does in Rails.
41
51
 
42
52
  To use Haml and Sass programatically,
43
- check out the RDocs for the Haml and Sass modules.
53
+ check out the [YARD documentation](http://haml-lang.com/docs/yardoc).
44
54
 
45
55
  ## Formatting
46
56
 
@@ -302,26 +312,27 @@ See `css2sass --help` for further information and options.
302
312
 
303
313
  ## Authors
304
314
 
305
- Haml and Sass are designed by Hampton Catlin (hcatlin) and he is the author
306
- of the original implementation. However, Hampton doesn't even know his way
307
- around the code anymore and mostly just concentrates on the language issues.
308
- Hampton lives in Toronto, Ontario (though he's an American by birth) and
309
- is a partner at Unspace Interactive.
310
-
311
- Nathan Weizenbaum is the primary maintainer and architect of the "modern" Ruby
312
- implementation of Haml. His hard work has kept the project alive by endlessly
313
- answering forum posts, fixing bugs, refactoring, finding speed improvements,
314
- writing documentation, implementing new features, and getting Hampton
315
- coffee (a fitting task for a boy-genius). Nathan lives in Seattle, Washington and
316
- while not being a student at University of Washington he consults for
317
- Unspace Interactive and Microsoft.
318
-
319
- Chris Eppstein is a core contributor to Sass and the creator of Compass, the first
320
- Sass-based framework. Chris focuses on making Sass more powerful, easy to use, and
321
- on ways to speed its adoption through the web development community. Chris lives in
322
- San Jose, CA with his wife and daughter. He is the Software Architect for Caring.com,
323
- a website devoted to the 34 Million caregivers whose parents are sick or elderly,
324
- that uses Haml and Sass.
315
+ Haml and Sass were created by [Hampton Catlin](http://hamptoncatlin.com)
316
+ (hcatlin) and he is the author of the original implementation. However, Hampton
317
+ doesn't even know his way around the code anymore and now occasionally consults
318
+ on the language issues. Hampton lives in Jacksonville, Florida and is the lead
319
+ mobile developer for Wikimedia.
320
+
321
+ [Nathan Weizenbaum](http://nex-3.com) is the primary developer and architect of
322
+ the "modern" Ruby implementation of Haml. His hard work has kept the project
323
+ alive by endlessly answering forum posts, fixing bugs, refactoring, finding
324
+ speed improvements, writing documentation, implementing new features, and
325
+ getting Hampton coffee (a fitting task for a boy-genius). Nathan lives in
326
+ Seattle, Washington and while not being a student at the University of
327
+ Washington or working at an internship, he consults for Unspace Interactive.
328
+
329
+ [Chris Eppstein](http://acts-as-architect.blogspot.com) is a core contributor to
330
+ Sass and the creator of Compass, the first Sass-based framework. Chris focuses
331
+ on making Sass more powerful, easy to use, and on ways to speed its adoption
332
+ through the web development community. Chris lives in San Jose, California with
333
+ his wife and daughter. He is the Software Architect for
334
+ [Caring.com](http://caring.com), a website devoted to the 34 Million caregivers
335
+ whose parents are sick or elderly, that uses Haml and Sass.
325
336
 
326
337
  If you use this software, you must pay Hampton a compliment. And
327
338
  buy Nathan some jelly beans. Maybe pet a kitten. Yeah. Pet that kitty.
data/Rakefile CHANGED
@@ -81,6 +81,8 @@ task :release => [:package] do
81
81
  end
82
82
 
83
83
  task :release_edge do
84
+ puts "#{'=' * 50} Running rake release_edge"
85
+
84
86
  sh %{git checkout edge-gem}
85
87
  sh %{git reset --hard origin/edge-gem}
86
88
  sh %{git merge origin/master}
@@ -153,11 +155,12 @@ rescue LoadError
153
155
  end
154
156
 
155
157
  task :pages do
158
+ puts "#{'=' * 50} Running rake proj PROJ=#{ENV["PROJ"].inspect}"
156
159
  raise 'No ENV["PROJ"]!' unless proj = ENV["PROJ"]
157
160
  sh %{git checkout #{proj}-pages}
158
161
  sh %{git reset --hard origin/#{proj}-pages}
159
162
 
160
- sh %{staticmatic build .}
163
+ sh %{rake build --trace}
161
164
  sh %{rsync -av --delete site/ /var/www/#{proj}-pages}
162
165
  end
163
166
 
@@ -246,15 +249,20 @@ end
246
249
  # ----- Handling Updates -----
247
250
 
248
251
  task :handle_update do
252
+ puts
253
+ puts
254
+ puts '=' * 150
255
+ puts "Running rake REF=#{ENV["REF"].inspect}"
256
+
249
257
  sh %{git checkout master}
250
258
  sh %{git fetch origin}
251
259
  sh %{git reset --hard origin/master}
252
260
 
253
261
  begin
254
262
  if ENV["REF"] == "refs/heads/master"
255
- sh %{rake release_edge}
263
+ sh %{rake release_edge --trace}
256
264
  elsif ENV["REF"] =~ %r{^refs/heads/(haml|sass)-pages$}
257
- sh %{rake pages PROJ=#{$1}}
265
+ sh %{rake pages --trace PROJ=#{$1}}
258
266
  end
259
267
  ensure
260
268
  sh %{git reset --hard HEAD}
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.34
1
+ 2.1.35
@@ -6,5 +6,5 @@ set :environment, :production
6
6
  Dir.chdir(File.dirname(__FILE__) + "/..")
7
7
 
8
8
  post "/" do
9
- system %{rake handle_update REF=#{JSON.parse(params["payload"])["ref"].inspect}}
9
+ system %{rake handle_update --trace REF=#{JSON.parse(params["payload"])["ref"].inspect}}
10
10
  end
data/lib/haml/exec.rb CHANGED
@@ -87,10 +87,10 @@ module Haml
87
87
  def process_result
88
88
  input, output = @options[:input], @options[:output]
89
89
  input_file, output_file = if input
90
- [nil, open_file(ARGV[0], 'w')]
90
+ [nil, open_file(@args[0], 'w')]
91
91
  else
92
- @options[:filename] = ARGV[0]
93
- [open_file(ARGV[0]), open_file(ARGV[1], 'w')]
92
+ @options[:filename] = @args[0]
93
+ [open_file(@args[0]), open_file(@args[1], 'w')]
94
94
  end
95
95
 
96
96
  input ||= input_file
data/lib/sass/css.rb CHANGED
@@ -181,13 +181,26 @@ module Sass
181
181
  #
182
182
  # @param re [Regexp] The regular expression to assert
183
183
  def assert_match(re)
184
- if !@template.scan(re)
185
- line = @template.string[0..@template.pos].count "\n"
186
- # Display basic regexps as plain old strings
187
- expected = re.source == Regexp.escape(re.source) ? "\"#{re.source}\"" : re.inspect
188
- raise Exception.new("Invalid CSS on line #{line}: expected #{expected}")
184
+ if @template.scan(re)
185
+ whitespace
186
+ return
189
187
  end
190
- whitespace
188
+
189
+ line = @template.string[0..@template.pos].count "\n"
190
+ pos = @template.pos
191
+
192
+ after = @template.string[pos - 15...pos]
193
+ after = "..." + after if pos >= 15
194
+
195
+ # Display basic regexps as plain old strings
196
+ expected = re.source == Regexp.escape(re.source) ? "\"#{re.source}\"" : re.inspect
197
+
198
+ was = @template.rest[0...15]
199
+ was += "..." if @template.rest.size >= 15
200
+ raise Exception.new(<<MESSAGE)
201
+ Invalid CSS on line #{line + 1} after #{after.inspect}:
202
+ expected #{expected}, was #{was.inspect}
203
+ MESSAGE
191
204
  end
192
205
 
193
206
  # Transform
data/lib/sass/engine.rb CHANGED
@@ -170,7 +170,10 @@ module Sass
170
170
  lines = []
171
171
  string.gsub(/\r|\n|\r\n|\r\n/, "\n").scan(/^.*?$/).each_with_index do |line, index|
172
172
  index += (@options[:line] || 1)
173
- next if line.strip.empty?
173
+ if line.strip.empty?
174
+ lines.last.text << "\n" if lines.last && lines.last.comment?
175
+ next
176
+ end
174
177
 
175
178
  line_tab_str = line[/^\s*/]
176
179
  unless line_tab_str.empty?
@@ -310,7 +313,7 @@ END
310
313
  when MIXIN_DEFINITION_CHAR
311
314
  parse_mixin_definition(line)
312
315
  when MIXIN_INCLUDE_CHAR
313
- if line.text[1].nil?
316
+ if line.text[1].nil? || line.text[1] == ?\s
314
317
  Tree::RuleNode.new(line.text)
315
318
  else
316
319
  parse_mixin_include(line, root)
@@ -50,9 +50,13 @@ module Sass::Tree
50
50
  def to_s(tabs = 0, _ = nil)
51
51
  return if invisible?
52
52
 
53
+ content = (value.split("\n") + lines.map {|l| l.text})
54
+ content.map! {|l| (l.empty? ? "" : " ") + l}
55
+ content.first.gsub!(/^ /, '')
56
+ content.last.gsub!(%r{ ?\*/ *$}, '')
57
+
53
58
  spaces = ' ' * (tabs - 1)
54
- spaces + "/* " + (value.split("\n") + lines.map {|l| l.text}).
55
- map{|l| l.sub(%r{ ?\*/ *$},'')}.join(style == :compact ? ' ' : "\n#{spaces} * ") + " */"
59
+ spaces + "/* " + content.join(style == :compact ? '' : "\n#{spaces} *") + " */"
56
60
  end
57
61
 
58
62
  # Returns `true` if this is a silent comment
@@ -130,7 +130,9 @@ module Sass
130
130
  result << child_str + (style == :compressed ? '' : "\n")
131
131
  end
132
132
  end
133
- style == :compressed ? result+"\n" : result[0...-1]
133
+ result.rstrip!
134
+ return "" if result.empty?
135
+ return result + "\n"
134
136
  rescue Sass::SyntaxError => e; e.add_metadata(filename, line)
135
137
  end
136
138
 
@@ -186,8 +186,8 @@ SASS
186
186
  end
187
187
 
188
188
  def test_css_import
189
- assert_equal("@import url(./fonts.css) screen;", render("@import url(./fonts.css) screen"))
190
- assert_equal("@import \"./fonts.css\" screen;", render("@import \"./fonts.css\" screen"))
189
+ assert_equal("@import url(./fonts.css) screen;\n", render("@import url(./fonts.css) screen"))
190
+ assert_equal("@import \"./fonts.css\" screen;\n", render("@import \"./fonts.css\" screen"))
191
191
  end
192
192
 
193
193
  def test_sass_import
@@ -273,7 +273,7 @@ SASS
273
273
  end
274
274
 
275
275
  def test_directive
276
- assert_equal("@a b;", render("@a b"))
276
+ assert_equal("@a b;\n", render("@a b"))
277
277
 
278
278
  assert_equal("@a {\n b: c; }\n", render("@a\n :b c"))
279
279
  assert_equal("@a { b: c; }\n", render("@a\n :b c", :style => :compact))
@@ -759,6 +759,30 @@ CSS
759
759
  SASS
760
760
  end
761
761
 
762
+ def test_plus_with_space
763
+ assert_equal(<<CSS, render(<<SASS))
764
+ a + b {
765
+ color: green; }
766
+ CSS
767
+ a
768
+ + b
769
+ color: green
770
+ SASS
771
+ end
772
+
773
+ def test_empty_line_comment
774
+ assert_equal(<<CSS, render(<<SASS))
775
+ /* Foo
776
+ *
777
+ * Bar */
778
+ CSS
779
+ /*
780
+ Foo
781
+
782
+ Bar
783
+ SASS
784
+ end
785
+
762
786
  private
763
787
 
764
788
  def render(sass, options = {})
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.1.34
4
+ version: 2.1.35
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: 2009-06-19 00:00:00 -04:00
13
+ date: 2009-06-25 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies: []
16
16
 
@@ -24,8 +24,8 @@ executables:
24
24
  extensions: []
25
25
 
26
26
  extra_rdoc_files:
27
- - MIT-LICENSE
28
27
  - README.md
28
+ - MIT-LICENSE
29
29
  - VERSION
30
30
  - REVISION
31
31
  - EDGE_GEM_VERSION
@@ -79,7 +79,6 @@ files:
79
79
  - lib/sass/script/unary_operation.rb
80
80
  - lib/sass/script/variable.rb
81
81
  - lib/sass/tree
82
- - lib/sass/tree/node.rb
83
82
  - lib/sass/tree/comment_node.rb
84
83
  - lib/sass/tree/debug_node.rb
85
84
  - lib/sass/tree/directive_node.rb
@@ -88,10 +87,11 @@ files:
88
87
  - lib/sass/tree/if_node.rb
89
88
  - lib/sass/tree/mixin_def_node.rb
90
89
  - lib/sass/tree/mixin_node.rb
90
+ - lib/sass/tree/node.rb
91
+ - lib/sass/tree/prop_node.rb
91
92
  - lib/sass/tree/rule_node.rb
92
93
  - lib/sass/tree/variable_node.rb
93
94
  - lib/sass/tree/while_node.rb
94
- - lib/sass/tree/prop_node.rb
95
95
  - bin/css2sass
96
96
  - bin/haml
97
97
  - bin/html2haml
@@ -227,8 +227,8 @@ files:
227
227
  - extra/update_watch.rb
228
228
  - Rakefile
229
229
  - init.rb
230
- - MIT-LICENSE
231
230
  - README.md
231
+ - MIT-LICENSE
232
232
  - VERSION
233
233
  - REVISION
234
234
  - EDGE_GEM_VERSION