1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//! Provides token definitions for HTML stream processing. The goal of this
//! library is to provide a simple API over which higher abstraction can be
//! built on.
//!
//! ## Example
//!
//! ```rust
//! #[macro_use]
//! extern crate hamlet;
//!
//! use std::fmt::Write;
//!
//! fn main() {
//! use hamlet::Token;
//! let tokens = vec![
//! Token::text("Hello, "),
//! Token::start_tag("small", attrs!(class="foo")),
//! Token::text("world!"),
//! Token::end_tag("small"),
//! ];
//!
//! let mut html = String::from("");
//! for token in tokens {
//! write!(html, "{}", token);
//! }
//!
//! assert_eq!(html, "Hello, <small class=\"foo\">world!</small>");
//! }
//! ```
/// Currently contains just a semi-private utility function to support the
/// [`attrs!`](./macro.attrs!.html) macro.
/// Contains structs for defining attributes on elements.
pub use Token;