Skip to content
/ rumal Public

rumal (রুমাল) is a tiny header only single file HTML/CSS generator C++ library

License

Notifications You must be signed in to change notification settings

neel/rumal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rumal (রুমাল) is a tiny header only XML/HTML/SVG/CSS/Javascript* Generator C++ library

License pipeline status Documentation Status Codacy Badge Total alerts Language grade: C/C++

Composing XML/HTML/SVG/CSS/Javascript* fragments do not involve any heap memory allocation. Both HTML and CSS blocks can be nested. An HTML block refers to an HTML tag whereas a CSS block refers to a CSS declarations block. Nesting a CSS block inside another results into nested CSS declaration.

Basic Example

#include <iostream>
#include <rumal/rumal.hpp>

int main(int argc, char **argv){
    using namespace rumal::html::attrs;
    using namespace rumal::html::tags;
    using namespace rumal::css;
    using namespace rumal::css::props;
   
    std::cout << div(_id(42) / _class("test"),
                    span(_id(43) / _class("test"), "Hello"),
                    span("World")
                ) << std::endl;
    
    std::cout << select(".heading", 
                    position("relative") / 
                    display("block"), 
                ) << std::endl;
    return 0;
}

Nested CSS

using namespace rumal::css;
using namespace rumal::css::props;

select(".main", 
      display("block") 
    / position("relative"), 
    select(".heading", 
          display("block") 
        / position("relative")
    )
) / select(".container", 
      display("block") 
    / position("relative")
);

The above example produces the following CSS.

.container{
    position: relative; 
    display: block;
}

.main{
    position: relative;
    display: block;
}

.main > .heading{
    position: relative;
    display: block;
}

HTML attributes

HTML Tags

About

rumal (রুমাল) is a tiny header only single file HTML/CSS generator C++ library

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published