Skip to content
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

Add support for class="class1 class2" #289

Merged
merged 1 commit into from
Jun 19, 2018

Conversation

anga
Copy link
Contributor

@anga anga commented Jun 19, 2018

This is not a final code, but works. It use regex create to split with space (\s+). Should we split by any other character?

with this, you can now do class="class1 class2 class3" without problem.

Maybe I can update attach_class and not create a similar new one, don't know what you think.

EDIT: Maybe use lazy_static! to build the regexp object to prevent build it every time?

@anga anga changed the title Add support for classess with space Add support for class="class1 class2" with space Jun 19, 2018
@anga anga changed the title Add support for class="class1 class2" with space Add support for class="class1 class2" Jun 19, 2018
@therustmonk
Copy link
Member

@anga I've improved this PR if you don't mind:

  1. regex dependency has removed (used split_whitespace builtin) to reduce size of compiled apps and have better performance
  2. Add information to CHANGELOG.md
  3. Add support of any types compatible with AsRef<str>
  4. Cover all of them with tests

@anga
Copy link
Contributor Author

anga commented Jun 19, 2018

@deniskolodin of course not. Thanks for review this. I agree 100% with your changes, I forgot about split_whitespace method for example

@therustmonk
Copy link
Member

Great! Thank you for this PR! I'm starting to merge it 🎉

@therustmonk
Copy link
Member

bors r+

bors bot added a commit that referenced this pull request Jun 19, 2018
289: Add support for class="class1 class2" r=DenisKolodin a=anga

This is not a final code, but works. It use regex create to split with space (`\s+`). Should we split by any other character?

with this, you can now do `class="class1 class2       class3"` without problem.

Maybe I can update `attach_class` and not create a similar new one, don't know what you think.

**EDIT:** Maybe use `lazy_static!` to build the regexp object to prevent build it every time?

Co-authored-by: anga <andres.b.dev@gmail.com>
@bors
Copy link
Contributor

bors bot commented Jun 19, 2018

Build succeeded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants