Stebalien / Horrorshow Rs
Licence: other
A macro-based html builder for rust
Stars: ✭ 228
Programming Languages
rust
11053 projects
Projects that are alternatives of or similar to Horrorshow Rs
Express Es6 Template Engine
Rendering engine for Express that uses ES6 javascript string templates as syntax.
Stars: ✭ 175 (-23.25%)
Mutual labels: html-template
Design Blocks
A set of 170+ Bootstrap based design blocks ready to be used to create clean modern websites.
Stars: ✭ 13,317 (+5740.79%)
Mutual labels: html-template
Duckscript
Simple, extendable and embeddable scripting language.
Stars: ✭ 169 (-25.88%)
Mutual labels: rust-library
Rust Delegate
Rust method delegation with less boilerplate
Stars: ✭ 177 (-22.37%)
Mutual labels: rust-library
Fatfree
A powerful yet easy-to-use PHP micro-framework designed to help you build dynamic and robust Web applications - fast!
Stars: ✭ 2,504 (+998.25%)
Mutual labels: html-template
Wither
An ODM for MongoDB built on the official MongoDB Rust driver.
Stars: ✭ 174 (-23.68%)
Mutual labels: rust-library
Gentelella Rtl
Free RTL Bootstrap 3 Admin Template
Stars: ✭ 194 (-14.91%)
Mutual labels: html-template
Pdb
A parser for Microsoft PDB (Program Database) debugging information
Stars: ✭ 156 (-31.58%)
Mutual labels: rust-library
Oboe
🗄 A simple tool to convert an Obsidian vault into a static directory of HTML files.
Stars: ✭ 168 (-26.32%)
Mutual labels: html-template
Ionic Starter Template
Reinventing the wheel, again! Sorry Ionic Team... but there are many newbies learning on Youtube!
Stars: ✭ 208 (-8.77%)
Mutual labels: html-template
Tentacle
A multiplexed p2p network framework that supports custom protocols
Stars: ✭ 150 (-34.21%)
Mutual labels: rust-library
Rust S3
Rust library for interfacing with AWS S3 and other API compatible services
Stars: ✭ 177 (-22.37%)
Mutual labels: rust-library
Spartan
Spartan: High-speed zkSNARKs without trusted setup
Stars: ✭ 211 (-7.46%)
Mutual labels: rust-library
Horrorshow
A macro-based html templating library, compatible with stable rust (currently requires rust >= 1.37).
Features
This crate will degrade gracefully when compiled without std
(disable the "std"
feature) and even without alloc
(disable the "alloc" feature).
When compiled with alloc
but without std
:
-
Template::write_to_io()
is not defined. - Templates may only emit errors implementing
ToString
and all such errors are immediately converted to strings.
When compiled with just core:
-
RenderBox
is no longer defined (no allocation). - The
Template::into_string()
andTemplate::write_to_string()
are no longer defined. The only template rendering method available isTemplate::write_to_fmt()
. - Templates may only emit static
&str
errors, and only the first is recorded.
Example:
#[macro_use]
extern crate horrorshow;
use horrorshow::prelude::*;
use horrorshow::helper::doctype;
fn main() {
let actual = format!("{}", html! {
: doctype::HTML;
html {
head {
title : "Hello world!";
}
body {
// attributes
h1(id="heading") {
// Insert escaped text
: "Hello! This is <html />"
}
p {
// Insert raw text (unescaped)
: Raw("Let's <i>count</i> to 10!")
}
ol(id="count") {
// You can embed for loops, while loops, and if statements.
@ for i in 0..10 {
li(first? = (i == 0)) {
// Format some text.
: format_args!("{}", i+1)
}
}
}
// You need semi-colons for tags without children.
br; br;
p {
// You can also embed closures.
|tmpl| {
tmpl << "Easy!";
}
}
}
}
});
let expected = "\
<!DOCTYPE html>\
<html>\
<head>\
<title>Hello world!</title>\
</head>\
<body>\
<h1 id=\"heading\">Hello! This is <html /></h1>\
<p>Let's <i>count</i> to 10!</p>\
<ol id=\"count\">\
<li first>1</li>\
<li>2</li>\
<li>3</li>\
<li>4</li>\
<li>5</li>\
<li>6</li>\
<li>7</li>\
<li>8</li>\
<li>9</li>\
<li>10</li>\
</ol>\
<br /><br />\
<p>Easy!</p>\
</body>\
</html>";
assert_eq!(expected, actual);
}
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].