Created
January 6, 2012 04:01
-
-
Save Buildstarted/1568896 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<pre>@if(someBool){<text>output</text>}</pre> | |
<pre>@if(someBool){ | |
<text>output</text> | |
}</pre> | |
The above items create different output. | |
Specifically whitespace between { } is maintained when it shouldn't be on the second one. | |
The expected output for both statements should simply be "<pre>output</pre>". |
Perhaps, worth asking Andrew Nurse about it?
Yeah. Already did and he said it was by design to preserve whitespace for stuff like lists. The only way to get around it is to remove all whitespace which can result in ugly, hard to read html/code blocks :)
Lol, alternatively @(someBool ? "output" : "")
That's an alternative to the specific example of a boolean check but it affects any block level code such as for,foreach and so forth.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Absolutely it should ignore it. For instance: click here
That will result in a url that looks like: "/somepath? somevalue=whatever" - which is invalid and unacceptable. In addition to <pre></pre> being invalid as it will have tabs or spaces and line feeds is the second example is used.