-
Notifications
You must be signed in to change notification settings - Fork 5
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
Output content format is strange #2
Comments
And another issue:
will produce:
but NOT:
As you see, the newline character is missing, I think it should keep the original format. |
I read your source code, and find the root cause for the second problem, it is because a
the prefix newline character is dropped, I don't quite understand your design intention about this, could you please do some explanation? Thanks, |
The mustache standard has a lot to say on handling newlines: https://github.com/mustache/spec/blob/v1.0.2/specs/sections.yml#L135 So, a fully compliant mustache implementation will change whitespace in some circumstances. Also, mustache.el isn't perfectly compliant with the specification yet. However, removing the
This example is from the specification: https://github.com/mustache/spec/blob/v1.0.2/specs/sections.yml#L155 That being said, mustache.el is clearly doing the wrong thing here. I tested python-mustache (a fully compliant implementation), and it renders your second example to "AA\n BB" as expected. I'll try to fix this when I can. I need to read the specification again to understand how we should treat whitespace. |
Thanks for your reply, waiting for your great solution solving this~~ :-D |
OK, this should now all work according to the spec. Your examples now give the output expected. Let me know if you find any other issues. |
Yeah, thanks for your great work, it works well now, except a little defect, let's take the following example:
the output is:
As you see, the last line only contains a condition validation close tag, according to this spec(https://github.com/mustache/spec/blob/v1.0.2/specs/sections.yml#L155), this line should be removed also. However, this does not affect much, but I am a perfactionist, so if this issue is smooth to fix, please help fix it, thanks very much~~ :-D |
Hi,
When I am using
mustache.el
to render templates, I find something strange, let's take the code snippets below as example:the output is:
what I expect is that the output should be consistent with the original format:
no more extra spaces before
<CC />
and the last line.I don't know if this is an issue, or there is something, maybe a switch, can change the behavior.
Thanks,
Kelvin
The text was updated successfully, but these errors were encountered: