File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -616,7 +616,7 @@ def parse_declarations!(block) # :nodoc:
616
616
decs = ( continuation ? continuation + decs : decs )
617
617
if decs =~ /\( [^)]*\Z / # if it has an unmatched parenthesis
618
618
continuation = "#{ decs } ;"
619
- elsif ( matches = decs . match ( /\s *(.[^:]*)\s *:\s *(.+? )(?:;?\s *\Z )/i ) )
619
+ elsif ( matches = decs . match ( /\s *(.[^:]*)\s *:\s *(?m:(.+) )(?:;?\s *\Z )/i ) )
620
620
# skip end_of_declaration
621
621
property = matches [ 1 ]
622
622
value = matches [ 2 ]
Original file line number Diff line number Diff line change @@ -113,6 +113,26 @@ def test_ignoring_malformed_declarations
113
113
end
114
114
end
115
115
116
+ def test_multiline_declarations
117
+ css = <<-CSS
118
+ @font-face {
119
+ font-family: 'some_font';
120
+ src: url(https://example.com/font.woff2) format('woff2'),
121
+ url(https://example.com/font.woff) format('woff');
122
+ font-style: normal;
123
+ }
124
+ CSS
125
+
126
+ @cp . add_block! ( css )
127
+ @cp . each_selector do |selector , declarations , _spec |
128
+ assert_equal '@font-face' , selector
129
+ assert_equal "font-family: 'some_font'; " \
130
+ "src: url(https://example.com/font.woff2) format('woff2')," \
131
+ "url(https://example.com/font.woff) format('woff'); " \
132
+ "font-style: normal;" , declarations
133
+ end
134
+ end
135
+
116
136
def test_find_rule_sets
117
137
css = <<-CSS
118
138
h1, h2 { color: blue; }
You can’t perform that action at this time.
0 commit comments