diff --git a/src/Microsoft.AspNet.Razor/Chunks/ChunkTreeBuilder.cs b/src/Microsoft.AspNet.Razor/Chunks/ChunkTreeBuilder.cs
index 812eeb2dcb..fe828e4752 100644
--- a/src/Microsoft.AspNet.Razor/Chunks/ChunkTreeBuilder.cs
+++ b/src/Microsoft.AspNet.Razor/Chunks/ChunkTreeBuilder.cs
@@ -132,14 +132,6 @@ namespace Microsoft.AspNet.Razor.Chunks
}, association);
}
- public void AddResolveUrlChunk(string url, SyntaxTreeNode association)
- {
- AddChunk(new ResolveUrlChunk
- {
- Url = url
- }, association);
- }
-
public void AddSetBaseTypeChunk(string typeName, SyntaxTreeNode association)
{
AddChunk(new SetBaseTypeChunk
diff --git a/src/Microsoft.AspNet.Razor/Chunks/Generators/ResolveUrlChunkGenerator.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/ResolveUrlChunkGenerator.cs
deleted file mode 100644
index b0ef82b10d..0000000000
--- a/src/Microsoft.AspNet.Razor/Chunks/Generators/ResolveUrlChunkGenerator.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using Microsoft.AspNet.Razor.Parser.SyntaxTree;
-
-namespace Microsoft.AspNet.Razor.Chunks.Generators
-{
- public class ResolveUrlChunkGenerator : SpanChunkGenerator
- {
- public override void GenerateChunk(Span target, ChunkGeneratorContext context)
- {
- // Check if the host supports it
- if (string.IsNullOrEmpty(context.Host.GeneratedClassContext.ResolveUrlMethodName))
- {
- // Nope, just use the default MarkupChunkGenerator behavior
- new MarkupChunkGenerator().GenerateChunk(target, context);
- return;
- }
-
- context.ChunkTreeBuilder.AddResolveUrlChunk(target.Content, target);
- }
-
- public override string ToString()
- {
- return "VirtualPath";
- }
- }
-}
diff --git a/src/Microsoft.AspNet.Razor/Chunks/ResolveUrlChunk.cs b/src/Microsoft.AspNet.Razor/Chunks/ResolveUrlChunk.cs
deleted file mode 100644
index 3e9f5ede1a..0000000000
--- a/src/Microsoft.AspNet.Razor/Chunks/ResolveUrlChunk.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-namespace Microsoft.AspNet.Razor.Chunks
-{
- public class ResolveUrlChunk : Chunk
- {
- public string Url { get; set; }
- }
-}
diff --git a/src/Microsoft.AspNet.Razor/CodeGenerators/GeneratedClassContext.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/GeneratedClassContext.cs
index ab3d4be31b..a6726e39fc 100644
--- a/src/Microsoft.AspNet.Razor/CodeGenerators/GeneratedClassContext.cs
+++ b/src/Microsoft.AspNet.Razor/CodeGenerators/GeneratedClassContext.cs
@@ -136,9 +136,6 @@ namespace Microsoft.AspNet.Razor.CodeGenerators
public string WriteAttributeMethodName { get; set; }
public string WriteAttributeToMethodName { get; set; }
- [SuppressMessage("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings", Justification = "Property is not a URL property")]
- public string ResolveUrlMethodName { get; set; }
-
public bool AllowSections
{
get { return !string.IsNullOrEmpty(DefineSectionMethodName); }
diff --git a/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpCodeVisitor.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpCodeVisitor.cs
index 731d72593e..e5e6fefa15 100644
--- a/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpCodeVisitor.cs
+++ b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpCodeVisitor.cs
@@ -94,45 +94,6 @@ namespace Microsoft.AspNet.Razor.CodeGenerators.Visitors
Writer.WriteEndMethodInvocation(false).WriteLine();
}
- protected override void Visit(ResolveUrlChunk chunk)
- {
- if (!Context.Host.DesignTimeMode && string.IsNullOrEmpty(chunk.Url))
- {
- return;
- }
-
- var generateInstrumentation = ShouldGenerateInstrumentationForExpressions();
-
- if (generateInstrumentation)
- {
- // Add a non-literal context call (non-literal because the expanded URL will not match the source
- // character-by-character)
- Writer.WriteStartInstrumentationContext(Context, chunk.Association, isLiteral: false);
- }
-
- if (!string.IsNullOrEmpty(chunk.Url) && !Context.Host.DesignTimeMode)
- {
- if (Context.ExpressionRenderingMode == ExpressionRenderingMode.WriteToOutput)
- {
- RenderPreWriteStart();
- }
-
- Writer.WriteStartMethodInvocation(Context.Host.GeneratedClassContext.ResolveUrlMethodName)
- .WriteStringLiteral(chunk.Url)
- .WriteEndMethodInvocation(endLine: false);
-
- if (Context.ExpressionRenderingMode == ExpressionRenderingMode.WriteToOutput)
- {
- Writer.WriteEndMethodInvocation();
- }
- }
-
- if (generateInstrumentation)
- {
- Writer.WriteEndInstrumentationContext(Context);
- }
- }
-
protected override void Visit(LiteralChunk chunk)
{
if (Context.Host.DesignTimeMode || string.IsNullOrEmpty(chunk.Text))
diff --git a/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpTagHelperAttributeValueVisitor.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpTagHelperAttributeValueVisitor.cs
index 3d8091b2e7..6b7fa9f5ec 100644
--- a/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpTagHelperAttributeValueVisitor.cs
+++ b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpTagHelperAttributeValueVisitor.cs
@@ -92,19 +92,6 @@ namespace Microsoft.AspNet.Razor.CodeGenerators.Visitors
RenderCode(chunk.Text, (Span)chunk.Association);
}
- ///
- /// Writes code for the given .
- ///
- /// The to render.
- ///
- /// Allowed to support future C# extensions. Likely "~/..." will lead to a C# compilation error but that is up
- /// to the compiler.
- ///
- protected override void Visit(ResolveUrlChunk chunk)
- {
- RenderCode(chunk.Url, (Span)chunk.Association);
- }
-
///
/// Writes code for the given .
///
diff --git a/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/ChunkVisitor.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/ChunkVisitor.cs
index 3143eb6df8..cbb5fef7a6 100644
--- a/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/ChunkVisitor.cs
+++ b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/ChunkVisitor.cs
@@ -61,10 +61,6 @@ namespace Microsoft.AspNet.Razor.CodeGenerators.Visitors
{
Visit((RemoveTagHelperChunk)chunk);
}
- else if (chunk is ResolveUrlChunk)
- {
- Visit((ResolveUrlChunk)chunk);
- }
else if (chunk is TypeMemberChunk)
{
Visit((TypeMemberChunk)chunk);
@@ -117,7 +113,6 @@ namespace Microsoft.AspNet.Razor.CodeGenerators.Visitors
protected abstract void Visit(CodeAttributeChunk chunk);
protected abstract void Visit(SectionChunk chunk);
protected abstract void Visit(TypeMemberChunk chunk);
- protected abstract void Visit(ResolveUrlChunk chunk);
protected abstract void Visit(SetBaseTypeChunk chunk);
protected abstract void Visit(TemplateChunk chunk);
protected abstract void Visit(ExpressionBlockChunk chunk);
diff --git a/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CodeVisitor.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CodeVisitor.cs
index b89c2f242b..dab34ba9fa 100644
--- a/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CodeVisitor.cs
+++ b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CodeVisitor.cs
@@ -59,9 +59,6 @@ namespace Microsoft.AspNet.Razor.CodeGenerators.Visitors
protected override void Visit(TypeMemberChunk chunk)
{
}
- protected override void Visit(ResolveUrlChunk chunk)
- {
- }
protected override void Visit(SetBaseTypeChunk chunk)
{
}
diff --git a/src/Microsoft.AspNet.Razor/Parser/HtmlMarkupParser.Block.cs b/src/Microsoft.AspNet.Razor/Parser/HtmlMarkupParser.Block.cs
index 916e8787b4..90a1ade056 100644
--- a/src/Microsoft.AspNet.Razor/Parser/HtmlMarkupParser.Block.cs
+++ b/src/Microsoft.AspNet.Razor/Parser/HtmlMarkupParser.Block.cs
@@ -616,20 +616,6 @@ namespace Microsoft.AspNet.Razor.Parser
}
}
}
- else if (At(HtmlSymbolType.Text) &&
- CurrentSymbol.Content.Length > 0 &&
- CurrentSymbol.Content[0] == '~' &&
- NextIs(HtmlSymbolType.ForwardSlash))
- {
- Accept(prefix);
-
- // Virtual Path value
- var valueStart = CurrentLocation;
- VirtualPath();
- Span.ChunkGenerator = new LiteralAttributeChunkGenerator(
- prefix.GetContent(prefixStart),
- new LocationTagged(new ResolveUrlChunkGenerator(), valueStart));
- }
else
{
Accept(prefix);
@@ -676,18 +662,6 @@ namespace Microsoft.AspNet.Razor.Parser
sym.Type == HtmlSymbolType.NewLine;
}
- private void VirtualPath()
- {
- Assert(HtmlSymbolType.Text);
- Debug.Assert(CurrentSymbol.Content.Length > 0 && CurrentSymbol.Content[0] == '~');
-
- // Parse until a transition symbol, whitespace, newline or quote. We support only a fairly minimal subset of Virtual Paths
- AcceptUntil(HtmlSymbolType.Transition, HtmlSymbolType.WhiteSpace, HtmlSymbolType.NewLine, HtmlSymbolType.SingleQuote, HtmlSymbolType.DoubleQuote);
-
- // Output a Virtual Path span
- Span.EditHandler.EditorHints = EditorHints.VirtualPath;
- }
-
private void RecoverToEndOfTag()
{
// Accept until ">", "/" or "<", but parse code
diff --git a/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpRazorChunkGeneratorTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpRazorChunkGeneratorTest.cs
index a31a37bb9e..ed03b0f3b8 100644
--- a/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpRazorChunkGeneratorTest.cs
+++ b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpRazorChunkGeneratorTest.cs
@@ -28,7 +28,6 @@ namespace Microsoft.AspNet.Razor.Test.Generator
}
private const string TestPhysicalPath = @"C:\Bar.cshtml";
- private const string TestVirtualPath = "~/Foo/Bar.cshtml";
[Fact]
public void ConstructorRequiresNonNullClassName()
@@ -69,7 +68,6 @@ namespace Microsoft.AspNet.Razor.Test.Generator
[InlineData("RazorComments")]
[InlineData("InlineBlocks")]
[InlineData("ConditionalAttributes")]
- [InlineData("ResolveUrl")]
[InlineData("Await")]
[InlineData("CodeBlockWithTextElement")]
public void CSharpChunkGeneratorCorrectlyGeneratesRunTimeCode(string testType)
diff --git a/test/Microsoft.AspNet.Razor.Test/CodeGenerators/RazorChunkGeneratorTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/RazorChunkGeneratorTest.cs
index 735f7f87f0..00e124eb89 100644
--- a/test/Microsoft.AspNet.Razor.Test/CodeGenerators/RazorChunkGeneratorTest.cs
+++ b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/RazorChunkGeneratorTest.cs
@@ -152,19 +152,17 @@ namespace Microsoft.AspNet.Razor.Test.Generator
host.DefaultClassName = name;
// Add support for templates, etc.
- host.GeneratedClassContext = new GeneratedClassContext(GeneratedClassContext.DefaultExecuteMethodName,
- GeneratedClassContext.DefaultWriteMethodName,
- GeneratedClassContext.DefaultWriteLiteralMethodName,
- "WriteTo",
- "WriteLiteralTo",
- "Template",
- "DefineSection",
- "Instrumentation.BeginContext",
- "Instrumentation.EndContext",
- new GeneratedTagHelperContext())
- {
- ResolveUrlMethodName = "Href"
- };
+ host.GeneratedClassContext = new GeneratedClassContext(
+ GeneratedClassContext.DefaultExecuteMethodName,
+ GeneratedClassContext.DefaultWriteMethodName,
+ GeneratedClassContext.DefaultWriteLiteralMethodName,
+ "WriteTo",
+ "WriteLiteralTo",
+ "Template",
+ "DefineSection",
+ "Instrumentation.BeginContext",
+ "Instrumentation.EndContext",
+ new GeneratedTagHelperContext());
if (hostConfig != null)
{
host = hostConfig(host);
diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlAttributeTest.cs b/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlAttributeTest.cs
index ea5b3511f6..1348da2975 100644
--- a/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlAttributeTest.cs
+++ b/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlAttributeTest.cs
@@ -137,10 +137,9 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html
.AsImplicitExpression(CSharpCodeParser.DefaultKeywords)
.Accepts(AcceptedCharacters.NonWhiteSpace))),
Factory.Markup(" ~/Foo/Bar")
- .WithEditorHints(EditorHints.VirtualPath)
.With(new LiteralAttributeChunkGenerator(
new LocationTagged(" ", 13, 0, 13),
- new LocationTagged(new ResolveUrlChunkGenerator(), 14, 0, 14))),
+ new LocationTagged("~/Foo/Bar", 14, 0, 14))),
Factory.Markup("'").With(SpanChunkGenerator.Null)),
Factory.Markup(" />").Accepts(AcceptedCharacters.None))));
}
@@ -181,33 +180,6 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html
Factory.Markup(" />"))));
}
- [Fact]
- public void ConditionalAttributeCollapserDoesNotRemoveUrlAttributeValues()
- {
- // Act
- var results = ParseDocument("");
- var rewritingContext = new RewritingContext(results.Document, new ErrorSink());
- new ConditionalAttributeCollapser(new HtmlMarkupParser().BuildSpan).Rewrite(rewritingContext);
- new MarkupCollapser(new HtmlMarkupParser().BuildSpan).Rewrite(rewritingContext);
- var rewritten = rewritingContext.SyntaxTree;
-
- // Assert
- Assert.Equal(0, results.ParserErrors.Count());
- EvaluateParseTree(rewritten,
- new MarkupBlock(
- new MarkupTagBlock(
- Factory.Markup("(" href='", 2, 0, 2), suffix: new LocationTagged("'", 18, 0, 18)),
- Factory.Markup(" href='").With(SpanChunkGenerator.Null),
- Factory.Markup("~/Foo/Bar")
- .WithEditorHints(EditorHints.VirtualPath)
- .With(new LiteralAttributeChunkGenerator(
- new LocationTagged(string.Empty, 9, 0, 9),
- new LocationTagged(new ResolveUrlChunkGenerator(), 9, 0, 9))),
- Factory.Markup("'").With(SpanChunkGenerator.Null)),
- Factory.Markup(" />"))));
- }
-
[Fact]
public void ConditionalAttributeCollapserDoesNotRewriteEscapedTransitions()
{
diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlUrlAttributeTest.cs b/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlUrlAttributeTest.cs
deleted file mode 100644
index 2dd7ac6b4a..0000000000
--- a/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlUrlAttributeTest.cs
+++ /dev/null
@@ -1,293 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using Microsoft.AspNet.Razor.Chunks.Generators;
-using Microsoft.AspNet.Razor.Editor;
-using Microsoft.AspNet.Razor.Parser;
-using Microsoft.AspNet.Razor.Parser.SyntaxTree;
-using Microsoft.AspNet.Razor.Test.Framework;
-using Microsoft.AspNet.Razor.Text;
-using Xunit;
-
-namespace Microsoft.AspNet.Razor.Test.Parser.Html
-{
- public class HtmlUrlAttributeTest : CsHtmlMarkupParserTestBase
- {
- [Fact]
- public void SimpleUrlInAttributeInMarkupBlock()
- {
- ParseBlockTest("",
- new MarkupBlock(
- new MarkupTagBlock(
- Factory.Markup("(" href='", 2, 0, 2), new LocationTagged("'", 22, 0, 22)),
- Factory.Markup(" href='").With(SpanChunkGenerator.Null),
- Factory.Markup("~/Foo/Bar/Baz")
- .WithEditorHints(EditorHints.VirtualPath)
- .With(new LiteralAttributeChunkGenerator(
- new LocationTagged(string.Empty, 9, 0, 9),
- new LocationTagged(new ResolveUrlChunkGenerator(), 9, 0, 9))),
- Factory.Markup("'").With(SpanChunkGenerator.Null)),
- Factory.Markup(" />").Accepts(AcceptedCharacters.None))));
- }
-
- [Fact]
- public void SimpleUrlInAttributeInMarkupDocument()
- {
- ParseDocumentTest("",
- new MarkupBlock(
- new MarkupTagBlock(
- Factory.Markup("(" href='", 2, 0, 2), new LocationTagged("'", 22, 0, 22)),
- Factory.Markup(" href='").With(SpanChunkGenerator.Null),
- Factory.Markup("~/Foo/Bar/Baz")
- .WithEditorHints(EditorHints.VirtualPath)
- .With(new LiteralAttributeChunkGenerator(
- new LocationTagged(string.Empty, 9, 0, 9),
- new LocationTagged(new ResolveUrlChunkGenerator(), 9, 0, 9))),
- Factory.Markup("'").With(SpanChunkGenerator.Null)),
- Factory.Markup(" />"))));
- }
-
- [Fact]
- public void SimpleUrlInAttributeInMarkupSection()
- {
- ParseDocumentTest("@section Foo { }",
- new MarkupBlock(
- Factory.EmptyHtml(),
- new SectionBlock(new SectionChunkGenerator("Foo"),
- Factory.CodeTransition(),
- Factory.MetaCode("section Foo {")
- .AutoCompleteWith(null, atEndOfSpan: true)
- .Accepts(AcceptedCharacters.Any),
- new MarkupBlock(
- Factory.Markup(" "),
- new MarkupTagBlock(
- Factory.Markup("(" href='", 17, 0, 17), new LocationTagged("'", 37, 0, 37)),
- Factory.Markup(" href='").With(SpanChunkGenerator.Null),
- Factory.Markup("~/Foo/Bar/Baz")
- .WithEditorHints(EditorHints.VirtualPath)
- .With(new LiteralAttributeChunkGenerator(
- new LocationTagged(string.Empty, 24, 0, 24),
- new LocationTagged(new ResolveUrlChunkGenerator(), 24, 0, 24))),
- Factory.Markup("'").With(SpanChunkGenerator.Null)),
- Factory.Markup(" />")),
- Factory.Markup(" ")
- ),
- Factory.MetaCode("}").Accepts(AcceptedCharacters.None)),
- Factory.EmptyHtml()));
- }
-
- [Fact]
- public void UrlWithExpressionsInAttributeInMarkupBlock()
- {
- ParseBlockTest("",
- new MarkupBlock(
- new MarkupTagBlock(
- Factory.Markup("(" href='", 2, 0, 2), new LocationTagged("'", 22, 0, 22)),
- Factory.Markup(" href='").With(SpanChunkGenerator.Null),
- Factory.Markup("~/Foo/")
- .WithEditorHints(EditorHints.VirtualPath)
- .With(new LiteralAttributeChunkGenerator(
- new LocationTagged(string.Empty, 9, 0, 9),
- new LocationTagged(new ResolveUrlChunkGenerator(), 9, 0, 9))),
- new MarkupBlock(new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 15, 0, 15), 15, 0, 15),
- new ExpressionBlock(
- Factory.CodeTransition().Accepts(AcceptedCharacters.None),
- Factory.Code("id")
- .AsImplicitExpression(CSharpCodeParser.DefaultKeywords)
- .Accepts(AcceptedCharacters.NonWhiteSpace))),
- Factory.Markup("/Baz")
- .With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 18, 0, 18), new LocationTagged("/Baz", 18, 0, 18))),
- Factory.Markup("'").With(SpanChunkGenerator.Null)),
- Factory.Markup(" />").Accepts(AcceptedCharacters.None))));
- }
-
- [Fact]
- public void UrlWithExpressionsInAttributeInMarkupDocument()
- {
- ParseDocumentTest("",
- new MarkupBlock(
- new MarkupTagBlock(
- Factory.Markup("(" href='", 2, 0, 2), new LocationTagged("'", 22, 0, 22)),
- Factory.Markup(" href='").With(SpanChunkGenerator.Null),
- Factory.Markup("~/Foo/")
- .WithEditorHints(EditorHints.VirtualPath)
- .With(new LiteralAttributeChunkGenerator(
- new LocationTagged(string.Empty, 9, 0, 9),
- new LocationTagged(new ResolveUrlChunkGenerator(), 9, 0, 9))),
- new MarkupBlock(new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 15, 0, 15), 15, 0, 15),
- new ExpressionBlock(
- Factory.CodeTransition().Accepts(AcceptedCharacters.None),
- Factory.Code("id")
- .AsImplicitExpression(CSharpCodeParser.DefaultKeywords)
- .Accepts(AcceptedCharacters.NonWhiteSpace))),
- Factory.Markup("/Baz")
- .With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 18, 0, 18), new LocationTagged("/Baz", 18, 0, 18))),
- Factory.Markup("'").With(SpanChunkGenerator.Null)),
- Factory.Markup(" />"))));
- }
-
- [Fact]
- public void UrlWithExpressionsInAttributeInMarkupSection()
- {
- ParseDocumentTest("@section Foo { }",
- new MarkupBlock(
- Factory.EmptyHtml(),
- new SectionBlock(new SectionChunkGenerator("Foo"),
- Factory.CodeTransition(),
- Factory.MetaCode("section Foo {")
- .AutoCompleteWith(null, atEndOfSpan: true),
- new MarkupBlock(
- Factory.Markup(" "),
- new MarkupTagBlock(
- Factory.Markup("(" href='", 17, 0, 17), new LocationTagged("'", 37, 0, 37)),
- Factory.Markup(" href='").With(SpanChunkGenerator.Null),
- Factory.Markup("~/Foo/")
- .WithEditorHints(EditorHints.VirtualPath)
- .With(new LiteralAttributeChunkGenerator(
- new LocationTagged(string.Empty, 24, 0, 24),
- new LocationTagged(new ResolveUrlChunkGenerator(), 24, 0, 24))),
- new MarkupBlock(new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 30, 0, 30), 30, 0, 30),
- new ExpressionBlock(
- Factory.CodeTransition().Accepts(AcceptedCharacters.None),
- Factory.Code("id")
- .AsImplicitExpression(CSharpCodeParser.DefaultKeywords)
- .Accepts(AcceptedCharacters.NonWhiteSpace))),
- Factory.Markup("/Baz")
- .With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 33, 0, 33), new LocationTagged("/Baz", 33, 0, 33))),
- Factory.Markup("'").With(SpanChunkGenerator.Null)),
- Factory.Markup(" />")),
- Factory.Markup(" ")
- ),
- Factory.MetaCode("}").Accepts(AcceptedCharacters.None)),
- Factory.EmptyHtml()));
- }
-
- [Fact]
- public void UrlWithComplexCharactersInAttributeInMarkupBlock()
- {
- ParseBlockTest("",
- new MarkupBlock(
- new MarkupTagBlock(
- Factory.Markup("(" href='", 2, 0, 2), new LocationTagged("'", 31, 0, 31)),
- Factory.Markup(" href='").With(SpanChunkGenerator.Null),
- Factory.Markup("~/Foo+Bar:Baz(Biz),Boz")
- .WithEditorHints(EditorHints.VirtualPath)
- .With(new LiteralAttributeChunkGenerator(
- new LocationTagged(string.Empty, 9, 0, 9),
- new LocationTagged(new ResolveUrlChunkGenerator(), 9, 0, 9))),
- Factory.Markup("'").With(SpanChunkGenerator.Null)),
- Factory.Markup(" />").Accepts(AcceptedCharacters.None))));
- }
-
- [Fact]
- public void UrlWithComplexCharactersInAttributeInMarkupDocument()
- {
- ParseDocumentTest("",
- new MarkupBlock(
- new MarkupTagBlock(
- Factory.Markup("(" href='", 2, 0, 2), new LocationTagged("'", 31, 0, 31)),
- Factory.Markup(" href='").With(SpanChunkGenerator.Null),
- Factory.Markup("~/Foo+Bar:Baz(Biz),Boz")
- .WithEditorHints(EditorHints.VirtualPath)
- .With(new LiteralAttributeChunkGenerator(
- new LocationTagged(string.Empty, 9, 0, 9),
- new LocationTagged(new ResolveUrlChunkGenerator(), 9, 0, 9))),
- Factory.Markup("'").With(SpanChunkGenerator.Null)),
- Factory.Markup(" />"))));
- }
-
- [Fact]
- public void UrlInUnquotedAttributeValueInMarkupBlock()
- {
- ParseBlockTest("",
- new MarkupBlock(
- new MarkupTagBlock(
- Factory.Markup("(" href=", 2, 0, 2), new LocationTagged(string.Empty, 38, 0, 38)),
- Factory.Markup(" href=").With(SpanChunkGenerator.Null),
- Factory.Markup("~/Foo+Bar:Baz(Biz),Boz/")
- .WithEditorHints(EditorHints.VirtualPath)
- .With(new LiteralAttributeChunkGenerator(
- new LocationTagged(string.Empty, 8, 0, 8),
- new LocationTagged(new ResolveUrlChunkGenerator(), 8, 0, 8))),
- new MarkupBlock(new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 31, 0, 31), 31, 0, 31),
- new ExpressionBlock(
- Factory.CodeTransition()
- .Accepts(AcceptedCharacters.None),
- Factory.Code("id")
- .AsImplicitExpression(CSharpCodeParser.DefaultKeywords)
- .Accepts(AcceptedCharacters.NonWhiteSpace))),
- Factory.Markup("/Boz").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 34, 0, 34), new LocationTagged("/Boz", 34, 0, 34)))),
- Factory.Markup(" />").Accepts(AcceptedCharacters.None))));
- }
-
- [Fact]
- public void UrlInUnquotedAttributeValueInMarkupDocument()
- {
- ParseDocumentTest("",
- new MarkupBlock(
- new MarkupTagBlock(
- Factory.Markup("(" href=", 2, 0, 2), new LocationTagged(string.Empty, 38, 0, 38)),
- Factory.Markup(" href=").With(SpanChunkGenerator.Null),
- Factory.Markup("~/Foo+Bar:Baz(Biz),Boz/")
- .WithEditorHints(EditorHints.VirtualPath)
- .With(new LiteralAttributeChunkGenerator(
- new LocationTagged(string.Empty, 8, 0, 8),
- new LocationTagged(new ResolveUrlChunkGenerator(), 8, 0, 8))),
- new MarkupBlock(new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 31, 0, 31), 31, 0, 31),
- new ExpressionBlock(
- Factory.CodeTransition()
- .Accepts(AcceptedCharacters.None),
- Factory.Code("id")
- .AsImplicitExpression(CSharpCodeParser.DefaultKeywords)
- .Accepts(AcceptedCharacters.NonWhiteSpace))),
- Factory.Markup("/Boz").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 34, 0, 34), new LocationTagged("/Boz", 34, 0, 34)))),
- Factory.Markup(" />"))));
- }
-
- [Fact]
- public void UrlInUnquotedAttributeValueInMarkupSection()
- {
- ParseDocumentTest("@section Foo { }",
- new MarkupBlock(
- Factory.EmptyHtml(),
- new SectionBlock(new SectionChunkGenerator("Foo"),
- Factory.CodeTransition(),
- Factory.MetaCode("section Foo {")
- .AutoCompleteWith(null, atEndOfSpan: true),
- new MarkupBlock(
- Factory.Markup(" "),
- new MarkupTagBlock(
- Factory.Markup("(" href=", 17, 0, 17), new LocationTagged(string.Empty, 53, 0, 53)),
- Factory.Markup(" href=").With(SpanChunkGenerator.Null),
- Factory.Markup("~/Foo+Bar:Baz(Biz),Boz/")
- .WithEditorHints(EditorHints.VirtualPath)
- .With(new LiteralAttributeChunkGenerator(
- new LocationTagged(string.Empty, 23, 0, 23),
- new LocationTagged(new ResolveUrlChunkGenerator(), 23, 0, 23))),
- new MarkupBlock(new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 46, 0, 46), 46, 0, 46),
- new ExpressionBlock(
- Factory.CodeTransition()
- .Accepts(AcceptedCharacters.None),
- Factory.Code("id")
- .AsImplicitExpression(CSharpCodeParser.DefaultKeywords)
- .Accepts(AcceptedCharacters.NonWhiteSpace))),
- Factory.Markup("/Boz").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 49, 0, 49), new LocationTagged("/Boz", 49, 0, 49)))),
- Factory.Markup(" />")),
- Factory.Markup(" ")
- ),
- Factory.MetaCode("}").Accepts(AcceptedCharacters.None)),
- Factory.EmptyHtml()));
- }
- }
-}
diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ConditionalAttributes.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ConditionalAttributes.cs
index 81bb4c5cba..b6de066b67 100644
--- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ConditionalAttributes.cs
+++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ConditionalAttributes.cs
@@ -73,12 +73,8 @@ WriteTo(__razor_attribute_value_writer, cls);
}
), 256), false));
- Instrumentation.BeginContext(282, 11, true);
- WriteLiteral(" />\r\n (Href("~/Foo"), 300), false));
- Instrumentation.BeginContext(306, 16, true);
- WriteLiteral(" />\r\n \r\n \r\n