css_parser 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +9 -29
- data/LICENSE +18 -39
- data/README +8 -10
- data/lib/css_parser/rule_set.rb +4 -5
- metadata +3 -3
data/CHANGELOG
CHANGED
@@ -1,33 +1,13 @@
|
|
1
|
-
|
1
|
+
=== Ruby CSS Parser CHANGELOG
|
2
2
|
|
3
|
-
|
4
|
-
*
|
5
|
-
|
3
|
+
==== Version 0.9.1
|
4
|
+
* Fixed RuleSet#declaration_to_s so it would respect <tt>!important</tt>
|
5
|
+
rules (thanks to Dana - http://github.com/DanaDanger)
|
6
6
|
|
7
|
-
|
8
|
-
*
|
9
|
-
* incremental parsing improvements
|
7
|
+
==== Version 0.9
|
8
|
+
* Initial version forked from Premailer project
|
10
9
|
|
11
|
-
|
12
|
-
*
|
13
|
-
*
|
14
|
-
* preliminary support for shorthand CSS properties (<tt>margin</tt>, <tt>padding</tt>)
|
15
|
-
* preliminary separation of CSS parser
|
16
|
-
|
17
|
-
== Version 1.2
|
18
|
-
* respect <tt>LINK</tt> media types
|
19
|
-
* better style folding
|
20
|
-
* incremental parsing improvements
|
21
|
-
|
22
|
-
== Version 1.3
|
23
|
-
* separate CSS parser into its own library
|
24
|
-
* handle <tt>background: red url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVR42mP4%2F58BAAT%2FAf9jgNErAAAAAElFTkSuQmCC);</tt>
|
25
|
-
* preserve <tt>:hover</tt> etc... in head styles
|
26
|
-
|
27
|
-
== TODO: Future
|
28
|
-
* respect <tt>@media</tt> rule (http://www.w3.org/TR/CSS21/media.html#at-media-rule)
|
29
|
-
* complete shorthand properties support (<tt>border-width</tt>, <tt>font</tt>, <tt>background</tt>)
|
30
|
-
* better quote escaping
|
31
|
-
* UTF-8 and other charsets (test page: http://kianga.kcore.de/2004/09/21/utf8_test)
|
32
|
-
* make warnings for <tt>border</tt> match <tt>border-left</tt>, etc...
|
10
|
+
==== TODO: Future
|
11
|
+
* border shorthand/folding support
|
12
|
+
* re-implement caching on CssParser.merge
|
33
13
|
* correctly parse http://www.webstandards.org/files/acid2/test.html
|
data/LICENSE
CHANGED
@@ -1,42 +1,21 @@
|
|
1
|
-
|
1
|
+
=== Ruby CSS Parser License
|
2
2
|
|
3
3
|
Copyright (c) 2007 Alex Dunae
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
c) rename any non-standard executables so the names do not conflict
|
24
|
-
with standard executables, which must also be provided.
|
25
|
-
|
26
|
-
d) make other distribution arrangements with the author.
|
27
|
-
|
28
|
-
3. You may modify and include the part of the software into any other
|
29
|
-
software (possibly commercial) as long as clear acknowledgement and
|
30
|
-
a link back to the original software (http://code.dunae.ca/premailer.web/)
|
31
|
-
is provided.
|
32
|
-
|
33
|
-
5. The scripts and library files supplied as input to or produced as
|
34
|
-
output from the software do not automatically fall under the
|
35
|
-
copyright of the software, but belong to whomever generated them,
|
36
|
-
and may be sold commercially, and may be aggregated with this
|
37
|
-
software.
|
38
|
-
|
39
|
-
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
40
|
-
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
41
|
-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
42
|
-
PURPOSE.
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
|
1
|
+
=== Ruby CSS Parser
|
2
2
|
|
3
3
|
Load, parse and cascade CSS rule sets in Ruby.
|
4
4
|
|
5
|
-
|
5
|
+
==== Setup
|
6
6
|
|
7
7
|
Install the gem from RubyGems.
|
8
8
|
|
@@ -10,7 +10,7 @@ Install the gem from RubyGems.
|
|
10
10
|
|
11
11
|
Done.
|
12
12
|
|
13
|
-
|
13
|
+
==== An example
|
14
14
|
require 'css_parser'
|
15
15
|
include CssParser
|
16
16
|
|
@@ -41,7 +41,7 @@ Done.
|
|
41
41
|
=> #content { font-size: 13px; line-height: 1.2; }
|
42
42
|
body { margin: 0 1em; }
|
43
43
|
|
44
|
-
|
44
|
+
==== Testing
|
45
45
|
|
46
46
|
You can run the suite of unit tests using <tt>rake test</tt>.
|
47
47
|
|
@@ -49,12 +49,10 @@ The download/import tests require that WEBrick is installed. The tests set up
|
|
49
49
|
a temporary server on port 12000 and pull down files from the <tt>test/fixtures/</tt>
|
50
50
|
directory.
|
51
51
|
|
52
|
-
|
52
|
+
==== Credits and code
|
53
53
|
|
54
|
-
|
55
|
-
* Source: http://code.dunae.ca/svn/css_parser/
|
56
|
-
* Docs: http://code.dunae.ca/css_parser/doc/
|
54
|
+
By Alex Dunae (dunae.ca, e-mail 'code' at the same domain), 2007-08.
|
57
55
|
|
58
|
-
|
56
|
+
Thanks to Dana (http://github.com/DanaDanger) for the 0.9.1 update.
|
59
57
|
|
60
|
-
Made
|
58
|
+
Made on Vancouver Island.
|
data/lib/css_parser/rule_set.rb
CHANGED
@@ -84,14 +84,13 @@ module CssParser
|
|
84
84
|
end
|
85
85
|
|
86
86
|
# Return all declarations as a string.
|
87
|
-
#--
|
88
|
-
# TODO: Clean-up regexp doesn't seem to work
|
89
|
-
#++
|
90
87
|
def declarations_to_s(options = {})
|
91
88
|
options = {:force_important => false}.merge(options)
|
92
89
|
str = ''
|
93
|
-
|
94
|
-
|
90
|
+
each_declaration do |prop, val, is_important|
|
91
|
+
importance = (options[:force_important] || is_important) ? ' !important' : ''
|
92
|
+
str += "#{prop}: #{val}#{importance}; "
|
93
|
+
end
|
95
94
|
str.gsub(/^[\s]+|[\n\r\f\t]*|[\s]+$/mx, '').strip
|
96
95
|
end
|
97
96
|
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.2
|
3
3
|
specification_version: 1
|
4
4
|
name: css_parser
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.9.
|
7
|
-
date:
|
6
|
+
version: 0.9.1
|
7
|
+
date: 2008-11-12 00:00:00 -08:00
|
8
8
|
summary: A set of classes for parsing CSS.
|
9
9
|
require_paths:
|
10
10
|
- lib
|