css_parser 1.15.0 → 1.16.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 91aaa83da45a315177fda1bff179f8a313c46f441e378c66b8cc95d6d5808c68
4
- data.tar.gz: 25db2114f5bcc9fd310ca5ccdfed5f47a87ec22098cc1b16754c1f824569a7db
3
+ metadata.gz: 36f35091b57e726d3e9b528b6f3357232343c075af962f61a402f2bb111aadd1
4
+ data.tar.gz: ee8dbf61a3a6f396e8d383f0334cfee91ad483b192bfbffb4e5c5d9294f89859
5
5
  SHA512:
6
- metadata.gz: 7be87bf3530120ca4c9277973c7a945af18441ed3d574ff52cff4c0547787197d0b59a724af64b1b186366326db464c0afd0139c8489dee8b171980e77707c21
7
- data.tar.gz: a2e590d95594aeac08604b4b0591979c6c91d81fe785e46c573f84b4e3bfab8aa7b050d12799309223c2ca58fef40f49a79a0db62124c1924a079769f725b596
6
+ metadata.gz: ba19471cdbeed2daf719a2e1b238bff145bd748abbc760b64cd5ba40ba3e0ed03de8f6550b44b114bcbdbd577cd415b8f5c609def6c53a25699d3ca71f6e06d7
7
+ data.tar.gz: 72d71760da086f403c0d404c97d6bd6476e330376b56ce91b8ebfc51cdd27fc89932a066397b38799c15fb9f9a8a8b625d30728656dc0e8cfc24ec61a168e8e7
@@ -329,7 +329,7 @@ module CssParser
329
329
  rule_start = nil
330
330
  offset = nil
331
331
 
332
- block.scan(/\s+|\\{2,}|\\?[{}\s"]|.[^\s"{}\\]*/) do |token|
332
+ block.scan(/\s+|\\{2,}|\\?[{}\s"]|[()]|.[^\s"{}()\\]*/) do |token|
333
333
  # save the regex offset so that we know where in the file we are
334
334
  offset = Regexp.last_match.offset(0) if options[:capture_offsets]
335
335
 
@@ -391,7 +391,16 @@ module CssParser
391
391
  current_media_query = String.new
392
392
  else
393
393
  token.strip!
394
- current_media_query << token << ' '
394
+ # special-case the ( and ) tokens to remove inner-whitespace
395
+ # (eg we'd prefer '(width: 500px)' to '( width: 500px )' )
396
+ case token
397
+ when '('
398
+ current_media_query << token
399
+ when ')'
400
+ current_media_query.sub!(/ ?$/, token)
401
+ else
402
+ current_media_query << token << ' '
403
+ end
395
404
  end
396
405
  elsif in_charset or token =~ /@charset/i
397
406
  # iterate until we are out of the charset declaration
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CssParser
4
- VERSION = '1.15.0'.freeze
4
+ VERSION = '1.16.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.15.0
4
+ version: 1.16.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: 2023-08-29 00:00:00.000000000 Z
11
+ date: 2023-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable