css_parser 1.21.0 → 1.22.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: c8880ebd6978e8a8a3108ea93b4d567252aee152b28f237dab31809f1488f42e
4
- data.tar.gz: 4e8379acf246b7fe2573a2ada4fc49c01e9c3b2de43fe80d07f42390f8f16450
3
+ metadata.gz: b67e47f563af5ce2fe5e26371810a6b546032c691289071c092ffc8c52ee2aa7
4
+ data.tar.gz: 40bc138ff5e63f022fddba80b08c847542508c1d925658917df756d8bd2135de
5
5
  SHA512:
6
- metadata.gz: 480947bb06a6c40ab955f76ff9eb7ba9ac5caf160d7fe343d16901e9f37210c9ccab22a07a4d3165ec26bec4cd28547f530718978d2d969ed398c8195351a0c0
7
- data.tar.gz: e7a757c9dc096e71d5f617343f0900bacddea42bef4b26ca68f2830728a480ace908807dc4db82b6b0b77a11c1b2c9295ad814bb2aaa80fd069c959cd58afe65
6
+ metadata.gz: 50447464b22d0af5c72c097bb3e37e05e6d0ace513e9d9cd6751b057f505c76130aecb98ce4f02b101b9424c6379c809c6fd94a5dda39a35d825e6e4961f3d13
7
+ data.tar.gz: d92c7583e8063a4ceebdd18ba7ab24f7ebb151c1ea0a4bd745767c5f2fe51dc0ee9981bdbbc997c53fb8a0ddde7ca335a3fb4b27de81d993b317fe347523cb27
@@ -448,7 +448,7 @@ module CssParser
448
448
  current_media_query << token << ' '
449
449
  end
450
450
  end
451
- elsif in_charset or token =~ /@charset/i
451
+ elsif in_charset or /@charset/i.match?(token)
452
452
  # iterate until we are out of the charset declaration
453
453
  in_charset = !token.include?(';')
454
454
  elsif !in_string && token.include?('}')
@@ -467,7 +467,7 @@ module CssParser
467
467
  current_selectors << token
468
468
 
469
469
  # mark this as the beginning of the selector unless we have already marked it
470
- rule_start = start_offset if options[:capture_offsets] && rule_start.nil? && token =~ /^[^\s]+$/
470
+ rule_start = start_offset if options[:capture_offsets] && rule_start.nil? && /^[^\s]+$/.match?(token)
471
471
  end
472
472
  end
473
473
 
@@ -648,7 +648,6 @@ module CssParser
648
648
  uri.port = 443 unless uri.port
649
649
  http = Net::HTTP.new(uri.host, uri.port)
650
650
  http.use_ssl = true
651
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
652
651
  else
653
652
  http = Net::HTTP.new(uri.host, uri.port)
654
653
  end
@@ -89,17 +89,20 @@ module CssParser
89
89
  # puts declarations['margin']
90
90
  # => #<CssParser::RuleSet::Declarations::Value:0x00000000030c1838 @important=true, @order=2, @value="0px auto">
91
91
  #
92
- # If the property already exists its value will be over-written.
92
+ # If the property already exists its value will be over-written unless it was !important and the new value
93
+ # is not !important.
93
94
  # If the value is empty - property will be deleted
94
95
  def []=(property, value)
95
96
  property = normalize_property(property)
97
+ currently_important = declarations[property]&.important
96
98
 
97
- if value.is_a?(Value)
99
+ if value.is_a?(Value) && (!currently_important || value.important)
98
100
  declarations[property] = value
99
101
  elsif value.to_s.strip.empty?
100
102
  delete property
101
103
  else
102
- declarations[property] = Value.new(value)
104
+ value = Value.new(value)
105
+ declarations[property] = value if !currently_important || value.important
103
106
  end
104
107
  rescue ArgumentError => e
105
108
  raise e.exception, "#{property} #{e.message}"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CssParser
4
- VERSION = '1.21.0'.freeze
4
+ VERSION = '1.22.0'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: css_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.21.0
4
+ version: 1.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Dunae
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-12-13 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: addressable
@@ -44,7 +43,6 @@ metadata:
44
43
  source_code_uri: https://github.com/premailer/css_parser
45
44
  bug_tracker_uri: https://github.com/premailer/css_parser/issues
46
45
  rubygems_mfa_required: 'true'
47
- post_install_message:
48
46
  rdoc_options: []
49
47
  require_paths:
50
48
  - lib
@@ -59,8 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
59
57
  - !ruby/object:Gem::Version
60
58
  version: '0'
61
59
  requirements: []
62
- rubygems_version: 3.4.19
63
- signing_key:
60
+ rubygems_version: 4.0.3
64
61
  specification_version: 4
65
62
  summary: Ruby CSS parser.
66
63
  test_files: []