C# Class Tp.Web.Extensions.Components.PlainTextRenderer

A specialized sanitizer which outputs formatted plain text instead of HTML.
The renderer removes extra whitespace, and converts block level HTML elements to lines of plain text.
Inheritance: Sanitizer
Afficher le fichier Open project: TargetProcess/Tp.HelpDesk Class Usage Examples

Protected Properties

Свойство Type Description
_newLineStarted bool
_whiteSpaceStarted bool

Méthodes publiques

Méthode Description
RenderToPlainText ( string input ) : string

Converts HTML to plain text.

Warning, the returned text may contain HTML fragments!!! For example, the original HTML code is: <p>&lt;hello&lt;>/p> Then, the converted text will be: <hello> So if you intend to output the stripped text in HTML, you need encode it first!

Méthodes protégées

Méthode Description
After ( TextWriter result ) : void
Before ( TextWriter result ) : void
RenderText ( TextWriter result, string value ) : void
StartNewLine ( TextWriter result ) : void
WriteCData ( TextWriter result, string value ) : void
WriteElement ( TextWriter result, string name, StringDictionary attributes, bool empty ) : void
WriteEndElement ( TextWriter result, string name ) : void
WriteString ( TextWriter result, string value ) : void

Method Details

After() protected méthode

protected After ( TextWriter result ) : void
result System.IO.TextWriter
Résultat void

Before() protected méthode

protected Before ( TextWriter result ) : void
result System.IO.TextWriter
Résultat void

RenderText() protected méthode

protected RenderText ( TextWriter result, string value ) : void
result System.IO.TextWriter
value string
Résultat void

RenderToPlainText() public static méthode

Converts HTML to plain text.
Warning, the returned text may contain HTML fragments!!! For example, the original HTML code is: <p>&lt;hello&lt;>/p> Then, the converted text will be: <hello> So if you intend to output the stripped text in HTML, you need encode it first!
public static RenderToPlainText ( string input ) : string
input string Input HTML. May be null.
Résultat string

StartNewLine() protected méthode

protected StartNewLine ( TextWriter result ) : void
result System.IO.TextWriter
Résultat void

WriteCData() protected méthode

protected WriteCData ( TextWriter result, string value ) : void
result System.IO.TextWriter
value string
Résultat void

WriteElement() protected méthode

protected WriteElement ( TextWriter result, string name, StringDictionary attributes, bool empty ) : void
result System.IO.TextWriter
name string
attributes System.Collections.Specialized.StringDictionary
empty bool
Résultat void

WriteEndElement() protected méthode

protected WriteEndElement ( TextWriter result, string name ) : void
result System.IO.TextWriter
name string
Résultat void

WriteString() protected méthode

protected WriteString ( TextWriter result, string value ) : void
result System.IO.TextWriter
value string
Résultat void

Property Details

_newLineStarted protected_oe property

If new line has already been written.
protected bool _newLineStarted
Résultat bool

_whiteSpaceStarted protected_oe property

Whether currently outputing whitespace.
protected bool _whiteSpaceStarted
Résultat bool