View Source z_svg (zotonic_stdlib v1.26.1)

Utility functions for svg processing. Sanitize SVG content to remove potentially harmful elements and attributes. The sanitizer uses a whitelist of allowed elements and attributes.

Summary

Functions

Sanitize a binary containing a SVG

Sanitize an element from the SVG parse tree. Also called from z_html.erl

Types

svg_element/0

-type svg_element() :: binary() | {binary(), list(), list()} | {comment, binary()}.

Functions

sanitize(Svg)

-spec sanitize(binary()) -> binary().

Sanitize a binary containing a SVG

sanitize_element(Bin)

-spec sanitize_element(svg_element() | term()) -> svg_element().

Sanitize an element from the SVG parse tree. Also called from z_html.erl