| Crates.io | hyprtxt |
| lib.rs | hyprtxt |
| version | 0.1.1 |
| created_at | 2023-12-03 03:36:33.16481+00 |
| updated_at | 2023-12-03 04:08:58.202788+00 |
| description | A simple HTML templating macro. |
| homepage | https://github.com/adabarx/hyprtxt |
| repository | https://github.com/adabarx/hyprtxt |
| max_upload_size | |
| id | 1056667 |
| size | 9,151 |
A simple HTML templating proc macro. I was inspired to make this after reading hypermedia.systems.
use hyprtxt::hyprtxt;
fn main() {
let x = hyprtxt!(
"html" {
"lang"="en"
"head" {
"title" { $: "this is a test" }
"meta"* { "dum"="brane" }
}
"body" {
"div" {
"class"="class"
"id"="id"
"type"="idk"
"p" { $: "paragraph" }
$: "stuff"
$: "moar stuff"
}
}
}
);
assert_eq!(x, "<html lang=\"en\"><head><title>this is a test</title><meta dum=\"brane\"></head><body><div class=\"class\" id=\"id\" type=\"idk\"><p>paragraph</p>stuffmoar stuff</div></body></html>".to_string())
}