#xml #html #templating #library

nightly macro rdxl

Rusty Domain Extensible Language

39 releases

✓ Uses Rust 2018 edition

new 0.3.13 Jun 2, 2020
0.3.12 Jun 1, 2020
0.3.7 May 30, 2020
0.2.4 May 28, 2020
0.1.8 Apr 28, 2020

#40 in Template engine

Download history 86/week @ 2020-04-26 25/week @ 2020-05-03 6/week @ 2020-05-10 144/week @ 2020-05-17 194/week @ 2020-05-24

188 downloads per month
Used in 2 crates

MIT/Apache

56KB
1K SLoC

Rusty Domain Extensible Language

Domain specific language macros for Rust to generate xhtml.

let my_int = 3;
let my_str = "asdf";
let my_vec = vec![true, false, true, true];

println!("{}",xhtml!(<ul>
   {{ for v in my_vec.iter() {{
      <li>{{my_int}}, {{my_str}}, {{v}}</li>
   }} }}
</ul>));

Modularized templating is encouraged through custom XML elements:

xtype!(<!MyList my_string:String my_int:u64>
   <!MyItem my_bool:bool/>
   <!MyOtherItem my_char:char/>
</MyList>);

xrender!(MyList, <ul>
  <li>{{ self.my_string }}</li>
  <li>{{ self.my_int }}</li>
  {{ for i in self.children.iter() {{
    {{ if let MyListChildren::MyItem(my_item) = i {{
      <li>MyItem: {{ my_item.my_bool }}</li>
    }} else if let MyListChildren::MyOtherItem(my_other_item) = i {{
      <li>MyOtherItem: {{ my_other_item.my_char }}</li>
    }} }}
  }} }}
</ul>);

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in rdxl by you, shall be dual licensed under the MIT and Apache 2.0 license without any additional terms or conditions.

Dependencies

~400–720KB
~17K SLoC