1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

[Sass] [SCSS] Make sure unicode is handled correctly under Ruby 1.9.

This commit is contained in:
Nathan Weizenbaum 2010-02-14 14:46:27 -08:00
parent 6a1f2450dd
commit d6c471bc46
2 changed files with 15 additions and 2 deletions

View file

@ -18,9 +18,14 @@ module Sass
H = /[0-9a-f]/i
NL = /\n|\r\n|\r|\f/
NONASCII = /[\200-\377]/
UNICODE = /\\#{H}{1,6}[ \t\r\n\f]?/
ESCAPE = /#{UNICODE}|\\[ -~\200-\377]/
s = if Haml::Util.ruby1_8?
'\200-\377'
else
'\u{80}-\u{D7FF}\u{E000}-\u{FFFD}\u{10000}-\u{10FFFF}'
end
NONASCII = /[#{s}]/
ESCAPE = /#{UNICODE}|\\[ -~#{s}]/
NMSTART = /[a-z]|#{NONASCII}|#{ESCAPE}/i
NMCHAR = /[a-z0-9_-]|#{NONASCII}|#{ESCAPE}/i
STRING1 = /\"((?:[^\n\r\f\\"]|\\#{NL}|#{ESCAPE})*)\"/

View file

@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require File.dirname(__FILE__) + '/test_helper'
require 'sass/scss/css_parser'
@ -48,6 +49,13 @@ baz {bar: baz}
SCSS
end
def test_unicode
assert_parses <<SCSS
foo {
bar: föö bâr; }
SCSS
end
def test_invisible_comments
assert_equal <<CSS, render(<<SCSS)
foo {