'**************************************************
' FILE      : BBCodeHtmlGenerator.vb
' AUTHOR    : Paulo Santos
' CREATION  : 5/2/2009 10:19:43 AM
' COPYRIGHT : Copyright © 2009
'             PJ on Development
'             All Rights Reserved.
'
' Description:
'       TODO: Add file description
'
' Change log:
' 0.1   5/2/2009 10:19:43 AM
'       Paulo Santos
'       Created.
'***************************************************

''' <summary>
''' Represnts an HTML generator for the <see cref="BBCodeParser"/>.
''' </summary>
Public NotInheritable Class BBCodeHtmlFormatter
    Implements ITextFormatter

    ''' <summary>
    ''' Generates the desired text from the specified source.
    ''' </summary>
    ''' <param name="source">The source to generate the text.</param>
    ''' <returns>The text generated by the source.</returns>
    Public Function GenerateText(ByVal source As String) As String Implements ITextFormatter.Format
        Dim sb As New Text.StringBuilder(HtmlEncode(source))
        sb.Replace(vbCrLf, vbLf)
        sb.Replace(vbCr, String.Empty)
        sb.Replace(vbLf, "<br/>")
        Return sb.ToString()
    End Function

End Class
