rtml
description
(r)ust macros for h(tml) expansion => rtml
usage
the output html will be.
Page Title
text
This is a Heading
This is a paragraph.
When there are attributes, they go first, before adding any inner nested html.
div!{ .style="background-color: red;" }
call render()
when you want to build the html.
Getting Started
Install the latest version of the rtml crate into your project
use either specific tags you plan to use or reference all tags by adding this use
statement.
use p;
// or
use *;
Attributes
According to the html5 spec, there are 3 different kinds of attributes, Global
, Event
, and Specific
.
Every tag can implement any of the attributes from the Global
or Event
list.
Specific
attributes go to a specific tag. Some of the Specific
tags can be on multiple tags. What makes this even more confusing, is the possible values an attribute can be for Specific
can change between the tag.
Event
attributes are not implemented yet.
One other goal of this project is to add extreme type safety on the possible attributes that can go on a tag and their specific value.
There are some special ones in rtml
as their attribute name is a keyword in rust itself, or an invalid token stream. It would be possible to allow them thanks to rusts macro expansion, but for simplicity, these special tags are represented as follows.
html5 | rtml |
---|---|
type | type_ |
for | for_ |
loop | loop_ |
kind | kind_ |
async | async_ |
http-equiv | http_equiv |
accept-charset | accept_charset |
Components
not implemented yet