Module z_css

Utility functions for CSS processing.

Copyright © 2014 Marc Worrell

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

Description

Utility functions for CSS processing. Also used for sanitizing HTML.

Data Types

charset()

charset() = no_charset | {charset, string()}

import()

import() = no_import | {import, Uri::token(), medialist()}

line()

line() = pos_integer()

media()

media() = [{ident, line(), string()}]

medialist()

medialist() = [media()]

rules()

rules() = list()

stylesheet()

stylesheet() = {stylesheet, charset(), import(), rules()}

tk()

tk() = '{' | '}' | '[' | ']' | '(' | ')' | ',' | '.' | ':' | '/' | '-' | '+' | '*' | '>' | '=' | badcomment | includes | dashmatch | string | bad_string | ident | hash | import_sym | page_sym | media_sym | charset_sym | important_sym | ems | exs | length | angle | time | freq | dimension | percentage | number | uri | bad_uri | function | literal

token()

token() = {tk(), line(), string()}

tokens()

tokens() = [token()]

Function Index

parse/1Parse a CSS binary or a token list.
sanitize/1Sanitize a css string, remove all external URI references and injectable content.
sanitize_style/1Sanitize a css style tag, remove all external URI references and injectable content.
scan/1Tokenize a CSS string ot binary, returns a list of tokens.

Function Details

parse/1

parse(B::binary() | tokens()) -> {ok, stylesheet()} | {error, {line(), Error::binary()}}

Parse a CSS binary or a token list. Return a parse tree of the css.

sanitize/1

sanitize(Css::binary()) -> {ok, Css::binary()} | {error, {Line::line(), Message::binary()}}

Sanitize a css string, remove all external URI references and injectable content.

sanitize_style/1

sanitize_style(Css::binary() | string()) -> {ok, Css::binary()} | {error, {Line::line(), Message::binary()}}

Sanitize a css style tag, remove all external URI references and injectable content.

scan/1

scan(Bs::string() | binary()) -> {ok, tokens()}

Tokenize a CSS string ot binary, returns a list of tokens.


Generated by EDoc