More bug fix for #379

This commit is contained in:
Ajay Bhargav Baaskaran 2015-05-20 12:50:30 -07:00
parent 0e296283f9
commit aaa14cd36b
4 changed files with 20 additions and 26 deletions

View File

@ -1048,6 +1048,8 @@ namespace Microsoft.AspNet.Razor.Parser
} }
tags.Clear(); tags.Clear();
if (!Context.DesignTimeMode) if (!Context.DesignTimeMode)
{
if (At(HtmlSymbolType.WhiteSpace))
{ {
if (Context.LastSpan.Kind == SpanKind.Transition) if (Context.LastSpan.Kind == SpanKind.Transition)
{ {
@ -1063,6 +1065,7 @@ namespace Microsoft.AspNet.Razor.Parser
{ {
AcceptWhile(HtmlSymbolType.WhiteSpace); AcceptWhile(HtmlSymbolType.WhiteSpace);
} }
}
if (!EndOfFile && CurrentSymbol.Type == HtmlSymbolType.NewLine) if (!EndOfFile && CurrentSymbol.Type == HtmlSymbolType.NewLine)
{ {

View File

@ -647,7 +647,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
), ),
new MarkupTagBlock( new MarkupTagBlock(
Factory.MarkupTransition("</text>").Accepts(AcceptedCharacters.None)), Factory.MarkupTransition("</text>").Accepts(AcceptedCharacters.None)),
Factory.Markup(Environment.NewLine).With(new StatementCodeGenerator()).Accepts(AcceptedCharacters.None) Factory.Markup(Environment.NewLine).Accepts(AcceptedCharacters.None)
), ),
Factory.Code($" }}{Environment.NewLine} if(!false) {{{Environment.NewLine}").AsStatement(), Factory.Code($" }}{Environment.NewLine} if(!false) {{{Environment.NewLine}").AsStatement(),
new MarkupBlock( new MarkupBlock(

View File

@ -49,12 +49,9 @@ namespace TestOutput
#line default #line default
#line hidden #line hidden
Instrumentation.EndContext(); Instrumentation.EndContext();
#line 3 "CodeBlockWithTextElement.cshtml" Instrumentation.BeginContext(80, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
#line default
#line hidden
#line 4 "CodeBlockWithTextElement.cshtml" #line 4 "CodeBlockWithTextElement.cshtml"
#line default #line default

View File

@ -81,15 +81,9 @@ namespace TestOutput
Instrumentation.EndContext(); Instrumentation.EndContext();
WriteAttribute("href", Tuple.Create(" href=\"", 387), Tuple.Create("\"", 442), Tuple.Create(Tuple.Create("", 394), Tuple.Create<System.Object, System.Int32>(Href("~/A+Really(Crazy),Url.Is:This/"), 394), false), WriteAttribute("href", Tuple.Create(" href=\"", 387), Tuple.Create("\"", 442), Tuple.Create(Tuple.Create("", 394), Tuple.Create<System.Object, System.Int32>(Href("~/A+Really(Crazy),Url.Is:This/"), 394), false),
Tuple.Create(Tuple.Create("", 424), Tuple.Create<System.Object, System.Int32>(product.id, 424), false), Tuple.Create(Tuple.Create("", 435), Tuple.Create("/Detail", 435), true)); Tuple.Create(Tuple.Create("", 424), Tuple.Create<System.Object, System.Int32>(product.id, 424), false), Tuple.Create(Tuple.Create("", 435), Tuple.Create("/Detail", 435), true));
Instrumentation.BeginContext(443, 21, true); Instrumentation.BeginContext(443, 23, true);
WriteLiteral(">Crazy Url!</a>\r\n "); WriteLiteral(">Crazy Url!</a>\r\n \r\n");
Instrumentation.EndContext(); Instrumentation.EndContext();
#line 12 "ResolveUrl.cshtml"
#line default
#line hidden
#line 13 "ResolveUrl.cshtml" #line 13 "ResolveUrl.cshtml"
#line default #line default