Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a fix for #3 where using a variable more than once isn't replaced. The solution to this is to use javascript's global replace functionality, which requires using a regex with a global flag for finding the substring. I've added in a helper function from stack overflow to make sure that special characters in the variable are escaped. I've also pretty much rewritten the replaceAttributes function so it's a lot more readable (sorry, that's mostly personal preference since I can't understand comma operator statements to save my life).
Let me know if there's anything you'd like me to tweak to make it easier to add this to your project!
This is a great helper to me, since it's simple and does the job! Thanks!