C# Class Rsdn.Framework.Formatting.TextFormatter

�������������� ��������� � ��������� ����.
ファイルを表示 Open project: rsdn/RsdnFormatter Class Usage Examples

Public Properties

Property Type Description
HeadersRegex System.Text.RegularExpressions.Regex
TrimArray char[]

Protected Properties

Property Type Description
HostFormatting ProcessUrl>.IDictionary
ImagesDelegate ProcessImagesDelegate
SchemeFormatting ProcessUrl>.IDictionary
ServerName string

Public Methods

Method Description
CreateInlineTagReplacers ( bool checking, string>.Func tagNameGetter = null ) : StringBuilder>>.IList

Format ( string txt ) : string

Форматирование текста. НЕПОТОКОБЕЗОПАСНЫЙ!

Format ( string txt, bool smile ) : string

Форматирование текста. НЕПОТОКОБЕЗОПАСНЫЙ!

Format ( string txt, bool smile, bool doNotReplaceTags, bool doNotFormatImplicitLinks ) : string

Форматирование текста. НЕПОТОКОБЕЗОПАСНЫЙ!

FormatEmail ( string email ) : string

Format email address

GetMSDNRef ( string keyword ) : string

Возвращает ссылку на MSDN.

GetSmileFiles ( string text ) : string[]

Возвращает список имен файлов смайликов, задействованных в сообщении.

IsThereModeratorTag ( string text ) : bool

Проверяет на наличие модераторского текста в сообщении

ProcessISBN ( Match match, string isbn ) : string

Обработка ISBN

ProcessImages ( Match image ) : string

Process RSDN IMG tag

RemoveModeratorTag ( string text ) : string

Remove [moderator] tag from text.

RemoveTaglineTag ( string text ) : string

Remove [tagline] tag from text.

ReplaceImgWithUrl ( string text ) : string

Заменить теги IMG на URL.

TextFormatter ( ) : System

Создаёт экземпляр класса TextFormatter.

TextFormatter ( ProcessImagesDelegate imagesDelegate ) : System

Создаёт экземпляр класса TextFormatter

Protected Methods

Method Description
AddClass ( HtmlAnchor link, string className ) : HtmlAnchor

Add css class to HtmlAnchor

DefaultProcessImagesDelegate ( TextFormatter formatter, Match image ) : string

Делагат по умолчанию для обработки картинок.

DoMSDNRef ( Match match ) : string

Обработывает ссылки на MSDN.

FormatRsdnURLs ( Match urlMatch, HtmlAnchor link ) : bool

Format RSDN URLs to hyperlinks. Used in both, explicitly & implicitly specified links.

FormatURLs ( Match urlMatch, string urlAdsress, string urlName ) : string

Format URLs to hyperlinks. Used in both, explicitly & implicitly specified links.

GetImagePrefix ( ) : string

Возвращает префикс для картинок.

GetPathToRoot ( ) : string

Returns path to root of the site.

ListEvaluator ( Match match ) : string

Обработка нумерованных списков

PaintCode ( Match codeMatch ) : StringBuilder

Раскраска кода

ParseUrl ( string url ) : Match

Отпарсить URL.

ProcessEmailLink ( Match match ) : string

Process email link.

ProcessImplicitURLs ( Match match ) : string

Process implicit URLs (not explicity specified by RSDN URL tag).

ProcessRsdnLink ( Match name ) : string

Process RSDN link tag

ProcessRsdnLinkAsAnchor ( Match name ) : HtmlAnchor

Process RSDN link tag

ProcessURLs ( string url, string tag ) : string

Process RSDN URL tag

RenderHtmlAnchor ( HtmlAnchor htmlAnchor ) : string

Renders HTML for url.

Private Methods

Method Description
ProcessMsHelpLink ( Match urlMatch, HtmlAnchor link ) : bool

Process local MSDN links (ms-help scheme).

SetFont ( string code ) : string

Заменяет временные теги на html.

Method Details

AddClass() protected static method

Add css class to HtmlAnchor
protected static AddClass ( HtmlAnchor link, string className ) : HtmlAnchor
link HtmlAnchor
className string
return HtmlAnchor

CreateInlineTagReplacers() public static method

public static CreateInlineTagReplacers ( bool checking, string>.Func tagNameGetter = null ) : StringBuilder>>.IList
checking bool
tagNameGetter string>.Func
return StringBuilder>>.IList

DefaultProcessImagesDelegate() protected static method

Делагат по умолчанию для обработки картинок.
protected static DefaultProcessImagesDelegate ( TextFormatter formatter, Match image ) : string
formatter TextFormatter Форматтер.
image System.Text.RegularExpressions.Match Регэксповское совпадение тэга [img].
return string

DoMSDNRef() protected method

Обработывает ссылки на MSDN.
protected DoMSDNRef ( Match match ) : string
match System.Text.RegularExpressions.Match Вхождение [msdn]
return string

Format() public method

Форматирование текста. НЕПОТОКОБЕЗОПАСНЫЙ!
public Format ( string txt ) : string
txt string Исходный текст.
return string

Format() public method

Форматирование текста. НЕПОТОКОБЕЗОПАСНЫЙ!
public Format ( string txt, bool smile ) : string
txt string Исходный текст.
smile bool Признак обработки смайликов.
return string

Format() public method

Форматирование текста. НЕПОТОКОБЕЗОПАСНЫЙ!
public Format ( string txt, bool smile, bool doNotReplaceTags, bool doNotFormatImplicitLinks ) : string
txt string Исходный текст.
smile bool Признак обработки смайликов.
doNotReplaceTags bool Не заменять служебные символы HTML.
doNotFormatImplicitLinks bool Не форматировать явно не указанные ссылки.
return string

FormatEmail() public method

Format email address
public FormatEmail ( string email ) : string
email string
return string

FormatRsdnURLs() protected method

Format RSDN URLs to hyperlinks. Used in both, explicitly & implicitly specified links.
protected FormatRsdnURLs ( Match urlMatch, HtmlAnchor link ) : bool
urlMatch System.Text.RegularExpressions.Match Regex match with URL address.
link HtmlAnchor HtmlLink, initialized by default
return bool

FormatURLs() protected method

Format URLs to hyperlinks. Used in both, explicitly & implicitly specified links.
protected FormatURLs ( Match urlMatch, string urlAdsress, string urlName ) : string
urlMatch System.Text.RegularExpressions.Match Regex match with URL address.
urlAdsress string URL address.
urlName string URL name. May be or may be not different from URL address.
return string

GetImagePrefix() protected method

Возвращает префикс для картинок.
protected GetImagePrefix ( ) : string
return string

GetMSDNRef() public method

Возвращает ссылку на MSDN.
public GetMSDNRef ( string keyword ) : string
keyword string Название функции или искомый текст.
return string

GetPathToRoot() protected method

Returns path to root of the site.
protected GetPathToRoot ( ) : string
return string

GetSmileFiles() public static method

Возвращает список имен файлов смайликов, задействованных в сообщении.
public static GetSmileFiles ( string text ) : string[]
text string
return string[]

IsThereModeratorTag() public static method

Проверяет на наличие модераторского текста в сообщении
public static IsThereModeratorTag ( string text ) : bool
text string
return bool

ListEvaluator() protected static method

Обработка нумерованных списков
protected static ListEvaluator ( Match match ) : string
match System.Text.RegularExpressions.Match
return string

PaintCode() protected static method

Раскраска кода
protected static PaintCode ( Match codeMatch ) : StringBuilder
codeMatch System.Text.RegularExpressions.Match Вхождение кода (группа tag содержит тип кода)
return StringBuilder

ParseUrl() protected static method

Отпарсить URL.
protected static ParseUrl ( string url ) : Match
url string
return System.Text.RegularExpressions.Match

ProcessEmailLink() protected method

Process email link.
protected ProcessEmailLink ( Match match ) : string
match System.Text.RegularExpressions.Match Email match
return string

ProcessISBN() public method

Обработка ISBN
public ProcessISBN ( Match match, string isbn ) : string
match System.Text.RegularExpressions.Match
isbn string
return string

ProcessImages() public method

Process RSDN IMG tag
public ProcessImages ( Match image ) : string
image System.Text.RegularExpressions.Match Regexp match with RSDN img tag
return string

ProcessImplicitURLs() protected method

Process implicit URLs (not explicity specified by RSDN URL tag).
protected ProcessImplicitURLs ( Match match ) : string
match System.Text.RegularExpressions.Match URL match.
return string

ProcessRsdnLink() protected method

Process RSDN link tag
protected ProcessRsdnLink ( Match name ) : string
name System.Text.RegularExpressions.Match Regexp match with RSDN link tag
return string

ProcessRsdnLinkAsAnchor() protected method

Process RSDN link tag
protected ProcessRsdnLinkAsAnchor ( Match name ) : HtmlAnchor
name System.Text.RegularExpressions.Match Regexp match with RSDN link tag
return HtmlAnchor

ProcessURLs() protected method

Process RSDN URL tag
protected ProcessURLs ( string url, string tag ) : string
url string
tag string
return string

RemoveModeratorTag() public static method

Remove [moderator] tag from text.
public static RemoveModeratorTag ( string text ) : string
text string Original text.
return string

RemoveTaglineTag() public static method

Remove [tagline] tag from text.
public static RemoveTaglineTag ( string text ) : string
text string Original text.
return string

RenderHtmlAnchor() protected static method

Renders HTML for url.
protected static RenderHtmlAnchor ( HtmlAnchor htmlAnchor ) : string
htmlAnchor HtmlAnchor
return string

ReplaceImgWithUrl() public static method

Заменить теги IMG на URL.
public static ReplaceImgWithUrl ( string text ) : string
text string
return string

TextFormatter() public method

Создаёт экземпляр класса TextFormatter.
public TextFormatter ( ) : System
return System

TextFormatter() public method

Создаёт экземпляр класса TextFormatter
public TextFormatter ( ProcessImagesDelegate imagesDelegate ) : System
imagesDelegate ProcessImagesDelegate Делегат для обработки картинок. /// Если null - используется делегат по умолчанию . ///
return System

Property Details

HeadersRegex public_oe static_oe property

Headers
public static Regex,System.Text.RegularExpressions HeadersRegex
return System.Text.RegularExpressions.Regex

HostFormatting protected_oe property

Map of host names and associated handlers.
protected IDictionary HostFormatting
return ProcessUrl>.IDictionary

ImagesDelegate protected_oe property

Делегат для обработки картинок.
protected ProcessImagesDelegate ImagesDelegate
return ProcessImagesDelegate

SchemeFormatting protected_oe property

Map of URI schemes and associated handlers.
protected IDictionary SchemeFormatting
return ProcessUrl>.IDictionary

ServerName protected_oe property

Server's name for using in rsdn host replacing.
protected string ServerName
return string

TrimArray public_oe static_oe property

Массив символов для отсечения ведущих и концевых пробельных строк сообщений.
public static char[] TrimArray
return char[]