Crates.io | hamlet |
lib.rs | hamlet |
version | 0.2.1 |
source | src |
created_at | 2016-03-29 17:02:57.439522 |
updated_at | 2016-04-09 15:47:54.081136 |
description | Html token definitions for stream processing |
homepage | https://nemo157.com/hamlet |
repository | https://github.com/Nemo157/hamlet |
max_upload_size | |
id | 4609 |
size | 36,554 |
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.
#[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>");
}
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any additional terms or conditions.