Fix dependency to aspnet/AspNetCore-Tooling (dotnet/aspnetcore-tooling#170)
* Remove unused package versions
* Remove references to Html.Abstractions
Removing this package since it's from the aspnet/AspNetCore.
* Remove System.ValueTuple package inside remove
* Add versions.details.xml items from corefx
* Add Microsoft.NETCore.App
* Fill up Version.Details.xml
* Update dependencies
* Fix failing test
\n\nCommit migrated from bd7fc9ddf6
This commit is contained in:
parent
642a2f5789
commit
d4c3a2fbd9
|
|
@ -245,12 +245,13 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||||
Assert.FileExists(result, OutputPath, "SimpleMvc.deps.json");
|
Assert.FileExists(result, OutputPath, "SimpleMvc.deps.json");
|
||||||
var depsFilePath = Path.Combine(Project.DirectoryPath, OutputPath, "SimpleMvc.deps.json");
|
var depsFilePath = Path.Combine(Project.DirectoryPath, OutputPath, "SimpleMvc.deps.json");
|
||||||
var dependencyContext = ReadDependencyContext(depsFilePath);
|
var dependencyContext = ReadDependencyContext(depsFilePath);
|
||||||
|
|
||||||
// Pick a couple of libraries and ensure they have some compile references
|
// Pick a couple of libraries and ensure they have some compile references
|
||||||
var packageReference = dependencyContext.CompileLibraries.First(l => l.Name == "Microsoft.AspNetCore.Html.Abstractions");
|
var packageReference = dependencyContext.CompileLibraries.First(l => l.Name == "Microsoft.NETCore.App");
|
||||||
Assert.NotEmpty(packageReference.Assemblies);
|
Assert.NotEmpty(packageReference.Assemblies);
|
||||||
|
|
||||||
var projectReference = dependencyContext.CompileLibraries.First(l => l.Name == "SimpleMvc");
|
var projectReference = dependencyContext.CompileLibraries.First(l => l.Name == "SimpleMvc");
|
||||||
Assert.NotEmpty(packageReference.Assemblies);
|
Assert.NotEmpty(projectReference.Assemblies);
|
||||||
|
|
||||||
Assert.Contains(customDefine, dependencyContext.CompilationOptions.Defines);
|
Assert.Contains(customDefine, dependencyContext.CompilationOptions.Defines);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@
|
||||||
<!-- The test projects rely on these binaries being available -->
|
<!-- The test projects rely on these binaries being available -->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourcePackageVersion)" />
|
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourcePackageVersion)" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Html.Abstractions" Version="$(MicrosoftAspNetCoreHtmlAbstractionsPackageVersion)" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Html.Abstractions" Version="$(MicrosoftAspNetCoreHtmlAbstractionsPackageVersion)" />
|
|
||||||
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourcePackageVersion)" />
|
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourcePackageVersion)" />
|
||||||
|
<PackageReference Include="System.Text.Encodings.Web" Version="$(SystemTextEncodingsWebPackageVersion)" />
|
||||||
|
|
||||||
<ProjectReference Include="..\Microsoft.AspNetCore.Razor.Test.ComponentShim\Microsoft.AspNetCore.Razor.Test.ComponentShim.csproj" />
|
<ProjectReference Include="..\Microsoft.AspNetCore.Razor.Test.ComponentShim\Microsoft.AspNetCore.Razor.Test.ComponentShim.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
// 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 System.IO;
|
||||||
|
using System.Text.Encodings.Web;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Html
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// HTML content which can be written to a TextWriter.
|
||||||
|
/// </summary>
|
||||||
|
public interface IHtmlContent
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Writes the content by encoding it with the specified <paramref name="encoder"/>
|
||||||
|
/// to the specified <paramref name="writer"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="writer">The <see cref="TextWriter"/> to which the content is written.</param>
|
||||||
|
/// <param name="encoder">The <see cref="HtmlEncoder"/> which encodes the content to be written.</param>
|
||||||
|
void WriteTo(TextWriter writer, HtmlEncoder encoder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
// 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.AspNetCore.Html
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A builder for HTML content.
|
||||||
|
/// </summary>
|
||||||
|
public interface IHtmlContentBuilder : IHtmlContentContainer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Appends an <see cref="IHtmlContent"/> instance.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="content">The <see cref="IHtmlContent"/> to append.</param>
|
||||||
|
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
|
||||||
|
IHtmlContentBuilder AppendHtml(IHtmlContent content);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Appends a <see cref="string"/> value. The value is treated as unencoded as-provided, and will be HTML
|
||||||
|
/// encoded before writing to output.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="unencoded">The <see cref="string"/> to append.</param>
|
||||||
|
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
|
||||||
|
IHtmlContentBuilder Append(string unencoded);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Appends an HTML encoded <see cref="string"/> value. The value is treated as HTML encoded as-provided, and
|
||||||
|
/// no further encoding will be performed.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="encoded">The HTML encoded <see cref="string"/> to append.</param>
|
||||||
|
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
|
||||||
|
IHtmlContentBuilder AppendHtml(string encoded);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clears the content.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
|
||||||
|
IHtmlContentBuilder Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
// 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.AspNetCore.Html
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Defines a contract for <see cref="IHtmlContent"/> instances made up of several components which
|
||||||
|
/// can be copied into an <see cref="IHtmlContentBuilder"/>.
|
||||||
|
/// </summary>
|
||||||
|
public interface IHtmlContentContainer : IHtmlContent
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Copies the contained content of this <see cref="IHtmlContentContainer"/> into <paramref name="builder"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="builder">The <see cref="IHtmlContentBuilder"/>.</param>
|
||||||
|
void CopyTo(IHtmlContentBuilder builder);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>
|
||||||
|
/// Moves the contained content of this <see cref="IHtmlContentContainer"/> into <paramref name="builder"/>.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// After <see cref="MoveTo"/> is called, this <see cref="IHtmlContentContainer"/> instance should be left
|
||||||
|
/// in an empty state.
|
||||||
|
/// </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="builder">The <see cref="IHtmlContentBuilder"/>.</param>
|
||||||
|
void MoveTo(IHtmlContentBuilder builder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -30,7 +30,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
|
||||||
/// <returns>A reference to this instance after the set operation has completed.</returns>
|
/// <returns>A reference to this instance after the set operation has completed.</returns>
|
||||||
public TagHelperContent SetHtmlContent(IHtmlContent htmlContent)
|
public TagHelperContent SetHtmlContent(IHtmlContent htmlContent)
|
||||||
{
|
{
|
||||||
HtmlContentBuilderExtensions.SetHtmlContent(this, htmlContent);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -44,7 +43,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
|
||||||
/// <returns>A reference to this instance after the set operation has completed.</returns>
|
/// <returns>A reference to this instance after the set operation has completed.</returns>
|
||||||
public TagHelperContent SetContent(string unencoded)
|
public TagHelperContent SetContent(string unencoded)
|
||||||
{
|
{
|
||||||
HtmlContentBuilderExtensions.SetContent(this, unencoded);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -58,7 +56,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
|
||||||
/// <returns>A reference to this instance after the set operation has completed.</returns>
|
/// <returns>A reference to this instance after the set operation has completed.</returns>
|
||||||
public TagHelperContent SetHtmlContent(string encoded)
|
public TagHelperContent SetHtmlContent(string encoded)
|
||||||
{
|
{
|
||||||
HtmlContentBuilderExtensions.SetHtmlContent(this, encoded);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,7 +93,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
|
||||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||||
public TagHelperContent AppendFormat(string format, params object[] args)
|
public TagHelperContent AppendFormat(string format, params object[] args)
|
||||||
{
|
{
|
||||||
HtmlContentBuilderExtensions.AppendFormat(this, null, format, args);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -113,7 +109,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
|
||||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||||
public TagHelperContent AppendFormat(IFormatProvider provider, string format, params object[] args)
|
public TagHelperContent AppendFormat(IFormatProvider provider, string format, params object[] args)
|
||||||
{
|
{
|
||||||
HtmlContentBuilderExtensions.AppendFormat(this, provider, format, args);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Html.Abstractions" Version="$(MicrosoftAspNetCoreHtmlAbstractionsPackageVersion)" />
|
|
||||||
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourcePackageVersion)" />
|
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourcePackageVersion)" />
|
||||||
|
<PackageReference Include="System.Text.Encodings.Web" Version="$(SystemTextEncodingsWebPackageVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
// 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 System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text.Encodings.Web;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Html
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An <see cref="IHtmlContent"/> implementation that wraps an HTML encoded <see cref="string"/>.
|
||||||
|
/// </summary>
|
||||||
|
public class HtmlString : IHtmlContent
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An <see cref="HtmlString"/> instance for <see cref="Environment.NewLine"/>.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly HtmlString NewLine = new HtmlString(Environment.NewLine);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An <see cref="HtmlString"/> instance for <see cref="string.Empty"/>.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly HtmlString Empty = new HtmlString(string.Empty);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new <see cref="HtmlString"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">The HTML encoded value.</param>
|
||||||
|
public HtmlString(string value)
|
||||||
|
{
|
||||||
|
Value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the HTML encoded value.
|
||||||
|
/// </summary>
|
||||||
|
public string Value { get; }
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public void WriteTo(TextWriter writer, HtmlEncoder encoder)
|
||||||
|
{
|
||||||
|
if (writer == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(writer));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (encoder == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(encoder));
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.Write(Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Value ?? string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
// 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 System.IO;
|
||||||
|
using System.Text.Encodings.Web;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Html
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// HTML content which can be written to a TextWriter.
|
||||||
|
/// </summary>
|
||||||
|
public interface IHtmlContent
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Writes the content by encoding it with the specified <paramref name="encoder"/>
|
||||||
|
/// to the specified <paramref name="writer"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="writer">The <see cref="TextWriter"/> to which the content is written.</param>
|
||||||
|
/// <param name="encoder">The <see cref="HtmlEncoder"/> which encodes the content to be written.</param>
|
||||||
|
void WriteTo(TextWriter writer, HtmlEncoder encoder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
// 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.AspNetCore.Html
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A builder for HTML content.
|
||||||
|
/// </summary>
|
||||||
|
public interface IHtmlContentBuilder : IHtmlContentContainer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Appends an <see cref="IHtmlContent"/> instance.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="content">The <see cref="IHtmlContent"/> to append.</param>
|
||||||
|
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
|
||||||
|
IHtmlContentBuilder AppendHtml(IHtmlContent content);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Appends a <see cref="string"/> value. The value is treated as unencoded as-provided, and will be HTML
|
||||||
|
/// encoded before writing to output.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="unencoded">The <see cref="string"/> to append.</param>
|
||||||
|
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
|
||||||
|
IHtmlContentBuilder Append(string unencoded);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Appends an HTML encoded <see cref="string"/> value. The value is treated as HTML encoded as-provided, and
|
||||||
|
/// no further encoding will be performed.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="encoded">The HTML encoded <see cref="string"/> to append.</param>
|
||||||
|
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
|
||||||
|
IHtmlContentBuilder AppendHtml(string encoded);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clears the content.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
|
||||||
|
IHtmlContentBuilder Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
// 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.AspNetCore.Html
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Defines a contract for <see cref="IHtmlContent"/> instances made up of several components which
|
||||||
|
/// can be copied into an <see cref="IHtmlContentBuilder"/>.
|
||||||
|
/// </summary>
|
||||||
|
public interface IHtmlContentContainer : IHtmlContent
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Copies the contained content of this <see cref="IHtmlContentContainer"/> into <paramref name="builder"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="builder">The <see cref="IHtmlContentBuilder"/>.</param>
|
||||||
|
void CopyTo(IHtmlContentBuilder builder);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>
|
||||||
|
/// Moves the contained content of this <see cref="IHtmlContentContainer"/> into <paramref name="builder"/>.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// After <see cref="MoveTo"/> is called, this <see cref="IHtmlContentContainer"/> instance should be left
|
||||||
|
/// in an empty state.
|
||||||
|
/// </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="builder">The <see cref="IHtmlContentBuilder"/>.</param>
|
||||||
|
void MoveTo(IHtmlContentBuilder builder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -30,7 +30,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
|
||||||
/// <returns>A reference to this instance after the set operation has completed.</returns>
|
/// <returns>A reference to this instance after the set operation has completed.</returns>
|
||||||
public TagHelperContent SetHtmlContent(IHtmlContent htmlContent)
|
public TagHelperContent SetHtmlContent(IHtmlContent htmlContent)
|
||||||
{
|
{
|
||||||
HtmlContentBuilderExtensions.SetHtmlContent(this, htmlContent);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -44,7 +43,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
|
||||||
/// <returns>A reference to this instance after the set operation has completed.</returns>
|
/// <returns>A reference to this instance after the set operation has completed.</returns>
|
||||||
public TagHelperContent SetContent(string unencoded)
|
public TagHelperContent SetContent(string unencoded)
|
||||||
{
|
{
|
||||||
HtmlContentBuilderExtensions.SetContent(this, unencoded);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -58,7 +56,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
|
||||||
/// <returns>A reference to this instance after the set operation has completed.</returns>
|
/// <returns>A reference to this instance after the set operation has completed.</returns>
|
||||||
public TagHelperContent SetHtmlContent(string encoded)
|
public TagHelperContent SetHtmlContent(string encoded)
|
||||||
{
|
{
|
||||||
HtmlContentBuilderExtensions.SetHtmlContent(this, encoded);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,7 +93,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
|
||||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||||
public TagHelperContent AppendFormat(string format, params object[] args)
|
public TagHelperContent AppendFormat(string format, params object[] args)
|
||||||
{
|
{
|
||||||
HtmlContentBuilderExtensions.AppendFormat(this, null, format, args);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -113,7 +109,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
|
||||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||||
public TagHelperContent AppendFormat(IFormatProvider provider, string format, params object[] args)
|
public TagHelperContent AppendFormat(IFormatProvider provider, string format, params object[] args)
|
||||||
{
|
{
|
||||||
HtmlContentBuilderExtensions.AppendFormat(this, provider, format, args);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Html.Abstractions" Version="$(MicrosoftAspNetCoreHtmlAbstractionsPackageVersion)" />
|
|
||||||
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourcePackageVersion)" />
|
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourcePackageVersion)" />
|
||||||
|
<PackageReference Include="System.Text.Encodings.Web" Version="$(SystemTextEncodingsWebPackageVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
// 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 System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text.Encodings.Web;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Html
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An <see cref="IHtmlContent"/> implementation that wraps an HTML encoded <see cref="string"/>.
|
||||||
|
/// </summary>
|
||||||
|
public class HtmlString : IHtmlContent
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An <see cref="HtmlString"/> instance for <see cref="Environment.NewLine"/>.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly HtmlString NewLine = new HtmlString(Environment.NewLine);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An <see cref="HtmlString"/> instance for <see cref="string.Empty"/>.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly HtmlString Empty = new HtmlString(string.Empty);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new <see cref="HtmlString"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">The HTML encoded value.</param>
|
||||||
|
public HtmlString(string value)
|
||||||
|
{
|
||||||
|
Value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the HTML encoded value.
|
||||||
|
/// </summary>
|
||||||
|
public string Value { get; }
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public void WriteTo(TextWriter writer, HtmlEncoder encoder)
|
||||||
|
{
|
||||||
|
if (writer == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(writer));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (encoder == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(encoder));
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.Write(Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Value ?? string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
// 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 System.IO;
|
||||||
|
using System.Text.Encodings.Web;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Html
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// HTML content which can be written to a TextWriter.
|
||||||
|
/// </summary>
|
||||||
|
public interface IHtmlContent
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Writes the content by encoding it with the specified <paramref name="encoder"/>
|
||||||
|
/// to the specified <paramref name="writer"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="writer">The <see cref="TextWriter"/> to which the content is written.</param>
|
||||||
|
/// <param name="encoder">The <see cref="HtmlEncoder"/> which encodes the content to be written.</param>
|
||||||
|
void WriteTo(TextWriter writer, HtmlEncoder encoder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
// 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.AspNetCore.Html
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A builder for HTML content.
|
||||||
|
/// </summary>
|
||||||
|
public interface IHtmlContentBuilder : IHtmlContentContainer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Appends an <see cref="IHtmlContent"/> instance.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="content">The <see cref="IHtmlContent"/> to append.</param>
|
||||||
|
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
|
||||||
|
IHtmlContentBuilder AppendHtml(IHtmlContent content);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Appends a <see cref="string"/> value. The value is treated as unencoded as-provided, and will be HTML
|
||||||
|
/// encoded before writing to output.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="unencoded">The <see cref="string"/> to append.</param>
|
||||||
|
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
|
||||||
|
IHtmlContentBuilder Append(string unencoded);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Appends an HTML encoded <see cref="string"/> value. The value is treated as HTML encoded as-provided, and
|
||||||
|
/// no further encoding will be performed.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="encoded">The HTML encoded <see cref="string"/> to append.</param>
|
||||||
|
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
|
||||||
|
IHtmlContentBuilder AppendHtml(string encoded);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clears the content.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
|
||||||
|
IHtmlContentBuilder Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
// 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.AspNetCore.Html
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Defines a contract for <see cref="IHtmlContent"/> instances made up of several components which
|
||||||
|
/// can be copied into an <see cref="IHtmlContentBuilder"/>.
|
||||||
|
/// </summary>
|
||||||
|
public interface IHtmlContentContainer : IHtmlContent
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Copies the contained content of this <see cref="IHtmlContentContainer"/> into <paramref name="builder"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="builder">The <see cref="IHtmlContentBuilder"/>.</param>
|
||||||
|
void CopyTo(IHtmlContentBuilder builder);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>
|
||||||
|
/// Moves the contained content of this <see cref="IHtmlContentContainer"/> into <paramref name="builder"/>.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// After <see cref="MoveTo"/> is called, this <see cref="IHtmlContentContainer"/> instance should be left
|
||||||
|
/// in an empty state.
|
||||||
|
/// </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="builder">The <see cref="IHtmlContentBuilder"/>.</param>
|
||||||
|
void MoveTo(IHtmlContentBuilder builder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -30,7 +30,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
|
||||||
/// <returns>A reference to this instance after the set operation has completed.</returns>
|
/// <returns>A reference to this instance after the set operation has completed.</returns>
|
||||||
public TagHelperContent SetHtmlContent(IHtmlContent htmlContent)
|
public TagHelperContent SetHtmlContent(IHtmlContent htmlContent)
|
||||||
{
|
{
|
||||||
HtmlContentBuilderExtensions.SetHtmlContent(this, htmlContent);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -44,7 +43,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
|
||||||
/// <returns>A reference to this instance after the set operation has completed.</returns>
|
/// <returns>A reference to this instance after the set operation has completed.</returns>
|
||||||
public TagHelperContent SetContent(string unencoded)
|
public TagHelperContent SetContent(string unencoded)
|
||||||
{
|
{
|
||||||
HtmlContentBuilderExtensions.SetContent(this, unencoded);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -58,7 +56,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
|
||||||
/// <returns>A reference to this instance after the set operation has completed.</returns>
|
/// <returns>A reference to this instance after the set operation has completed.</returns>
|
||||||
public TagHelperContent SetHtmlContent(string encoded)
|
public TagHelperContent SetHtmlContent(string encoded)
|
||||||
{
|
{
|
||||||
HtmlContentBuilderExtensions.SetHtmlContent(this, encoded);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,7 +93,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
|
||||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||||
public TagHelperContent AppendFormat(string format, params object[] args)
|
public TagHelperContent AppendFormat(string format, params object[] args)
|
||||||
{
|
{
|
||||||
HtmlContentBuilderExtensions.AppendFormat(this, null, format, args);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -113,7 +109,6 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
|
||||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||||
public TagHelperContent AppendFormat(IFormatProvider provider, string format, params object[] args)
|
public TagHelperContent AppendFormat(IFormatProvider provider, string format, params object[] args)
|
||||||
{
|
{
|
||||||
HtmlContentBuilderExtensions.AppendFormat(this, provider, format, args);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,9 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Html.Abstractions" Version="$(MicrosoftAspNetCoreHtmlAbstractionsPackageVersion)" />
|
|
||||||
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourcePackageVersion)" />
|
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourcePackageVersion)" />
|
||||||
|
<PackageReference Include="System.Text.Encodings.Web" Version="$(SystemTextEncodingsWebPackageVersion)" />
|
||||||
|
|
||||||
<ProjectReference Include="..\Microsoft.AspNetCore.Razor.Test.ComponentShim\Microsoft.AspNetCore.Razor.Test.ComponentShim.csproj" />
|
<ProjectReference Include="..\Microsoft.AspNetCore.Razor.Test.ComponentShim\Microsoft.AspNetCore.Razor.Test.ComponentShim.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
||||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Html.Abstractions.dll"/>
|
|
||||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
|
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
|
||||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/>
|
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
||||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Html.Abstractions.dll"/>
|
|
||||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
|
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
|
||||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/>
|
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
||||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Html.Abstractions.dll"/>
|
|
||||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
|
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
|
||||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/>
|
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
||||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Html.Abstractions.dll"/>
|
|
||||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
|
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
|
||||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/>
|
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
||||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Html.Abstractions.dll"/>
|
|
||||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
|
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
|
||||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/>
|
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
||||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Html.Abstractions.dll"/>
|
|
||||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
|
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
|
||||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/>
|
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
||||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Html.Abstractions.dll"/>
|
|
||||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
|
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
|
||||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/>
|
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
||||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Html.Abstractions.dll"/>
|
|
||||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
|
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.ComponentShim.dll"/>
|
||||||
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/>
|
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.dll"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue