hyprtxt

Crates.iohyprtxt
lib.rshyprtxt
version0.1.1
sourcesrc
created_at2023-12-03 03:36:33.16481
updated_at2023-12-03 04:08:58.202788
descriptionA simple HTML templating macro.
homepagehttps://github.com/adabarx/hyprtxt
repositoryhttps://github.com/adabarx/hyprtxt
max_upload_size
id1056667
size9,151
Adamina Barx (adabarx)

documentation

README

hyprtxt

Concept

A simple HTML templating proc macro. I was inspired to make this after reading hypermedia.systems.

Example

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())
}
Commit count: 46

cargo fmt