view
ModuleServer-side views: templates with escaped params, filters, nesting and HTML minification.
A template is a Template function that writes the output; a view
without one renders its file's content as is.
Contents
use utopia_http::View;pub struct ViewA view: a template path or function, its params and filters, and an optional parent view.
Debug.use utopia_http::minify_html;pub fn minify_html(html: &str) -> StringMinifies HTML: drops tabs and line breaks right after > and right
before <, collapses runs of whitespace to one character, and keeps
<textarea> and <pre> blocks intact.
pub type Filter = Arc<dyn Fn(&str) -> String + Send + Sync>A filter: a string transformation registered by name.
pub type Template = Arc<dyn Fn(&View, &mut String) -> Result<()> + Send + Sync>A template: renders a view into out.
pub const FILTER_ESCAPE: &str = "escape"The name of the filter that HTML-escapes a value (every character with an HTML entity, quotes included).
pub const FILTER_NL2P: &str = "nl2p"The name of the filter that wraps blank-line separated blocks in <p>
and turns the remaining line breaks into <br />.