You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.2 KiB
37 lines
1.2 KiB
'**************************************************
|
|
' 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(Of TContext As Class)
|
|
Implements ITextFormatter(Of TContext)
|
|
|
|
''' <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 context As TContext, ByVal source As String) As String Implements ITextFormatter(Of TContext).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
|
|
|