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

Leading space after sections being ignored #89

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

Leading space after sections being ignored #89

neocotic opened this issue Mar 15, 2012 · 3 comments
Assignees
Labels
Milestone

Comments

@neocotic
Copy link
Member

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
Copy link
Member Author

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
Copy link
Member Author

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

@neocotic
Copy link
Member Author

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
Labels
Projects
None yet
Development

No branches or pull requests

1 participant