css_parser 1.3.0 → 1.3.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.
- data/lib/css_parser/regexps.rb +7 -7
- data/lib/css_parser/rule_set.rb +7 -1
- metadata +3 -3
data/lib/css_parser/regexps.rb
CHANGED
@@ -22,17 +22,17 @@ module CssParser
|
|
22
22
|
|
23
23
|
RE_URI = Regexp.new('(url\([\s]*([\s]*' + RE_STRING.to_s + '[\s]*)[\s]*\))|(url\([\s]*([!#$%&*\-~]|' + RE_NON_ASCII.to_s + '|' + RE_ESCAPE.to_s + ')*[\s]*)\)', Regexp::IGNORECASE | Regexp::EXTENDED | Regexp::MULTILINE, 'n')
|
24
24
|
URI_RX = /url\(("([^"]*)"|'([^']*)'|([^)]*))\)/im
|
25
|
-
RE_GRADIENT = /[a-z
|
25
|
+
RE_GRADIENT = /[-a-z]*gradient\([-a-z0-9 .,#%()]*\)/im
|
26
26
|
|
27
27
|
# Initial parsing
|
28
28
|
RE_AT_IMPORT_RULE = /\@import[\s]+(url\()?["''"]?(.[^'"\s"']*)["''"]?\)?([\w\s\,^\])]*)\)?;?/
|
29
|
-
|
29
|
+
|
30
30
|
#--
|
31
31
|
#RE_AT_MEDIA_RULE = Regexp.new('(\"(.[^\n\r\f\\"]*|\\\\' + RE_NL.to_s + '|' + RE_ESCAPE.to_s + ')*\")')
|
32
|
-
|
32
|
+
|
33
33
|
#RE_AT_IMPORT_RULE = Regexp.new('@import[\s]*(' + RE_STRING.to_s + ')([\w\s\,]*)[;]?', Regexp::IGNORECASE) -- should handle url() even though it is not allowed
|
34
34
|
#++
|
35
|
-
IMPORTANT_IN_PROPERTY_RX = /[\s]*!important[\s]*/i
|
35
|
+
IMPORTANT_IN_PROPERTY_RX = /[\s]*!important\b[\s]*/i
|
36
36
|
|
37
37
|
RE_INSIDE_OUTSIDE = regex_possible_values 'inside', 'outside'
|
38
38
|
RE_SCROLL_FIXED = regex_possible_values 'scroll', 'fixed'
|
@@ -52,8 +52,8 @@ module CssParser
|
|
52
52
|
FONT_UNITS_RX = /(([x]+\-)*small|medium|large[r]*|auto|inherit|([0-9]+|[0-9]*\.[0-9]+)(e[mx]+|px|[cm]+m|p[tc+]|in|\%)*)/i
|
53
53
|
RE_BORDER_STYLE = /([\s]*^)?(none|hidden|dotted|dashed|solid|double|dot-dash|dot-dot-dash|wave|groove|ridge|inset|outset)([\s]*$)?/imx
|
54
54
|
RE_BORDER_UNITS = Regexp.union(BOX_MODEL_UNITS_RX, /(thin|medium|thick)/i)
|
55
|
-
|
56
|
-
|
55
|
+
|
56
|
+
|
57
57
|
# Patterns for specificity calculations
|
58
58
|
NON_ID_ATTRIBUTES_AND_PSEUDO_CLASSES_RX= /
|
59
59
|
(\.[\w]+) # classes
|
@@ -75,7 +75,7 @@ module CssParser
|
|
75
75
|
/ix
|
76
76
|
ELEMENTS_AND_PSEUDO_ELEMENTS_RX = /
|
77
77
|
((^|[\s\+\>\~]+)[\w]+ # elements
|
78
|
-
|
|
78
|
+
|
|
79
79
|
\:{1,2}( # pseudo-elements
|
80
80
|
after|before
|
81
81
|
|first-letter|first-line
|
data/lib/css_parser/rule_set.rb
CHANGED
@@ -466,11 +466,17 @@ module CssParser
|
|
466
466
|
|
467
467
|
block.gsub!(/(^[\s]*)|([\s]*$)/, '')
|
468
468
|
|
469
|
+
continuation = ''
|
469
470
|
block.split(/[\;$]+/m).each do |decs|
|
470
|
-
|
471
|
+
decs = continuation + decs
|
472
|
+
if decs =~ /\([^)]*\Z/ # if it has an unmatched parenthesis
|
473
|
+
continuation = decs + ';'
|
474
|
+
|
475
|
+
elsif matches = decs.match(/(.[^:]*)\s*:\s*(.+)(;?\s*\Z)/i)
|
471
476
|
property, value, end_of_declaration = matches.captures
|
472
477
|
|
473
478
|
add_declaration!(property, value)
|
479
|
+
continuation = ''
|
474
480
|
end
|
475
481
|
end
|
476
482
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: css_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -52,7 +52,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
52
52
|
version: '0'
|
53
53
|
segments:
|
54
54
|
- 0
|
55
|
-
hash:
|
55
|
+
hash: -3236645012416092950
|
56
56
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
57
|
none: false
|
58
58
|
requirements:
|
@@ -61,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
61
|
version: '0'
|
62
62
|
segments:
|
63
63
|
- 0
|
64
|
-
hash:
|
64
|
+
hash: -3236645012416092950
|
65
65
|
requirements: []
|
66
66
|
rubyforge_project:
|
67
67
|
rubygems_version: 1.8.25
|