Skip to content

Fix too eager templater reg exp #118

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

Conversation

FredericRuaudel
Copy link
Contributor

This pull request is fixing a simple bug that prevent the option to have two or more patterns without any spaces between them without having to add spaces inside the curly braces:

examples of pattern this PR solves:

"${num}/${total}"
"${value}${index}"
"${filename}.${ext}"
...

In the current code, it doesn't works because the genericPlaceholderPattern is too eager and split the patterns as one element (eg: ["${num}/${total}"] instead of ["${num}", "/", "${total}"]) then it changes the first value so we get only the equivalent of ${num} if we keep my last example.

And indeed, they all can be solved like this:

"${ num }/${ total }"
"${ value }${ index }"
"${ filename }.${ ext }"
...

but let's not limiting the options of your users ? 😉

thanks in advance!

@codecov
Copy link

codecov bot commented Aug 21, 2018

Codecov Report

Merging #118 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #118   +/-   ##
=======================================
  Coverage   95.58%   95.58%           
=======================================
  Files           6        6           
  Lines         249      249           
  Branches       75       75           
=======================================
  Hits          238      238           
  Misses         10       10           
  Partials        1        1
Impacted Files Coverage Δ
src/utils.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c7349e3...8f805ff. Read the comment docs.

@ryandrewjohnson ryandrewjohnson merged commit 21b039c into ryandrewjohnson:master Aug 23, 2018
@ryandrewjohnson
Copy link
Owner

ryandrewjohnson commented Aug 23, 2018

@FredericRuaudel Good catch! Thanks for the contribution 🎉

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.

2 participants