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

Fix the output of format (whitespace-only) blocks inside inline partials #557

Merged
merged 1 commit into from
Mar 11, 2015

Conversation

sethkinast
Copy link
Contributor

Closes #556

@@ -233,7 +233,7 @@
},

format: function(context, node) {
return '.w(' + escape(node[1] + node[2]) + ')';
return '.w(' + escape(node[1]) + ')';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really hate that our parser gives us things like node[0] and node[1] instead of node.body and node.lineNo. Tornado...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's done for perf... (supposedly)

@smfoote
Copy link
Contributor

smfoote commented Mar 10, 2015

Looks good to me.

@jimmyhchan
Copy link
Contributor

looks good + 1

…als.

When whitespace compression is on, format blocks are optimized away.
When whitespace compression is off, format blocks are usually coerced into buffers.
But if there are no buffers (which is basically only possible within an inline partial, since you're not going to compile a template that's a bunch of newlines and nothing else), we visit `compiler.nodes.format`, which didn't get updated as part of linkedin#531 since it's such an edge case.

Closes linkedin#556
prashn64 added a commit that referenced this pull request Mar 11, 2015
Fix the output of format (whitespace-only) blocks inside inline partials
@prashn64 prashn64 merged commit 0af1d54 into linkedin:master Mar 11, 2015
@sethkinast sethkinast deleted the fix-format branch March 11, 2015 02:04
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.

Dust.js has started outputting 'line,2 line,4 line,13 line,6' in weird places
4 participants