-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Pattern builder #1538
Pattern builder #1538
Conversation
It intrigues me that the build failed despite the fact that I only changed some comments... It seems like the |
Now it worked again. |
Travis does weird stuff sometimes. I wouldn't worry too much about it. |
This is just an idea for now but with ES6 tagged template literals we could make a function const foo = /\bfoo\b/;
Prism.regex`\w\s${foo}\s`; // returns /\w\s(?:\bfoo\b)/
// instead of
Prism.patterns.build(/\w\s<<0>>/, [foo]); There a few drawbacks ( Edit: Flags can be declared using |
Closed in favor of #2190. |
This PR is an implementation of #1476.
I decided to make a new namespace
Prism.patterns
(*hint* *hint* #1494) to keep things organized becausebuild
doesn't really belong in any of the other namespaces.The validation method of the base pattern and replacements is located in a new file called
tests/helper/prism-core-tester.js
.This file's purpose is to add testing functionality to existing Prism methods only when running
npm test
. This has the following advantages:prism-core.js
stays small but still validates on all tested components.Maybe we should make this a resource (#1539)?
Btw. This and #1537 go together really well.