Skip to content

Commit

Permalink
Merge pull request premailer#158 from stoivo/v2-remove-deprecation
Browse files Browse the repository at this point in the history
V2 remove deprecation
  • Loading branch information
grosser committed May 28, 2024
2 parents 6b3cca7 + 935308c commit faab4cb
Show file tree
Hide file tree
Showing 13 changed files with 450 additions and 525 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ gem 'rake'
gem 'rubocop'
gem 'rubocop-rake'
gem 'webrick'

gem 'debug', '~> 1.9', platforms: [:mri, :mingw, :x64_mingw]
24 changes: 23 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ PATH
specs:
css_parser (1.18.0)
addressable
crass (~> 1.0)

GEM
remote: https://rubygems.org/
Expand All @@ -12,6 +13,16 @@ GEM
ast (2.4.2)
benchmark-ips (2.13.0)
bump (0.10.0)
crass (1.0.6)
debug (1.9.2)
irb (~> 1.10)
reline (>= 0.3.8)
io-console (0.7.2)
io-console (0.7.2-java)
irb (1.13.1)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
jar-dependencies (0.4.1)
json (2.7.2)
json (2.7.2-java)
language_server-protocol (3.17.0.3)
Expand All @@ -23,12 +34,20 @@ GEM
parser (3.3.0.5)
ast (~> 2.4.1)
racc
psych (5.1.2)
stringio
psych (5.1.2-java)
jar-dependencies (>= 0.1.7)
public_suffix (5.0.5)
racc (1.7.3)
racc (1.7.3-java)
rainbow (3.1.1)
rake (13.2.1)
rdoc (6.6.3.1)
psych (>= 4.0.0)
regexp_parser (2.9.0)
reline (0.5.7)
io-console (~> 0.5)
rexml (3.2.6)
rubocop (1.62.1)
json (~> 2.3)
Expand All @@ -46,17 +65,20 @@ GEM
rubocop-rake (0.6.0)
rubocop (~> 1.0)
ruby-progressbar (1.13.0)
stringio (3.1.0)
unicode-display_width (2.5.0)
webrick (1.8.1)

PLATFORMS
arm64-darwin-22
java
ruby
x86_64-linux

DEPENDENCIES
benchmark-ips
bump
css_parser!
debug (~> 1.9)
maxitest
memory_profiler
rake
Expand Down
3 changes: 2 additions & 1 deletion css_parser.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ Gem::Specification.new name, CssParser::VERSION do |s|
s.metadata['bug_tracker_uri'] = 'https://github.com/premailer/css_parser/issues'
s.metadata['rubygems_mfa_required'] = 'true'

s.add_runtime_dependency 'addressable'
s.add_dependency 'addressable'
s.add_dependency 'crass', '~> 1.0'
end
7 changes: 6 additions & 1 deletion lib/css_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@
require 'zlib'
require 'stringio'
require 'iconv' unless String.method_defined?(:encode)
require 'crass'

require 'css_parser/version'
require 'css_parser/rule_set'
require 'css_parser/rule_set/declarations'
require 'css_parser/regexps'
require 'css_parser/parser'

module CssParser
class Error < StandardError; end
class EmptyValueError < Error; end

# Merge multiple CSS RuleSets by cascading according to the CSS 2.1 cascading rules
# (http://www.w3.org/TR/REC-CSS2/cascade.html#cascading-order).
#
Expand Down Expand Up @@ -89,7 +94,7 @@ def self.merge(*rule_sets)
end
end

merged = properties.each_with_object(RuleSet.new(nil, nil)) do |(property, details), rule_set|
merged = properties.each_with_object(RuleSet.new) do |(property, details), rule_set|
value = details[:value].strip
rule_set[property.strip] = details[:is_important] ? "#{value.gsub(/;\Z/, '')}!important" : value
end
Expand Down
Loading

0 comments on commit faab4cb

Please sign in to comment.