[Fixes #739] Newline after text tag rendered only if followed by html
This commit is contained in:
parent
2950c87651
commit
9bfa74d829
|
|
@ -1100,29 +1100,31 @@ namespace Microsoft.AspNetCore.Razor.Parser
|
|||
tags.Clear();
|
||||
if (!Context.DesignTimeMode)
|
||||
{
|
||||
if (At(HtmlSymbolType.WhiteSpace))
|
||||
{
|
||||
if (Context.LastSpan.Kind == SpanKind.Transition)
|
||||
{
|
||||
// Output current span content as markup.
|
||||
Output(SpanKind.Markup);
|
||||
var shouldAcceptWhitespaceAndNewLine = true;
|
||||
|
||||
// Accept and mark the whitespace at the end of a <text> tag as code.
|
||||
AcceptWhile(HtmlSymbolType.WhiteSpace);
|
||||
Span.ChunkGenerator = new StatementChunkGenerator();
|
||||
Output(SpanKind.Code);
|
||||
}
|
||||
else
|
||||
if (Context.LastSpan.Kind == SpanKind.Transition)
|
||||
{
|
||||
var symbols = ReadWhile(
|
||||
f => (f.Type == HtmlSymbolType.WhiteSpace) || (f.Type == HtmlSymbolType.NewLine));
|
||||
|
||||
// Make sure the current symbol is not markup, which can be html start tag or @:
|
||||
if (!(At(HtmlSymbolType.OpenAngle) ||
|
||||
(At(HtmlSymbolType.Transition) && Lookahead(count: 1).Content.StartsWith(":"))))
|
||||
{
|
||||
AcceptWhile(HtmlSymbolType.WhiteSpace);
|
||||
// Don't accept whitespace as markup if the end text tag is followed by csharp.
|
||||
shouldAcceptWhitespaceAndNewLine = false;
|
||||
}
|
||||
|
||||
PutCurrentBack();
|
||||
PutBack(symbols);
|
||||
EnsureCurrent();
|
||||
}
|
||||
|
||||
if (!EndOfFile &&
|
||||
At(HtmlSymbolType.NewLine) &&
|
||||
Context.LastSpan.Kind != SpanKind.Transition)
|
||||
if (shouldAcceptWhitespaceAndNewLine)
|
||||
{
|
||||
AcceptAndMoveNext();
|
||||
// Accept whitespace and a single newline if present
|
||||
AcceptWhile(HtmlSymbolType.WhiteSpace);
|
||||
Optional(HtmlSymbolType.NewLine);
|
||||
}
|
||||
}
|
||||
else if (Span.EditHandler.AcceptedCharacters == AcceptedCharacters.Any)
|
||||
|
|
|
|||
|
|
@ -841,255 +841,239 @@ namespace Microsoft.AspNetCore.Razor.Test.Generator
|
|||
generatedAbsoluteIndex: 3432,
|
||||
generatedLineIndex: 95,
|
||||
generatedCharacterOffsetIndex: 61,
|
||||
contentLength: 1),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 605,
|
||||
documentLineIndex: 17,
|
||||
documentCharacterOffsetIndex: 63,
|
||||
generatedAbsoluteIndex: 3567,
|
||||
generatedLineIndex: 101,
|
||||
generatedCharacterOffsetIndex: 62,
|
||||
contentLength: 8),
|
||||
contentLength: 9),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 635,
|
||||
documentLineIndex: 17,
|
||||
documentCharacterOffsetIndex: 93,
|
||||
generatedAbsoluteIndex: 3738,
|
||||
generatedLineIndex: 107,
|
||||
generatedAbsoluteIndex: 3604,
|
||||
generatedLineIndex: 101,
|
||||
generatedCharacterOffsetIndex: 91,
|
||||
contentLength: 1),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 636,
|
||||
documentLineIndex: 17,
|
||||
documentCharacterOffsetIndex: 94,
|
||||
generatedAbsoluteIndex: 3903,
|
||||
generatedLineIndex: 113,
|
||||
generatedCharacterOffsetIndex: 92,
|
||||
contentLength: 1),
|
||||
contentLength: 2),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 641,
|
||||
documentLineIndex: 18,
|
||||
generatedAbsoluteIndex: 4130,
|
||||
generatedLineIndex: 121,
|
||||
generatedAbsoluteIndex: 3832,
|
||||
generatedLineIndex: 109,
|
||||
characterOffsetIndex: 0,
|
||||
contentLength: 15),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 161,
|
||||
documentLineIndex: 7,
|
||||
generatedAbsoluteIndex: 4341,
|
||||
generatedLineIndex: 128,
|
||||
generatedAbsoluteIndex: 4043,
|
||||
generatedLineIndex: 116,
|
||||
characterOffsetIndex: 32,
|
||||
contentLength: 12),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 767,
|
||||
documentLineIndex: 21,
|
||||
generatedAbsoluteIndex: 4424,
|
||||
generatedLineIndex: 133,
|
||||
generatedAbsoluteIndex: 4126,
|
||||
generatedLineIndex: 121,
|
||||
characterOffsetIndex: 0,
|
||||
contentLength: 12),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 781,
|
||||
documentLineIndex: 21,
|
||||
generatedAbsoluteIndex: 4522,
|
||||
generatedLineIndex: 139,
|
||||
generatedAbsoluteIndex: 4224,
|
||||
generatedLineIndex: 127,
|
||||
characterOffsetIndex: 14,
|
||||
contentLength: 21),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 834,
|
||||
documentLineIndex: 22,
|
||||
documentCharacterOffsetIndex: 29,
|
||||
generatedAbsoluteIndex: 4865,
|
||||
generatedLineIndex: 147,
|
||||
generatedAbsoluteIndex: 4567,
|
||||
generatedLineIndex: 135,
|
||||
generatedCharacterOffsetIndex: 42,
|
||||
contentLength: 1),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 835,
|
||||
documentLineIndex: 22,
|
||||
documentCharacterOffsetIndex: 30,
|
||||
generatedAbsoluteIndex: 4866,
|
||||
generatedLineIndex: 147,
|
||||
generatedAbsoluteIndex: 4568,
|
||||
generatedLineIndex: 135,
|
||||
generatedCharacterOffsetIndex: 43,
|
||||
contentLength: 7),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 842,
|
||||
documentLineIndex: 22,
|
||||
documentCharacterOffsetIndex: 37,
|
||||
generatedAbsoluteIndex: 4873,
|
||||
generatedLineIndex: 147,
|
||||
generatedAbsoluteIndex: 4575,
|
||||
generatedLineIndex: 135,
|
||||
generatedCharacterOffsetIndex: 50,
|
||||
contentLength: 1),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 709,
|
||||
documentLineIndex: 20,
|
||||
documentCharacterOffsetIndex: 39,
|
||||
generatedAbsoluteIndex: 5078,
|
||||
generatedLineIndex: 153,
|
||||
generatedAbsoluteIndex: 4780,
|
||||
generatedLineIndex: 141,
|
||||
generatedCharacterOffsetIndex: 38,
|
||||
contentLength: 23),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 732,
|
||||
documentLineIndex: 20,
|
||||
documentCharacterOffsetIndex: 62,
|
||||
generatedAbsoluteIndex: 5101,
|
||||
generatedLineIndex: 153,
|
||||
generatedAbsoluteIndex: 4803,
|
||||
generatedLineIndex: 141,
|
||||
generatedCharacterOffsetIndex: 61,
|
||||
contentLength: 7),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 974,
|
||||
documentLineIndex: 25,
|
||||
documentCharacterOffsetIndex: 61,
|
||||
generatedAbsoluteIndex: 5447,
|
||||
generatedLineIndex: 160,
|
||||
generatedAbsoluteIndex: 5149,
|
||||
generatedLineIndex: 148,
|
||||
generatedCharacterOffsetIndex: 60,
|
||||
contentLength: 1),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 975,
|
||||
documentLineIndex: 25,
|
||||
documentCharacterOffsetIndex: 62,
|
||||
generatedAbsoluteIndex: 5448,
|
||||
generatedLineIndex: 160,
|
||||
generatedAbsoluteIndex: 5150,
|
||||
generatedLineIndex: 148,
|
||||
generatedCharacterOffsetIndex: 61,
|
||||
contentLength: 30),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 1005,
|
||||
documentLineIndex: 25,
|
||||
documentCharacterOffsetIndex: 92,
|
||||
generatedAbsoluteIndex: 5478,
|
||||
generatedLineIndex: 160,
|
||||
generatedAbsoluteIndex: 5180,
|
||||
generatedLineIndex: 148,
|
||||
generatedCharacterOffsetIndex: 91,
|
||||
contentLength: 1),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 877,
|
||||
documentLineIndex: 24,
|
||||
documentCharacterOffsetIndex: 16,
|
||||
generatedAbsoluteIndex: 5678,
|
||||
generatedLineIndex: 166,
|
||||
generatedAbsoluteIndex: 5380,
|
||||
generatedLineIndex: 154,
|
||||
generatedCharacterOffsetIndex: 33,
|
||||
contentLength: 8),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 885,
|
||||
documentLineIndex: 24,
|
||||
documentCharacterOffsetIndex: 24,
|
||||
generatedAbsoluteIndex: 5686,
|
||||
generatedLineIndex: 166,
|
||||
generatedAbsoluteIndex: 5388,
|
||||
generatedLineIndex: 154,
|
||||
generatedCharacterOffsetIndex: 41,
|
||||
contentLength: 1),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 886,
|
||||
documentLineIndex: 24,
|
||||
documentCharacterOffsetIndex: 25,
|
||||
generatedAbsoluteIndex: 5687,
|
||||
generatedLineIndex: 166,
|
||||
generatedAbsoluteIndex: 5389,
|
||||
generatedLineIndex: 154,
|
||||
generatedCharacterOffsetIndex: 42,
|
||||
contentLength: 23),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 1104,
|
||||
documentLineIndex: 28,
|
||||
documentCharacterOffsetIndex: 28,
|
||||
generatedAbsoluteIndex: 6031,
|
||||
generatedLineIndex: 173,
|
||||
generatedAbsoluteIndex: 5733,
|
||||
generatedLineIndex: 161,
|
||||
generatedCharacterOffsetIndex: 42,
|
||||
contentLength: 30),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 1042,
|
||||
documentLineIndex: 27,
|
||||
documentCharacterOffsetIndex: 16,
|
||||
generatedAbsoluteIndex: 6260,
|
||||
generatedLineIndex: 179,
|
||||
generatedAbsoluteIndex: 5962,
|
||||
generatedLineIndex: 167,
|
||||
generatedCharacterOffsetIndex: 33,
|
||||
contentLength: 30),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 1232,
|
||||
documentLineIndex: 31,
|
||||
documentCharacterOffsetIndex: 28,
|
||||
generatedAbsoluteIndex: 6611,
|
||||
generatedLineIndex: 186,
|
||||
generatedAbsoluteIndex: 6313,
|
||||
generatedLineIndex: 174,
|
||||
generatedCharacterOffsetIndex: 42,
|
||||
contentLength: 3),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 1235,
|
||||
documentLineIndex: 31,
|
||||
documentCharacterOffsetIndex: 31,
|
||||
generatedAbsoluteIndex: 6614,
|
||||
generatedLineIndex: 186,
|
||||
generatedAbsoluteIndex: 6316,
|
||||
generatedLineIndex: 174,
|
||||
generatedCharacterOffsetIndex: 45,
|
||||
contentLength: 2),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 1237,
|
||||
documentLineIndex: 31,
|
||||
documentCharacterOffsetIndex: 33,
|
||||
generatedAbsoluteIndex: 6616,
|
||||
generatedLineIndex: 186,
|
||||
generatedAbsoluteIndex: 6318,
|
||||
generatedLineIndex: 174,
|
||||
generatedCharacterOffsetIndex: 47,
|
||||
contentLength: 27),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 1264,
|
||||
documentLineIndex: 31,
|
||||
documentCharacterOffsetIndex: 60,
|
||||
generatedAbsoluteIndex: 6643,
|
||||
generatedLineIndex: 186,
|
||||
generatedAbsoluteIndex: 6345,
|
||||
generatedLineIndex: 174,
|
||||
generatedCharacterOffsetIndex: 74,
|
||||
contentLength: 1),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 1265,
|
||||
documentLineIndex: 31,
|
||||
documentCharacterOffsetIndex: 61,
|
||||
generatedAbsoluteIndex: 6644,
|
||||
generatedLineIndex: 186,
|
||||
generatedAbsoluteIndex: 6346,
|
||||
generatedLineIndex: 174,
|
||||
generatedCharacterOffsetIndex: 75,
|
||||
contentLength: 10),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 1169,
|
||||
documentLineIndex: 30,
|
||||
documentCharacterOffsetIndex: 17,
|
||||
generatedAbsoluteIndex: 6853,
|
||||
generatedLineIndex: 192,
|
||||
generatedAbsoluteIndex: 6555,
|
||||
generatedLineIndex: 180,
|
||||
generatedCharacterOffsetIndex: 33,
|
||||
contentLength: 1),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 1170,
|
||||
documentLineIndex: 30,
|
||||
documentCharacterOffsetIndex: 18,
|
||||
generatedAbsoluteIndex: 6854,
|
||||
generatedLineIndex: 192,
|
||||
generatedAbsoluteIndex: 6556,
|
||||
generatedLineIndex: 180,
|
||||
generatedCharacterOffsetIndex: 34,
|
||||
contentLength: 29),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 1199,
|
||||
documentLineIndex: 30,
|
||||
documentCharacterOffsetIndex: 47,
|
||||
generatedAbsoluteIndex: 6883,
|
||||
generatedLineIndex: 192,
|
||||
generatedAbsoluteIndex: 6585,
|
||||
generatedLineIndex: 180,
|
||||
generatedCharacterOffsetIndex: 63,
|
||||
contentLength: 1),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 1304,
|
||||
documentLineIndex: 33,
|
||||
generatedAbsoluteIndex: 6964,
|
||||
generatedLineIndex: 197,
|
||||
generatedAbsoluteIndex: 6666,
|
||||
generatedLineIndex: 185,
|
||||
characterOffsetIndex: 9,
|
||||
contentLength: 11),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 1359,
|
||||
documentLineIndex: 33,
|
||||
documentCharacterOffsetIndex: 64,
|
||||
generatedAbsoluteIndex: 7325,
|
||||
generatedLineIndex: 201,
|
||||
generatedAbsoluteIndex: 7027,
|
||||
generatedLineIndex: 189,
|
||||
generatedCharacterOffsetIndex: 63,
|
||||
contentLength: 7),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 1324,
|
||||
documentLineIndex: 33,
|
||||
documentCharacterOffsetIndex: 29,
|
||||
generatedAbsoluteIndex: 7523,
|
||||
generatedLineIndex: 207,
|
||||
generatedAbsoluteIndex: 7225,
|
||||
generatedLineIndex: 195,
|
||||
generatedCharacterOffsetIndex: 33,
|
||||
contentLength: 3),
|
||||
BuildLineMapping(
|
||||
documentAbsoluteIndex: 1388,
|
||||
documentLineIndex: 35,
|
||||
generatedAbsoluteIndex: 7638,
|
||||
generatedLineIndex: 218,
|
||||
generatedAbsoluteIndex: 7340,
|
||||
generatedLineIndex: 206,
|
||||
characterOffsetIndex: 0,
|
||||
contentLength: 1),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -622,10 +622,8 @@ namespace Microsoft.AspNetCore.Razor.Test.Parser.CSharp
|
|||
Factory.MarkupTransition("<text>").Accepts(AcceptedCharacters.None)),
|
||||
Factory.Markup(";").Accepts(AcceptedCharacters.None),
|
||||
new MarkupTagBlock(
|
||||
Factory.MarkupTransition("</text>").Accepts(AcceptedCharacters.None)),
|
||||
Factory.CodeMarkup(" ").With(new StatementChunkGenerator()).Accepts(AcceptedCharacters.None)
|
||||
),
|
||||
Factory.Code("}").AsStatement()));
|
||||
Factory.MarkupTransition("</text>").Accepts(AcceptedCharacters.None))),
|
||||
Factory.Code(" }").AsStatement()));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -642,10 +640,8 @@ namespace Microsoft.AspNetCore.Razor.Test.Parser.CSharp
|
|||
Factory.MarkupTransition("<text>").Accepts(AcceptedCharacters.None)),
|
||||
Factory.Markup(";").Accepts(AcceptedCharacters.None),
|
||||
new MarkupTagBlock(
|
||||
Factory.MarkupTransition("</text>").Accepts(AcceptedCharacters.None)),
|
||||
Factory.CodeMarkup(" ").With(new StatementChunkGenerator()).Accepts(AcceptedCharacters.None)
|
||||
),
|
||||
Factory.Code("} ").AsStatement(),
|
||||
Factory.MarkupTransition("</text>").Accepts(AcceptedCharacters.None))),
|
||||
Factory.Code(" } ").AsStatement(),
|
||||
Factory.MetaCode("}").Accepts(AcceptedCharacters.None)));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -511,9 +511,7 @@ namespace Microsoft.AspNetCore.Razor.Test.Parser.Html
|
|||
Factory.Markup("<foo>").Accepts(AcceptedCharacters.None)),
|
||||
Factory.Markup(" Baz"),
|
||||
new MarkupTagBlock(
|
||||
Factory.MarkupTransition("</text>")),
|
||||
Factory.CodeMarkup(" ").With(new StatementChunkGenerator()).Accepts(AcceptedCharacters.None)
|
||||
));
|
||||
Factory.MarkupTransition("</text>"))));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -532,9 +530,7 @@ namespace Microsoft.AspNetCore.Razor.Test.Parser.Html
|
|||
new MarkupTagBlock(
|
||||
Factory.Markup("</text>").Accepts(AcceptedCharacters.None)),
|
||||
new MarkupTagBlock(
|
||||
Factory.MarkupTransition("</text>")),
|
||||
Factory.CodeMarkup(" ").With(new StatementChunkGenerator()).Accepts(AcceptedCharacters.None)
|
||||
));
|
||||
Factory.MarkupTransition("</text>"))));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
|
|
@ -3,11 +3,13 @@
|
|||
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
||||
using Microsoft.AspNetCore.Razor.Editor;
|
||||
using Microsoft.AspNetCore.Razor.Parser;
|
||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||
using Microsoft.AspNetCore.Razor.Text;
|
||||
using Microsoft.AspNetCore.Razor.Tokenizer;
|
||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Test.Parser.Html
|
||||
|
|
@ -321,7 +323,7 @@ namespace Microsoft.AspNetCore.Razor.Test.Parser.Html
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentDoesNotRenderExtraNewlineAtTheEndTextTagInVerbatimBlock()
|
||||
public void ParseDocumentDoesNotRenderExtraNewlineAtTheEndTextTagInVerbatimBlockIfFollowedByCSharp()
|
||||
{
|
||||
ParseDocumentTest("@{<text>Blah</text>\r\n\r\n}<html>",
|
||||
new MarkupBlock(
|
||||
|
|
@ -340,6 +342,58 @@ namespace Microsoft.AspNetCore.Razor.Test.Parser.Html
|
|||
BlockFactory.MarkupTagBlock("<html>")));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentRendersExtraNewlineAtTheEndTextTagInVerbatimBlockIfFollowedByHtml()
|
||||
{
|
||||
ParseDocumentTest("@{<text>Blah</text>\r\n<input/>\r\n}<html>",
|
||||
new MarkupBlock(
|
||||
Factory.EmptyHtml(),
|
||||
new StatementBlock(
|
||||
Factory.CodeTransition(),
|
||||
Factory.MetaCode("{").Accepts(AcceptedCharacters.None),
|
||||
new MarkupBlock(
|
||||
new MarkupTagBlock(
|
||||
Factory.MarkupTransition("<text>")),
|
||||
Factory.Markup("Blah").Accepts(AcceptedCharacters.None),
|
||||
new MarkupTagBlock(
|
||||
Factory.MarkupTransition("</text>")),
|
||||
Factory.Markup("\r\n").Accepts(AcceptedCharacters.None)),
|
||||
new MarkupBlock(
|
||||
new MarkupTagBlock(
|
||||
Factory.Markup("<input/>").Accepts(AcceptedCharacters.None)),
|
||||
Factory.Markup("\r\n").Accepts(AcceptedCharacters.None)),
|
||||
Factory.EmptyCSharp().AsStatement(),
|
||||
Factory.MetaCode("}").Accepts(AcceptedCharacters.None)),
|
||||
BlockFactory.MarkupTagBlock("<html>")));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentRendersExtraNewlineAtTheEndTextTagInVerbatimBlockIfFollowedByMarkupTransition()
|
||||
{
|
||||
ParseDocumentTest("@{<text>Blah</text>\r\n@: Bleh\r\n}<html>",
|
||||
new MarkupBlock(
|
||||
Factory.EmptyHtml(),
|
||||
new StatementBlock(
|
||||
Factory.CodeTransition(),
|
||||
Factory.MetaCode("{").Accepts(AcceptedCharacters.None),
|
||||
new MarkupBlock(
|
||||
new MarkupTagBlock(
|
||||
Factory.MarkupTransition("<text>")),
|
||||
Factory.Markup("Blah").Accepts(AcceptedCharacters.None),
|
||||
new MarkupTagBlock(
|
||||
Factory.MarkupTransition("</text>")),
|
||||
Factory.Markup("\r\n").Accepts(AcceptedCharacters.None)),
|
||||
new MarkupBlock(
|
||||
Factory.MarkupTransition(),
|
||||
Factory.MetaMarkup(":", HtmlSymbolType.Colon),
|
||||
Factory.Markup(" Bleh\r\n")
|
||||
.With(new SingleLineMarkupEditHandler(CSharpLanguageCharacteristics.Instance.TokenizeString))
|
||||
.Accepts(AcceptedCharacters.None)),
|
||||
Factory.EmptyCSharp().AsStatement(),
|
||||
Factory.MetaCode("}").Accepts(AcceptedCharacters.None)),
|
||||
BlockFactory.MarkupTagBlock("<html>")));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentDoesNotIgnoreNewLineAtTheEndOfMarkupBlock()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1500,13 +1500,9 @@ namespace Microsoft.AspNetCore.Razor.Compilation.TagHelpers
|
|||
factory.MarkupTransition("<text>")),
|
||||
factory.Markup("Foo").Accepts(AcceptedCharacters.None),
|
||||
new MarkupTagBlock(
|
||||
factory.MarkupTransition("</text>")),
|
||||
factory
|
||||
.CodeMarkup(" ")
|
||||
.With(new StatementChunkGenerator())
|
||||
.Accepts(AcceptedCharacters.None)),
|
||||
factory.MarkupTransition("</text>"))),
|
||||
factory
|
||||
.Code("foo++; } while (foo<bar>);")
|
||||
.Code(" foo++; } while (foo<bar>);")
|
||||
.AsStatement()
|
||||
.Accepts(AcceptedCharacters.None)))));
|
||||
|
||||
|
|
|
|||
|
|
@ -26,14 +26,6 @@ namespace TestOutput
|
|||
Instrumentation.EndContext();
|
||||
#line 2 "CodeBlockWithTextElement.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
Instrumentation.BeginContext(38, 2, true);
|
||||
WriteLiteral("\r\n");
|
||||
Instrumentation.EndContext();
|
||||
#line 3 "CodeBlockWithTextElement.cshtml"
|
||||
var b = 1;
|
||||
|
||||
#line default
|
||||
|
|
|
|||
|
|
@ -89,24 +89,12 @@ if (true)
|
|||
#line 18 "ComplexTagHelpers.cshtml"
|
||||
if(true) {
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 18 "ComplexTagHelpers.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 18 "ComplexTagHelpers.cshtml"
|
||||
} else {
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 18 "ComplexTagHelpers.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
|
|
|
|||
|
|
@ -204,12 +204,6 @@ namespace TestOutput
|
|||
#line hidden
|
||||
|
||||
WriteLiteral("checkbox");
|
||||
#line 18 "ComplexTagHelpers.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 18 "ComplexTagHelpers.cshtml"
|
||||
} else {
|
||||
|
||||
|
|
@ -217,12 +211,6 @@ namespace TestOutput
|
|||
#line hidden
|
||||
|
||||
WriteLiteral("anything");
|
||||
#line 18 "ComplexTagHelpers.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 18 "ComplexTagHelpers.cshtml"
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,12 +44,6 @@ WriteTo(__razor_attribute_value_writer, link);
|
|||
Instrumentation.BeginContext(84, 1, true);
|
||||
WriteLiteralTo(__razor_attribute_value_writer, "#");
|
||||
Instrumentation.EndContext();
|
||||
#line 2 "InlineBlocks.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 2 "InlineBlocks.cshtml"
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue