Skip to content

Commit

Permalink
Merge branch 'master' of /home/nex3/code/haml
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed Jun 28, 2009
2 parents f1d849d + 01a3c1b commit ce9e6bf
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Rakefile
Expand Up @@ -261,6 +261,8 @@ task :handle_update do
begin
if ENV["REF"] == "refs/heads/master"
sh %{rake release_edge --trace}
sh %{rake pages --trace PROJ=haml}
sh %{rake pages --trace PROJ=sass}
elsif ENV["REF"] =~ %r{^refs/heads/(haml|sass)-pages$}
sh %{rake pages --trace PROJ=#{$1}}
end
Expand Down
8 changes: 8 additions & 0 deletions TODO
Expand Up @@ -11,6 +11,14 @@
** Haml
Figure out alternate attribute syntax
[2.4] Allow "!!! HTML5" to set :format => :html5 ?
How do we deal with partials?
[2.4] :ugly + :html improvements
Ignore closing tags where we can
http://code.google.com/speed/articles/optimizing-html.html
Requires Haml parsing refactor
Don't quote attributes that don't require it
http://www.w3.org/TR/REC-html40/intro/sgmltut.html#h-3.2.2
http://www.w3.org/TR/html5/syntax.html#attributes
** Sass
[2.4] CSS superset
[2.4] Classes are mixins
Expand Down
2 changes: 1 addition & 1 deletion lib/haml/util.rb
Expand Up @@ -15,7 +15,7 @@ module Util
# @param file [String] The filename relative to the Haml root
# @return [String] The filename relative to the the working directory
def scope(file)
File.expand_path File.join(File.dirname(__FILE__), '..', '..', file)
File.join(File.dirname(__FILE__), '..', '..', file)
end

# Converts an array of `[key, value]` pairs to a hash.
Expand Down
14 changes: 13 additions & 1 deletion lib/sass/css.rb
Expand Up @@ -118,7 +118,19 @@ def rules(root)
#
# @return [Tree::Node] The parsed rule
def rule
return unless rule = @template.scan(/[^\{\};]+/)
rule = ""
loop do
token = @template.scan(/(?:[^\{\};\/\s]|\/[^*])+/)
if token.nil?
return if rule.empty?
break
end
rule << token
break unless @template.match?(/\s|\/\*/)
whitespace
rule << " "
end

rule.strip!
directive = rule[0] == ?@

Expand Down
23 changes: 23 additions & 0 deletions test/sass/css2sass_test.rb
Expand Up @@ -207,6 +207,29 @@ def test_bad_formatting
CSS
end

def test_comments_in_selectors
assert_equal(<<SASS, css2sass(<<CSS))
.js
#location-navigation-form .form-submit, #business-listing-form .form-submit, #detailTabs ul, #detailsEnhanced #addTags, #locationSearchList, #moreHoods
display: none
#navListLeft
display: none
SASS
.js #location-navigation-form .form-submit,
.js #business-listing-form .form-submit,
.js #detailTabs ul,
/* .js #addReview, */
/* .js #addTags, */
.js #detailsEnhanced #addTags,
.js #locationSearchList,
.js #moreHoods,
#navListLeft
{ display: none; }
CSS
end

private

def css2sass(string, opts={})
Expand Down

0 comments on commit ce9e6bf

Please sign in to comment.