#html #hamlet

hamlet

Html token definitions for stream processing

3 unstable releases

Uses old Rust 2015

0.2.1 Apr 9, 2016
0.2.0 Apr 9, 2016
0.1.0 Mar 29, 2016

#132 in #html

21 downloads per month
Used in cmark-hamlet

MIT/Apache

22KB
301 lines

hamlet

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

#[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>");
}

Links

License

Licensed under either of

at your option.

Contribution

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.

No runtime deps