-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hyphenate attributes with certain prefixes #737
base: main
Are you sure you want to change the base?
Conversation
Pull Request Test Coverage Report for Build 12352593687Details
💛 - Coveralls |
Co-authored-by: François Freitag <mail@franek.fr>
def render_tag(tag, attrs=None, content=None, close=True): | ||
"""Render an HTML tag.""" | ||
prefixes = get_bootstrap_setting("hyphenate_attribute_prefixes") or [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not specifying should result in the default value being used.
prefixes = get_bootstrap_setting("hyphenate_attribute_prefixes") or [] | |
prefixes = get_bootstrap_setting("hyphenate_attribute_prefixes") or ["data"] |
if attrs: | ||
for attr_name, attr_value in copy(attrs).items(): | ||
if has_prefix(attr_name, prefixes): | ||
attrs[hyphenate(attr_name)] = attr_value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe error out or warn if the hyphenate key already exists?
Co-authored-by: François Freitag <mail@franek.fr>
Co-authored-by: François Freitag <mail@franek.fr>
Just as a reference, there’s a discussion about offering a method to pass attributes with hyphens on Django forums: |
No description provided.