#html #stack #dsl #web #html-templating #web-programming #filo

html_stack

A stack based dsl for writing html. This is not an html template!

3 stable releases

1.0.2 Dec 29, 2022

#2206 in Rust patterns

29 downloads per month

MIT/Apache

7KB
98 lines

by extinct

A dsl (domain specific language) for writing html. This is NOT an html template. This library focus is on html composability. It uses a FILO stack paradigm.

usage

use html_stack::Stack ;
fn myhomepage() ->String  {
         let s = Stack::new() ;
         s .put("my homepage") .wrp("title") .wrp("head") ;
         s .put("my homepage") .wrp("h1") ;
         s .put("Lorem ipsum dolor sit amet, consectetur adipiscing elit.") .wrp("p") .add() ;
         s .put("") .wrp("img src=/img/image.jpg") .add() ;
         s .put("some link") .wrp("a href=/somelink/") .add() ;
         s .wrp("div class='class1 class2'")
         s .wrp("body") .add() ;
         s .put("") .wrp("script type=module src=/js/main.js") .add() ;
         s .wrp("html") ;
         return s .doctype() ;
         }

No runtime deps