crass 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +8 -5
- data/HISTORY.md +15 -0
- data/LICENSE +1 -1
- data/README.md +0 -22
- data/crass.gemspec +8 -2
- data/lib/crass/tokenizer.rb +32 -13
- data/lib/crass/version.rb +1 -1
- metadata +9 -66
- data/test/css-parsing-tests/An+B.json +0 -156
- data/test/css-parsing-tests/LICENSE +0 -8
- data/test/css-parsing-tests/README.rst +0 -301
- data/test/css-parsing-tests/color3.json +0 -142
- data/test/css-parsing-tests/color3_hsl.json +0 -3890
- data/test/css-parsing-tests/color3_keywords.json +0 -803
- data/test/css-parsing-tests/component_value_list.json +0 -432
- data/test/css-parsing-tests/declaration_list.json +0 -44
- data/test/css-parsing-tests/make_color3_hsl.py +0 -17
- data/test/css-parsing-tests/make_color3_keywords.py +0 -191
- data/test/css-parsing-tests/one_component_value.json +0 -27
- data/test/css-parsing-tests/one_declaration.json +0 -46
- data/test/css-parsing-tests/one_rule.json +0 -36
- data/test/css-parsing-tests/rule_list.json +0 -48
- data/test/css-parsing-tests/stylesheet.json +0 -44
- data/test/css-parsing-tests/stylesheet_bytes.json +0 -146
- data/test/shared/parse_rules.rb +0 -463
- data/test/support/common.rb +0 -170
- data/test/support/serialization/animate.css +0 -3158
- data/test/support/serialization/bootstrap-theme.css +0 -384
- data/test/support/serialization/bootstrap.css +0 -6805
- data/test/support/serialization/html5-boilerplate.css +0 -268
- data/test/support/serialization/misc.css +0 -9
- data/test/support/serialization/pure.css +0 -1662
- data/test/test_crass.rb +0 -31
- data/test/test_css_parsing_tests.rb +0 -150
- data/test/test_parse_properties.rb +0 -310
- data/test/test_parse_rules.rb +0 -17
- data/test/test_parse_stylesheet.rb +0 -17
- data/test/test_serialization.rb +0 -71
data/test/test_parse_rules.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require_relative 'support/common'
|
4
|
-
require_relative 'shared/parse_rules'
|
5
|
-
|
6
|
-
describe 'Crass::Parser' do
|
7
|
-
make_my_diffs_pretty!
|
8
|
-
parallelize_me!
|
9
|
-
|
10
|
-
describe '#parse_rules' do
|
11
|
-
def parse(*args)
|
12
|
-
CP.parse_rules(*args)
|
13
|
-
end
|
14
|
-
|
15
|
-
behaves_like 'parsing a list of rules'
|
16
|
-
end
|
17
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require_relative 'support/common'
|
4
|
-
require_relative 'shared/parse_rules'
|
5
|
-
|
6
|
-
describe 'Crass::Parser' do
|
7
|
-
make_my_diffs_pretty!
|
8
|
-
parallelize_me!
|
9
|
-
|
10
|
-
describe '#parse_stylesheet' do
|
11
|
-
def parse(*args)
|
12
|
-
CP.parse_stylesheet(*args)
|
13
|
-
end
|
14
|
-
|
15
|
-
behaves_like 'parsing a list of rules'
|
16
|
-
end
|
17
|
-
end
|
data/test/test_serialization.rb
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require_relative 'support/common'
|
3
|
-
|
4
|
-
describe 'Serialization' do
|
5
|
-
make_my_diffs_pretty!
|
6
|
-
parallelize_me!
|
7
|
-
|
8
|
-
# Parse a bunch of real-world CSS and make sure it's the same when we
|
9
|
-
# serialize it.
|
10
|
-
Dir[File.join(File.dirname(__FILE__), 'support/serialization/*.css')].each do |filepath|
|
11
|
-
it "should parse and serialize #{filepath}" do
|
12
|
-
input = File.read(filepath)
|
13
|
-
|
14
|
-
tree = Crass.parse(input,
|
15
|
-
:preserve_comments => true,
|
16
|
-
:preserve_hacks => true)
|
17
|
-
|
18
|
-
assert_equal(input, CP.stringify(tree))
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
# -- Regression tests --------------------------------------------------------
|
23
|
-
it "should not omit a trailing semicolon when serializing a `@charset` rule" do
|
24
|
-
css = '@charset "utf-8";'
|
25
|
-
tree = Crass.parse(css)
|
26
|
-
|
27
|
-
assert_equal(css, CP.stringify(tree))
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should reflect modifications made to the block of an `:at_rule`" do
|
31
|
-
tree = Crass.parse(%[
|
32
|
-
@media (screen) {
|
33
|
-
.froggy { color: green; }
|
34
|
-
.piggy { color: pink; }
|
35
|
-
}
|
36
|
-
].strip)
|
37
|
-
|
38
|
-
tree[0][:block] = Crass::Parser.parse_rules(".piggy { color: pink; }")
|
39
|
-
|
40
|
-
assert_equal(
|
41
|
-
"@media (screen) {.piggy { color: pink; }}",
|
42
|
-
Crass::Parser.stringify(tree)
|
43
|
-
)
|
44
|
-
end
|
45
|
-
|
46
|
-
it "should serialize a @page rule" do
|
47
|
-
css = %[
|
48
|
-
@page { margin: 2cm }
|
49
|
-
|
50
|
-
@page :right {
|
51
|
-
@top-center { content: "Preliminary edition" }
|
52
|
-
@bottom-center { content: counter(page) }
|
53
|
-
}
|
54
|
-
|
55
|
-
@page {
|
56
|
-
size: 8.5in 11in;
|
57
|
-
margin: 10%;
|
58
|
-
|
59
|
-
@top-left {
|
60
|
-
content: "Hamlet";
|
61
|
-
}
|
62
|
-
@top-right {
|
63
|
-
content: "Page " counter(page);
|
64
|
-
}
|
65
|
-
}
|
66
|
-
].strip
|
67
|
-
|
68
|
-
tree = Crass.parse(css)
|
69
|
-
assert_equal(css, Crass::Parser.stringify(tree))
|
70
|
-
end
|
71
|
-
end
|