utkarshkukreti / markup.rs

A blazing fast, type-safe template engine for Rust.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make attributes composable with Nodes

DrSloth opened this issue · comments

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 :)

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