Crate weft

source ·
Expand description

weft.

This module provides runtime support for weft templates.

Example:

   use weft_derive::WeftRenderable;
   #[derive(WeftRenderable)]
   #[template(source = "<p>Hello {{ self.0 }}!</p>")]
   struct Greeting(String);

    let s = weft::render_to_string(Greeting("world".into())).expect("render_to_string");
    println!("{}", s);
    // Should print `<p>Hello world!<p>`

Modules

  • A module for things that should be in-scope by default in a template expression.

Structs

  • An attribute name and value pair.
  • An internal representation of a qualified name, such as a tag or attribute. Does not currently support namespaces.

Traits

  • Something that we can use to actually render HTML to text.
  • This is designed to be implemented via the weft_derive crate, but can be implemented manually for special cases.

Functions

Derive Macros

  • Derives a WeftRenderable instance from a given html template.