-
Notifications
You must be signed in to change notification settings - Fork 28
Closed
Description
I'm setting up with reference to README.md,
https://github.com/Shopify/better-html#how-to-use
but when I run the test with RSpec, the following error is displayed.
ActionView::Template::Error:
Invalid attribute name "class" does not match regular expression "/\\A[a-zA-Z0-9\\-\\:\\_]+\\z/"
On line 1 column 5:
<div class="container-fluid" id="wrapper_container">
I've tried several things with reference to the code in the gem's configuration file, but it doesn't work.
https://github.com/Shopify/better-html/blob/d2e117d6e6d375edfc25a664b1d04e1db7d4931f/lib/better_html/config.rb
When checking the operation of regular expressions using Rubular, my notation seems to work without problems.
I develop with Docker.
OS: mac, BigSur
Ruby: 2.7.7
Rails: 6.1.7
erb_lint: 0.3.1
better_html: 2.0.1
My code is here.
Gemfile
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.7.7'
group :development, :test do
gem "better_html"
gem 'erb_lint', require: false
end
config/initializers/better_html.rb
BetterHtml.config = BetterHtml::Config.new(YAML.load(File.read("#{Rails.root}/.better-html.yml")))
.better-html
---
allow_single_quoted_attributes: true
allow_unquoted_attributes: false
partial_attribute_name_pattern: /\A[a-zA-Z0-9\-\:\_]+\z/
# pending
# partial_tag_name_pattern: /\A[a-z0-9\-\:\_]+\z/
Please let me know why it doesn't work and how to fix it.
thank you.
Metadata
Metadata
Assignees
Labels
No labels