hemplateSimple XML template engine |
git clone git://git.dimitrijedobrota.com/hemplate.git |
Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING |
html.cpp (970B)
0 #include <iostream> 1 #include <vector> 2 3 #include "hemplate/html.hpp" 4 5 #include "hemplate/attribute.hpp" 6 7 int main() 8 { 9 using namespace hemplate; // NOLINT 10 11 const attribute_list li_attrs {{"class", "home_li"}}; 12 const attribute_list ul_attrs { 13 {"id", "main_ul"}, 14 {"class", "home_ul"}, 15 {"style", "margin-bottom: 1em"}, 16 }; 17 18 const std::vector<html::b> vec = {html::b("1"), html::b("2"), html::b("3")}; 19 20 std::cout << html::html { 21 comment {"Hello this is a comment"}, 22 html::ul { 23 html::li { 24 {li_attrs, {{"class", "item1"}}}, 25 "Item 1", 26 "some text", 27 }, 28 html::li { 29 {li_attrs, {{"class", "item2"}}}, 30 "Item 2", 31 "some text", 32 }, 33 transform( 34 vec, 35 [](const auto& e) 36 { 37 return e; 38 } 39 ), 40 }, 41 html::hr {}, 42 }; 43 44 return 0; 45 }