css_parser 1.11.0 → 1.13.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 351dd37c4f67732bcc07deb8d86c00ff6d15931787a3c08880ee8b4321fdf27e
4
- data.tar.gz: bc830e26b6b15e06af401f0a1e9abed835e2deec34cd2986c428baca1d51d18b
3
+ metadata.gz: 9bad6c42b4f2fbda14292b503c3f381ea4b3a9a4b77c74dd44da724866237901
4
+ data.tar.gz: 0b47ed4ef7d197a5552af3a99db42b89a8937cca205c7b6cf865cfb930d2d265
5
5
  SHA512:
6
- metadata.gz: 0013771da7b78cf5f9ef4edb4af039a535d4b9e8709d68808159a27df9f6d76649f6976f4bbecace5773e5b7b1d1fc3e3a7afbd85be267765d5beee2ac565877
7
- data.tar.gz: 7ef404fe368409bb2951764e232b2364522b76a5c72f171c4560f5ba70a3c51b0d149709a9e4777ae2bc8049241358b6b382005fdc18298ea0d8b24085476a15
6
+ metadata.gz: e91f481e093e423b873fcfd673bda8337645b066a7c278bea28175f8e11d94d9ac1dc401fc7defa1f8afca11d9125f7007aa8c12e1a4410351511f6e876bf593
7
+ data.tar.gz: 0fd7db359a459575bc2b7f08b5d6f86d5d78c58247af82db87884e5a1e10e768f9f3f0247abf2d491ebf30c9df8ec623fd65c8c51bf089fa29eba9cf75a9d9ac
@@ -39,6 +39,7 @@ module CssParser
39
39
  @options = {absolute_paths: false,
40
40
  import: true,
41
41
  io_exceptions: true,
42
+ rule_set_exceptions: true,
42
43
  capture_offsets: false}.merge(options)
43
44
 
44
45
  # array of RuleSets
@@ -167,6 +168,8 @@ module CssParser
167
168
  def add_rule!(selectors, declarations, media_types = :all)
168
169
  rule_set = RuleSet.new(selectors, declarations)
169
170
  add_rule_set!(rule_set, media_types)
171
+ rescue ArgumentError => e
172
+ raise e if @options[:rule_set_exceptions]
170
173
  end
171
174
 
172
175
  # Add a CSS rule by setting the +selectors+, +declarations+, +filename+, +offset+ and +media_types+.
@@ -8,10 +8,10 @@ module CssParser
8
8
  # :stopdoc:
9
9
  # Base types
10
10
  RE_NL = Regexp.new('(\n|\r\n|\r|\f)')
11
- RE_NON_ASCII = Regexp.new('([\x00-\xFF])', Regexp::IGNORECASE, 'n') # [^\0-\177]
12
- RE_UNICODE = Regexp.new('(\\\\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])*)', Regexp::IGNORECASE | Regexp::EXTENDED | Regexp::MULTILINE, 'n')
11
+ RE_NON_ASCII = Regexp.new('([\x00-\xFF])', Regexp::IGNORECASE | Regexp::NOENCODING) # [^\0-\177]
12
+ RE_UNICODE = Regexp.new('(\\\\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])*)', Regexp::IGNORECASE | Regexp::EXTENDED | Regexp::MULTILINE | Regexp::NOENCODING)
13
13
  RE_ESCAPE = Regexp.union(RE_UNICODE, '|(\\\\[^\n\r\f0-9a-f])')
14
- RE_IDENT = Regexp.new("[\-]?([_a-z]|#{RE_NON_ASCII}|#{RE_ESCAPE})([_a-z0-9\-]|#{RE_NON_ASCII}|#{RE_ESCAPE})*", Regexp::IGNORECASE, 'n')
14
+ RE_IDENT = Regexp.new("[\-]?([_a-z]|#{RE_NON_ASCII}|#{RE_ESCAPE})([_a-z0-9\-]|#{RE_NON_ASCII}|#{RE_ESCAPE})*", Regexp::IGNORECASE | Regexp::NOENCODING)
15
15
 
16
16
  # General strings
17
17
  RE_STRING1 = /("(.[^\n\r\f"]*|\\#{RE_NL}|#{RE_ESCAPE})*")/.freeze
@@ -93,6 +93,8 @@ module CssParser
93
93
  else
94
94
  declarations[property] = Value.new(value)
95
95
  end
96
+ rescue ArgumentError => e
97
+ raise e.exception, "#{property} #{e.message}"
96
98
  end
97
99
  alias add_declaration! []=
98
100
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CssParser
4
- VERSION = '1.11.0'.freeze
4
+ VERSION = '1.13.0'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: css_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.0
4
+ version: 1.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Dunae
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-14 00:00:00.000000000 Z
11
+ date: 2022-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -163,14 +163,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
- version: '2.4'
166
+ version: '2.7'
167
167
  required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  requirements:
169
169
  - - ">="
170
170
  - !ruby/object:Gem::Version
171
171
  version: '0'
172
172
  requirements: []
173
- rubygems_version: 3.2.16
173
+ rubygems_version: 3.1.6
174
174
  signing_key:
175
175
  specification_version: 4
176
176
  summary: Ruby CSS parser.