[−][src]Crate dom_renderer
Utilities for generating html (or other DOM) strings
Example
A simple html page can be created by following codes:
use dom_renderer::*; let html = html_basic!( title: "Page Title", body: end_elem!("h1"; "Section"), end_elem!("p"; "Text goes here..."), ); assert_eq!("<!DOCTYPE html><html><head><meta charset=\"utf-8\"><title>Page Title</title></head><body><h1>Section</h1><p>Text goes here...</p></body></html>", html.render());
DOM Nodes are represented by enum DomNode
, which can be created by macros, e.g.,
Re-exports
pub use doc_type::DomDocType; |
pub use element::DomEmptyElem; |
pub use element::DomElem; |
pub use document::DomDocument; |
pub use macros::*; |
pub use DomNode::*; |
Modules
doc_type | provides DOM DocumentType |
document | provides DOM Document (root node) |
element | provides DOM Elements |
macros | provides macros to create DOM Eelement instances |
Macros
doctype | creates DOM DocumentType |
domdoc | creates DOM Document |
domtxt | creates DOM Text Node |
elem | creates DOM Element |
empty | creates DOM Empty Element |
end_elem | crates DOM Element that have a single text node. |
html | creates HTML Document contains DocumenType and HTML element |
html_basic | creates HTML Document contains DocumenType and HTML element |
Enums
DomNode | Node types |
Traits
Render | Render recursive elements to String instance |