utkarshkukreti / markup.rs

A blazing fast, type-safe template engine for Rust.
Apache License 2.0
350 stars 14 forks source link

Make attributes composable with Nodes #26

Closed DrSloth closed 1 year ago

DrSloth commented 1 year ago

Hi, Currently attributes expect Expressions on both sides of the =. The body of elements is composable with more complex nodes like a for loop. It seems like there is no way to do the same for attributes. In my use case i want to compose a class list from a slice/iterator without allocating a temporary string and just directly writing it to the underlying fmt::Write instance. Currently the only solutions would be:

  1. allocating that temporary string
  2. use markup::raw
  3. Directly implement the Render trait

It would be nice if the attributes would be composable just like the body of html elements. If this would be changed this would obviously be a breaking change if there is no separate syntax implemented for this.

I would like to try implementing this as this crate is really really handy and helps with many of my use cases, thanks for the work.

Thanks :)

DrSloth commented 1 year ago

Closed via commit 131e185 see #27 for more info.