HtmlEscape(html) : String?

Escapes special HTML characters.

HtmlEscape Parameters

html : String?

HtmlEscape Examples

var ok = HtmlEscape('a < b') == 'a &amp;lt; b';

HtmlNode(tagname, attrs?, text?) : HtmlNode

Creates HTML element node.

HtmlNode Parameters

tagname : String
HTML tag name (e.g. div).

attrs? : Dict?
HTML attributes to set on the node (e.g. style, class).

text? : String?
Inner text of the node.

HtmlNode Examples

var ok = HtmlNode('div', { class = 'header' }, 'Title').ToString() == '&lt;div class="header"&gt;Title&lt;/div&gt;';

HtmlSanitize(html) : String?

Removes unsafe HTML markup from HTML fragment.

HtmlSanitize Parameters

html : String

HtmlSanitize Examples

var ok = HtmlSanitize('&lt;div&gt;&lt;script&gt;&lt;/script&gt;&lt;/div&gt;') == '&lt;div&gt;&lt;/div&gt;';

HtmlSelect(html, query) : HtmlQuery

Parses HTML content and selects nodes using jQuery-like syntax.

HtmlSelect Parameters

html : Binary?

query : String

HtmlSelect Examples

var ok = HtmlSelect('&lt;div&gt;Hello &lt;span&gt;World&lt;/span&gt;!&lt;/div&gt;', 'span').Text() == 'World';

HtmlTable(array, options?) : String?

Builds HTML table from array of objects.

HtmlTable Parameters

array : []

options? : Dict?
{ colfmt='{prefix}{col} {i} – ‘, addTableTag = true }

HtmlText(html, formatted = false) : String?

Extracts text from HTML content.

HtmlText Parameters

html : Binary?

formatted : Boolean = false
True to apply simple formatting (e.g. for lists, tables).

HtmlText Examples

var ok = HtmlText('&lt;div&gt;Hello &lt;span&gt;World&lt;/span&gt;!&lt;/div&gt;') == 'Hello World!';

ParseHtml(html) : HtmlQuery

Parses HTML content to a queryable object.

ParseHtml Parameters

html : Binary?

ParseHtml Examples

var ok = ParseHtml('&lt;div&gt;Hello &lt;span&gt;World&lt;/span&gt;!&lt;/div&gt;').First().Name == 'div';

ToHtml(object, includeProps?, attrProps?, tagSelector?, getProp?) : HtmlQuery

Converts an object to HTML DOM.

ToHtml Parameters

object : ?
Can be an object, dictionary or array of objects/dicts.

includeProps? : Dict?
Properties to serialize (leave empty to auto detect), name -> label.

attrProps? : Dict?
Properties to include as attributes (if empty then all properties starting with ‘@’ are treated as attributes), name -> attrName.

tagSelector? : Function
Function (item, nameInParent, defaultTag) => tagname or node; nameInParent is null for root objects and array items.

getProp? : Function
Custom function to extract property (item, propName) => value; propName is null for item itself.

WebBrowser(name?) : ?

Returns a web browser engine to execute javascript or render html page.

WebBrowser Parameters

name? : String?

Leave a Comment

Your email address will not be published. Required fields are marked *