Crates.io | html_stack |
lib.rs | html_stack |
version | 1.0.2 |
source | src |
created_at | 2022-12-29 00:16:10.319802 |
updated_at | 2022-12-29 19:40:43.019434 |
description | A stack based dsl for writing html. This is not an html template! |
homepage | |
repository | |
max_upload_size | |
id | 747058 |
size | 6,103 |
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.
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() ;
}