It's interesting to see how Maud's approach uses syntax extensions, in contrast to the less-powerful (but more stable) macro-based approach that Horrorshow uses: <a href="https://users.rust-lang.org/t/horrorshow-a-no-longer-poc-html-template-library/1603" rel="nofollow">https://users.rust-lang.org/t/horrorshow-a-no-longer-poc-htm...</a><p>I also wonder if Maud could benefit from the Syntex library (<a href="https://github.com/erickt/rust-syntex" rel="nofollow">https://github.com/erickt/rust-syntex</a>) which uses a fork of Rust's (currently unstable) parsing library to enable syntax extensions to work on the stable Rust release via code generation.
Very glad to see this. I've used type-safe templates in Haskell, and I've been hoping to see something similar in Rust. It looks like Maud has good defaults as well, such as escaping HTML by default.<p>I wonder if it would make sense to have splicing of previously created Maud values <i>not</i> escape them. That seems like the most common case where you'd end up using $$ otherwise: piecemeal generation of HTML fragments. Since Maud has a special type to represent the result of a template, it could recognize that type in a splice.<p>Also, the need to handle control structures inline (such as $if and $for) seems like it could be replaced with a mechanism to splice in arbitrary Rust code of the appropriate type. Because otherwise, Maud would need to handle things like $match.<p>Props for the name and documentation as well.
I started (and put aside) quite some times ago something with the similar approach, i.e using syntax extension but to actually write "real" html, in a template-language flavor<p><a href="https://github.com/allan-simon/rust-http-template" rel="nofollow">https://github.com/allan-simon/rust-http-template</a><p>I first wanted it to be used with Iron, but unfortunately I lost motivation when I saw that syntax extension will not be part of 1.0 . if people are interested I can revive it.
In "basic syntax" I suggest you to move the doc about "Splices" after "Elements", since the latter it's used in the former example (or even later since it's more complex than other things).
sorry to high jack the topic, whats the big deal with Rust? I have heard it has memory safety, but are the language syntax and standard library stable?