﻿// 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.Html.Abstractions
{
    /// <summary>
    /// A builder for HTML content.
    /// </summary>
    public interface IHtmlContentBuilder : IHtmlContent
    {
        /// <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 Append(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="content">The <see cref="string"/> to append.</param>
        /// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
        IHtmlContentBuilder Append(string unencoded);

        /// <summary>
        /// Clears the content.
        /// </summary>
        void Clear();
    }
}

﻿// 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.Html.Abstractions
{
    /// <summary>
    /// A builder for HTML content.
    /// </summary>
    public interface IHtmlContentBuilder : IHtmlContent
    {
        /// <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 Append(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="content">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="content">The HTML encoded <see cref="string"/> to append.</param>
        /// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
        IHtmlContentBuilder AppendEncoded(string encoded);

        /// <summary>
        /// Clears the content.
        /// </summary>
        void Clear();
    }
}

Add AppendEncoded to the builder
Add AppendEncoded to the builder

This is needed because a builder may have an optimized path for an
unencoded string. There's also no 'common' encoded string implementation
so it's much more straightforward to put this on the interface.
