C# Класс 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.
Наследование: Sanitizer
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
_newLineStarted bool
_whiteSpaceStarted bool

Открытые методы

Метод Описание
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!

Защищенные методы

Метод Описание
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

Описание методов

After() защищенный Метод

protected After ( TextWriter result ) : void
result System.IO.TextWriter
Результат void

Before() защищенный Метод

protected Before ( TextWriter result ) : void
result System.IO.TextWriter
Результат void

RenderText() защищенный Метод

protected RenderText ( TextWriter result, string value ) : void
result System.IO.TextWriter
value string
Результат void

RenderToPlainText() публичный статический Метод

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.
Результат string

StartNewLine() защищенный Метод

protected StartNewLine ( TextWriter result ) : void
result System.IO.TextWriter
Результат void

WriteCData() защищенный Метод

protected WriteCData ( TextWriter result, string value ) : void
result System.IO.TextWriter
value string
Результат void

WriteElement() защищенный Метод

protected WriteElement ( TextWriter result, string name, StringDictionary attributes, bool empty ) : void
result System.IO.TextWriter
name string
attributes System.Collections.Specialized.StringDictionary
empty bool
Результат void

WriteEndElement() защищенный Метод

protected WriteEndElement ( TextWriter result, string name ) : void
result System.IO.TextWriter
name string
Результат void

WriteString() защищенный Метод

protected WriteString ( TextWriter result, string value ) : void
result System.IO.TextWriter
value string
Результат void

Описание свойств

_newLineStarted защищенное свойство

If new line has already been written.
protected bool _newLineStarted
Результат bool

_whiteSpaceStarted защищенное свойство

Whether currently outputing whitespace.
protected bool _whiteSpaceStarted
Результат bool