Module z_html

Utility functions for html processing.

Copyright © 2009 Marc Worrell Date: 2009-04-17

Authors: Marc Worrell (marc@worrell.nl).

Description

Utility functions for html processing. Also used for property filtering (by m_rsc_update).

Function Index

ensure_escaped_amp/1Ensure that &-characters are properly escaped inside a html string.
escape/1Escape a string so that it is valid within HTML/ XML.
escape_link/1Escape a text.
escape_props/1Escape all properties used for an update statement.
nl2br/1Translate any newlines to html br entities.
noscript/1Filter a url, remove any javascript.
sanitize/1Sanitize a (X)HTML string.
scrape_link_elements/1Given a HTML list, scrape all <link> elements and return their attributes.
strip/1Strip all html elements from the text.
unescape/1Unescape - reverses the effect of escape.

Function Details

ensure_escaped_amp/1

ensure_escaped_amp(B) -> any()

Ensure that &-characters are properly escaped inside a html string.

escape/1

escape(L::iolist()) -> binary()

Escape a string so that it is valid within HTML/ XML.

escape_link/1

escape_link(Text) -> binary()

Escape a text. Expands any urls to links with a nofollow attribute.

escape_props/1

escape_props(Props::PropertyList) -> PropertyList

Escape all properties used for an update statement. Only leaves the body property in tact.

nl2br/1

nl2br(B) -> any()

Translate any newlines to html br entities.

noscript/1

noscript(Url) -> any()

Filter a url, remove any javascript.

sanitize/1

sanitize(Html::binary()) -> binary()

Sanitize a (X)HTML string. Remove elements and attributes that might be harmful.

scrape_link_elements/1

scrape_link_elements(Html::string()) -> [LinkAttributes]

Given a HTML list, scrape all <link> elements and return their attributes. Attribute names are lowercased.

strip/1

strip(Html::iolist()) -> iolist()

Strip all html elements from the text. Simple parsing is applied to find the elements. Does not escape the end result.

unescape/1

unescape(L::iolist()) -> binary()

Unescape - reverses the effect of escape.


Generated by EDoc, Feb 25 2011, 21:14:41.