Skip to content

Commit

Permalink
Fixes #1520
Browse files Browse the repository at this point in the history
  • Loading branch information
erwanlr committed Jul 18, 2020
1 parent 981bcf5 commit cba6e74
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/theme.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def parse_style
#
# @return [ String ]
def parse_style_tag(body, tag)
value = body[/#{Regexp.escape(tag)}:[\t ]*([^\r\n*]+)/i, 1]
value = body[/\b#{Regexp.escape(tag)}:[\t ]*([^\r\n*]+)/, 1]

value && !value.strip.empty? ? value.strip : nil
end
Expand Down
6 changes: 6 additions & 0 deletions spec/app/models/theme_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@
its(:style_uri) { should eql 'http://www.elegantthemes.com/gallery/divi/' }
its(:license_uri) { should eql 'http://www.gnu.org/licenses/gpl-2.0.html' }
end

context 'when no tags' do
let(:fixture) { fixtures.join('no_tags.css') }

its(:author) { should eql nil }
end
end

describe '#version' do
Expand Down
3 changes: 3 additions & 0 deletions spec/fixtures/models/theme/no_tags.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
comment-author:before,.comment-author:after,.widget-area:before,.widget-area:after,.widget:before,.widget:after {
/* Some style */
}

0 comments on commit cba6e74

Please sign in to comment.