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

Leading space after sections being ignored #89

Closed
neocotic opened this Issue Mar 15, 2012 · 3 comments

Comments

Projects
None yet
1 participant
@neocotic
Member

neocotic commented Mar 15, 2012

When you enter Template like:

{#shorten}{url}{/shorten} » {title}

The space after shortened URL gets deleted.

Best regards.

Ticket: #3

This appears to be a problem with the library used to render templates ignoring the first leading space after a template. I'm not sure why they're doing this but I'll look at the results of not ignoring it and try to get a fix together for today's 1.0.6 release.

@ghost ghost assigned neocotic Mar 15, 2012

@neocotic

This comment has been minimized.

Show comment
Hide comment
@neocotic

neocotic Mar 15, 2012

Member

The fix appears to be a simple change to a single regular expression;

mustache.js:194

// "\\s*([\\s\\S]*)$",
   "([\\s\\S]*)$",

I've just done a few tests and appears to do exactly what you'd expect. I'm not sure why mustache.js does this intentionally though.

Member

neocotic commented Mar 15, 2012

The fix appears to be a simple change to a single regular expression;

mustache.js:194

// "\\s*([\\s\\S]*)$",
   "([\\s\\S]*)$",

I've just done a few tests and appears to do exactly what you'd expect. I'm not sure why mustache.js does this intentionally though.

@neocotic

This comment has been minimized.

Show comment
Hide comment
@neocotic

neocotic Mar 15, 2012

Member

This appears to be working great with this fix so I'll include this in 1.0.6.

Member

neocotic commented Mar 15, 2012

This appears to be working great with this fix so I'll include this in 1.0.6.

@neocotic neocotic closed this Mar 15, 2012

@neocotic

This comment has been minimized.

Show comment
Hide comment
@neocotic

neocotic Mar 15, 2012

Member

I thought it would be worth noting that only the first leading whitespace character is preserved, all others are dropped.

I believe this quirk existed in order to make writing templates easier/neater.

Member

neocotic commented Mar 15, 2012

I thought it would be worth noting that only the first leading whitespace character is preserved, all others are dropped.

I believe this quirk existed in order to make writing templates easier/neater.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment