C# Class VX.Sys.HtmlStyler

Show file Open project: shuruev/CCNet.Extensions

Public Methods

Method Description
InlineCss ( string html ) : string

Converts HTML document with CSS style into HTML documend with inlined styles. Version 1.0.0.2

Please ensure that your html compatible with XHTML™ 1.1 http://www.w3.org/TR/xhtml11. Be informed that priority of applying CSS is not descendant but simply the order of style declaration.

Private Methods

Method Description
AppendNewStyleAttribute ( XmlDocument doc, CssStyle selector, XmlNode htmlNode ) : void

Save CSS style into "".

ExtractCssFromHtml ( string html ) : string

Extracts CSS style from HTML document.

FormatOutXmlDocument ( XmlDocument xmlDocument ) : string

Removes redundant spaces from result html text.

GetCssStyleList ( string css ) : IEnumerable

Parses CSS style text into separate styles.

GetTextAfterBodyTag ( string text ) : string
GetTextBeforeBodyTag ( string text ) : string
LowercaseInlineStylePropertyName ( XmlNode doc ) : void

Lowercase of inline CSS properties in "style" attributes of HTML document.

MergeStyles ( XmlDocument doc, XmlNode htmlNode ) : void

Apply CSS style to HTML node.

PrepareXml ( string text ) : string

Prepare valid XML text.

RemoveHiddenElements ( XmlNode doc ) : void

Removes nodes with style "display: none;" from HTML document.

ReplaceEx ( string original, string pattern, string replacement ) : string

Fast string replace method.

Method Details

InlineCss() public static method

Converts HTML document with CSS style into HTML documend with inlined styles. Version 1.0.0.2
Please ensure that your html compatible with XHTML™ 1.1 http://www.w3.org/TR/xhtml11. Be informed that priority of applying CSS is not descendant but simply the order of style declaration.
public static InlineCss ( string html ) : string
html string Source HTML document.
return string