css_parser 0.9.0 → 0.9.1

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.
Files changed (5) hide show
  1. data/CHANGELOG +9 -29
  2. data/LICENSE +18 -39
  3. data/README +8 -10
  4. data/lib/css_parser/rule_set.rb +4 -5
  5. metadata +3 -3
data/CHANGELOG CHANGED
@@ -1,33 +1,13 @@
1
- = Premailer CHANGELOG
1
+ === Ruby CSS Parser CHANGELOG
2
2
 
3
- == Version 0.9
4
- * initial proof-of-concept
5
- * PHP web version
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
- == Version 1.0
8
- * ported web interface to eRuby
9
- * incremental parsing improvements
7
+ ==== Version 0.9
8
+ * Initial version forked from Premailer project
10
9
 
11
- == Version 1.1
12
- * proper calculation of selector specificity per CSS 2.1 spec
13
- * support for <tt>@import</tt>
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
- = CSS Parser License
1
+ === Ruby CSS Parser License
2
2
 
3
3
  Copyright (c) 2007 Alex Dunae
4
4
 
5
- Premailer is copyrighted free software by Alex Dunae (http://dunae.ca/).
6
- You can redistribute it and/or modify it under the conditions below:
7
-
8
- 1. You may make and give away verbatim copies of the source form of the
9
- software without restriction, provided that you duplicate all of the
10
- original copyright notices and associated disclaimers.
11
-
12
- 2. You may modify your copy of the software in any way, provided that
13
- you do at least ONE of the following:
14
-
15
- a) place your modifications in the Public Domain or otherwise
16
- make them Freely Available, such as by posting said
17
- modifications to the internet or an equivalent medium, or by
18
- allowing the author to include your modifications in the software.
19
-
20
- b) use the modified software only within your corporation or
21
- organization.
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
- = Ruby CSS Parser
1
+ === Ruby CSS Parser
2
2
 
3
3
  Load, parse and cascade CSS rule sets in Ruby.
4
4
 
5
- === Setup
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
- === An example
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
- === Testing
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
- === Credits and code
52
+ ==== Credits and code
53
53
 
54
- * Project page: http://code.dunae.ca/css_parser/
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
- By Alex Dunae (dunae.ca, e-mail 'code' at the same domain), 2007.
56
+ Thanks to Dana (http://github.com/DanaDanger) for the 0.9.1 update.
59
57
 
60
- Made with love on Vancouver Island.
58
+ Made on Vancouver Island.
@@ -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
- importance = options[:force_important] ? ' !important' : ''
94
- each_declaration { |prop, val| str += "#{prop}: #{val}#{importance}; " }
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.4
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.0
7
- date: 2007-11-19 00:00:00 -08:00
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