Skip to content
This repository was archived by the owner on Nov 20, 2018. It is now read-only.

Commit bcb56bd

Browse files
committed
Rename AppendEncoded() to AppendHtml() and SetContentEncoded() to SetHtmlContent()
- aspnet/Mvc#3225, 1 of 3 Also correct parameter names and doc comments - add `xml-docs-test` to ensure this doc comments remain valid in the future
1 parent 0219aab commit bcb56bd

File tree

6 files changed

+32
-28
lines changed

6 files changed

+32
-28
lines changed

makefile.shade

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ var AUTHORS='Microsoft Open Technologies, Inc.'
55

66
use-standard-lifecycle
77
k-standard-goals
8+
9+
#xml-docs-test .clean .build-compile description='Check generated XML documentation files for errors' target='package'
10+
k-xml-docs-test

src/Microsoft.AspNet.Html.Abstractions/HtmlContentBuilderExtensions.cs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using System.Diagnostics;
66
using System.Globalization;
77
using System.IO;
8-
using System.Text;
98
using Microsoft.Extensions.WebEncoders;
109

1110
namespace Microsoft.AspNet.Html.Abstractions
@@ -20,6 +19,7 @@ public static class HtmlContentBuilderExtensions
2019
/// item with the HTML encoded <see cref="string"/> representation of the corresponding item in the
2120
/// <paramref name="args"/> array.
2221
/// </summary>
22+
/// <param name="builder">The <see cref="IHtmlContentBuilder"/>.</param>
2323
/// <param name="format">
2424
/// The composite format <see cref="string"/> (see http://msdn.microsoft.com/en-us/library/txafckwd.aspx).
2525
/// The format string is assumed to be HTML encoded as-provided, and no further encoding will be performed.
@@ -54,9 +54,10 @@ public static IHtmlContentBuilder AppendFormat(
5454

5555
/// <summary>
5656
/// Appends the specified <paramref name="format"/> to the existing content with information from the
57-
/// <paramref name="provider"/> after replacing each format item with the HTML encoded <see cref="string"/>
58-
/// representation of the corresponding item in the <paramref name="args"/> array.
57+
/// <paramref name="formatProvider"/> after replacing each format item with the HTML encoded
58+
/// <see cref="string"/> representation of the corresponding item in the <paramref name="args"/> array.
5959
/// </summary>
60+
/// <param name="builder">The <see cref="IHtmlContentBuilder"/>.</param>
6061
/// <param name="formatProvider">An object that supplies culture-specific formatting information.</param>
6162
/// <param name="format">
6263
/// The composite format <see cref="string"/> (see http://msdn.microsoft.com/en-us/library/txafckwd.aspx).
@@ -122,9 +123,9 @@ public static IHtmlContentBuilder AppendLine(this IHtmlContentBuilder builder, s
122123
/// <param name="builder">The <see cref="IHtmlContentBuilder"/>.</param>
123124
/// <param name="content">The <see cref="IHtmlContent"/> to append.</param>
124125
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
125-
public static IHtmlContentBuilder AppendLine(this IHtmlContentBuilder builder, IHtmlContent htmlContent)
126+
public static IHtmlContentBuilder AppendLine(this IHtmlContentBuilder builder, IHtmlContent content)
126127
{
127-
builder.Append(htmlContent);
128+
builder.Append(content);
128129
builder.Append(HtmlEncodedString.NewLine);
129130
return builder;
130131
}
@@ -134,11 +135,11 @@ public static IHtmlContentBuilder AppendLine(this IHtmlContentBuilder builder, I
134135
/// The value is treated as HTML encoded as-provided, and no further encoding will be performed.
135136
/// </summary>
136137
/// <param name="builder">The <see cref="IHtmlContentBuilder"/>.</param>
137-
/// <param name="content">The HTML encoded <see cref="string"/> to append.</param>
138+
/// <param name="encoded">The HTML encoded <see cref="string"/> to append.</param>
138139
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
139-
public static IHtmlContentBuilder AppendLineEncoded(this IHtmlContentBuilder builder, string encoded)
140+
public static IHtmlContentBuilder AppendHtmlLine(this IHtmlContentBuilder builder, string encoded)
140141
{
141-
builder.AppendEncoded(encoded);
142+
builder.AppendHtml(encoded);
142143
builder.Append(HtmlEncodedString.NewLine);
143144
return builder;
144145
}
@@ -148,7 +149,7 @@ public static IHtmlContentBuilder AppendLineEncoded(this IHtmlContentBuilder bui
148149
/// and will be HTML encoded before writing to output.
149150
/// </summary>
150151
/// <param name="builder">The <see cref="IHtmlContentBuilder"/>.</param>
151-
/// <param name="value">The <see cref="string"/> value that replaces the content.</param>
152+
/// <param name="unencoded">The <see cref="string"/> value that replaces the content.</param>
152153
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
153154
public static IHtmlContentBuilder SetContent(this IHtmlContentBuilder builder, string unencoded)
154155
{
@@ -161,7 +162,7 @@ public static IHtmlContentBuilder SetContent(this IHtmlContentBuilder builder, s
161162
/// Sets the content to the <see cref="IHtmlContent"/> value.
162163
/// </summary>
163164
/// <param name="builder">The <see cref="IHtmlContentBuilder"/>.</param>
164-
/// <param name="value">The <see cref="IHtmlContent"/> value that replaces the content.</param>
165+
/// <param name="content">The <see cref="IHtmlContent"/> value that replaces the content.</param>
165166
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
166167
public static IHtmlContentBuilder SetContent(this IHtmlContentBuilder builder, IHtmlContent content)
167168
{
@@ -175,12 +176,12 @@ public static IHtmlContentBuilder SetContent(this IHtmlContentBuilder builder, I
175176
/// no further encoding will be performed.
176177
/// </summary>
177178
/// <param name="builder">The <see cref="IHtmlContentBuilder"/>.</param>
178-
/// <param name="content">The HTML encoded <see cref="string"/> that replaces the content.</param>
179+
/// <param name="encoded">The HTML encoded <see cref="string"/> that replaces the content.</param>
179180
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
180-
public static IHtmlContentBuilder SetContentEncoded(this IHtmlContentBuilder builder, string encoded)
181+
public static IHtmlContentBuilder SetHtmlContent(this IHtmlContentBuilder builder, string encoded)
181182
{
182183
builder.Clear();
183-
builder.AppendEncoded(encoded);
184+
builder.AppendHtml(encoded);
184185
return builder;
185186
}
186187

src/Microsoft.AspNet.Html.Abstractions/IHtmlContentBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public interface IHtmlContentBuilder : IHtmlContent
2929
/// </summary>
3030
/// <param name="encoded">The HTML encoded <see cref="string"/> to append.</param>
3131
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
32-
IHtmlContentBuilder AppendEncoded(string encoded);
32+
IHtmlContentBuilder AppendHtml(string encoded);
3333

3434
/// <summary>
3535
/// Clears the content.

src/Microsoft.Extensions.BufferedHtmlContent.Sources/BufferedHtmlContent.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ internal class BufferedHtmlContent : IHtmlContentBuilder
2424
/// <summary>
2525
/// Appends the <see cref="string"/> to the collection.
2626
/// </summary>
27-
/// <param name="value">The <c>string</c> to be appended.</param>
27+
/// <param name="unencoded">The <c>string</c> to be appended.</param>
2828
/// <returns>A reference to this instance after the Append operation has completed.</returns>
29-
public IHtmlContentBuilder Append(string value)
29+
public IHtmlContentBuilder Append(string unencoded)
3030
{
31-
Entries.Add(value);
31+
Entries.Add(unencoded);
3232
return this;
3333
}
3434

@@ -46,11 +46,11 @@ public IHtmlContentBuilder Append(IHtmlContent htmlContent)
4646
/// <summary>
4747
/// Appends the HTML encoded <see cref="string"/> to the collection.
4848
/// </summary>
49-
/// <param name="value">The HTML encoded <c>string</c> to be appended.</param>
49+
/// <param name="encoded">The HTML encoded <c>string</c> to be appended.</param>
5050
/// <returns>A reference to this instance after the Append operation has completed.</returns>
51-
public IHtmlContentBuilder AppendEncoded(string value)
51+
public IHtmlContentBuilder AppendHtml(string encoded)
5252
{
53-
Entries.Add(new HtmlEncodedString(value));
53+
Entries.Add(new HtmlEncodedString(encoded));
5454
return this;
5555
}
5656
/// <summary>
@@ -95,7 +95,7 @@ public void WriteTo(TextWriter writer, IHtmlEncoder encoder)
9595
}
9696
}
9797
}
98-
98+
9999
private string DebuggerToString()
100100
{
101101
using (var writer = new StringWriter())

test/Microsoft.AspNet.Html.Abstractions.Test/HtmlContentBuilderExtensionsTest.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ public void Builder_AppendLine_IHtmlContent()
6262
}
6363

6464
[Fact]
65-
public void Builder_AppendLineEncoded_String()
65+
public void Builder_AppendHtmlLine_String()
6666
{
6767
// Arrange
6868
var builder = new TestHtmlContentBuilder();
6969

7070
// Act
71-
builder.AppendLineEncoded("Hi");
71+
builder.AppendHtmlLine("Hi");
7272

7373
// Assert
7474
Assert.Collection(
@@ -112,14 +112,14 @@ public void Builder_SetContent_IHtmlContent()
112112
}
113113

114114
[Fact]
115-
public void Builder_SetContentEncoded_String()
115+
public void Builder_SetHtmlContent_String()
116116
{
117117
// Arrange
118118
var builder = new TestHtmlContentBuilder();
119119
builder.Append("Existing Content. Will be Cleared.");
120120

121121
// Act
122-
builder.SetContentEncoded("Hi");
122+
builder.SetHtmlContent("Hi");
123123

124124
// Assert
125125
Assert.Collection(
@@ -366,7 +366,7 @@ public IHtmlContentBuilder Append(IHtmlContent content)
366366
return this;
367367
}
368368

369-
public IHtmlContentBuilder AppendEncoded(string encoded)
369+
public IHtmlContentBuilder AppendHtml(string encoded)
370370
{
371371
Entries.Add(new EncodedString(encoded));
372372
return this;

test/Microsoft.Extensions.BufferedHtmlContent.Test/BufferedHtmlContentTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ public void AppendString_WrittenAsEncoded()
4141
}
4242

4343
[Fact]
44-
public void AppendEncoded_DoesNotGetWrittenAsEncoded()
44+
public void AppendHtml_DoesNotGetWrittenAsEncoded()
4545
{
4646
// Arrange
4747
var content = new BufferedHtmlContent();
48-
content.AppendEncoded("Hello");
48+
content.AppendHtml("Hello");
4949

5050
var writer = new StringWriter();
5151

0 commit comments

Comments
 (0)